Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface GraphListener
Known subtypesGraphAdapter
What a NodeGraph tells an application about. Extend GraphAdapter to
implement only what is needed.
Every edit is offered first to the listeners, any of which may refuse it, and then to the model, which may refuse it too.
Methods
public abstract void selectionChanged(NodeGraph graph) | The selection changed. |
public abstract void nodeOpened(NodeGraph graph, GraphNode node) | A node was double tapped. |
public abstract boolean nodeMoving(NodeGraph graph, GraphNode node, double x, double y) | A node was dragged and is about to be moved to a world position. |
public abstract void nodeMoved(NodeGraph graph, GraphNode node) | A node was moved by the user. |
public abstract boolean edgeCreating(NodeGraph graph, GraphNode source, GraphPort sourcePort, GraphNode target, GraphPort targetPort) | An edge was dragged from a node or port to another and is about to be made. |
public abstract void edgeCreated(NodeGraph graph, GraphEdge edge) | An edge was made by the user. |
public abstract boolean removing(NodeGraph graph, GraphNode node, GraphEdge edge) | A node or an edge is about to be removed by NodeGraph.deleteSelection. |
public abstract void groupToggled(NodeGraph graph, GraphGroup group) | A group was collapsed or expanded by a tap on its title. |
Method details
selectionChanged
public abstract void selectionChanged(NodeGraph graph)The selection changed.
nodeOpened
public abstract void nodeOpened(NodeGraph graph, GraphNode node)A node was double tapped.
nodeMoving
public abstract boolean nodeMoving(NodeGraph graph, GraphNode node, double x, double y)A node was dragged and is about to be moved to a world position.
Returns
false to refuse, which puts it back
nodeMoved
public abstract void nodeMoved(NodeGraph graph, GraphNode node)A node was moved by the user.
edgeCreating
public abstract boolean edgeCreating(NodeGraph graph, GraphNode source, GraphPort sourcePort, GraphNode target, GraphPort targetPort)An edge was dragged from a node or port to another and is about to be
made. Either port may be null.
Returns
false to refuse
edgeCreated
public abstract void edgeCreated(NodeGraph graph, GraphEdge edge)An edge was made by the user.
removing
public abstract boolean removing(NodeGraph graph, GraphNode node, GraphEdge edge)A node or an edge is about to be removed by
NodeGraph.deleteSelection.
Exactly one of the two is not null.Returns
false to refuse
groupToggled
public abstract void groupToggled(NodeGraph graph, GraphGroup group)A group was collapsed or expanded by a tap on its title.