use of au.gov.asd.tac.constellation.graph.schema.visual.VisualSchemaFactory in project constellation by constellation-app.
the class HierarchicalControllerTopComponent method setNode.
/**
* Make the graph in the specified node the source for the clustering model.
* <p>
* If another graph is attached to the model, it is detached first.
*
* @param node The GraphNode containing the graph to be displayed.
*/
private void setNode(final GraphNode node) {
if (graphNode != null) {
graph.removeGraphChangeListener(this);
}
if (node != null) {
graphNode = node;
graph = graphNode.getGraph();
final ReadableGraph rg = graph.getReadableGraph();
try {
final int stateAttr = ClusteringConcept.MetaAttribute.HIERARCHICAL_CLUSTERING_STATE.get(rg);
state = stateAttr != Graph.NOT_FOUND ? (HierarchicalState) rg.getObjectValue(stateAttr, 0) : null;
if (rg.getSchema() != null && !(rg.getSchema().getFactory() instanceof VisualSchemaFactory)) {
interactiveButton.setSelected(false);
interactiveButton.setText(TOGGLE_ENABLED);
interactivityPermitted = false;
} else if (state != null) {
interactiveButton.setText(state.isInteractive() ? TOGGLE_ENABLED : TOGGLE_DISABLED);
interactiveButton.setSelected(state.isInteractive());
colorClustersCheckBox.setSelected(state.isColored());
interactivityPermitted = true;
} else {
interactiveButton.setText(TOGGLE_DISABLED);
interactiveButton.setSelected(true);
colorClustersCheckBox.setSelected(true);
interactivityPermitted = true;
}
} finally {
rg.release();
}
graph.addGraphChangeListener(this);
} else {
graphNode = null;
graph = null;
state = null;
}
setGroups(false);
}
Aggregations