Example usage for com.liferay.portal.kernel.language LanguageUtil get

List of usage examples for com.liferay.portal.kernel.language LanguageUtil get

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.language LanguageUtil get.

Prototype

public static String get(ResourceBundle resourceBundle, String key) 

Source Link

Usage

From source file:com.liferay.document.library.web.internal.display.context.logic.UIItemsBuilder.java

License:Open Source License

public void addMoveToTheRecycleBinToolbarItem(List<ToolbarItem> toolbarItems) throws PortalException {

    if (!isMoveToTheRecycleBinActionAvailable()) {
        return;/*w ww. j a v a2s  .  co m*/
    }

    LiferayPortletResponse liferayPortletResponse = _getLiferayPortletResponse();

    PortletURL portletURL = liferayPortletResponse.createRenderURL();

    long folderId = _fileEntry.getFolderId();

    if (folderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        portletURL.setParameter("mvcRenderCommandName", "/document_library/view");
    } else {
        portletURL.setParameter("mvcRenderCommandName", "/document_library/view_folder");
    }

    portletURL.setParameter("folderId", String.valueOf(folderId));
    portletURL.setParameter("folderId", String.valueOf(_fileEntry.getFolderId()));

    _addJavaScriptUIItem(new JavaScriptToolbarItem(), toolbarItems, DLUIItemKeys.MOVE_TO_THE_RECYCLE_BIN,
            LanguageUtil.get(_resourceBundle, "move-to-the-recycle-bin"),
            getSubmitFormJavaScript(Constants.MOVE_TO_TRASH, portletURL.toString()));
}

From source file:com.liferay.document.library.web.internal.display.context.logic.UIItemsBuilder.java

License:Open Source License

public void addOpenInMsOfficeToolbarItem(List<ToolbarItem> toolbarItems) throws PortalException {

    if (!isOpenInMsOfficeActionAvailable()) {
        return;//from w w  w  .  j a  va 2s .c o  m
    }

    String webDavURL = DLUtil.getWebDavURL(_themeDisplay, _fileEntry.getFolder(), _fileEntry,
            PropsValues.DL_FILE_ENTRY_OPEN_IN_MS_OFFICE_MANUAL_CHECK_IN_REQUIRED);

    StringBundler sb = new StringBundler(4);

    sb.append(getNamespace());
    sb.append("openDocument('");
    sb.append(webDavURL);
    sb.append("');");

    _addJavaScriptUIItem(new JavaScriptToolbarItem(), toolbarItems, DLUIItemKeys.OPEN_IN_MS_OFFICE,
            LanguageUtil.get(_resourceBundle, "open-in-ms-office"), sb.toString());
}

From source file:com.liferay.document.library.web.internal.display.context.logic.UIItemsBuilder.java

License:Open Source License

public void addPermissionsToolbarItem(List<ToolbarItem> toolbarItems) throws PortalException {

    if (!_fileEntryDisplayContextHelper.isPermissionsButtonVisible()) {
        return;/*from w w  w. java  2 s . c  om*/
    }

    String permissionsURL = null;

    try {
        permissionsURL = PermissionsURLTag.doTag(null, DLFileEntryConstants.getClassName(),
                HtmlUtil.unescape(_fileEntry.getTitle()), null, String.valueOf(_fileEntry.getFileEntryId()),
                LiferayWindowState.POP_UP.toString(), null, _request);
    } catch (Exception e) {
        throw new SystemException("Unable to create permissions URL", e);
    }

    StringBundler sb = new StringBundler(5);

    sb.append("Liferay.Util.openWindow({title: '");
    sb.append(UnicodeLanguageUtil.get(_resourceBundle, "permissions"));
    sb.append("', uri: '");
    sb.append(permissionsURL);
    sb.append("'});");

    _addJavaScriptUIItem(new JavaScriptToolbarItem(), toolbarItems, DLUIItemKeys.PERMISSIONS,
            LanguageUtil.get(_resourceBundle, "permissions"), sb.toString());
}

From source file:com.liferay.document.library.web.internal.display.context.logic.UIItemsBuilder.java

License:Open Source License

public JavaScriptMenuItem getJavacriptCheckinMenuItem() throws PortalException {

    PortletURL portletURL = _getActionURL("/document_library/edit_file_entry", Constants.CHECKIN);

    portletURL.setParameter("fileEntryId", String.valueOf(_fileEntry.getFileEntryId()));

    JavaScriptMenuItem javascriptMenuItem = new JavaScriptMenuItem();

    javascriptMenuItem.setKey(DLUIItemKeys.CHECKIN);
    javascriptMenuItem.setLabel("checkin");
    javascriptMenuItem.setOnClick(getNamespace() + "showVersionDetailsDialog('" + portletURL + "');");

    String javaScript = "/com/liferay/document/library/web/display/context/dependencies" + "/checkin_js.ftl";

    Class<?> clazz = getClass();

    URLTemplateResource urlTemplateResource = new URLTemplateResource(javaScript,
            clazz.getResource(javaScript));

    Template template = TemplateManagerUtil.getTemplate(TemplateConstants.LANG_TYPE_FTL, urlTemplateResource,
            false);//from   w w w.ja  va 2 s  . c  o m

    template.put("dialogCancelButtonLabel", LanguageUtil.get(_resourceBundle, "cancel"));
    template.put("dialogSaveButtonLabel", LanguageUtil.get(_resourceBundle, "save"));
    template.put("dialogTitle", UnicodeLanguageUtil.get(_resourceBundle, "describe-your-changes"));
    template.put("namespace", getNamespace());
    template.put("randomNamespace", _request.getAttribute("randomNamespace"));

    UnsyncStringWriter unsyncStringWriter = new UnsyncStringWriter();

    template.processTemplate(unsyncStringWriter);

    javascriptMenuItem.setJavaScript(unsyncStringWriter.toString());

    return javascriptMenuItem;
}

From source file:com.liferay.document.library.web.internal.dynamic.data.mapping.util.DLDDMDisplay.java

License:Open Source License

@Override
public String getStructureName(Locale locale) {
    ResourceBundle resourceBundle = getResourceBundle(locale);

    return LanguageUtil.get(resourceBundle, "metadata-set");
}

From source file:com.liferay.document.library.web.internal.dynamic.data.mapping.util.DLDDMDisplay.java

License:Open Source License

@Override
public String getTitle(Locale locale) {
    ResourceBundle resourceBundle = getResourceBundle(locale);

    return LanguageUtil.get(resourceBundle, "metadata-sets");
}

From source file:com.liferay.document.library.web.internal.dynamic.data.mapping.util.DocumentsAndMediaDDMDisplayTabItem.java

License:Open Source License

@Override
public String getTitle(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse) {

    ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(liferayPortletRequest.getLocale());

    return LanguageUtil.get(resourceBundle, "documents-and-media");
}

From source file:com.liferay.document.library.web.internal.dynamic.data.mapping.util.DocumentTypesDDMDisplayTabItem.java

License:Open Source License

@Override
public String getTitle(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse) {

    ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(liferayPortletRequest.getLocale());

    return LanguageUtil.get(resourceBundle, "document-types");
}

From source file:com.liferay.document.library.web.internal.portlet.configuration.icon.AccessFromDesktopPortletConfigurationIcon.java

License:Open Source License

@Override
public String getMessage(PortletRequest portletRequest) {
    return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), "access-from-desktop");
}

From source file:com.liferay.document.library.web.internal.portlet.configuration.icon.CancelCheckoutFileEntryPortletConfigurationIcon.java

License:Open Source License

@Override
public String getMessage(PortletRequest portletRequest) {
    return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), "cancel-checkout[document]");
}