Java DTV API 1.0
12-Dec-2008

com.sun.dtv.ui
Class ViewOnlyComponent

java.lang.Object
  extended bycom.sun.lwuit.Component
      extended bycom.sun.dtv.ui.MatteEnabledComponent
          extended bycom.sun.dtv.ui.ViewOnlyComponent
All Implemented Interfaces:
Animated, MatteEnabled, StyleListener
Direct Known Subclasses:
ButtonGroup, Label, List, Popup

public class ViewOnlyComponent
extends MatteEnabledComponent

This class represents any type of non-interactive component in the system and provides them with a pluggable look and feel.

See Also:
MatteEnabled

Field Summary
static int HORIZONTAL_ALIGN_CENTER
          Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent.
static int HORIZONTAL_ALIGN_JUSTIFIED
          Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent.
static int HORIZONTAL_ALIGN_LEFT
          Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent.
static int HORIZONTAL_ALIGN_RIGHT
          Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent.
static int SCALE_ASPECT_PROOF
          Constant to be used with the setScalingMode method of ViewOnlyComponent.
static int SCALE_NO
          Constant to be used with the setScalingMode method of ViewOnlyComponent.
static int SCALE_NO_ASPECT_PROOF
          Constant to be used with the setScalingMode method of ViewOnlyComponent.
static int VERTICAL_ALIGN_BOTTOM
          Constant to be used with the setVerticalAlignment method of ViewOnlyComponent.
static int VERTICAL_ALIGN_CENTER
          Constant to be used with the setVerticalAlignment method of ViewOnlyComponent.
static int VERTICAL_ALIGN_JUSTIFIED
          Constant to be used with the setVerticalAlignment method of ViewOnlyComponent.
static int VERTICAL_ALIGN_TOP
          Constant to be used with the setVerticalAlignment method of ViewOnlyComponent.
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Fields inherited from interface com.sun.dtv.ui.Animated
ALTERNATING, LOOP, REPEATING
 
Constructor Summary
ViewOnlyComponent()
           
 
Method Summary
 Image[] getAnimateContent(int state)
          Returns the animated content for this component, depending on the current state.
 Image getGraphicContent(int state)
          Returns the graphical content for this component, depending on the current state.
 int getHorizontalAlignment()
          Retrieve the horizontal alignment for any state-based content in this component.
 int getInteractionState()
          Return the current interaction state of the component.
 int getScalingMode()
          Retrieve the scaling mode for this component.
 String getTextContent(int state)
          Returns the text content for this component, depending on the current state.
 TextLayoutManager getTextLayoutManager()
          Gets the text layout manager that is currently in use for text layout in this component.
 int getVerticalAlignment()
          Retrieve the vertical alignment for any state-based content in this component.
 boolean isOpaque()
          Obtain information whether the whole area of the component is fully opaque, i.e. all pixels are painted in an opaque color.
 void paint(Graphics g)
          Method to paint the component.
 void setAnimateContent(Image[] images, int state)
          Assigns an array of graphical content to be used for animation to this component which is state-dependent.
 void setGraphicContent(Image image, int state)
          Assigns graphical content to this component which is state-dependent.
 void setHorizontalAlignment(int alignment)
          Set the horizontal alignment for any state-based content in this component.
protected  void setInteractionState(int state)
          Set the current state of the component with respect to interaction.
 void setScalingMode(int scaling)
          Set the scaling mode for this component.
 void setTextContent(String text, int state)
          Assigns text content to this component which is state-dependent.
 void setTextLayoutManager(TextLayoutManager manager)
          Sets the text layout manager that should be used for text layout in this component.
 void setVerticalAlignment(int alignment)
          Set the vertical alignment for any state-based content in this component.
 
