private UIComponent addUIExtension(UIExtension extension, Map<String, Object> context) throws Exception { UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class); UIComponent component = manager.addUIExtension(extension, context, this); if (component == null) return null; synchronized (component) { if (component instanceof UIAbstractManagerComponent) { // You can access to the given extension and the extension is valid UIAbstractManagerComponent uiAbstractManagerComponent = (UIAbstractManagerComponent) component; uiAbstractManagerComponent.setUIExtensionName(extension.getName()); uiAbstractManagerComponent.setUIExtensionCategory(extension.getCategory()); return component; } else if (component != null) { // You can access to the given extension but the extension is not valid if (LOG.isWarnEnabled()) { LOG.warn( "All the extension '" + extension.getName() + "' of type '" + EXTENSION_TYPE + "' must be associated to a component of type " + UIAbstractManagerComponent.class); } removeChild(component.getClass()); } } return null; }
public UIComponent getCustomAction() throws Exception { UIComponent uicomponent = null; List<UIExtension> uiExtensionList = getUIExtensionList(); for (UIExtension uiextension : uiExtensionList) { if (CUSTOM_ACTIONS.equals(uiextension.getCategory())) { uicomponent = addUIExtension(uiextension, null); } } return uicomponent; }
public UIComponent getPermlink(Node node) throws Exception { UIComponent uicomponent = null; List<UIExtension> uiExtensionList = getUIExtensionList(); for (UIExtension uiextension : uiExtensionList) { if (PERMLINK.equals(uiextension.getCategory())) { uicomponent = addUIExtension(uiextension, createContext(node)); } } return uicomponent; }
List<UIComponent> getMultiActionsExtensionList() throws Exception { List<UIComponent> uiActionList = new ArrayList<UIComponent>(); List<UIExtension> uiExtensionList = getUIExtensionList(); UIComponent uiAddedActionManage; for (UIExtension uiextension : uiExtensionList) { if (ITEM_CONTEXT_MENU.equals(uiextension.getCategory()) || ITEM_GROUND_CONTEXT_MENU.equals(uiextension.getCategory()) || MULTI_ITEM_CONTEXT_MENU.equals(uiextension.getCategory())) { uiAddedActionManage = addUIExtension(uiextension, null); if (uiAddedActionManage != null) { if (!uiActionList.contains(uiAddedActionManage)) uiActionList.add(uiAddedActionManage); } } } return uiActionList; }
List<UIComponent> getGroundActionsExtensionList() throws Exception { List<UIComponent> uiGroundActionList = new ArrayList<UIComponent>(); List<UIExtension> uiExtensionList = getUIExtensionList(); UIJCRExplorer uiExplorer = getAncestorOfType(UIJCRExplorer.class); Node currentNode = uiExplorer.getCurrentNode(); UIComponent uiAddedActionManage; for (UIExtension uiextension : uiExtensionList) { if (GROUND_CONTEXT_MENU.equals(uiextension.getCategory()) || ITEM_GROUND_CONTEXT_MENU.equals(uiextension.getCategory())) { uiAddedActionManage = addUIExtension(uiextension, createContext(currentNode)); if (uiAddedActionManage != null) { if (!uiGroundActionList.contains(uiAddedActionManage)) uiGroundActionList.add(uiAddedActionManage); } } } return uiGroundActionList; }
public String getActionsExtensionList(Node node) throws Exception { StringBuffer actionsList = new StringBuffer(1024); List<UIExtension> uiExtensionList = getUIExtensionList(); UIComponent uiAddedActionManage; try { NodeFinder nodeFinder = getApplicationComponent(NodeFinder.class); nodeFinder.getItem(getAncestorOfType(UIJCRExplorer.class).getSession(), node.getPath()); } catch (PathNotFoundException pne) { return ""; } for (UIExtension uiextension : uiExtensionList) { if (uiextension.getCategory().startsWith(ITEM_CONTEXT_MENU) || ITEM_GROUND_CONTEXT_MENU.equals(uiextension.getCategory())) { uiAddedActionManage = addUIExtension(uiextension, createContext(node)); if (uiAddedActionManage != null) { actionsList.append(uiextension.getName()).append(","); } } } if (actionsList.length() > 0) { return actionsList.substring(0, actionsList.length() - 1); } return actionsList.toString(); }