|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.ui.SophisticatedTextLayoutManager
public class SophisticatedTextLayoutManager
This class provides a TextLayoutManager with more features than the
DefaultTextLayoutManager
in
order to enable more sophisticated layout design possibilities for test to
be shown in TV components.
It is recommended, that the algorithms for rendering the text follow
the standard nomenclature and algorithm for layout of bi-directional text
as defined in Unicode 3.0.
See http://unicode.org for details.
DefaultTextLayoutManager
,
TextLayoutManager
Constructor Summary | |
---|---|
SophisticatedTextLayoutManager()
|
Method Summary | |
---|---|
void |
addTextOverflowListener(TextOverflowListener listener)
Register a TextOverflowListener . |
int |
getHorizontalAlignment()
Retrieve horizontal alignment. |
Insets |
getInsets()
Returns the insets as set by the setInsets method. |
Dimension |
getMaximumSize(ViewOnlyComponent component,
String text)
Provides the maximum size required to render the provided text content in the specified ViewOnlyComponent . |
Dimension |
getMaximumSize(ViewOnlyComponent component,
String text,
Insets insets)
Provides the maximum size required to render the provided text content in the specified ViewOnlyComponent . |
Dimension |
getMinimumSize(ViewOnlyComponent component,
String text)
Provides the minimum size required to render the provided text content in the specified ViewOnlyComponent . |
Dimension |
getMinimumSize(ViewOnlyComponent component,
String text,
Insets insets)
Provides the minimum size required to render the provided text content in the specified ViewOnlyComponent . |
Dimension |
getPreferredSize(ViewOnlyComponent component,
String text)
Provides the preferred size required to render the provided text content in the specified ViewOnlyComponent . |
Dimension |
getPreferredSize(ViewOnlyComponent component,
String text,
Insets insets)
Provides the preferred size required to render the provided text content in the specified ViewOnlyComponent . |
int |
getVerticalAlignment()
Retrieve vertical alignment. |
void |
removeTextOverflowListener(TextOverflowListener listener)
Removes a previously registered TextOverflowListener from this TextLayoutManager. |
void |
render(String text,
Graphics g,
ViewOnlyComponent component,
Insets insets)
Render a string. |
int |
retrieveHorizontalTabSpacing()
Retrieve horizontal tabulator spacing. |
int |
retrieveLetterSpace()
Retrieve letter space . |
int |
retrieveLineOrientation()
Retrieve line orientation. |
int |
retrieveLineSpace()
Retrieve line spacing. |
int |
retrieveStartCorner()
Retrieve starting corner. |
boolean |
retrieveTextWrapping()
Retrieve text wrapping. |
void |
setHorizontalAlignment(int alignment)
Determine the horizontal alignment. |
void |
setHorizontalTabSpacing(int spacing)
Determines the horizontal tabulation spacing. |
void |
setInsets(Insets insets)
Determines the insets to be used by the SophisticatedTextLayoutManager
to provide a virtual margin. |
void |
setLetterSpace(int spacing)
Determines the space between letters. |
void |
setLineOrientation(int orientation)
Determine the line orientation. |
void |
setLineSpace(int spacing)
Determines space between lines. |
void |
setStartCorner(int corner)
Determine the starting corner for text writing. |
void |
setTextWrapping(boolean wrap)
Determines whether text is wrapped. |
void |
setVerticalAlignment(int alignment)
Determine the vertical alignment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HORIZONTAL_ALIGN_LEFT
setHorizontalAlignment
method of SophisticatedTextLayoutManager
. It indicates that all
content will be left aligned.
Left aligned means the text is aligned to the left side if the
line orientation is horizontal, text starts at upper left corner, and is
read from left to right and from top to the bottom.
public static final int HORIZONTAL_ALIGN_CENTER
setHorizontalAlignment
method of SophisticatedTextLayoutManager
. It indicates that all content
will be centered horizontally.
Centered horizontally means the text is centered horizontally if the
line orientation is horizontal, text starts at upper left corner, and is
read from left to right and from top to the bottom.
public static final int HORIZONTAL_ALIGN_RIGHT
setHorizontalAlignment
method of SophisticatedTextLayoutManager
. It indicates that all content
will be right aligned.
Right aligned means the text is aligned to the right side if the
line orientation is horizontal, text starts at upper left corner, and is
read from left to right and from top to the bottom.
public static final int HORIZONTAL_ALIGN_JUSTIFIED
setHorizontalAlignment
method of SophisticatedTextLayoutManager
. It indicates that all content
will be justified horizontally.
Horizontal justified means the text is written as a horizontal block if
the line orientation is horizontal, text starts at upper left corner, and
is read from left to right and from top to the bottom.
public static final int VERTICAL_ALIGN_TOP
setVerticalAlignment
method of SophisticatedTextLayoutManager
. It indicates
that all content will be top aligned.
public static final int VERTICAL_ALIGN_CENTER
setVerticalAlignment
method of SophisticatedTextLayoutManager
. It indicates
that all content will be centered vertically.
public static final int VERTICAL_ALIGN_BOTTOM
setVerticalAlignment
method of SophisticatedTextLayoutManager
. It indicates
that all content will be bottom aligned.
public static final int VERTICAL_ALIGN_JUSTIFIED
setVerticalAlignment
method of SophisticatedTextLayoutManager
. It indicates
that all content will be justified vertically.
public static final int LINE_ORIENTATION_HORIZONTAL
setLineOrientation
method of SophisticatedTextLayoutManager
. It indicates that the line
orientation is horizontal.
public static final int LINE_ORIENTATION_VERTICAL
setLineOrientation
method of SophisticatedTextLayoutManager
. It indicates that the line
orientation is vertical.
public static final int START_UPPER_LEFT
setStartCorner
method of SophisticatedTextLayoutManager
. It indicates
that the text starts in the upper left corner.
public static final int START_UPPER_RIGHT
setStartCorner
method of SophisticatedTextLayoutManager
. It indicates
that the text starts in the upper right corner.
public static final int START_LOWER_LEFT
setStartCorner
method of SophisticatedTextLayoutManager
. It indicates
that the text starts in the lower left corner.
public static final int START_LOWER_RIGHT
setStartCorner
method of SophisticatedTextLayoutManager
. It indicates
that the text starts in the lower right corner.
public static final int DEFAULT_LINE_SPACE
setLineSpace
method of SophisticatedTextLayoutManager
. It indicates
that the line space should be set to the default value, determined by the
default font.
Constructor Detail |
---|
public SophisticatedTextLayoutManager()
Method Detail |
---|
public Dimension getMinimumSize(ViewOnlyComponent component, String text)
TextLayoutManager
ViewOnlyComponent
.
In this version of the method, it is assumed that the
ViewOnlyComponent
parameter defines
the borders by its bounds.
getMinimumSize
in interface TextLayoutManager
component
- the ViewOnlyComponent
to look attext
- the provided text to be rendered
public Dimension getMinimumSize(ViewOnlyComponent component, String text, Insets insets)
TextLayoutManager
ViewOnlyComponent
.
getMinimumSize
in interface TextLayoutManager
component
- the ViewOnlyComponent
to look attext
- the provided text to be renderedinsets
- the insets to define the area in which the text should be
laid out
public Dimension getMaximumSize(ViewOnlyComponent component, String text)
TextLayoutManager
ViewOnlyComponent
.
In this version of the method, it is assumed that the
ViewOnlyComponent
parameter defines
the borders by its bounds.
getMaximumSize
in interface TextLayoutManager
component
- the ViewOnlyComponent
to look attext
- the provided text to be rendered
public Dimension getMaximumSize(ViewOnlyComponent component, String text, Insets insets)
TextLayoutManager
ViewOnlyComponent
.
getMaximumSize
in interface TextLayoutManager
component
- the ViewOnlyComponent
to look attext
- the provided text to be renderedinsets
- the insets to define the area in which the text should be
laid out
public Dimension getPreferredSize(ViewOnlyComponent component, String text)
TextLayoutManager
ViewOnlyComponent
.
In this version of the method, it is assumed that the
ViewOnlyComponent
parameter defines
the borders by its bounds.
getPreferredSize
in interface TextLayoutManager
component
- the ViewOnlyComponent
to look attext
- the provided text to be rendered
public Dimension getPreferredSize(ViewOnlyComponent component, String text, Insets insets)
TextLayoutManager
ViewOnlyComponent
.
getPreferredSize
in interface TextLayoutManager
component
- the ViewOnlyComponent
to look attext
- the provided text to be renderedinsets
- the insets to define the area in which the text should be
laid out
public void render(String text, Graphics g, ViewOnlyComponent component, Insets insets)
ViewOnlyComponent
can be used to determine any additional information
needed in order to render the string properly (e.g. Font, Color etc.),
if the TextLayoutManagerClass implementing this interface does not
provide additional information for that.
The ViewOnlyComponent
also
defines
the layout area by its bounds, while of course the provided insets have
also to be taken into account if not null. The clipping rectangle of
the Graphics
object should not be subject of change by the
TextLayoutManager, though.
render
in interface TextLayoutManager
text
- the string to be renderedg
- the graphics context. This includes of course also a clipping
rectangle, which should be respected as borders within which the
rendering is permitted. An insets parameter not equal to null must be
additionally taken into account.component
- the ViewOnlyComponent
into which to render.insets
- the insets to define the area in which the text should be
laid out. This parameter can also be null
: in this case the
ViewOnlyComponent
parameter
defines the borders by its bounds.public void setHorizontalAlignment(int alignment)
alignment
- the value for the horizontal alignment. Possible values are:
HORIZONTAL_ALIGN_LEFT
,
HORIZONTAL_ALIGN_RIGHT
,
HORIZONTAL_ALIGN_CENTER
and HORIZONTAL_ALIGN_JUSTIFIED
.getHorizontalAlignment()
public void setVerticalAlignment(int alignment)
alignment
- the value for the vertical alignment. Possible values are:
VERTICAL_ALIGN_TOP
,
VERTICAL_ALIGN_BOTTOM
,
VERTICAL_ALIGN_CENTER
and VERTICAL_ALIGN_JUSTIFIED
.getVerticalAlignment()
public void setLineOrientation(int orientation)
orientation
- the value for the line orientation. Possible values are:
LINE_ORIENTATION_HORIZONTAL
and
LINE_ORIENTATION_VERTICAL
.public void setStartCorner(int corner)
corner
- the value for the starting corner. Possible values are:
START_UPPER_LEFT
,
START_UPPER_RIGHT
,
START_LOWER_LEFT
and
START_LOWER_RIGHT
.public void setTextWrapping(boolean wrap)
wrap
- true
if text should be wrapped,
false
otherwisepublic void setLineSpace(int spacing)
spacing
- value for line spacing; an integer or DEFAULT_LINE_SPACE
public void setLetterSpace(int spacing)
spacing
- letter space setting in units of 1/256th pointpublic void setHorizontalTabSpacing(int spacing)
spacing
- horizontal tabulator spacing in pointspublic int getHorizontalAlignment()
setHorizontalAlignment(int)
public int getVerticalAlignment()
setVerticalAlignment(int)
public int retrieveLineOrientation()
public int retrieveStartCorner()
public boolean retrieveTextWrapping()
public int retrieveLineSpace()
public int retrieveLetterSpace()
public int retrieveHorizontalTabSpacing()
public void setInsets(Insets insets)
SophisticatedTextLayoutManager
to provide a virtual margin. The insets determined by this method have to
be added to the insets passed to the render
method.
If this method has not been called, the default insets are 0 at each edge.
insets
- the determined insetsgetInsets()
public Insets getInsets()
setInsets
method. When not
previously set, zero insets are returned.
setInsets
methodsetInsets(java.awt.Insets)
public void addTextOverflowListener(TextOverflowListener listener)
TextOverflowListener
.
This listener will be notified if a text string won't fit into the
component during an attempt to render it.
listener
- the listener to be registeredremoveTextOverflowListener(com.sun.dtv.ui.TextOverflowListener)
public void removeTextOverflowListener(TextOverflowListener listener)
TextOverflowListener
from this TextLayoutManager.
listener
- the listener to be removedaddTextOverflowListener(com.sun.dtv.ui.TextOverflowListener)
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |