com.google.code.validationframework.swing.decoration.anchor
Class AnchorLink

java.lang.Object
  extended by com.google.code.validationframework.swing.decoration.anchor.AnchorLink

public class AnchorLink
extends Object

Pair of anchors.
Typically, this can be used to match an anchor point on a decorated component (master anchor) to an anchor point on its decoration (slave anchor).


Constructor Summary
AnchorLink(Anchor masterAnchor, Anchor slaveAnchor)
          Constructor specifying the master and slave anchors.
AnchorLink(AnchorLink anchorLink)
          Constructor specifying the anchor link to get the master and slave anchors from.
 
Method Summary
 Anchor getMasterAnchor()
          Gets the master anchor.
 Point getRelativeSlaveLocation(Component masterComponent, Component slaveComponent)
          Computes the location of the specified component that is slaved to the specified master component using this anchor link.
 Point getRelativeSlaveLocation(Dimension masterSize, Dimension slaveSize)
          Computes the location of the slave component (whose size is specified) that is slaved to the master component (whose size is specified) using this anchor link.
 Point getRelativeSlaveLocation(int masterWidth, int masterHeight, int slaveWidth, int slaveHeight)
          Computes the location of the slave component (whose size is specified) that is slaved to the master component (whose size is specified) using this anchor link.
 Anchor getSlaveAnchor()
          Gets the slave anchor.
 void setMasterAnchor(Anchor masterAnchor)
          Sets the master anchor.
 void setSlaveAnchor(Anchor slaveAnchor)
          Sets the slave anchor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnchorLink

public AnchorLink(AnchorLink anchorLink)
Constructor specifying the anchor link to get the master and slave anchors from.

Parameters:
anchorLink - Anchor link to get the master and slave anchors from.

AnchorLink

public AnchorLink(Anchor masterAnchor,
                  Anchor slaveAnchor)
Constructor specifying the master and slave anchors.

Parameters:
masterAnchor - Master anchor.
slaveAnchor - Slave anchor.
Method Detail

getMasterAnchor

public Anchor getMasterAnchor()
Gets the master anchor.

Returns:
Master anchor.

setMasterAnchor

public void setMasterAnchor(Anchor masterAnchor)
Sets the master anchor.

Parameters:
masterAnchor - Master anchor.

getSlaveAnchor

public Anchor getSlaveAnchor()
Gets the slave anchor.

Returns:
Slave anchor.

setSlaveAnchor

public void setSlaveAnchor(Anchor slaveAnchor)
Sets the slave anchor.

Parameters:
slaveAnchor - Slave anchor.

getRelativeSlaveLocation

public Point getRelativeSlaveLocation(Component masterComponent,
                                      Component slaveComponent)
Computes the location of the specified component that is slaved to the specified master component using this anchor link.

Parameters:
masterComponent - Master component to which the other component is slaved.
slaveComponent - Slave component that is slaved to the master component.
Returns:
Location where the slave component should be.

getRelativeSlaveLocation

public Point getRelativeSlaveLocation(Dimension masterSize,
                                      Dimension slaveSize)
Computes the location of the slave component (whose size is specified) that is slaved to the master component (whose size is specified) using this anchor link.

Parameters:
masterSize - Size of the master component to which the other component is slaved.
slaveSize - Size of the slave component that is slaved to the master component.
Returns:
Location where the slave component should be.

getRelativeSlaveLocation

public Point getRelativeSlaveLocation(int masterWidth,
                                      int masterHeight,
                                      int slaveWidth,
                                      int slaveHeight)
Computes the location of the slave component (whose size is specified) that is slaved to the master component (whose size is specified) using this anchor link.

Parameters:
masterWidth - Width of the master component to which the other component is slaved.
masterHeight - Height of the master component to which the other component is slaved.
slaveWidth - Width of the slave component that is slaved to the master component.
slaveHeight - Height of the slave component that is slaved to the master component.
Returns:
Location where the slave component should be.


Copyright © 2013. All Rights Reserved.