* */
private void collapsGroups()
{
final SequencedTask t = Tasks.createSequencedTask("collapse or open groups");
t.addTask(new Task("wait")
{
public void run()
{
controller.getVisualization().addLock(t);
}
});
t.addTask(new Task("collapse")
{
public void run()
{
NetworkAnalysisWorkspace workspace = NetworkAnalysisWorkspace.getInstance(Activator.getBundleContext());
Controller<?> activeController = workspace.getActiveController();
if (activeController instanceof StandardController)
{
controller = (StandardController) activeController;
}
if(controller!=null)
{
LinkedList<IHierarchyComponent> groupList = new LinkedList<IHierarchyComponent>();
java.util.Collection<IComponent> components =controller.getMappingModel().getRootComponent().getChildren();
for (IComponent c : components)
{
if (c instanceof IHierarchyComponent)
{
IHierarchyComponent group = ((IHierarchyComponent) c);
groupList.add(group);;
}
}
for (IHierarchyComponent g : groupList)
{
if (!((INodeComponentUI) g.getUI()).getLabel().isEmpty())
{
try
{
g.setCollapsed(collapse);
}
catch (ModelException e)
{
e.printStackTrace();
}
}
}
}
}
});
controller.updateAll(t);
t.addTask(new Task("change collapse")
{
public void run()
{
if(collapse)
{
collapse = false;
}
else
{
collapse=true;
}
}
});
t.addTask(new Task("delete metalayer")
{
public void run()
{
deleteBackground();
}
});
t.addTask(new Task("color groups")
{
public void run()
{
colorGroupList();
}
});
controller.updateAll(t);
IRootComponent activeRoot = controller.getMappingModel().getRootComponent();
if (activeRoot.getBackgroundModel() != null)
{
t.addTask(new Task("calculate metalayer")
{
public void run()
{
calculateBackground();
}
});
t.addTask(new Task("draw metalayer")
{
public void run()
{
insertBackground();
}
});
}
t.addTask(new Task("remove wait")
{
public void run()
{
controller.getVisualization().removeLock(t);
}