Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d.text
Class FlowUtilities

java.lang.Object
  extended by
org.eclipse.draw2d.text.FlowUtilities

public class FlowUtilities
extends java.lang.Object

Utility class for FlowFigures.

Since:
3.4

Field Summary
static  FlowUtilities INSTANCE
          a singleton default instance
 
Constructor Summary
FlowUtilities ()
           
 
Method Summary
protected  float getAverageCharWidth ( TextFragmentBox fragment, Font font)
          Gets the average character width.
protected  Rectangle getTextLayoutBounds (java.lang.String s, Font f, int start, int end)
           
protected   TextUtilities getTextUtilities ()
          Returns an instance of a TextUtililities class on which text calculations can be performed.
protected  void setupFragment ( TextFragmentBox fragment, Font font, java.lang.String string)
          Sets up the fragment width based using the font and string passed in.
protected  int wrapFragmentInContext ( TextFragmentBox frag, java.lang.String string, FlowContext context, org.eclipse.draw2d.text.FlowUtilities.LookAhead lookahead, Font font, int wrapping)
          Sets up a fragment and returns the number of characters consumed from the given String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static 
FlowUtilities INSTANCE
a singleton default instance

Constructor Detail

FlowUtilities

public FlowUtilities()
Method Detail

getAverageCharWidth

protected float getAverageCharWidth(
TextFragmentBox fragment,
                                    Font font)
Gets the average character width.

Parameters:
fragment - the supplied TextFragmentBox to use for calculation. if the length is 0 or if the width is or below 0, the average character width is taken from standard font metrics.
font - the font to use in case the TextFragmentBox conditions above are true.
Returns:
the average character width

setupFragment

protected final void setupFragment(
TextFragmentBox fragment,
                                   Font font,
                                   java.lang.String string)
Sets up the fragment width based using the font and string passed in.

Parameters:
fragment - the text fragment whose width will be set
font - the font to be used in the calculation
string - the string to be used in the calculation

wrapFragmentInContext

protected final int wrapFragmentInContext(
TextFragmentBox frag,
                                          java.lang.String string,
                                          
FlowContext context,
                                          org.eclipse.draw2d.text.FlowUtilities.LookAhead lookahead,
                                          Font font,
                                          int wrapping)
Sets up a fragment and returns the number of characters consumed from the given String. An average character width can be provided as a hint for faster calculation. If a fragment's bidi level is set, a TextLayout will be used to calculate the width.

Parameters:
frag - the TextFragmentBox
string - the String
font - the Font used for measuring
context - the flow context
wrapping - the word wrap style
Returns:
the number of characters that will fit in the given space; can be 0 (eg., when the first character of the given string is a newline)

getTextLayoutBounds

protected Rectangle getTextLayoutBounds(java.lang.String s,
                                        Font f,
                                        int start,
                                        int end)
See Also:
TextLayout#getBounds()

getTextUtilities

protected 
TextUtilities getTextUtilities()
Returns an instance of a TextUtililities class on which text calculations can be performed. Clients may override to customize.

Returns:
the TextUtililities instance
Since:
3.4

Eclipse Draw2d
3.3

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire