com.liferay.blade.samples.portlet.configuration.icon.BladePortletConfigurationIcon.java Source code

Java tutorial

Introduction

Here is the source code for com.liferay.blade.samples.portlet.configuration.icon.BladePortletConfigurationIcon.java

Source

/**
 * Copyright 2000-present Liferay, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.liferay.blade.samples.portlet.configuration.icon;

import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.portlet.configuration.icon.BasePortletConfigurationIcon;
import com.liferay.portal.kernel.portlet.configuration.icon.PortletConfigurationIcon;
import com.liferay.portal.kernel.util.ResourceBundleUtil;

import java.util.ResourceBundle;

import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;

import org.osgi.service.component.annotations.Component;

/**
 * @author Liferay
 */
@Component(immediate = true, property = {
        "javax.portlet.name=com_liferay_hello_world_web_portlet_HelloWorldPortlet" }, service = PortletConfigurationIcon.class)
public class BladePortletConfigurationIcon extends BasePortletConfigurationIcon {

    @Override
    public String getMessage(PortletRequest portletRequest) {
        ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", getLocale(portletRequest),
                getClass());

        return LanguageUtil.get(resourceBundle, "sample-link");
    }

    @Override
    public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

        return "https://www.liferay.com";
    }

    @Override
    public double getWeight() {
        return 150.0;
    }

    @Override
    public boolean isShow(PortletRequest portletRequest) {
        return true;
    }

    @Override
    public boolean isToolTip() {
        return false;
    }

    @Override
    public boolean isUseDialog() {
        return false;
    }

}