public GraphSettings getGraphSettings() {
return settings;
}
public void update(XPDLElementChangeInfo info) {
XMLElement changedElement = info.getChangedElement();
List changedElements = info.getChangedSubElements();
int action = info.getAction();
// ********************************* START OF SELECTION EVENT
if (action == XPDLElementChangeInfo.SELECTED) {
// clean old selection
if (selectedGraph != null) {
if (overview != null) {
if (overview.getGraph() != null) {
overview.getGraph().clearSelection();
}
}
selectedGraph.clearSelection();
}
if (changedElement != null) {
// ***************************** find graph
Graph g = null;
XMLElement lastSel = changedElement;
if (changedElements.size() > 0) {
lastSel = (XMLElement) changedElements.get(changedElements.size() - 1);
}
if (graphMap.containsKey(lastSel)) {
g = getGraph((XMLCollectionElement) lastSel);
}
if (g == null && selectedGraph != null) {
if (lastSel instanceof Participant && selectedGraph.getGraphManager().getGraphParticipant((Participant) lastSel) != null) {
g = selectedGraph;
} else if (lastSel instanceof ExtendedAttribute && selectedGraph.getGraphManager().getBubble((ExtendedAttribute) lastSel) != null) {
g = selectedGraph;
} else if (lastSel instanceof Activity && selectedGraph.getGraphManager().getGraphActivity((Activity) lastSel) != null) {
g = selectedGraph;
GraphUtilities.reloadGraph(g);
} else if (lastSel instanceof Transition && selectedGraph.getGraphManager().getGraphTransition((Transition) lastSel) != null) {
g = selectedGraph;
}
}
if (g == null) {
XMLElement parent = lastSel;
do {
parent = parent.getParent();
} while (parent != null && !(parent instanceof ActivitySet || parent instanceof WorkflowProcess));
if (parent != null) {
g = getGraph((XMLCollectionElement) parent);
} else {
if (selectedGraph != null) {
if (XMLUtil.getPackage(lastSel) == XMLUtil.getPackage(selectedGraph.getXPDLObject())) {
g = selectedGraph;
}
}
}
}
if (g == null) {
Package sp = XMLUtil.getPackage(lastSel);
if (sp != null) {
List wps = sp.getWorkflowProcesses().toElements();
if (wps.size() != 0) {
g = getGraph((XMLCollectionElement) wps.get(0));
}
}
}
if (g != selectedGraph) {
setSelectedGraph(g);
}
if (selectedGraph != null) {
selectedGraph.clearSelection();
}
// ***************************** end of find graph
// **************************** select elements
WorkflowElement selectedElement = null;
WorkflowElement lastSelected = null;
if (selectedGraph != null) {
List selectedElements = new ArrayList();
List overviewElements = new ArrayList();
List toCheck = new ArrayList();
if (changedElements == null || changedElements.size() == 0) {
toCheck.add(changedElement);
} else {
toCheck.addAll(changedElements);
}
for (Iterator it = toCheck.iterator(); it.hasNext();) {
XMLElement el = (XMLElement) it.next();
selectedElement = selectedGraph.getGraphInterface(el);
if (overview != null && selectedElement != null && !(selectedElement instanceof GraphTransitionInterface)) {
overviewElements.add(selectedElement);
}