public Anchor.Result compute (Anchor.Entry entry) { return anchors[index].compute (entry); }
public Widget getRelatedWidget () { return anchors[index].getRelatedWidget(); }
public Point getRelatedSceneLocation () { return anchors[index].getRelatedSceneLocation (); }
/** * Sets a target anchor of the connection widget. * @param targetAnchor the target anchor */ public final void setTargetAnchor (Anchor targetAnchor) { if (this.targetAnchor != null) this.targetAnchor.removeEntry (targetEntry); this.targetAnchor = targetAnchor; if (targetAnchor != null) targetAnchor.addEntry (targetEntry); reroute (); }
/** * Called by ConnectionWidget to unregister the usage of the anchor. * @param entry the anchor entry */ public final void removeEntry (Entry entry) { entries.remove (entry); notifyEntryRemoved (entry); if (attachedToWidget && entries.size () <= 0) { attachedToWidget = false; if (relatedWidget != null) relatedWidget.removeDependency (this); notifyUnused (); } revalidateDependency (); }
/** * Called by ConnectionWidget to register the usage of the anchor. * @param entry the anchor entry */ public final void addEntry (Anchor.Entry entry) { if (entry == null) return; notifyEntryAdded (entry); entries.add (entry); if (! attachedToWidget && entries.size () > 0) { attachedToWidget = true; if (relatedWidget != null) relatedWidget.addDependency (this); notifyUsed (); } revalidateDependency (); }
if (sourceAnchor.getRelatedWidget() != null && (sourceAnchor.getRelatedWidget() == targetAnchor.getRelatedWidget())) Rectangle rec = sourceAnchor.getRelatedWidget().convertLocalToScene(sourceAnchor.getRelatedWidget().getBounds()); rec.grow(SPACING_NODE, SPACING_NODE); verticalCollisions.add(rec); final Point originalSourceCenterPoint = sourceAnchor.getRelatedSceneLocation(); final Point originalTargetCenterPoint = targetAnchor.getRelatedSceneLocation(); Point sourcePoint = originalSourceCenterPoint; Point targetPoint = originalTargetCenterPoint; if (!sourceAnchor.allowsArbitraryConnectionPlacement()) { Result sourceResult = sourceAnchor.compute(widget.getSourceAnchorEntry()); sourceDirections = sourceResult.getDirections(); sourcePoint = sourceResult.getAnchorSceneLocation(); if (!targetAnchor.allowsArbitraryConnectionPlacement()) { Result targetResult = targetAnchor.compute(widget.getTargetAnchorEntry()); targetDirections = targetResult.getDirections(); targetPoint = targetResult.getAnchorSceneLocation(); if (!sourceAnchor.allowsArbitraryConnectionPlacement() && !targetAnchor.allowsArbitraryConnectionPlacement()) { return bestListOfPoints; if (sourceAnchor.allowsArbitraryConnectionPlacement()) { bestPoints = sourceAnchor.compute(bestListOfPoints);
public void stateChanged () { int state = getModel ().getState (); if (index == state) return; anchors[index].removeEntries (getEntries ()); index = state; anchors[index].addEntries (getEntries ()); revalidateDependency (); }
/** * Registers multiple entries at once. * @param entries a list of entries */ public final void addEntries (List<Entry> entries) { for (Entry entry : entries) addEntry (entry); }
/** * This method is called by revalidation-change of related widget and notifies all entries about the anchor change. */ public final void revalidateDependency () { notifyRevalidate (); for (Entry entry : entries) entry.revalidateEntry (); }
if (sourceAnchor.getRelatedWidget() != null && (sourceAnchor.getRelatedWidget() == targetAnchor.getRelatedWidget())) Rectangle rec = sourceAnchor.getRelatedWidget().convertLocalToScene(sourceAnchor.getRelatedWidget().getBounds()); rec.grow(SPACING_NODE, SPACING_NODE); verticalCollisions.add(rec); final Point originalSourceCenterPoint = sourceAnchor.getRelatedSceneLocation(); final Point originalTargetCenterPoint = targetAnchor.getRelatedSceneLocation(); Point sourcePoint = originalSourceCenterPoint; Point targetPoint = originalTargetCenterPoint; if (!sourceAnchor.allowsArbitraryConnectionPlacement()) { Result sourceResult = sourceAnchor.compute(widget.getSourceAnchorEntry()); sourceDirections = sourceResult.getDirections(); sourcePoint = sourceResult.getAnchorSceneLocation(); if (!targetAnchor.allowsArbitraryConnectionPlacement()) { Result targetResult = targetAnchor.compute(widget.getTargetAnchorEntry()); targetDirections = targetResult.getDirections(); targetPoint = targetResult.getAnchorSceneLocation(); if (!sourceAnchor.allowsArbitraryConnectionPlacement() && !targetAnchor.allowsArbitraryConnectionPlacement()) { return bestListOfPoints; if (sourceAnchor.allowsArbitraryConnectionPlacement()) { bestPoints = sourceAnchor.compute(bestListOfPoints);
/** * Called by ConnectionWidget to unregister the usage of the anchor. * @param entry the anchor entry */ public final void removeEntry (Entry entry) { entries.remove (entry); notifyEntryRemoved (entry); if (attachedToWidget && entries.size () <= 0) { attachedToWidget = false; if (relatedWidget != null) relatedWidget.removeDependency (this); notifyUnused (); } revalidateDependency (); }
/** * Called by ConnectionWidget to register the usage of the anchor. * @param entry the anchor entry */ public final void addEntry (Anchor.Entry entry) { if (entry == null) return; notifyEntryAdded (entry); entries.add (entry); if (! attachedToWidget && entries.size () > 0) { attachedToWidget = true; if (relatedWidget != null) relatedWidget.addDependency (this); notifyUsed (); } revalidateDependency (); }
/** * Sets a source anchor of the connection widget. * @param sourceAnchor the source anchor */ public final void setSourceAnchor (Anchor sourceAnchor) { if (this.sourceAnchor != null) this.sourceAnchor.removeEntry (sourceEntry); this.sourceAnchor = sourceAnchor; if (this.sourceAnchor != null) sourceAnchor.addEntry (sourceEntry); reroute (); }
public void stateChanged () { int state = getModel ().getState (); if (index == state) return; anchors[index].removeEntries (getEntries ()); index = state; anchors[index].addEntries (getEntries ()); revalidateDependency (); }
/** * Registers multiple entries at once. * @param entries a list of entries */ public final void addEntries (List<Entry> entries) { for (Entry entry : entries) addEntry (entry); }
/** * This method is called by revalidation-change of related widget and notifies all entries about the anchor change. */ public final void revalidateDependency () { notifyRevalidate (); for (Entry entry : entries) entry.revalidateEntry (); }
public Widget getRelatedWidget () { return anchors[index].getRelatedWidget(); }
public Anchor.Result compute (Anchor.Entry entry) { return anchors[index].compute (entry); }
/** * Sets a source anchor of the connection widget. * @param sourceAnchor the source anchor */ public final void setSourceAnchor (Anchor sourceAnchor) { if (this.sourceAnchor != null) this.sourceAnchor.removeEntry (sourceEntry); this.sourceAnchor = sourceAnchor; if (this.sourceAnchor != null) sourceAnchor.addEntry (sourceEntry); reroute (); }