Package net.sourceforge.jeuclid.layout
Interface LayoutInfo
-
- All Known Implementing Classes:
LayoutInfoImpl
public interface LayoutInfoRepresented Information about a layouted object.The completeness of this information depends on the objects
LayoutStage.Each object is described with:
- Origin:
getPosX(LayoutStage),getPosY(LayoutStage)) - Horizontal Size:
getWidth(LayoutStage)) - Vertical Size:
getAscentHeight(LayoutStage),getDescentHeight(LayoutStage)
Coordinates are given relative to the baseline. If the object has no descent, this means the origin of the object is the lower left corner.
The actual Graphical representation can be retrieved with
getGraphicObjects().The stretch information (
getStretchAscent(),getStretchDescent(),getStretchWidth()) is set during the parents layout and defines the size to which stretchable operators are scaled to.- Version:
- $Revision: 686a662dbcbe $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description floatgetAscentHeight(LayoutStage stage)Returns the current height of the upper part of this component from the baseline.floatgetDescentHeight(LayoutStage stage)Returns the current height of the lower part of this component from the baseline.java.util.List<GraphicsObject>getGraphicObjects()floatgetHorizontalCenterOffset(LayoutStage stage)Retrieve the X-position of the horizontal center of the content.LayoutStagegetLayoutStage()TheLayoutStagethis element represents.floatgetPosX(LayoutStage stage)Retrieve the X position of this element relative to its parent.floatgetPosY(LayoutStage stage)Retrieve the Y position of this element relative to its parent.floatgetStretchAscent()Retrieve the stretch ascent if set, or STAGE1.ascent if unset.floatgetStretchDescent()Retrieve the stretch descent if set, or STAGE1.descent if unset.floatgetStretchWidth()Retrieve the stretch width if set, or STAGE1.width if unset.floatgetWidth(LayoutStage stage)Returns the current width of this element.voidmoveTo(float x, float y, LayoutStage stage)Move this element to the given position relative to its parent.voidsetAscentHeight(float ascentHeight, LayoutStage stage)voidsetDescentHeight(float descentHeight, LayoutStage stage)voidsetGraphicsObject(GraphicsObject graphicsObject)voidsetHorizontalCenterOffset(float newOffset, LayoutStage stage)voidsetLayoutStage(LayoutStage newStage)voidsetStretchAscent(float stretchAscent)Set the stretch ascent for children.voidsetStretchDescent(float stretchDescent)Set the stretch descent for children.voidsetStretchWidth(float stretchWidth)Set the stretch width for children, or < 0 if children should be horizontally unstretched.voidsetWidth(float width, LayoutStage stage)voidshiftVertically(float offsetY, LayoutStage stage)Shift vertically by given offset.
-
-
-
Method Detail
-
getLayoutStage
LayoutStage getLayoutStage()
TheLayoutStagethis element represents. The information will not be complete until the final LayoutStage (LayoutStage.STAGE2) has been reached.- Returns:
- current layout stage.
-
setLayoutStage
void setLayoutStage(LayoutStage newStage)
- Parameters:
newStage- new Layout Stage.
-
getAscentHeight
float getAscentHeight(LayoutStage stage)
Returns the current height of the upper part of this component from the baseline.- Parameters:
stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)- Returns:
- Height of the upper part
-
getDescentHeight
float getDescentHeight(LayoutStage stage)
Returns the current height of the lower part of this component from the baseline.- Parameters:
stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)- Returns:
- Height of the lower part.
-
getWidth
float getWidth(LayoutStage stage)
Returns the current width of this element.- Parameters:
stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)- Returns:
- Width of this element.
-
getHorizontalCenterOffset
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.- Parameters:
stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)- Returns:
- X-position of the center of the content
-
setHorizontalCenterOffset
void setHorizontalCenterOffset(float newOffset, LayoutStage stage)- Parameters:
newOffset- new horizontal offset.stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)
-
getPosX
float getPosX(LayoutStage stage)
Retrieve the X position of this element relative to its parent.- Parameters:
stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)- Returns:
- X position
-
getPosY
float getPosY(LayoutStage stage)
Retrieve the Y position of this element relative to its parent.- Parameters:
stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)- Returns:
- Y position
-
moveTo
void moveTo(float x, float y, LayoutStage stage)Move this element to the given position relative to its parent.- Parameters:
x- new X positiony- new Y positionstage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)
-
shiftVertically
void shiftVertically(float offsetY, LayoutStage stage)Shift vertically by given offset.- Parameters:
offsetY- offset to shift.stage- Stage to manipulate.
-
setAscentHeight
void setAscentHeight(float ascentHeight, LayoutStage stage)- Parameters:
ascentHeight- new ascentHeight.stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)
-
setDescentHeight
void setDescentHeight(float descentHeight, LayoutStage stage)- Parameters:
descentHeight- new descentHeight.stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)
-
setWidth
void setWidth(float width, LayoutStage stage)- Parameters:
width- new width.stage-LayoutStageto get this information for (eitherLayoutStage.STAGE1orLayoutStage.STAGE2)
-
setStretchWidth
void setStretchWidth(float stretchWidth)
Set the stretch width for children, or < 0 if children should be horizontally unstretched.- Parameters:
stretchWidth- new stretch width
-
getStretchWidth
float getStretchWidth()
Retrieve the stretch width if set, or STAGE1.width if unset.- Returns:
- stretch width.
-
setStretchDescent
void setStretchDescent(float stretchDescent)
Set the stretch descent for children. Defaults to STAGE1.descent- Parameters:
stretchDescent- new stretch descent
-
getStretchDescent
float getStretchDescent()
Retrieve the stretch descent if set, or STAGE1.descent if unset.- Returns:
- stretch descent.
-
setStretchAscent
void setStretchAscent(float stretchAscent)
Set the stretch ascent for children. Defaults to STAGE1.ascent- Parameters:
stretchAscent- new stretch ascent
-
getStretchAscent
float getStretchAscent()
Retrieve the stretch ascent if set, or STAGE1.ascent if unset.- Returns:
- stretch ascent.
-
setGraphicsObject
void setGraphicsObject(GraphicsObject graphicsObject)
- Parameters:
graphicsObject- the GraphicsObject to set.
-
getGraphicObjects
java.util.List<GraphicsObject> getGraphicObjects()
- Returns:
- Graphic objects associated with this node.
-
-