Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface PortEditorFactory
Makes the small component beside an input port in which its value is typed while nothing is connected to it, as node editors do.
NodeGraph graph = new NodeGraph();
graph.setPortEditorFactory((g, node, port) -> {
if (!"number".equals(port.getType())) {
return null;
}
TextField tf = new TextField(String.valueOf(port.getValue()), "", 6, TextArea.DECIMAL);
tf.addActionListener(e -> g.setPortValue(port, Double.valueOf(tf.getAsDouble(0))));
return tf;
});The component is shown at NodeGraph.getComponentZoom and above, and
hidden while an edge enters the port: the edge supplies the value then.
Methods
public abstract Component createEditor(NodeGraph graph, GraphNode node, GraphPort port) | The editor for an input port, or null for none. |
Method details
createEditor
public abstract Component createEditor(NodeGraph graph, GraphNode node, GraphPort port)The editor for an input port, or null for none. Called once per port;
store what the user enters with
NodeGraph.setPortValue.