public abstract class Anchor extends Object implements Widget.Dependency
Modifier and Type | Class and Description |
---|---|
static class |
Anchor.Direction
The direction of the anchor.
|
static interface |
Anchor.Entry
Represents a place where an anchor is used.
|
class |
Anchor.Result
Represents calculated scene location and orthogonal direction(s) of an anchor.
|
Modifier and Type | Field and Description |
---|---|
static EnumSet<Anchor.Direction> |
DIRECTION_ANY
The set of all orthogonal directions.
|
Modifier | Constructor and Description |
---|---|
protected |
Anchor(Widget relatedWidget)
Creates an anchor that is related to a widget.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntries(List<Anchor.Entry> entries)
Registers multiple entries at once.
|
void |
addEntry(Anchor.Entry entry)
Called by ConnectionWidget to register the usage of the anchor.
|
boolean |
allowsArbitraryConnectionPlacement() |
abstract Anchor.Result |
compute(Anchor.Entry entry)
Computes a result (position and direction) for a specific entry.
|
List<Point> |
compute(List<Point> bestPoints) |
List<Anchor.Entry> |
getEntries()
Returns a list of registered entries
|
Point |
getOppositeSceneLocation(Anchor.Entry entry)
Returns a scene location of a related widget of an opposite anchor.
|
Point |
getRelatedSceneLocation()
Returns a scene location of a related widget.
|
Widget |
getRelatedWidget()
Returns a related widget.
|
protected boolean |
isUsed()
Returns whether the anchor is used.
|
protected void |
notifyEntryAdded(Anchor.Entry entry)
Notifies when an entry is registered
|
protected void |
notifyEntryRemoved(Anchor.Entry entry)
Notifies when an entry is unregistered
|
protected void |
notifyRevalidate()
Notifies when the anchor is going to be revalidated.
|
protected void |
notifyUnused()
Notifies when the anchor is going to be not used.
|
protected void |
notifyUsed()
Notifies when the anchor is going to be used.
|
void |
removeEntries(List<Anchor.Entry> entries)
Unregisters multiple entries at once.
|
void |
removeEntry(Anchor.Entry entry)
Called by ConnectionWidget to unregister the usage of the anchor.
|
void |
revalidateDependency()
This method is called by revalidation-change of related widget and notifies all entries about the anchor change.
|
public static final EnumSet<Anchor.Direction> DIRECTION_ANY
protected Anchor(Widget relatedWidget)
relatedWidget
- the related widget; if null then the anchor is not related to any widgetpublic final void addEntry(Anchor.Entry entry)
entry
- the anchor entrypublic final void removeEntry(Anchor.Entry entry)
entry
- the anchor entrypublic final void addEntries(List<Anchor.Entry> entries)
entries
- a list of entriespublic final void removeEntries(List<Anchor.Entry> entries)
entries
- a list of entriespublic final List<Anchor.Entry> getEntries()
protected void notifyEntryAdded(Anchor.Entry entry)
entry
- the registered entryprotected void notifyEntryRemoved(Anchor.Entry entry)
entry
- the unregistered entryprotected final boolean isUsed()
protected void notifyUsed()
protected void notifyUnused()
protected void notifyRevalidate()
public final void revalidateDependency()
revalidateDependency
in interface Widget.Dependency
public Widget getRelatedWidget()
public Point getRelatedSceneLocation()
public Point getOppositeSceneLocation(Anchor.Entry entry)
entry
- the entry to which the opposite anchor searchedpublic boolean allowsArbitraryConnectionPlacement()
public abstract Anchor.Result compute(Anchor.Entry entry)
entry
- the entry