|
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.DefaultTextLayoutManager
public class DefaultTextLayoutManager
This class provides a standard mechanism for rendering of provided texts and
is at the same time the simplest implementation of the TextLayoutManager
interface.
The DefaultTextLayoutManager
is
capable to handle alignment and justification of the text contained in the
provided string in both horizontal and vertical directions. The direction
depends on the currently valid alignment mode of the ViewOnlyComponent
. Scaling is not supported
though, and even the scaling mode of the ViewOnlyComponent
is ignored.
Multi-line texts are supported in the provided string paramter to the
render method. Color and font information needed for the rendering will be
taken from the provided ViewOnlyComponent
TextLayoutManager
,
SophisticatedTextLayoutManager
Constructor Summary | |
---|---|
DefaultTextLayoutManager()
|
Method Summary | |
---|---|
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 . |
void |
render(String text,
Graphics g,
ViewOnlyComponent component,
Insets insets)
Render a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultTextLayoutManager()
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 TextLayoutManager class 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 rendered. This string may be multi-line,
where each line is separated by a "\n"(0x0A). If the string
does not fit in the space available, it will be truncated and an ellipsis
("...") appended to indicate the truncation.g
- 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. Color and font information to be taken from here.
If the specified font is not available, it will be replaced by the
nearest built-in font. Each missing character is replaced by an
"*" character.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.
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |