Eclipse Draw2d
3.0

org.eclipse.draw2d.text
Class FlowContainerLayout

java.lang.Object
  extended byorg.eclipse.draw2d.AbstractLayout
      extended byorg.eclipse.draw2d.text.FlowFigureLayout
          extended byorg.eclipse.draw2d.text.FlowContainerLayout
All Implemented Interfaces:
FlowContext, LayoutManager
Direct Known Subclasses:
BlockFlowLayout, InlineFlowLayout

public abstract class FlowContainerLayout
extends FlowFigureLayout
implements FlowContext

A layout for FlowFigures with children.

WARNING: This class is not intended to be subclassed by clients.

Since:
2.1

Field Summary
protected  LineBox currentLine
          the current line
 
Fields inherited from class org.eclipse.draw2d.text.FlowFigureLayout
context, invalid
 
Fields inherited from class org.eclipse.draw2d.AbstractLayout
isObservingVisibility, preferredSize
 
Constructor Summary
protected FlowContainerLayout(FlowFigure flowFigure)
           
 
Method Summary
 void addToCurrentLine(FlowBox block)
          Clears the layout state everytime a new box is added to the current line: FlowContext.setConsumeSpaceOnNewLine(boolean) and FlowContext.setContinueOnSameLine(boolean)
protected  void cleanup()
          Flush anything pending and free all temporary data used during layout.
protected abstract  void createNewLine()
          Used by getCurrentLine().
protected abstract  void flush()
          Called after layoutChildren() when all children have been laid out.
 LineBox getCurrentLine()
          FlowBoxes shouldn't be added directly to the current line.
 boolean getWordWidthFollowing(FlowFigure child, int[] width)
          This method looks ahead for line-breaks.
 boolean isCurrentLineOccupied()
           
protected  void layout()
          Called during FlowFigureLayout.layout(IFigure).
protected  void layoutChildren()
          Layout all children.
protected abstract  void preLayout()
          Called before layoutChildren() to setup any necessary state.
 
Methods inherited from class org.eclipse.draw2d.text.FlowFigureLayout
calculatePreferredSize, getFlowFigure, invalidate, layout, setFlowContext
 
Methods inherited from class org.eclipse.draw2d.AbstractLayout
calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.draw2d.text.FlowContext
endLine, getConsumeSpaceOnNewLine, getContinueOnSameLine, getCurrentY, setConsumeSpaceOnNewLine, setContinueOnSameLine
 

Field Detail

currentLine

protected LineBox currentLine
the current line

Constructor Detail

FlowContainerLayout

protected FlowContainerLayout(FlowFigure flowFigure)
See Also:
FlowFigureLayout.FlowFigureLayout(FlowFigure)
Method Detail

addToCurrentLine

public void addToCurrentLine(FlowBox block)
Clears the layout state everytime a new box is added to the current line: FlowContext.setConsumeSpaceOnNewLine(boolean) and FlowContext.setContinueOnSameLine(boolean). * @see org.eclipse.draw2d.text.FlowContext#addToCurrentLine(FlowBox)

Specified by:
addToCurrentLine in interface FlowContext
Parameters:
block - the FlowBox to add

cleanup

protected void cleanup()
Flush anything pending and free all temporary data used during layout.


createNewLine

protected abstract void createNewLine()
Used by getCurrentLine().


flush

protected abstract void flush()
Called after layoutChildren() when all children have been laid out. This method exists to flush the last line.


getCurrentLine

public LineBox getCurrentLine()
FlowBoxes shouldn't be added directly to the current line. Use addToCurrentLine(FlowBox) for that. * @see org.eclipse.draw2d.text.FlowContext#getCurrentLine()

Specified by:
getCurrentLine in interface FlowContext
Returns:
the current line

getWordWidthFollowing

public boolean getWordWidthFollowing(FlowFigure child,
                                     int[] width)
Description copied from interface: FlowContext
This method looks ahead for line-breaks. When laying out, this method can be used to determine the next line-break across multiple figures.

Specified by:
getWordWidthFollowing in interface FlowContext
Parameters:
child - the search will occur starting from the figure after the given child
width - the width before the next line-break (if one's found; all the width, otherwise) will be added on to the first int in the given array
Returns:
boolean indicating whether a line-break was found
See Also:
FlowContext.getWordWidthFollowing(FlowFigure, int[])

isCurrentLineOccupied

public boolean isCurrentLineOccupied()
Specified by:
isCurrentLineOccupied in interface FlowContext
Returns:
true if the current line contains any fragments
See Also:
FlowContext.isCurrentLineOccupied()

layout

protected void layout()
Description copied from class: FlowFigureLayout
Called during FlowFigureLayout.layout(IFigure). The FlowFigureLayout.invalid flag is reset after this method is called.

Specified by:
layout in class FlowFigureLayout
See Also:
FlowFigureLayout.layout()

layoutChildren

protected void layoutChildren()
Layout all children.


preLayout

protected abstract void preLayout()
Called before layoutChildren() to setup any necessary state.


Eclipse Draw2d
3.0

Copyright (c) IBM Corp. and others 2000, 2004. All Rights Reserved.