public void setGraphArcStyle(GraphArcStyle style) { if ((style != null) && (this.arcStyle != style)) { GraphArcStyle oldStyle = this.arcStyle; this.arcStyle = style; // now update the styles on all arcs Collection<GraphArc> arcs = model.getAllArcs(); for (GraphArc arc : arcs) { arc.setArcStyle(this.arcStyle); } firePropertyChange(GRAPH_ARC_STYLE_PROPERTY, oldStyle, this.arcStyle); } }
public void setGraphNodeStyle(GraphNodeStyle style) { if ((style != null) && (this.nodeStyle != style)) { GraphNodeStyle oldStyle = this.nodeStyle; this.nodeStyle = style; // now update the styles on all nodes Collection<GraphNode> nodes = model.getAllNodes(); for (GraphNode node : nodes) { node.setNodeStyle(this.nodeStyle); } firePropertyChange(GRAPH_NODE_STYLE_PROPERTY, oldStyle, this.nodeStyle); } }
public void setModel(GraphModel model) { GraphModel oldModel = this.model; oldModel.removeGraphModelListener(modelListener); // now remove any of "our" graph model listeners for (GraphModelListener gml : graphModelListeners) { oldModel.removeGraphModelListener(gml); } // don't allow null models if (model == null) { model = new DefaultGraphModel(); } this.model = model; this.model.addGraphModelListener(modelListener); // now add "our" graph model listeners back for (GraphModelListener gml : graphModelListeners) { this.model.addGraphModelListener(gml); } loadModel(); firePropertyChange(GRAPH_MODEL_PROPERTY, oldModel, this.model); }