protected List listChildren() {
   List children = new ArrayList();
   PanelInstancesNode parent = (PanelInstancesNode) getParent();
   final String language = LocaleManager.currentLang();
   try {
     String workspaceId = parent.getHandler().getWorkspaceId();
     WorkspaceImpl workspace =
         (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
     PanelInstance[] instances = workspace.getPanelInstancesInGroup(providerId);
     if (instances != null) {
       TreeSet<PanelInstance> panelInstances =
           new TreeSet<PanelInstance>(
               new Comparator<PanelInstance>() {
                 public int compare(PanelInstance p1, PanelInstance p2) {
                   return p1.getTitle(language).compareToIgnoreCase(p2.getTitle(language));
                 }
               });
       TreeSet<String> groups = new TreeSet<String>();
       for (PanelInstance pi : instances) {
         String group = pi.getParameterValue(PanelInstance.PARAMETER_GROUP, language);
         if (group != null && !"".equals(group.trim())) {
           groups.add(group);
         } else {
           panelInstances.add(pi);
         }
       }
       for (String gr : groups) {
         children.add(getNewGroupNode(workspaceId, gr));
       }
       for (PanelInstance pi : panelInstances) {
         children.add(getNewInstanceNode(pi));
       }
     }
   } catch (Exception e) {
     log.error("Error: ", e);
   }
   return children;
 }
Exemplo n.º 2
0
 /**
  * Returns if this driver is using default language
  *
  * @param panel
  * @return if this driver is using default language
  */
 public boolean isUsingDefaultLanguage(PanelInstance panel) {
   return Boolean.valueOf(panel.getParameterValue(PARAMETER_USE_DEFAULTS)).booleanValue();
 }