Eclipse Draw2d
3.0

org.eclipse.draw2d.text
Class FlowFigure

java.lang.Object
  extended byorg.eclipse.draw2d.Figure
      extended byorg.eclipse.draw2d.text.FlowFigure
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
BlockFlow, ImageFlow, InlineFlow

public abstract class FlowFigure
extends Figure

The base implementation for text flow figures. A flow figure is used to render a document in which elements are laid out horizontally within a "line" until that line is filled. Layout continues on the next line.

WARNING: This class is not intended to be subclassed by clients. Future versions may contain additional abstract methods.

Since:
2.1

Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator, Figure.IdentitySearch
 
Nested classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
 
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
FlowFigure()
          Constructs a new FlowFigure.
 
Method Summary
 void add(IFigure child, Object constraint, int index)
          Only FlowFigures should be added to a FlowFigure.
 boolean addLeadingWordRequirements(int[] width)
          Calculates the width of text before the next line-break is encountered.
protected  void contributeBidi(BidiProcessor proc)
          FlowFigures can contribute text for their block to the given BidiProcessor, which will process the contributions to determine Bidi levels and shaping requirements.
protected abstract  FlowFigureLayout createDefaultFlowLayout()
          Creates the default layout manager
 int[] getBidiValues()
          For the format of the bidi levels, see BidiProcessor.process().
protected  void invalidateBidi()
          Throws away the cached Bidi state for this figure and all its children.
abstract  void postValidate()
          Called after validate has occurred.
 void remove(IFigure figure)
          Overridden to revalidateBidi when fragments are removed.
protected  void revalidateBidi(IFigure origin)
          This method should be invoked whenever a change that can potentially affect the Bidi evaluation is made (eg., adding or removing children, setting text, etc.).
 void setAppendJoiner(boolean append)
          This method is invoked by the BidiProcessor if it determines that a shaping character needs to be appended to the text contributed by this Figure for it to appear properly on the screen.
protected  void setBidiValues(int[] levels)
          This method is invoked by the BidiProcessor to set the Bidi levels for the text contributed by this figure.
 void setBounds(Rectangle r)
          FlowFigures override setBounds() to prevent translation of children.
 void setFlowContext(FlowContext flowContext)
          Sets the flow context.
 void setPrependJoiner(boolean prepend)
          This method is invoked by the BidiProcessor if it determines that a shaping character needs to be prepended to the text contributed by this Figure for it to appear properly on the screen.
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, paint, paintBorder, paintChildren, paintClientArea, paintFigure, primTranslate, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowFigure

public FlowFigure()
Constructs a new FlowFigure.

Method Detail

add

public void add(IFigure child,
                Object constraint,
                int index)
Only FlowFigures should be added to a FlowFigure. The child figure's context is set to the layout manager of this figure.

Specified by:
add in interface IFigure
Overrides:
add in class Figure
See Also:
IFigure.add(IFigure, Object, int)

addLeadingWordRequirements

public boolean addLeadingWordRequirements(int[] width)
Calculates the width of text before the next line-break is encountered.

Default implementation treats each FlowFigure as a line-break. It adds no width and returns true. Sub-classes should override as needed.

Parameters:
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 or not a line-break was found
Since:
3.1

contributeBidi

protected void contributeBidi(BidiProcessor proc)
FlowFigures can contribute text for their block to the given BidiProcessor, which will process the contributions to determine Bidi levels and shaping requirements.

This method is invoked as part of validating Bidi.

Parameters:
proc - the BidiProcessor to which contributions should be made
Since:
3.1
See Also:
BidiProcessor.add(FlowFigure, String)

createDefaultFlowLayout

protected abstract FlowFigureLayout createDefaultFlowLayout()
Creates the default layout manager

Returns:
The default layout

getBidiValues

public int[] getBidiValues()
For the format of the bidi levels, see BidiProcessor.process().

Returns:
the bidi levels assigned by the BidiProcessor; can be null if there is no Bidi text
Since:
3.1
See Also:
setBidiValues(int[])

invalidateBidi

protected void invalidateBidi()
Throws away the cached Bidi state for this figure and all its children. This method is invoked by BlockFlow.revalidateBidi(IFigure).

Since:
3.1

postValidate

public abstract void postValidate()
Called after validate has occurred. This is used to update the bounds of the FlowFigure to encompass its new flow boxed created during validate.


remove

public void remove(IFigure figure)
Overridden to revalidateBidi when fragments are removed.

Specified by:
remove in interface IFigure
Overrides:
remove in class Figure
Parameters:
figure - The Figure to remove
See Also:
IFigure.remove(org.eclipse.draw2d.IFigure)

revalidateBidi

protected void revalidateBidi(IFigure origin)
This method should be invoked whenever a change that can potentially affect the Bidi evaluation is made (eg., adding or removing children, setting text, etc.).

The default implementation delegates the revaliation task to the parent. Only blocks perform the actual revaliation.

The given IFigure is the one that triggered the revalidation. This can be used to optimize bidi evaluation.

Parameters:
origin - the figure that was revalidated
Since:
3.1

setAppendJoiner

public void setAppendJoiner(boolean append)
This method is invoked by the BidiProcessor if it determines that a shaping character needs to be appended to the text contributed by this Figure for it to appear properly on the screen.

This method does nothing by default. Sub-classes should override as needed.

Parameters:
append - the ZWJ will be appended if true
Since:
3.1

setBidiValues

protected void setBidiValues(int[] levels)
This method is invoked by the BidiProcessor to set the Bidi levels for the text contributed by this figure. For the format of the Bidi levels, set BidiProcessor.process().

Parameters:
levels - the bidi levels
Since:
3.1
See Also:
getBidiValues()

setBounds

public void setBounds(Rectangle r)
FlowFigures override setBounds() to prevent translation of children. "bounds" is a derived property for FlowFigures, calculated from the fragments that make up the FlowFigure.

Specified by:
setBounds in interface IFigure
Overrides:
setBounds in class Figure
Parameters:
r - The new bounds
See Also:
Figure.setBounds(Rectangle)

setFlowContext

public void setFlowContext(FlowContext flowContext)
Sets the flow context.

Parameters:
flowContext - the flow context for this flow figure

setPrependJoiner

public void setPrependJoiner(boolean prepend)
This method is invoked by the BidiProcessor if it determines that a shaping character needs to be prepended to the text contributed by this Figure for it to appear properly on the screen.

This method does nothing by default. Sub-classes should override as needed.

Parameters:
prepend - the ZWJ will be prepended if true
Since:
3.1

Eclipse Draw2d
3.0

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