Eclipse Draw2d
3.0

org.eclipse.draw2d.text
Class InlineFlowLayout

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

public class InlineFlowLayout
extends FlowContainerLayout

The layout manager for InlineFlow figures.

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

Since:
2.1

Field Summary
 
Fields inherited from class org.eclipse.draw2d.text.FlowContainerLayout
currentLine
 
Fields inherited from class org.eclipse.draw2d.text.FlowFigureLayout
context, invalid
 
Fields inherited from class org.eclipse.draw2d.AbstractLayout
isObservingVisibility, preferredSize
 
Constructor Summary
InlineFlowLayout(FlowFigure flow)
          Creates a new InlineFlowLayout with the given FlowFigure.
 
Method Summary
 void addToCurrentLine(FlowBox block)
          Adds the given FlowBox to the current line of this InlineFlowLayout.
protected  void createNewLine()
          Used by getCurrentLine().
 void endLine()
          The current line should be committed if it is occupied, and then set to null.
protected  void flush()
          Called after FlowContainerLayout.layoutChildren() when all children have been laid out.
 boolean getConsumeSpaceOnNewLine()
          InlineFlowLayout gets this information from its context.
 boolean getContinueOnSameLine()
          InlineFlowLayout gets this information from its context.
 int getCurrentY()
          Returns the current Y value.
 boolean getWordWidthFollowing(FlowFigure child, int[] width)
          An InlineFlow will pass the query onto its parent if it can't find a break among its children.
 boolean isCurrentLineOccupied()
           
 void preLayout()
          Clears out all fragments prior to the call to layoutChildren().
 void setConsumeSpaceOnNewLine(boolean consume)
          InlineFlow passes this information to its context.
 void setContinueOnSameLine(boolean value)
          InlineFlow passes this information to its context.
protected  void setupLine(LineBox line)
          Initializes the given LineBox.
 
Methods inherited from class org.eclipse.draw2d.text.FlowContainerLayout
cleanup, getCurrentLine, layout, layoutChildren
 
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
 

Constructor Detail

InlineFlowLayout

public InlineFlowLayout(FlowFigure flow)
Creates a new InlineFlowLayout with the given FlowFigure.

Parameters:
flow - The FlowFigure
Method Detail

addToCurrentLine

public void addToCurrentLine(FlowBox block)
Adds the given FlowBox to the current line of this InlineFlowLayout.

Specified by:
addToCurrentLine in interface FlowContext
Overrides:
addToCurrentLine in class FlowContainerLayout
Parameters:
block - the FlowBox to add to the current line

createNewLine

protected void createNewLine()
Description copied from class: FlowContainerLayout
Used by getCurrentLine().

Specified by:
createNewLine in class FlowContainerLayout
See Also:
FlowContainerLayout.createNewLine()

endLine

public void endLine()
Description copied from interface: FlowContext
The current line should be committed if it is occupied, and then set to null. Otherwise, do nothing.

See Also:
FlowContext.endLine()

flush

protected void flush()
Description copied from class: FlowContainerLayout
Called after FlowContainerLayout.layoutChildren() when all children have been laid out. This method exists to flush the last line.

Specified by:
flush in class FlowContainerLayout
See Also:
FlowContainerLayout.flush()

getConsumeSpaceOnNewLine

public boolean getConsumeSpaceOnNewLine()
InlineFlowLayout gets this information from its context.

Returns:
true if leading whitespace should be consumed on the newline
See Also:
FlowContext.getConsumeSpaceOnNewLine()

getContinueOnSameLine

public boolean getContinueOnSameLine()
InlineFlowLayout gets this information from its context.

Returns:
true if the next fragment should be placed on the current line
See Also:
FlowContext.getContinueOnSameLine()

getCurrentY

public int getCurrentY()
Description copied from interface: FlowContext
Returns the current Y value.

Returns:
the current Y value
See Also:
FlowContext.getCurrentY()

getWordWidthFollowing

public boolean getWordWidthFollowing(FlowFigure child,
                                     int[] width)
An InlineFlow will pass the query onto its parent if it can't find a break among its children.

Specified by:
getWordWidthFollowing in interface FlowContext
Overrides:
getWordWidthFollowing in class FlowContainerLayout
See Also:
FlowContext.getWordWidthFollowing(org.eclipse.draw2d.text.FlowFigure, int[])

isCurrentLineOccupied

public boolean isCurrentLineOccupied()
Specified by:
isCurrentLineOccupied in interface FlowContext
Overrides:
isCurrentLineOccupied in class FlowContainerLayout
See Also:
FlowContainerLayout.isCurrentLineOccupied()

preLayout

public void preLayout()
Clears out all fragments prior to the call to layoutChildren().

Specified by:
preLayout in class FlowContainerLayout

setConsumeSpaceOnNewLine

public void setConsumeSpaceOnNewLine(boolean consume)
InlineFlow passes this information to its context.

Parameters:
consume - true indicates that the next TextFlow to be laid out should not display its first whitespace character (if it has one), if it is being placed on a new line
See Also:
FlowContext.setConsumeSpaceOnNewLine(boolean)

setContinueOnSameLine

public void setContinueOnSameLine(boolean value)
InlineFlow passes this information to its context.

Parameters:
value - true indicates that the first fragment of the next TextFlow should be laid out on the current line, and not a new one
See Also:
FlowContext.setContinueOnSameLine(boolean)

setupLine

protected void setupLine(LineBox line)
Initializes the given LineBox. Called by createNewLine().

Parameters:
line - The LineBox to initialize.

Eclipse Draw2d
3.0

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