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

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

Introduction

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

Prototype

@Override
    public void setTarget(String target) 

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;/*from w  w w .  j a  va2  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");
}