Class TextFlow
- All Implemented Interfaces:
- IFigure
InlineFlow figure's must
 be parented by a FlowFigure.
 WARNING: This class is not intended to be subclassed by clients.
- Since:
- 2.1
- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.draw2d.FigureFigure.FigureIterator, Figure.IdentitySearch, Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigureIFigure.NoInsets
- 
Field SummaryFields inherited from class org.eclipse.draw2d.text.FlowFigureselectionStartFields inherited from class org.eclipse.draw2d.FigurebgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.IFigureMAX_DIMENSION, MIN_DIMENSION, NO_INSETS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaddLeadingWordRequirements(int[] width) Returns the width of the text until the first line-break.protected voidcontributeBidi(BidiProcessor proc) A TextFlow contributes its text.protected FlowFigureLayoutCreates the default layout managerReturns the BidiInfo for this figure ornull.protected StringgetBidiSubstring(TextFragmentBox box, int index) getCaretPlacement(int offset, boolean trailing) Returns the CaretInfo in absolute coordinates.intgetFirstOffsetForLine(int baseline) Returns the minimum character offset which is on the given baseline y-coordinate.protected FlowUtilitiesGets theFlowUtilitiesinstance to be used in measurement calculations.List<? extends TextFragmentBox> Returns theFlowBoxfragments contained in this InlineFlow.protected List<? extends TextFragmentBox> Returns theTextFragmentBoxfragments contained in this TextFlow, not including the border fragments.intgetLastOffsetForLine(int baseline) Returns the maximum offset for a character which is on the given baseline y-coordinate.intgetNextOffset(Point p, boolean down, int[] trailing) Returns the offset nearest the given point either up or down one line.intgetNextVisibleOffset(int offset) Returns the next offset which is visible in at least one fragment or -1 if there is not one.intReturns the offset of the character directly below or nearest the given location.intgetPreviousVisibleOffset(int offset) Returns the previous offset which is visible in at least one fragment or -1 if there is not one.getText()protected TextUtilitiesGets theTextUtilitiesinstance to be used in measurement calculations.booleanReturnstrueif a portion if the text is truncated using ellipses ("...").protected voidPaints this Figure's primary representation, or background.protected voidpaintSelection(Graphics graphics) Renders the XOR selection rectangles to the graphics.protected voidvoidsetBidiInfo(BidiInfo info) Sets the bidi information for this figure.voidsetSelection(int start, int end) Sets the extent of selection.voidSets the text being displayed.toString()Methods inherited from class org.eclipse.draw2d.text.InlineFlowcontainsPoint, paintBorder, postValidate, setBorderMethods inherited from class org.eclipse.draw2d.text.FlowFigureadd, remove, revalidateBidi, setBounds, setFlowContextMethods inherited from class org.eclipse.draw2d.Figureadd, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, handleMouseWheelScrolled, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, layout, optimizeClip, paint, paintChildren, paintClientArea, primTranslate, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, 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
- 
Constructor Details- 
TextFlowpublic TextFlow()Constructs a new TextFlow with the empty String.- See Also:
 
- 
TextFlowConstructs a new TextFlow with the specified String.- Parameters:
- s- the string
 
 
- 
- 
Method Details- 
addLeadingWordRequirementspublic boolean addLeadingWordRequirements(int[] width) Returns the width of the text until the first line-break.- Overrides:
- addLeadingWordRequirementsin class- InlineFlow
- 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
- See Also:
 
- 
contributeBidiA TextFlow contributes its text.- Overrides:
- contributeBidiin class- FlowFigure
- Parameters:
- proc- the BidiProcessor to which contributions should be made
- See Also:
 
- 
createDefaultFlowLayoutDescription copied from class:FlowFigureCreates the default layout manager- Overrides:
- createDefaultFlowLayoutin class- InlineFlow
- Returns:
- The default layout
- See Also:
 
- 
getBidiInfoReturns the BidiInfo for this figure ornull.- Returns:
- nullor the info
- Since:
- 3.1
 
- 
getBidiSubstring- Parameters:
- box- which fragment
- index- the fragment index
- Returns:
- the bidi string for that fragment
- Since:
- 3.1
 
- 
getCaretPlacementReturns the CaretInfo in absolute coordinates. The offset must be between 0 and the length of the String being displayed.- Parameters:
- offset- the location in this figure's text
- trailing- true if the caret is being placed after the offset
- Returns:
- the caret bounds relative to this figure
- Throws:
- IllegalArgumentException- If the offset is not between- 0and the length of the string inclusively
- Since:
- 3.1
 
- 
getFirstOffsetForLinepublic int getFirstOffsetForLine(int baseline) Returns the minimum character offset which is on the given baseline y-coordinate. The y location should be relative to this figure. The return value will be between 0 and N-1. If no fragment is located on the baseline,-1is returned.- Parameters:
- baseline- the relative baseline coordinate
- Returns:
- -1 or the lowest offset for the line
- Since:
- 3.1
 
- 
getFragmentsDescription copied from class:InlineFlowReturns theFlowBoxfragments contained in this InlineFlow. The returned list should not be modified.- Overrides:
- getFragmentsin class- InlineFlow
- Returns:
- The fragments
 
