@Override public void unsetHovering(Widget widget) { if (widget != null) { widget.setBackground(scene.getLookFeel().getBackground(ObjectState.createNormal())); widget.setForeground(new Color(0, 0, 0, 0)); CustomPortInteractor port = (CustomPortInteractor) widget; port.setOver(false); } }
@Override public void setHovering(Widget widget) { if (widget != null) { ObjectState state = ObjectState.createNormal().deriveSelected(true); widget.setBackground(scene.getLookFeel().getBackground(state)); widget.setForeground(Color.yellow); CustomPortInteractor port = (CustomPortInteractor) widget; port.setOver(true); } }
public void connect(CustomPortInteractor source, CustomPortInteractor target) { CustomConnectionWidget connection = new CustomConnectionWidget(this); connection.setSourceAnchor(AnchorFactory.createCircularAnchor(source, 1)); connection.setTargetAnchor(AnchorFactory.createCircularAnchor(target, 1)); // save one for each so that they connections can be accessed in both directions connections.add( new Connection( source.getNode(), source.getPortNumber(), target.getNode(), target.getPortNumber(), connection)); addEdge(connection); }