WorkspaceImpl workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId);
PanelInstance[] instances = workspace.getPanelInstancesInGroup(providerId);
if (instances != null) {
TreeSet instancias = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
PanelInstance p1 = (PanelInstance) o1;
PanelInstance p2 = (PanelInstance) o2;
return p1.getTitle(SessionManager.getLang()).compareToIgnoreCase(p2.getTitle(SessionManager.getLang()));
}
});
TreeSet grupos = new TreeSet();
for (int i = 0; i < instances.length; i++) {
PanelInstance instance = instances[i];
String grupo = instance.getParameterValue(PanelInstance.PARAMETER_GROUP, language);
if (grupo != null && !"".equals(grupo.trim())) {
grupos.add(grupo);
} else {
instancias.add(instance);
}
}
for (Iterator iterator = grupos.iterator(); iterator.hasNext();) {
String grupo = (String) iterator.next();
children.add(getNewGroupNode(workspaceId, grupo));
}
for (Iterator iterator = instancias.iterator(); iterator.hasNext();) {
PanelInstance panelInstance = (PanelInstance) iterator.next();
children.add(getNewInstanceNode(panelInstance));
}
}
} catch (Exception e) {
log.error("Error: ", e);