@Override protected void unregister(IViewer<Node> viewer) { if (edgeLabelPart != null) { removeAnchored(edgeLabelPart); getParent().removeChild(edgeLabelPart); edgeLabelPart = null; } super.unregister(viewer); }
@Override protected void doActivate() { super.doActivate(); getContent().addPropertyChangeListener(edgeAttributesPropertyChangeListener); // add label part if (edgeLabelPart == null) { edgeLabelPart = injector.getInstance(EdgeLabelPart.class); edgeLabelPart.getVisual().getStyleClass().add(CSS_CLASS_LABEL); getParent().addChild(edgeLabelPart); edgeLabelPart.addAnchorage(this); } }
@Override public void setContent(Object content) { super.setContent(content); if (content == null) { return; } if (!(content instanceof Edge)) { throw new IllegalArgumentException("Content of wrong type!"); } final FXConnection visual = getVisual(); setAdapter( AdapterKey.get( Provider.class, FXDefaultFeedbackPartFactory.SELECTION_FEEDBACK_GEOMETRY_PROVIDER), new Provider<IGeometry>() { @Override public IGeometry get() { return FXUtils.localToParent( visual, FXUtils.localToParent( visual.getCurveNode(), ((FXGeometryNode<?>) visual.getCurveNode()).getGeometry())); } }); setAdapter( AdapterKey.get( Provider.class, FXDefaultFeedbackPartFactory.HOVER_FEEDBACK_GEOMETRY_PROVIDER), new Provider<IGeometry>() { @Override public IGeometry get() { return FXUtils.localToParent( visual, FXUtils.localToParent( visual.getCurveNode(), ((FXGeometryNode<?>) visual.getCurveNode()).getGeometry())); } }); }
@Override protected void register(IViewer<Node> viewer) { super.register(viewer); }
@Override protected void doDeactivate() { getContent().removePropertyChangeListener(edgeAttributesPropertyChangeListener); super.doDeactivate(); }
@Override protected void doActivate() { super.doActivate(); getContent().addPropertyChangeListener(nodeAttributesPropertyChangeListener); }