Interface PortEditorFactory
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.
-
Method Summary
Modifier and TypeMethodDescriptioncreateEditor(NodeGraph graph, GraphNode node, GraphPort port) The editor for an input port, or null for none.
-
Method Details
-
createEditor
-