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

public class GraphNodeTemplate

  1. Object
  2. GraphNodeTemplate

A kind of node a user can add: what a com.codename1.ui.graph.GraphPalette lists, and what a node editor calls a node type.

GraphNodeTemplate decision = new GraphNodeTemplate("Decision")
        .setShape(GraphShapes.DECISION).setSize(140, 90);
GraphNodeTemplate add = new GraphNodeTemplate("Add")
        .addInput("a", "A", "number").addInput("b", "B", "number")
        .addOutput("sum", "Sum", "number");

Override create to make nodes that carry data of your own.

Constructors

public GraphNodeTemplate(String name)A template whose nodes are labeled with its name.

Methods

public String getName()The name a palette shows.
public String getLabel()The label new nodes get.
public GraphNodeTemplate setLabel(String label)Sets the label new nodes get.
public String getDescription()The description new nodes get, or null.
public GraphNodeTemplate setDescription(String description)Sets the description new nodes get.
public String getShape()The outline of new nodes, one of the GraphShapes names, or null.
public GraphNodeTemplate setShape(String shape)Sets the outline of new nodes.
public String getStyleKey()The style key of new nodes, or null.
public GraphNodeTemplate setStyleKey(String styleKey)Sets the style key of new nodes.
public double getWidth()The width of new nodes in world units.
public double getHeight()The height of new nodes in world units.
public GraphNodeTemplate setSize(double width, double height)Sets the size of new nodes in world units.
public GraphNodeTemplate addInput(String id, String label, String type)Gives new nodes an input port.
public GraphNodeTemplate addOutput(String id, String label, String type)Gives new nodes an output port.
public boolean hasPorts()True when new nodes have ports.
public GraphNode create(String id)Makes a node at the origin; the view places it.

Inherited methods

Constructor details

GraphNodeTemplate

public GraphNodeTemplate(String name)
A template whose nodes are labeled with its name.

Method details

getName

public String getName()
The name a palette shows.

getLabel

public String getLabel()
The label new nodes get.

setLabel

public GraphNodeTemplate setLabel(String label)
Sets the label new nodes get.

getDescription

public String getDescription()
The description new nodes get, or null.

setDescription

public GraphNodeTemplate setDescription(String description)
Sets the description new nodes get.

getShape

public String getShape()
The outline of new nodes, one of the GraphShapes names, or null.

setShape

public GraphNodeTemplate setShape(String shape)
Sets the outline of new nodes.

getStyleKey

public String getStyleKey()
The style key of new nodes, or null.

setStyleKey

public GraphNodeTemplate setStyleKey(String styleKey)
Sets the style key of new nodes.

getWidth

public double getWidth()
The width of new nodes in world units.

getHeight

public double getHeight()
The height of new nodes in world units.

setSize

public GraphNodeTemplate setSize(double width, double height)
Sets the size of new nodes in world units.

addInput

public GraphNodeTemplate addInput(String id, String label, String type)
Gives new nodes an input port.

addOutput

public GraphNodeTemplate addOutput(String id, String label, String type)
Gives new nodes an output port.

hasPorts

public boolean hasPorts()
True when new nodes have ports.

create

public GraphNode create(String id)
Makes a node at the origin; the view places it.

Parameters

id String
an id no node of the model has