Search in sources :

Example 1 with SidebarPluginConfig

use of org.alfresco.web.config.SidebarConfigElement.SidebarPluginConfig in project acs-community-packaging by Alfresco.

the class SidebarBean method getPlugins.

// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
 * Returns a list of configured plugins
 *
 * @return List of UIListItem's representing the plugins available
 */
public List<UIListItem> getPlugins() {
    if (this.plugins == null) {
        FacesContext context = FacesContext.getCurrentInstance();
        this.plugins = new ArrayList<UIListItem>();
        // create a list entry for each configured plugin
        for (String pluginId : this.sidebarConfig.getPlugins().keySet()) {
            SidebarPluginConfig plugin = this.sidebarConfig.getPlugin(pluginId);
            // resolve the label for the plugin
            String label = plugin.getlabelId();
            if (label != null) {
                label = Application.getMessage(context, label);
            }
            if (label == null) {
                label = plugin.getlabel();
            }
            if (label == null) {
                label = plugin.getId();
            }
            // resolve the description (tooltip for the plugin)
            String tooltip = plugin.getDescriptionId();
            if (tooltip != null) {
                tooltip = Application.getMessage(context, tooltip);
            }
            if (tooltip == null) {
                tooltip = plugin.getDescription();
            }
            UIListItem item = new UIListItem();
            item.setValue(plugin.getId());
            item.setLabel(label);
            if (tooltip != null) {
                item.setTooltip(tooltip);
            }
            this.plugins.add(item);
        }
    }
    return this.plugins;
}
Also used : SidebarPluginConfig(org.alfresco.web.config.SidebarConfigElement.SidebarPluginConfig) FacesContext(javax.faces.context.FacesContext) UIListItem(org.alfresco.web.ui.common.component.UIListItem)

Example 2 with SidebarPluginConfig

use of org.alfresco.web.config.SidebarConfigElement.SidebarPluginConfig in project acs-community-packaging by Alfresco.

the class UISidebar method setupActionGroupId.

/**
 * Sets up the corrent actions config group id on the given actions
 * component.
 *
 * @param context Faces context
 * @param actionsComponent The actions component to set the group id for
 */
protected void setupActionGroupId(FacesContext context, UIActions actionsComponent) {
    String actionsGroupId = null;
    SidebarConfigElement config = SidebarBean.getSidebarConfig(context);
    if (config != null) {
        SidebarPluginConfig plugin = config.getPlugin(getActivePlugin());
        if (plugin != null) {
            actionsGroupId = plugin.getActionsConfigId();
        }
    }
    actionsComponent.setValue(actionsGroupId);
}
Also used : SidebarPluginConfig(org.alfresco.web.config.SidebarConfigElement.SidebarPluginConfig) SidebarConfigElement(org.alfresco.web.config.SidebarConfigElement)

Aggregations

SidebarPluginConfig (org.alfresco.web.config.SidebarConfigElement.SidebarPluginConfig)2 FacesContext (javax.faces.context.FacesContext)1 SidebarConfigElement (org.alfresco.web.config.SidebarConfigElement)1 UIListItem (org.alfresco.web.ui.common.component.UIListItem)1