- 
getFragmentsWithoutBorderReturns theTextFragmentBoxfragments contained in this TextFlow, not including the border fragments. The returned list should not be modified.- Returns:
- list of fragments without the border fragments
- Since:
- 3.4
 
- 
getLastOffsetForLinepublic int getLastOffsetForLine(int baseline) Returns the maximum offset for a character which is on the given baseline y-coordinate. The y location should be relative to this figure. The return value will be between 0 and N-1. If no fragment is located on the baseline,-1is returned.- Parameters:
- baseline- the relative baseline coordinate
- Returns:
- -1 or the highest offset at the given baseline
- Since:
- 3.1
 
- 
getNextOffsetReturns the offset nearest the given point either up or down one line. If no offset is found, -1 is returned.trailing[0]will be set to 1 if the reference point is closer to the trailing edge of the offset than it is to the leading edge.- Parameters:
- p- a reference point
- down-- trueif the search is down
- trailing- an int array
- Returns:
- the next offset or -1
- Since:
- 3.1
 
- 
getNextVisibleOffsetpublic int getNextVisibleOffset(int offset) Returns the next offset which is visible in at least one fragment or -1 if there is not one. A visible offset means that the character or the one preceding it is displayed, which implies that a caret can be positioned at such an offset. This is useful for advancing a caret past characters which resulted in a line wrap.- Parameters:
- offset- the reference offset
- Returns:
- the next offset which is visible
- Since:
- 3.1
 
- 
getOffsetReturns the offset of the character directly below or nearest the given location. The point must be relative to this figure. The return value will be between 0 and N-1. If the proximity argument is notnull, the result may also be-1if no offset was found within the proximity.For a typical character, the trailing argument will be filled in to indicate whether the point is closer to the leading edge (0) or the trailing edge (1). When the point is over a cluster composed of multiple characters, the trailing argument will be filled with the position of the character in the cluster that is closest to the point. If the proximity argument is not null, then the location may be no further than the proximity given. Passingnullis equivalent to passingnew Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE). Thewidthfield of the proximity will contain the horizontal distance,heightwill contain vertical. Vertical proximity is more important than horizontal. The returned offset is the lowest index with minimum vertical proximity not exceeding the given limit, with horizontal proximity not exceeding the given limit. If an offset that is within the proximity is found, then the givenDimensionwill be updated to reflect the new proximity.- Parameters:
- p- the point relative to this figure
- trailing- the trailing buffer
- proximity- restricts and records the distance of the returned offset
- Returns:
- the nearest offset in this figure's text
- Since:
- 3.1
 
- 
getPreviousVisibleOffsetpublic int getPreviousVisibleOffset(int offset) Returns the previous offset which is visible in at least one fragment or -1 if there is not one. SeegetNextVisibleOffset(int)for more.- Parameters:
- offset- a reference offset
- Returns:
- -1 or the previous offset which is visible
- Since:
- 3.1
 
- 
getText- Returns:
- the String being displayed; will not be null
 
- 
isTextTruncatedpublic boolean isTextTruncated()Returnstrueif a portion if the text is truncated using ellipses ("...").- Returns:
- trueif the text is truncated with ellipses
 
- 
paintFigureDescription copied from class:FigurePaints this Figure's primary representation, or background. Changes made to the graphics to the graphics current state will not affect the subsequent calls toFigure.paintClientArea(Graphics)andFigure.paintBorder(Graphics). Furthermore, it is safe to callgraphics.restoreState()within this method, and doing so will restore the graphics to its original state upon entry.- Overrides:
- paintFigurein class- Figure
- Parameters:
- g- The Graphics used to paint
- See Also:
 
- 
paintSelectionDescription copied from class:InlineFlowRenders the XOR selection rectangles to the graphics.- Overrides:
- paintSelectionin class- InlineFlow
- Parameters:
- graphics- the graphics to paint on
- See Also:
 
- 
paintText
- 
setBidiInfoDescription copied from class:FlowFigureSets the bidi information for this figure. A flow figure contributes bidi text inFlowFigure.contributeBidi(BidiProcessor). If the figure contributes text associated with it, this method is called back to indicate the bidi properties for that text within its block.- Overrides:
- setBidiInfoin class- FlowFigure
- Parameters:
- info- the BidiInfo for this figure
- See Also:
 
- 
setSelectionpublic void setSelection(int start, int end) Sets the extent of selection. The selection range is inclusive. For example, the range [0, 0] indicates that the first character is selected.- Overrides:
- setSelectionin class- FlowFigure
- Parameters:
- start- the start offset
- end- the end offset
- Since:
- 3.1
 
- 
setTextSets the text being displayed. The string may not benull.- Parameters:
- s- The new text
 
- 
toString
- 
getFlowUtilitiesGets theFlowUtilitiesinstance to be used in measurement calculations.- Returns:
- a FlowUtilitiesinstance
- Since:
- 3.4
 
- 
getTextUtilitiesGets theTextUtilitiesinstance to be used in measurement calculations.- Returns:
- a TextUtilitiesinstance
- Since:
- 3.4
 
 
-