yFiles Tutorial Node Ports Demos

The following demos demonstrate how to use and interact with node ports as well as how to customize their visual appearance and how to associate labels to node ports. In addition, it shows how to use node halos to avoid node port overlaps.

Class Description
demo.view.advanced.ports.NodePortsDemo Demonstrates how to use node ports.
demo.view.advanced.ports.LogicGatesDemo Demonstrates how to create an application that makes use of nodes that have a fixed set of ports. The nodes represent logic gates. Edges can only start at the ports located at the right side of nodes. These are the outputs of the represented gates. Edges can only end at ports located at the left side of the nodes. These are the inputs of the represented gates. Valid ports will be highlighted when hovering over a node or when creating an edge. The nodes are realized using GenericNodeRealizers and the ports are realized using NodePorts.

Running the Demos

From Within an IDE

Set <yFilesDir>/src as your source directory. Then add <yFilesDir>/lib/y.jar and the source folder <yFilesDir>/src to your classpath. Now you should be ready to compile and run all executable demo classes.

With Ant

First make sure you have the build tool Ant installed on your system. Now you can use the demo build script build.xml located in <yFilesDir>/src/demo to launch each demo by specifying its simple class name as a target. Alternatively, launch the interactive demo driver by specifying run as target to conveniently access all demos.