Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class ConnectionValidator

  1. Object
  2. ConnectionValidator

Decides whether an edge may be made. Extend it for rules of your own and call super.canConnect to keep these.

By default an edge is refused when it connects a node to itself, repeats an edge that exists, leaves an input port or enters an output port, joins two ports whose types are both set and differ, or takes a port past its GraphPort.getMaxConnections. Cycles are allowed unless setAllowCycles(false) is called.

Constructors

public ConnectionValidator()

Methods

public boolean isAllowCycles()True, the default, when an edge may close a cycle.
public void setAllowCycles(boolean allowCycles)Refuses edges that would close a cycle when false.
public boolean isAllowSelfLoops()False, the default, when a node may not connect to itself.
public void setAllowSelfLoops(boolean allowSelfLoops)Allows a node to connect to itself.
public boolean canConnect(GraphModel model, GraphNode source, GraphPort sourcePort, GraphNode target, GraphPort targetPort)True when the edge may be made.

Inherited methods

Constructor details

ConnectionValidator

public ConnectionValidator()

Method details

isAllowCycles

public boolean isAllowCycles()
True, the default, when an edge may close a cycle.

setAllowCycles

public void setAllowCycles(boolean allowCycles)
Refuses edges that would close a cycle when false.

isAllowSelfLoops

public boolean isAllowSelfLoops()
False, the default, when a node may not connect to itself.

setAllowSelfLoops

public void setAllowSelfLoops(boolean allowSelfLoops)
Allows a node to connect to itself.

canConnect

public boolean canConnect(GraphModel model, GraphNode source, GraphPort sourcePort, GraphNode target, GraphPort targetPort)
True when the edge may be made.