站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Anchor (Visual Library API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.api.visual 2.2

org.netbeans.api.visual.anchor
Class Anchor

java.lang.Object
  extended by org.netbeans.api.visual.anchor.Anchor
All Implemented Interfaces:
Widget.Dependency
Direct Known Subclasses:
VMDNodeAnchor

public abstract class Anchor
extends Object
implements Widget.Dependency

This class represents an anchor for connections. An anchor is usually attached to widget and resolves a source or target point of a connection where it is used. Single instance of an anchor could be used by multiple entries. An entry represents the place where the anchor is used. An anchor can by attached to so-called proxy-anchor also. The proxy-anchor uses a set of anchor and allows smooth switching of the active anchor.


Nested Class Summary
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.
 
Field Summary
static EnumSet<Anchor.Direction> DIRECTION_ANY
          The set of all orthogonal directions.
 
Constructor Summary
protected Anchor(Widget relatedWidget)
          Creates an anchor that is related to a widget.
 
Method Summary
 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.
abstract  Anchor.Result compute(Anchor.Entry entry)
          Computes a result (position and direction) for a specific entry.
 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTION_ANY

public static final EnumSet<Anchor.Direction> DIRECTION_ANY
The set of all orthogonal directions.

Constructor Detail

Anchor

protected Anchor(Widget relatedWidget)
Creates an anchor that is related to a widget.

Parameters:
relatedWidget - the related widget; if null then the anchor is not related to any widget
Method Detail

addEntry

public final void addEntry(Anchor.Entry entry)
Called by ConnectionWidget to register the usage of the anchor.

Parameters:
entry - the anchor entry

removeEntry

public final void removeEntry(Anchor.Entry entry)
Called by ConnectionWidget to unregister the usage of the anchor.

Parameters:
entry - the anchor entry

addEntries

public final void addEntries(List<Anchor.Entry> entries)
Registers multiple entries at once.

Parameters:
entries - a list of entries

removeEntries

public final void removeEntries(List<Anchor.Entry> entries)
Unregisters multiple entries at once.

Parameters:
entries - a list of entries

getEntries

public final List<Anchor.Entry> getEntries()
Returns a list of registered entries

Returns:
the list of entries

notifyEntryAdded

protected void notifyEntryAdded(Anchor.Entry entry)
Notifies when an entry is registered

Parameters:
entry - the registered entry

notifyEntryRemoved

protected void notifyEntryRemoved(Anchor.Entry entry)
Notifies when an entry is unregistered

Parameters:
entry - the unregistered entry

isUsed

protected final boolean isUsed()
Returns whether the anchor is used.

Returns:
true if there is at least one entry registered

notifyUsed

protected void notifyUsed()
Notifies when the anchor is going to be used.


notifyUnused

protected void notifyUnused()
Notifies when the anchor is going to be not used.


revalidateDependency

public final void revalidateDependency()
This method is called by revalidation-change of related widget and notifies all entries about the anchor change.

Specified by:
revalidateDependency in interface Widget.Dependency

getRelatedWidget

public Widget getRelatedWidget()
Returns a related widget.

Returns:
the related widget; null if no related widget is assigned

getRelatedSceneLocation

public Point getRelatedSceneLocation()
Returns a scene location of a related widget.

Returns:
the scene location; null if no related widget is assigned

getOppositeSceneLocation

public Point getOppositeSceneLocation(Anchor.Entry entry)
Returns a scene location of a related widget of an opposite anchor.

Parameters:
entry - the entry to which the opposite anchor searched
Returns:
the scene location

compute

public abstract Anchor.Result compute(Anchor.Entry entry)
Computes a result (position and direction) for a specific entry.

Parameters:
entry - the entry
Returns:
the calculated result

org.netbeans.api.visual 2.2

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.