Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.draw2d.ui.figures
Class BaseSlidableAnchor

java.lang.Object
  extended by 

org.eclipse.draw2d.ConnectionAnchorBase
      extended by 

org.eclipse.draw2d.AbstractConnectionAnchor
          extended by 
org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor
All Implemented Interfaces:
AncestorListener, ConnectionAnchor, OrthogonalConnectionAnchor
Direct Known Subclasses:
SlidableAnchor

public class BaseSlidableAnchor
extends AbstractConnectionAnchor
implements OrthogonalConnectionAnchor

Provides the implementation of Slidable anchor


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d. AncestorListener
AncestorListener.Stub
 
Field Summary
 
Fields inherited from class org.eclipse.draw2d. ConnectionAnchorBase
listeners
 
Constructor Summary
BaseSlidableAnchor ()
          Empty constructor
BaseSlidableAnchor ( IFigure f)
          Default constructor.
BaseSlidableAnchor ( IFigure f, PrecisionPoint p)
          Constructor.
 
Method Summary
 boolean equals (java.lang.Object obj)
           
static  PrecisionPoint getAnchorRelativeLocation ( Point p, Rectangle bounds)
          Calculates the relative location of the reference point with respect to the bounds of the figure.
protected   Rectangle getBox ()
          Gets the anchors associated figure's bounding box in absolute coordinates.
protected   PointList getIntersectionPoints ( Point ownReference, Point foreignReference)
          Calculates intersection points of the figure and the line that passes through ownReference and foreignReference points
  Point getLocation ( Point reference)
           
protected   Point getLocation ( Point ownReference, Point foreignReference)
          Calculates the location of the anchor depending on the anchors own reference and foreign reference points
  Point getOrthogonalLocation ( Point orthoReference)
          Determines connection anchor point for Orthogonal connection.
protected   PointList getPolygonPoints ()
          Returns the list of all the vertices of the figure.
  Point getReferencePoint ()
           
 java.lang.String getTerminal ()
          Creates terminal string for slidable anchor
 int hashCode ()
           
 boolean isDefaultAnchor ()
          Returns true if the SlidableAnchor is default one with a reference at the center
protected   Point normalizeToStraightlineTolerance ( Point foreignReference, Point ownReference, int tolerance)
          Returns a new owned reference point that is normalized to be with-in a straight-line tolerance value.
static  PrecisionPoint parseTerminalString (java.lang.String terminal)
          Parses anchors terminal string and returns the relative reference icorporated in the terminal string
 
Methods inherited from class org.eclipse.draw2d. AbstractConnectionAnchor
addAnchorListener, ancestorAdded, ancestorMoved, ancestorRemoved, getOwner, removeAnchorListener, setOwner
 
Methods inherited from class org.eclipse.draw2d. ConnectionAnchorBase
fireAnchorMoved
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.draw2d. ConnectionAnchor
addAnchorListener, getOwner, removeAnchorListener
 

Constructor Detail

BaseSlidableAnchor

public BaseSlidableAnchor()
Empty constructor


BaseSlidableAnchor

public BaseSlidableAnchor(
IFigure f)
Default constructor. The anchor will have the center of the figure as the reference point

Parameters:
f - IFigure that this anchor is associated with.

BaseSlidableAnchor

public BaseSlidableAnchor(
IFigure f,
                          
PrecisionPoint p)
Constructor. Takes point p to store the reference point

Parameters:
f - IFigure that this anchor is associated with.
p - the PrecisionPoint that the anchor will initially attach to.
Method Detail

getTerminal

public java.lang.String getTerminal()
Creates terminal string for slidable anchor

Returns:
String terminal for slidable anchor

getReferencePoint

public 
Point getReferencePoint()
Specified by:
getReferencePoint in interface ConnectionAnchor
Overrides:
getReferencePoint in class AbstractConnectionAnchor

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getLocation

protected 
Point getLocation(
Point ownReference,
                            
Point foreignReference)
Calculates the location of the anchor depending on the anchors own reference and foreign reference points

Parameters:
ownReference - - the own reference of the anchor
foreignReference - - foreign reference that comes in
Returns:
the location of the anchor depending on the anchors own reference and foreign reference points

getLocation

public 
Point getLocation(
Point reference)
Specified by:
getLocation in interface ConnectionAnchor

normalizeToStraightlineTolerance

protected 
Point normalizeToStraightlineTolerance(
Point foreignReference,
                                                 
Point ownReference,
                                                 int tolerance)
Returns a new owned reference point that is normalized to be with-in a straight-line tolerance value.

Parameters:
foreignReference - Point that is the foreign reference point used to calculate the interfection anchor point on the shape in absolute coordinates.
ownReference - Point that is the reference point with-in the shape in absolute coordinates
tolerance - int value that is the difference in absolute coordinates where the two points would be considered straight and then adjusted.
Returns:
Point that is the normalized owned reference to be with-in a given straight-line tolerance value of the foreign reference point.

getIntersectionPoints

protected 
PointList getIntersectionPoints(
Point ownReference,
                                          
Point foreignReference)
Calculates intersection points of the figure and the line that passes through ownReference and foreignReference points

Parameters:
ownReference - the reference Point on or inside the shape that is being anchored to.
foreignReference - the outside reference Point point that is the terminal end of the line formed by the two parameters.
Returns:
intersection points of the figure and the line that passes through ownReference and foreignReference points

getPolygonPoints

protected 
PointList getPolygonPoints()
Returns the list of all the vertices of the figure. The created list must form a polygon, i.e. closed polyline, for figures hence the starting and ending points must be the same

Returns:
the PointList list of all the vertices of the figure.

getAnchorRelativeLocation

public static 
PrecisionPoint getAnchorRelativeLocation(
Point p,
                                                       
Rectangle bounds)
Calculates the relative location of the reference point with respect to the bounds of the figure. If point p is not inside of the figure's bounds then the point is mapped on the bounds and the point relative location is calculated

Parameters:
p - the Point that is relative coordinates of the point
Returns:
PrecisionPoint, i.e. the relative reference for SlidableAnchor

getBox

protected 
Rectangle getBox()
Gets the anchors associated figure's bounding box in absolute coordinates.

Returns:
a Rectangle that is the bounding box of the owner figure in absolute coordinates

isDefaultAnchor

public boolean isDefaultAnchor()
Returns true if the SlidableAnchor is default one with a reference at the center

Returns:
boolean true is the SlidableAnchor is default one, false otherwise

parseTerminalString

public static 
PrecisionPoint parseTerminalString(java.lang.String terminal)
Parses anchors terminal string and returns the relative reference icorporated in the terminal string

Parameters:
terminal - - the terminal string containing relative reference
Returns:
returns the relative reference incorporated in the terminal string

getOrthogonalLocation

public 
Point getOrthogonalLocation(
Point orthoReference)
Description copied from interface: OrthogonalConnectionAnchor
Determines connection anchor point for Orthogonal connection. Generally, the anchor point would the intersection of perpendicular line drawn from the orthoReference point to the shape and shape's edge.

Specified by:
getOrthogonalLocation in interface OrthogonalConnectionAnchor
Parameters:
orthoReference - the reference point
Returns:
The location of the orthogonal connection anchor.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire