Example usage for com.liferay.portal.kernel.servlet.taglib.ui URLMenuItem setMethod

List of usage examples for com.liferay.portal.kernel.servlet.taglib.ui URLMenuItem setMethod

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.servlet.taglib.ui URLMenuItem setMethod.

Prototype

public void setMethod(String method) 

Source Link

Usage

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

License:Open Source License

public void addDownloadMenuItem(List<MenuItem> menuItems) throws PortalException {

    if (!_fileEntryDisplayContextHelper.isDownloadActionAvailable()) {
        return;//ww w. j  av  a 2  s  . c  o  m
    }

    String label = TextFormatter.formatStorageSize(_fileEntry.getSize(), _themeDisplay.getLocale());

    label = _themeDisplay.translate("download") + " (" + label + ")";

    String url = DLUtil.getDownloadURL(_fileEntry, _fileVersion, _themeDisplay, StringPool.BLANK, false, true);

    URLMenuItem urlMenuItem = _addURLUIItem(new URLMenuItem(), menuItems, DLUIItemKeys.DOWNLOAD, label, url);

    urlMenuItem.setMethod("get");
    urlMenuItem.setTarget("_blank");
}

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

License:Open Source License

public void addPermissionsMenuItem(List<MenuItem> menuItems) throws PortalException {

    if (!_fileEntryDisplayContextHelper.isPermissionsButtonVisible()) {
        return;/*from   www.  j  a  v a2 s .c  om*/
    }

    String url = null;

    try {
        url = 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);
    }

    URLMenuItem urlMenuItem = _addURLUIItem(new URLMenuItem(), menuItems, DLUIItemKeys.PERMISSIONS,
            "permissions", url);

    urlMenuItem.setMethod("get");
    urlMenuItem.setUseDialog(true);
}

From source file:com.liferay.wiki.web.internal.display.context.DefaultWikiListPagesDisplayContext.java

License:Open Source License

protected void addPermissionsMenuItem(List<MenuItem> menuItems, WikiPage wikiPage) {

    if (!WikiPagePermissionChecker.contains(_wikiRequestHelper.getPermissionChecker(), wikiPage,
            ActionKeys.PERMISSIONS)) {//from w  w w.j a  v a 2s. c om

        return;
    }

    URLMenuItem urlMenuItem = new URLMenuItem();

    urlMenuItem.setKey(WikiUIItemKeys.PERMISSIONS);
    urlMenuItem.setLabel("permissions");
    urlMenuItem.setMethod("get");
    urlMenuItem.setUseDialog(true);

    String url = null;

    try {
        url = PermissionsURLTag.doTag(null, WikiPage.class.getName(), wikiPage.getTitle(), null,
                String.valueOf(wikiPage.getResourcePrimKey()), LiferayWindowState.POP_UP.toString(), null,
                _request);
    } catch (Exception e) {
        throw new SystemException("Unable to create permissions URL", e);
    }

    urlMenuItem.setURL(url);

    menuItems.add(urlMenuItem);
}