Methods inherited from class com.sun.dtv.ui.MatteEnabledComponent
getMatte, isDoubleBuffered, processEvent, setMatte
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, animate, calcPreferredSize, contains, deinitialize, fireClicked, getAbsoluteX, getAbsoluteY, getAnimationMode, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDelay, getHeight, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPosition, getPreferredSize, getRepetitionMode, getScrollAnimationSpeed, getScrollX, getScrollY, getSideGap, getStyle, getUIID, getWidth, getX, getY, handlesInput, hasFocus, initComponent, isEnabled, isFocusable, isFocusPainted, isInitialized, isRunning, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isVisible, jumpTo, keyPressed, keyReleased, keyRepeated, longKeyPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintScrollbars, paintScrollbarX, paintScrollbarY, paramString, pointerDragged, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, setAnimationMode, setCellRenderer, setDelay, setEnabled, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredSize, setRepetitionMode, setScrollAnimationSpeed, setScrollX, setScrollY, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setStyle, setVisible, setWidth, setX, setY, start, stop, styleChanged, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HORIZONTAL_ALIGN_LEFT

public static final int HORIZONTAL_ALIGN_LEFT
Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent. It indicates that all content will be left aligned.

See Also:
Constant Field Values

HORIZONTAL_ALIGN_CENTER

public static final int HORIZONTAL_ALIGN_CENTER
Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent. It indicates that all content will be centered horizontally.

See Also:
Constant Field Values

HORIZONTAL_ALIGN_RIGHT

public static final int HORIZONTAL_ALIGN_RIGHT
Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent. It indicates that all content will be right aligned.

See Also:
Constant Field Values

HORIZONTAL_ALIGN_JUSTIFIED

public static final int HORIZONTAL_ALIGN_JUSTIFIED
Constant to be used with the setHorizontalAlignment method of ViewOnlyComponent. It indicates that all content will be justified horizontally.

See Also:
Constant Field Values

VERTICAL_ALIGN_TOP

public static final int VERTICAL_ALIGN_TOP
Constant to be used with the setVerticalAlignment method of ViewOnlyComponent. It indicates that all content will be top aligned.

See Also:
Constant Field Values

VERTICAL_ALIGN_CENTER

public static final int VERTICAL_ALIGN_CENTER
Constant to be used with the setVerticalAlignment method of ViewOnlyComponent. It indicates that all content will be centered vertically.

See Also:
Constant Field Values

VERTICAL_ALIGN_BOTTOM

public static final int VERTICAL_ALIGN_BOTTOM
Constant to be used with the setVerticalAlignment method of ViewOnlyComponent. It indicates that all content will be bottom aligned.

See Also:
Constant Field Values

VERTICAL_ALIGN_JUSTIFIED

public static final int VERTICAL_ALIGN_JUSTIFIED
Constant to be used with the setVerticalAlignment method of ViewOnlyComponent. It indicates that all content will be justified vertically.

See Also:
Constant Field Values

SCALE_NO

public static final int SCALE_NO
Constant to be used with the setScalingMode method of ViewOnlyComponent. It indicates that nothing of the content will be scaled to fit the component.

See Also:
Constant Field Values

SCALE_ASPECT_PROOF

public static final int SCALE_ASPECT_PROOF
Constant to be used with the setScalingMode method of ViewOnlyComponent. It indicates that all content will be scaled in a way preserving the aspect ratio.

See Also:
Constant Field Values

SCALE_NO_ASPECT_PROOF

public static final int SCALE_NO_ASPECT_PROOF
Constant to be used with the setScalingMode method of ViewOnlyComponent. It indicates that all content will be scaled in a way not necessarily preserving the aspect ratio.

See Also:
Constant Field Values
Constructor Detail

ViewOnlyComponent

public ViewOnlyComponent()
Method Detail

paint

public void paint(Graphics g)
Method to paint the component.

Specified by:
paint in interface Animated
Overrides:
paint in class Component
Parameters:
g - the graphics context to use for painting.

setTextContent

public void setTextContent(String text,
                           int state)
                    throws IllegalArgumentException
Assigns text content to this component which is state-dependent.

Parameters:
text - the text content, or null (removes text content which had been assigned before)
state - the state of the component for which this content should be displayed.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
getTextContent(int)

setGraphicContent

public void setGraphicContent(Image image,
                              int state)
                       throws IllegalArgumentException
Assigns graphical content to this component which is state-dependent.

Parameters:
image - the graphical content, or null (removes graphical content which had been assigned before)
state - the state of the component for which this content should be displayed.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
getGraphicContent(int)

setAnimateContent

public void setAnimateContent(Image[] images,
                              int state)
                       throws IllegalArgumentException
Assigns an array of graphical content to be used for animation to this component which is state-dependent.

