use of org.eclipse.zest.core.widgets.GraphConnection in project archi by archimatetool.
the class AbstractStructuredGraphViewer method unReveal.
public void unReveal(Object element) {
Widget[] items = this.findItems(element);
for (int i = 0; i < items.length; i++) {
Widget item = items[i];
if (item instanceof GraphNode) {
GraphNode graphModelNode = (GraphNode) item;
graphModelNode.unhighlight();
} else if (item instanceof GraphConnection) {
GraphConnection graphModelConnection = (GraphConnection) item;
graphModelConnection.unhighlight();
}
}
}
use of org.eclipse.zest.core.widgets.GraphConnection in project archi by archimatetool.
the class AbstractStructuredGraphViewer method filterVisuals.
protected void filterVisuals() {
if (getGraphControl() == null) {
return;
}
Object[] filtered = getFilteredChildren(getInput());
SimpleGraphComparator comparator = new SimpleGraphComparator();
TreeSet filteredElements = new TreeSet(comparator);
TreeSet unfilteredElements = new TreeSet(comparator);
List connections = getGraphControl().getConnections();
List nodes = getGraphControl().getNodes();
if (filtered.length == 0) {
// the nodes?
for (Iterator i = connections.iterator(); i.hasNext(); ) {
GraphConnection c = (GraphConnection) i.next();
c.setVisible(false);
}
for (Iterator i = nodes.iterator(); i.hasNext(); ) {
GraphNode n = (GraphNode) i.next();
n.setVisible(false);
}
return;
}
for (Iterator i = connections.iterator(); i.hasNext(); ) {
GraphConnection c = (GraphConnection) i.next();
if (c.getExternalConnection() != null) {
unfilteredElements.add(c);
}
}
for (Iterator i = nodes.iterator(); i.hasNext(); ) {
GraphNode n = (GraphNode) i.next();
if (n.getData() != null) {
unfilteredElements.add(n);
}
}
for (int i = 0; i < filtered.length; i++) {
Object modelElement = connectionsMap.get(filtered[i]);
if (modelElement == null) {
modelElement = nodesMap.get(filtered[i]);
}
if (modelElement != null) {
filteredElements.add(modelElement);
}
}
unfilteredElements.removeAll(filteredElements);
// all the elements that passed to visible.
while (unfilteredElements.size() > 0) {
GraphItem i = (GraphItem) unfilteredElements.first();
i.setVisible(false);
unfilteredElements.remove(i);
}
while (filteredElements.size() > 0) {
GraphItem i = (GraphItem) filteredElements.first();
i.setVisible(true);
filteredElements.remove(i);
}
}
use of org.eclipse.zest.core.widgets.GraphConnection in project archi by archimatetool.
the class AbstractStructuredGraphViewer method reveal.
/**
*/
@Override
public void reveal(Object element) {
Widget[] items = this.findItems(element);
for (int i = 0; i < items.length; i++) {
Widget item = items[i];
if (item instanceof GraphNode) {
GraphNode graphModelNode = (GraphNode) item;
graphModelNode.highlight();
} else if (item instanceof GraphConnection) {
GraphConnection graphModelConnection = (GraphConnection) item;
graphModelConnection.highlight();
}
}
}
Aggregations