net.sourceforge.jeuclid.layout
Class LayoutInfoImpl

java.lang.Object
  extended by net.sourceforge.jeuclid.layout.LayoutInfoImpl
All Implemented Interfaces:
LayoutInfo

public class LayoutInfoImpl
extends Object
implements LayoutInfo

Version:
$Revision: 88b901bf20fb $

Constructor Summary
LayoutInfoImpl()
          Default Constructor.
 
Method Summary
 float getAscentHeight(LayoutStage stage)
          Returns the current height of the upper part of this component from the baseline.
 float getDescentHeight(LayoutStage stage)
          Returns the current height of the lower part of this component from the baseline.
 List<GraphicsObject> getGraphicObjects()
          
 float getHorizontalCenterOffset(LayoutStage stage)
          Retrieve the X-position of the horizontal center of the content.
 LayoutStage getLayoutStage()
          The LayoutStage this element represents.
 float getPosX(LayoutStage stage)
          Retrieve the X position of this element relative to its parent.
 float getPosY(LayoutStage stage)
          Retrieve the Y position of this element relative to its parent.
 float getStretchAscent()
          Retrieve the stretch ascent if set, or STAGE1.ascent if unset.
 float getStretchDescent()
          Retrieve the stretch descent if set, or STAGE1.descent if unset.
 float getStretchWidth()
          Retrieve the stretch width if set, or STAGE1.width if unset.
 float getWidth(LayoutStage stage)
          Returns the current width of this element.
 void moveTo(float x, float y, LayoutStage stage)
          Move this element to the given position relative to its parent.
 void setAscentHeight(float ascentHeight, LayoutStage stage)
          
 void setDescentHeight(float descentHeight, LayoutStage stage)
          
 void setGraphicsObject(GraphicsObject graphicsObject)
          
 void setHorizontalCenterOffset(float newOffset, LayoutStage stage)
          
 void setLayoutStage(LayoutStage newStage)
          
 void setStretchAscent(float newStretchAscent)
          Set the stretch ascent for children.
 void setStretchDescent(float newStretchDescent)
          Set the stretch descent for children.
 void setStretchWidth(float newStretchWidth)
          Set the stretch width for children, or < 0 if children should be horizontally unstretched.
 void setWidth(float width, LayoutStage stage)
          
 void shiftVertically(float offsetY, LayoutStage stage)
          Shift vertically by given offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutInfoImpl

public LayoutInfoImpl()
Default Constructor.

Method Detail

getLayoutStage

public LayoutStage getLayoutStage()
The LayoutStage this element represents. The information will not be complete until the final LayoutStage (LayoutStage.STAGE2 ) has been reached.

Specified by:
getLayoutStage in interface LayoutInfo
Returns:
current layout stage.

setLayoutStage

public void setLayoutStage(LayoutStage newStage)

Specified by:
setLayoutStage in interface LayoutInfo
Parameters:
newStage - new Layout Stage.

getAscentHeight

public float getAscentHeight(LayoutStage stage)
Returns the current height of the upper part of this component from the baseline.

Specified by:
getAscentHeight in interface LayoutInfo
Parameters:
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)
Returns:
Height of the upper part

getDescentHeight

public float getDescentHeight(LayoutStage stage)
Returns the current height of the lower part of this component from the baseline.

Specified by:
getDescentHeight in interface LayoutInfo
Parameters:
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)
Returns:
Height of the lower part.

getHorizontalCenterOffset

public float getHorizontalCenterOffset(LayoutStage stage)
Retrieve the X-position of the horizontal center of the content. In most cases, this will be width / 2. This does not, however, take extra borders into account. An element may have different border width on left and right, in which case the center will be moved.

Specified by:
getHorizontalCenterOffset in interface LayoutInfo
Parameters:
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)
Returns:
X-position of the center of the content

getPosX

public float getPosX(LayoutStage stage)
Retrieve the X position of this element relative to its parent.

Specified by:
getPosX in interface LayoutInfo
Parameters:
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)
Returns:
X position

getPosY

public float getPosY(LayoutStage stage)
Retrieve the Y position of this element relative to its parent.

Specified by:
getPosY in interface LayoutInfo
Parameters:
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)
Returns:
Y position

getWidth

public float getWidth(LayoutStage stage)
Returns the current width of this element.

Specified by:
getWidth in interface LayoutInfo
Parameters:
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)
Returns:
Width of this element.

moveTo

public void moveTo(float x,
                   float y,
                   LayoutStage stage)
Move this element to the given position relative to its parent.

Specified by:
moveTo in interface LayoutInfo
Parameters:
x - new X position
y - new Y position
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)

setAscentHeight

public void setAscentHeight(float ascentHeight,
                            LayoutStage stage)

Specified by:
setAscentHeight in interface LayoutInfo
Parameters:
ascentHeight - new ascentHeight.
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)

setDescentHeight

public void setDescentHeight(float descentHeight,
                             LayoutStage stage)

Specified by:
setDescentHeight in interface LayoutInfo
Parameters:
descentHeight - new descentHeight.
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)

setHorizontalCenterOffset

public void setHorizontalCenterOffset(float newOffset,
                                      LayoutStage stage)

Specified by:
setHorizontalCenterOffset in interface LayoutInfo
Parameters:
newOffset - new horizontal offset.
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)

setWidth

public void setWidth(float width,
                     LayoutStage stage)

Specified by:
setWidth in interface LayoutInfo
Parameters:
width - new width.
stage - LayoutStage to get this information for (either LayoutStage.STAGE1 or LayoutStage.STAGE2)

setGraphicsObject

public void setGraphicsObject(GraphicsObject graphicsObject)

Specified by:
setGraphicsObject in interface LayoutInfo
Parameters:
graphicsObject - the GraphicsObject to set.

getGraphicObjects

public List<GraphicsObject> getGraphicObjects()

Specified by:
getGraphicObjects in interface LayoutInfo
Returns:
Graphic objects associated with this node.

getStretchWidth

public float getStretchWidth()
Retrieve the stretch width if set, or STAGE1.width if unset.

Specified by:
getStretchWidth in interface LayoutInfo
Returns:
stretch width.

setStretchWidth

public void setStretchWidth(float newStretchWidth)
Set the stretch width for children, or < 0 if children should be horizontally unstretched.

Specified by:
setStretchWidth in interface LayoutInfo
Parameters:
newStretchWidth - new stretch width

getStretchAscent

public float getStretchAscent()
Retrieve the stretch ascent if set, or STAGE1.ascent if unset.

Specified by:
getStretchAscent in interface LayoutInfo
Returns:
stretch ascent.

getStretchDescent

public float getStretchDescent()
Retrieve the stretch descent if set, or STAGE1.descent if unset.

Specified by:
getStretchDescent in interface LayoutInfo
Returns:
stretch descent.

setStretchAscent

public void setStretchAscent(float newStretchAscent)
Set the stretch ascent for children. Defaults to STAGE1.ascent

Specified by:
setStretchAscent in interface LayoutInfo
Parameters:
newStretchAscent - new stretch ascent

setStretchDescent

public void setStretchDescent(float newStretchDescent)
Set the stretch descent for children. Defaults to STAGE1.descent

Specified by:
setStretchDescent in interface LayoutInfo
Parameters:
newStretchDescent - new stretch descent

shiftVertically

public void shiftVertically(float offsetY,
                            LayoutStage stage)
Shift vertically by given offset.

Specified by:
shiftVertically in interface LayoutInfo
Parameters:
offsetY - offset to shift.
stage - Stage to manipulate.


Copyright © 2002-2010 The JEuclid project. All Rights Reserved.