Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 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();
 }