Java tutorial
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.document.library.web.internal.dynamic.data.mapping.util; import com.liferay.dynamic.data.mapping.util.DDMDisplayTabItem; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.portlet.LiferayPortletRequest; import com.liferay.portal.kernel.portlet.LiferayPortletResponse; import com.liferay.portal.kernel.util.Portal; import com.liferay.portal.kernel.util.PortletKeys; import com.liferay.portal.kernel.util.ResourceBundleLoader; import java.util.ResourceBundle; import javax.portlet.PortletRequest; import javax.portlet.PortletURL; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * @author Alejandro Tardn */ @Component(property = { "javax.portlet.name=" + PortletKeys.DOCUMENT_LIBRARY }, service = { DDMDisplayTabItem.class, DocumentsAndMediaDDMDisplayTabItem.class }) public class DocumentsAndMediaDDMDisplayTabItem implements DDMDisplayTabItem { @Override public String getTitle(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse) { ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(liferayPortletRequest.getLocale()); return LanguageUtil.get(resourceBundle, "documents-and-media"); } @Override public String getURL(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse) throws Exception { PortletURL portletURL = _portal.getControlPanelPortletURL(liferayPortletRequest, PortletKeys.DOCUMENT_LIBRARY_ADMIN, PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcRenderCommandName", "/document_library/view"); return portletURL.toString(); } @Reference private Portal _portal; @Reference(target = "(bundle.symbolic.name=com.liferay.document.library.web)") private ResourceBundleLoader _resourceBundleLoader; }