Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class GraphPort
- Object
- GraphPort
A place on a GraphNode where edges attach, as in a node editor.
A node with no ports is connected node to node, as in a system diagram. Ports are ordered on their side of the node in the order they were added.
Fields
public static final int INPUT = 0 | The port takes incoming edges and sits on the leading side of the node. |
public static final int OUTPUT = 1 | The port starts outgoing edges and sits on the trailing side. |
Constructors
public GraphPort(String id, int direction, String label, String type) | A port. |
Methods
public String getId() | The id, unique within the node. |
public int getDirection() | INPUT or OUTPUT. |
public boolean isInput() | True for an INPUT port. |
public String getLabel() | The label, or null. |
public void setLabel(String label) | Sets the label. |
public String getType() | The data type edges must agree on, or null for any. |
public void setType(String type) | Sets the data type. |
public int getMaxConnections() | How many edges may attach, or -1 for any number. |
public void setMaxConnections(int maxConnections) | Limits the edges that may attach; -1 for any number. |
public Object getValue() | The value an input uses while nothing is connected to it, such as the number typed beside it in a node editor. |
public void setValue(Object value) | Sets the value. |
public GraphNode getNode() | The node the port belongs to, or null before it is added to one. |
Inherited methods
Field details
INPUT
public static final int INPUT = 0The port takes incoming edges and sits on the leading side of the node.
OUTPUT
public static final int OUTPUT = 1The port starts outgoing edges and sits on the trailing side.
Constructor details
GraphPort
public GraphPort(String id, int direction, String label, String type)A port.
Parameters
idString- unique within its node
directionintINPUTorOUTPUTlabelString- painted beside the port, may be null
typeString- compared by
ConnectionValidator; null accepts any type
Method details
getId
public String getId()The id, unique within the node.
getDirection
public int getDirection()INPUT or OUTPUT.isInput
public boolean isInput()True for an
INPUT port.getLabel
public String getLabel()The label, or null.
setLabel
public void setLabel(String label)Sets the label.
getType
public String getType()The data type edges must agree on, or null for any.
setType
public void setType(String type)Sets the data type.
getMaxConnections
public int getMaxConnections()How many edges may attach, or -1 for any number.
setMaxConnections
public void setMaxConnections(int maxConnections)Limits the edges that may attach; -1 for any number.
getValue
public Object getValue()The value an input uses while nothing is connected to it, such as the
number typed beside it in a node editor. Null by default.
setValue
public void setValue(Object value)Sets the value. A model shown by a component is told through
GraphModel.setPortValue.
GraphJson saves a value that is a string, a number or a boolean, and
so does the clipboard. Read back, a whole number is a Long and any
other number a Double, whatever class it was: compare a value as a
Number, not as the class it was set with.
getNode
public GraphNode getNode()The node the port belongs to, or null before it is added to one.