Parameters:
images - the graphical content array, or null (removes any graphical content which had been assigned before)
state - the state of the component for which this content should be displayed.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
getAnimateContent(int)

getTextContent

public String getTextContent(int state)
                      throws IllegalArgumentException
Returns the text content for this component, depending on the current state.

Parameters:
state - The state for which content is to be retrieved.
Returns:
The text content associated with the specified state, or null if there is none.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
setTextContent(java.lang.String, int)

getGraphicContent

public Image getGraphicContent(int state)
                        throws IllegalArgumentException
Returns the graphical content for this component, depending on the current state.

Parameters:
state - The state for which content is to be retrieved.
Returns:
The graphical content associated with the specified state, or null if there is none.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
setGraphicContent(com.sun.lwuit.Image, int)

getAnimateContent

public Image[] getAnimateContent(int state)
                          throws IllegalArgumentException
Returns the animated content for this component, depending on the current state.

Parameters:
state - The state for which content is to be retrieved.
Returns:
The graphical content associated with the specified state, or null if there is none.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
setAnimateContent(com.sun.lwuit.Image[], int)

setInteractionState

protected void setInteractionState(int state)
                            throws IllegalArgumentException
Set the current state of the component with respect to interaction. Subclasses are intended to use this method in order to change the interaction state, too.

Parameters:
state - the interaction state for this component.
Throws:
IllegalArgumentException - if the state parameter does not represent a state
See Also:
getInteractionState()

getInteractionState

public int getInteractionState()
Return the current interaction state of the component.

Returns:
the current interaction state of the component.
See Also:
setInteractionState(int)

setTextLayoutManager

public void setTextLayoutManager(TextLayoutManager manager)
Sets the text layout manager that should be used for text layout in this component.

Parameters:
manager - the TextLayoutManager
See Also:
getTextLayoutManager()

getTextLayoutManager

public TextLayoutManager getTextLayoutManager()
Gets the text layout manager that is currently in use for text layout in this component.

Returns:
the TextLayoutManager
See Also:
setTextLayoutManager(com.sun.dtv.ui.TextLayoutManager)

isOpaque

public boolean isOpaque()
Obtain information whether the whole area of the component is fully opaque, i.e. all pixels are painted in an opaque color.

Overrides:
isOpaque in class MatteEnabledComponent
Returns:
true if all the pixels are painted with an opaque color.

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Set the horizontal alignment for any state-based content in this component.

Parameters:
alignment - the horizontal alignment mode, one of HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_RIGHT or HORIZONTAL_ALIGN_JUSTIFIED.
See Also:
getHorizontalAlignment()

setVerticalAlignment

public void setVerticalAlignment(int alignment)
Set the vertical alignment for any state-based content in this component.

Parameters:
alignment - the vertical alignment mode, one of VERTICAL_ALIGN_TOP, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_BOTTOM or VERTICAL_ALIGN_JUSTIFIED.
See Also:
getVerticalAlignment()

getHorizontalAlignment

public int getHorizontalAlignment()
Retrieve the horizontal alignment for any state-based content in this component.

Returns:
the current horizontal alignment mode, one of HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_RIGHT or HORIZONTAL_ALIGN_JUSTIFIED.
See Also:
setHorizontalAlignment(int)

getVerticalAlignment

public int getVerticalAlignment()
Retrieve the vertical alignment for any state-based content in this component.

Returns:
the current horizontal alignment mode, one of VERTICAL_ALIGN_TOP, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_BOTTOM or VERTICAL_ALIGN_JUSTIFIED.
See Also:
setVerticalAlignment(int)

setScalingMode

public void setScalingMode(int scaling)
Set the scaling mode for this component.

Parameters:
scaling - the scaling mode, one of SCALE_NO, SCALE_NO_ASPECT_PROOF or SCALE_ASPECT_PROOF.
See Also:
getScalingMode()

getScalingMode

public int getScalingMode()
Retrieve the scaling mode for this component.

Returns:
the current scaling mode, one of SCALE_NO, SCALE_NO_ASPECT_PROOF or SCALE_ASPECT_PROOF.
See Also:
setScalingMode(int)

Java DTV API 1.0
12-Dec-2008

Copyright © 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.