|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.umber.crucible.old.layout.AbstractLayoutEngine org.umber.crucible.old.layout.SimpleFlowLayout
Very simple layout engine which flows all LayoutArea objects down and to the right. Half-heartedly attempts to keep adjacent areas together, but does not bother with more complex relationships. This is a very low-tech layout engine intended for simple, small objects with few formatting constraints. It's good for simple ASCII to PDF conversion.
Constructor Summary | |
SimpleFlowLayout()
|
Method Summary | |
protected void |
acceptArea(LayoutArea area,
LayoutContext context,
java.util.List oldAreas)
Accept the entire contents of this area; if this is a group area, accept all child elements. |
protected java.awt.Rectangle |
calculateFinalExtents(LayoutArea area,
LayoutContext context)
Creates an extent for placing the area in its final position in the layout. |
boolean |
fitsInRegion(LayoutArea area,
java.awt.Rectangle region,
java.util.List areasInRegion)
Checks to see if the area will fit in the given region. |
java.awt.Dimension |
guessSize(LayoutArea area)
Estimates the size that the area "wants" to be. |
protected boolean |
layoutArea(LayoutArea area,
LayoutContext context,
java.util.List oldAreas)
Lay out an area; unlike layoutRegion(), it can be called recursively. |
void |
layoutRegion(LayoutContext context,
java.awt.Rectangle region)
Attempts to lay out as many of the pending areas in the context as it can, into the provided region's bounding box. |
Methods inherited from class org.umber.crucible.old.layout.AbstractLayoutEngine |
acceptArea, clearQueue, fitsInRegion, getFreeSpace, getQueueSize, layoutAreas, setCurrentRegion |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleFlowLayout()
Method Detail |
public java.awt.Dimension guessSize(LayoutArea area)
This implementation simply returns the value of 'preferred'. If the preferred width or height is DefaultStyle.NOT_FOUND, that extent is autosized. In the case of a LayoutText area, the size the text needs will determine the autosized extent. A LayoutGroup extent will become the sum of its children in that direction.
guessSize
in interface LayoutEngine
guessSize
in class AbstractLayoutEngine
area
- the area to examine
public boolean fitsInRegion(LayoutArea area, java.awt.Rectangle region, java.util.List areasInRegion)
The SimpleFlowLayout engine uses a very simple algorithm for fit-testing. It ignores smallest and largest constraints, using only preferred constraints, to get a better performance and keep the code leaner. For a more "respectful" layout engine, try the FlowLayout engine. SimpleFlowLayout does allow area breaking.
area
- the LayoutArea object to try to fitregion
- the bounding area of the regionareasInRegion
- optional list of areas already in the region
public void layoutRegion(LayoutContext context, java.awt.Rectangle region)
context
- the running context for this rendering passregion
- the bounding area to render areas intoprotected boolean layoutArea(LayoutArea area, LayoutContext context, java.util.List oldAreas)
Criteria:
area
- the area to rendercontext
- the running context for this rendering passoldAreas
- areas already accepted in this region
protected java.awt.Rectangle calculateFinalExtents(LayoutArea area, LayoutContext context)
area
- the LayoutArea object to calculate extents forcontext
- context for the region
protected void acceptArea(LayoutArea area, LayoutContext context, java.util.List oldAreas)
area
- the LayoutArea to accept into the LayoutContextcontext
- the running context for this rendering passoldAreas
- areas already accepted in this region
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |