Class AbstractGraphModel
java.lang.Object
com.codename1.graph.AbstractGraphModel
- All Implemented Interfaces:
GraphModel
- Direct Known Subclasses:
DefaultGraphModel
The listener list, the lookups and the refusals every read-only model shares.
A subclass supplies getNodes, getEdges and getGroups. Every edit is
refused until the matching method is overridden.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener told about every change.Makes an edge from one node or port to another.protected voidTells every listener the model changed.The group with this id, or null.The node with this id, or null.booleanMoves a node to a world position.voidRemoves a listener.booleanremoveEdge(GraphEdge edge) Removes an edge.booleanremoveNode(GraphNode node) Removes a node and every edge that touches it.booleanrenameNode(GraphNode node, String label) Gives a node a new label.booleansetCollapsed(GraphGroup group, boolean collapsed) Collapses or expands a group.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GraphModel
getEdges, getGroups, getNodes
-
Constructor Details
-
AbstractGraphModel
public AbstractGraphModel()
-
-
Method Details
-
getNode
Description copied from interface:GraphModelThe node with this id, or null.- Specified by:
getNodein interfaceGraphModel
-
getGroup
Description copied from interface:GraphModelThe group with this id, or null.- Specified by:
getGroupin interfaceGraphModel
-
moveNode
Description copied from interface:GraphModelMoves a node to a world position.
Returns
false when the model refuses the move
- Specified by:
moveNodein interfaceGraphModel
-
connect
public GraphEdge connect(GraphNode source, GraphPort sourcePort, GraphNode target, GraphPort targetPort) Description copied from interface:GraphModelMakes an edge from one node or port to another.
Parameters
source: the node the edge leavessourcePort: its output port, or nulltarget: the node the edge enterstargetPort: its input port, or null
Returns
the new edge, or null when the model refuses it
- Specified by:
connectin interfaceGraphModel
-
removeEdge
Description copied from interface:GraphModelRemoves an edge.
Returns
false when the model refuses
- Specified by:
removeEdgein interfaceGraphModel
-
removeNode
Description copied from interface:GraphModelRemoves a node and every edge that touches it.
Returns
false when the model refuses
- Specified by:
removeNodein interfaceGraphModel
-
renameNode
Description copied from interface:GraphModelGives a node a new label.
Returns
false when the model refuses
- Specified by:
renameNodein interfaceGraphModel
-
setCollapsed
Description copied from interface:GraphModelCollapses or expands a group.
Returns
false when the model refuses
- Specified by:
setCollapsedin interfaceGraphModel
-
addChangeListener
Description copied from interface:GraphModelAdds a listener told about every change.- Specified by:
addChangeListenerin interfaceGraphModel
-
removeChangeListener
Description copied from interface:GraphModelRemoves a listener.- Specified by:
removeChangeListenerin interfaceGraphModel
-
fireChanged
protected void fireChanged()Tells every listener the model changed.
-