org.havi.ui
Class HVisible

java.lang.Object
  extended byjava.awt.Component
      extended byorg.havi.ui.HComponent
          extended byorg.havi.ui.HVisible
All Implemented Interfaces:
HMatteLayer, HState, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, TestOpacity
Direct Known Subclasses:
HListGroup, HSinglelineEntry, HStaticAnimation, HStaticIcon, HStaticRange, HStaticText

public class HVisible
extends HComponent
implements HState

The HVisible class is the base class for all non-interactive components.

If a layout manager is associated with the Container into which a HVisible component is placed, the size and location of the component will be controlled by the layout manager.

HVisible provides the following features for the use of subclasses:

Some of these features are discussed in more detail below.

Interaction State

Interaction states for HVisible components are defined in the HState interface. The only interaction states valid for a plain (un-subclassed) HVisible are:

Subclasses of HVisible may use other states. However, setInteractionState(int) is the only means by which state can be changed and will throw an IllegalArgumentException if the state is not valid for a particular component type. Subclasses of HVisible must not manipulate state in other ways.

The getInteractionState method is provided to allow any class to read the current state of a component.

State-based content

Specific content may be set for any interaction state defined in HState, irrespective of whether the subclass of HVisible can ever be in that state.

Note that content is set on the various STATE constants defined in HState, and not on the STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown by any method which takes a state as a parameter if a STATE_BIT rather than a STATE is passed.

By default it is possible to set content for any of eight discrete states. However, if no content has been set for a particular state, the associated HLook should use content from the nearest matching state as defined below:

StateContent if missingExample style
HState.NORMAL_STATE noneno special style
HState.FOCUSED_STATE HState.NORMAL_STATE highlighted
HState.ACTIONED_STATE HState.FOCUSED_STATE pushed in
HState.ACTIONED_FOCUSED_STATE HState.FOCUSED_STATEhighlighted & pushed in
HState.DISABLED_STATE HState.NORMAL_STATE grayed out
HState.DISABLED_FOCUSED_STATE HState.DISABLED_STATEgrayed out & highlighted
HState.DISABLED_ACTIONED_STATE HState.ACTIONED_STATEgrayed out & pushed in
HState.DISABLED_ACTIONED_FOCUSED_STATE HState.DISABLED_STATEgrayed out & highlighted & pushed

It is recommended that HLook implementations be capable of drawing components in styles that allow the interaction state to be visually distinguished even when no content is set, or the content is the same for several states.

Content for any component may be changed "on the fly" using the setContent methods. However, some components (e.g. HStaticAnimation and HAnimation) may be asynchronously referencing their content (i.e. through a separate implementation-specific animation thread). Therefore the following restrictions apply to the setAnimateContent(java.awt.Image[], int) method when the instance of HVisible on which it is invoked implements the HAnimateEffect interface:

Alternative platform-specific animation schemes which do not use HAnimateEffect are outside the scope of this document. However, a similar strategy should be employed to avoid synchronization problems.

Content Scaling and Alignment

Where state-based content is used, it is an implementation option to support scaling of the content to fit the HVisible. Some looks also support alignment of content. See the class description of HLook for details of which looks support scaling and alignment. See the fields description of this class for constants which can be used to specify scaling and alignment modes.

The following methods are used to get and set alignment of content:

The following methods are used to get and set the scaling of content. Scaling support is optional, however all implementations must support the RESIZE_NONE scaling mode. Platforms are not required to support scaling of textual content by default.

Repaint Hints

An associated HLook provides a mechanism of efficiently repainting an HVisible, based on a hint which provides data about the change which triggered the redrawing. The HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method should be called in preference to repaint whenever the HVisible requires a redraw to change its appearance.

The HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method requires an array of one or more HChangeData objects, which contain a hint, and associated data. All keys have the type int, with values defined as constants in this class. The following hints are defined:

Hint (key)Data (value)Data Interpretation
TEXT_CONTENT_CHANGE Object[9][Integer changedState, String oldNORMAL_STATEtext, String oldFOCUSED_STATEtext, String oldACTIONED_STATEtext, String oldACTIONED_FOCUSED_STATEtext, String oldDISABLED_STATEtext, String oldDISABLED_FOCUSED_STATEtext, String oldDISABLED_ACTIONED_STATEtext, String oldDISABLED_ACTIONED_FOCUSED_STATEtext]
GRAPHIC_CONTENT_CHANGE Object[9][Integer changedState, Image oldNORMAL_STATEimage, Image oldFOCUSED_STATEimage, Image oldACTIONED_STATEimage, Image oldACTIONED_FOCUSED_STATEimage, Image oldDISABLED_STATEimage, Image oldDISABLED_FOCUSED_STATEimage, Image oldDISABLED_ACTIONED_STATEimage, Image oldDISABLED_ACTIONED_FOCUSED_STATEimage]
ANIMATE_CONTENT_CHANGE Object[9][Integer changedState, Image[] oldNORMAL_STATEanimation, Image[] oldFOCUSED_STATEanimation, Image[] oldACTIONED_STATEanimation, Image[] oldACTIONED_FOCUSED_STATEanimation, Image[] oldDISABLED_STATEanimation, Image[] oldDISABLED_FOCUSED_STATEanimation, Image[] oldDISABLED_ACTIONED_STATEanimation, Image[] oldDISABLED_ACTIONED_FOCUSED_STATEanimation]
CONTENT_CHANGE Object[9][Integer changedState, Object oldNORMAL_STATEcontent, Object oldFOCUSED_STATEcontent, Object oldACTIONED_STATEcontent, Object oldACTIONED_FOCUSED_STATEcontent, Object oldDISABLED_STATEcontent, Object oldDISABLED_FOCUSED_STATEcontent, Object oldDISABLED_ACTIONED_STATEcontent, Object oldDISABLED_ACTIONED_FOCUSED_STATEcontent]
STATE_CHANGE IntegeroldState
CARET_POSITION_CHANGE IntegeroldPosition
ECHO_CHAR_CHANGE CharacteroldEcho
EDIT_MODE_CHANGE BooleanoldEditMode
MIN_MAX_CHANGE Integer[2][oldMin, oldMax]
THUMB_OFFSETS_CHANGE Integer[2][oldMin, oldMax]
ORIENTATION_CHANGE IntegeroldOrientation
ITEM_VALUE_CHANGE IntegeroldValue
ADJUSTMENT_VALUE_CHANGE IntegeroldIndex
LIST_CONTENT_CHANGE HListElement[] oldContent
LIST_ICONSIZE_CHANGE Dimension oldSize
LIST_LABELSIZE_CHANGE Dimension oldSize
LIST_MULTISELECTION_CHANGE Boolean oldSelection
LIST_SCROLLPOSITION_CHANGE Integer oldScrollPosition
SIZE_CHANGE IntegeroldSize
BORDER_CHANGE BooleanoldBorderMode
REPEAT_COUNT_CHANGE IntegeroldRepeatCount
ANIMATION_POSITION_CHANGE IntegeroldValue
LIST_SELECTION_CHANGE HListElement[] oldSelectedElements
UNKNOWN_CHANGE IntegerUNKNOWN_CHANGE

Note that implementations of HLook may not actually implement more efficient drawing code for a given hint. In particular, simply repainting the entire HVisible is a valid implementation option.

The following code for the HStaticRange.setRange(int, int) method demonstrates how hint objects are used. Note that the values passed in the hint are always the old values, since the HLook can always retrieve the new values as needed from the HVisible. Variables starting with "my" are member variables of the class.


public boolean setRange(int min, int max)

{

  if (min >= max)

    return false;



  if (min != myMin || max != myMax)

  {

    // create hint object with the OLD values

    HChangeData oldRangeData =

      new HChangeData(HVisible.MIN_MAX_CHANGE,

                      new Integer[] { new Integer(myMin),

                                      new Integer(myMax) });



    // update the values

    myMin = min;

    myMax = max;



    Integer oldValue = new Integer(myValue);



    // behavior checking elided

    if (myValue < myMin)

      myValue = myMin;

    else if (myValue > myMax)

      myValue = myMax;

    else

      oldValue = null; // myValue is within new range



    HChangeData[] array;

    if (oldValue == null)

      array = new HChangeData[] { oldRangeData };

    else

      array = new HChangeDate[]

      { oldRangeData,

        new HChangeData( HVisible.ADJUSTMENT_VALUE_CHANGE,

                        oldValue )};



    // tell the look to repaint as needed

    if (myLook != null)

      myLook.widgetChanged(this, array);

  }

  return true;

}

Private HLook data

Private data for the use of an associated HLook to optimize the redraw of the component may be set on any HVisible. Examples of such data are: Data is set using the setLookData(java.lang.Object, java.lang.Object) method, and retrieved with the getLookData(java.lang.Object) method.

To keep the on-screen representation of an HVisible synchronized with its state, any class may call setLookData(java.lang.Object, java.lang.Object) with a parameter of null to invalidate any cached data. Instances of HLook must be able to regenerate any data they store on HVisible classes at any time. This mechanism is intended for implementation optimization only and shall not be used for storing content.

Use of this mechanism is an implementation option. If this mechanism is not used by an implementation, getLookData(java.lang.Object) shall always return null and setLookData(java.lang.Object, java.lang.Object) shall do nothing. Interoperable systems shall not assume that this mechanism is implemented.

Preferred Sizes

The setDefaultSize(java.awt.Dimension) and getDefaultSize() methods provide support for a user-defined default preferred size to be passed to a layout manager. This value is returned to the layout manager through the HLook.getPreferredSize(org.havi.ui.HVisible) method and if set overrides any look-specific value based on content calculated by the HLook.

Note that the interpretation of the size passed to setDefaultSize(java.awt.Dimension) is not the overall size of the component, but the area available to the look to render the component into excluding any look-specific borders. Therefore when a layout manager is in use the actual size of the component is likely to be larger than this default size. See the descriptions of HLook.getMinimumSize(org.havi.ui.HVisible), HLook.getPreferredSize(org.havi.ui.HVisible) and HLook.getMaximumSize(org.havi.ui.HVisible) in HLook for details of the exact algorithm used.

Note that constructors of HVisible and subclasses which accept width and height parameters shall set the default size to [width, height] as if these parameters were passed to setDefaultSize(java.awt.Dimension). If a layout manager is in use the actual size of the component will probably be larger than this size after layout due to the HLook adding borders. However, if no layout manager is used the width and height parameters are simply used to set the actual size of the component.

Background Painting

Normally the associated HLook does not paint the background of the HVisible, allowing for non-rectangular components and text overlaying bitmaps. However, HVisible provides for components which require their background to be painted through the setBackgroundMode method. Note that if the mode is set to BACKGROUND_FILL the return value of the HComponent.isOpaque() method may be true, depending on whether the current background color of the HVisible is opaque. If the background mode is set to NO_BACKGROUND_FILL the HComponent.isOpaque() method must return false.

Event Handling

While implementations of HVisible may enable certain java.awt.AWTEvents, applications should assume that an HVisible class does not generate or respond to any java.awt.AWTEvents. If this behavior is required the standard AWT mechanisms (i.e. processEvent and similar functions) may be used to handle events on HVisible or subclasses. However, it is strongly recommended that component implementors use the HAVi events defined in the org.havi.ui.event package where possible.

For example, a component wishing to respond to user action should normally subclass HComponent, implement the HActionInputPreferred interface and handle HActionEvent events in the HActionInputPreferred.processHActionEvent(org.havi.ui.event.HActionEvent) method, instead of overriding java.awt.Component#processEvent or similar.


The parameters to the constructors are as follows, in cases where parameters are not used, then the constructor should use the default values.

Default parameter values exposed in the constructors

ParameterDescriptionDefault value Set methodGet method
x x-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). --- java.awt.Component#setBounds java.awt.Component#getBounds
y y-coordinate of top left hand corner of this component in pixels, relative to its parent container (subject to layout management). --- java.awt.Component#setBounds java.awt.Component#getBounds
width width of this component in pixels (subject to layout management). --- java.awt.Component#setBounds java.awt.Component#getBounds
height height of this component in pixels (subject to layout management). --- java.awt.Component#setBounds java.awt.Component#getBounds

Default parameter values not exposed in the constructors

DescriptionDefault valueSet method Get method
Associated matte (HMatte). none (i.e. getMatte() returns null) setMatte getMatte
The text layout manager responsible for text formatting. An HDefaultTextLayoutManager object. setTextLayoutManager(org.havi.ui.HTextLayoutManager) getTextLayoutManager()
The background painting mode NO_BACKGROUND_FILL setBackgroundMode(int) getBackgroundMode()
The default preferred size not set (i.e. NO_DEFAULT_SIZE) unless specified by width and height parameters setDefaultSize(java.awt.Dimension) getDefaultSize()
The horizontal content alignment HALIGN_CENTER setHorizontalAlignment(int) getHorizontalAlignment()
The vertical content alignment VALIGN_CENTER setVerticalAlignment(int) getVerticalAlignment()
The content scaling mode RESIZE_NONE setResizeMode(int) getResizeMode()
The border mode true setBordersEnabled(boolean) getBordersEnabled()

See Also:
Serialized Form

Field Summary
static int ADJUSTMENT_VALUE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int ANIMATE_CONTENT_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int ANIMATION_POSITION_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int BACKGROUND_FILL
          A constant for use with the setBackgroundMode(int) method of HVisible which indicates that an associated HLook should fill the bounding rectangle of the HVisible with its current background color before drawing any content.
static int BORDER_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int CARET_POSITION_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int CONTENT_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int ECHO_CHAR_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int EDIT_MODE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int FIRST_CHANGE
          A constant which indicates the first change value for use with the hinting mechanism.
static int GRAPHIC_CONTENT_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int HALIGN_CENTER
          A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be centered horizontally.
static int HALIGN_JUSTIFY
          A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be fully justified (horizontally).
static int HALIGN_LEFT
          A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be left aligned.
static int HALIGN_RIGHT
          A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be right aligned.
static int ITEM_VALUE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int LAST_CHANGE
          A constant which indicates the last defined value for use with the hinting mechanism.
static int LIST_CONTENT_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int LIST_ICONSIZE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int LIST_LABELSIZE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int LIST_MULTISELECTION_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int LIST_SCROLLPOSITION_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int LIST_SELECTION_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int MIN_MAX_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int NO_BACKGROUND_FILL
          A constant for use with the setBackgroundMode(int) method of HVisible which indicates that an associated HLook should not fill the bounding rectangle of the HVisible with its current background color before drawing any content.
static int NO_DEFAULT_HEIGHT
          A constant for use with the setDefaultSize(java.awt.Dimension) and getDefaultSize() methods of HVisible which indicates that no default height is desired for the HVisible.
static java.awt.Dimension NO_DEFAULT_SIZE
          A constant for use with the setDefaultSize(java.awt.Dimension) and getDefaultSize() methods of HVisible which indicates that no default size is desired for the HVisible.
static int NO_DEFAULT_WIDTH
          A constant for use with the setDefaultSize(java.awt.Dimension) and getDefaultSize() methods of HVisible which indicates that no default width is desired for the HVisible.
static int ORIENTATION_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int REPEAT_COUNT_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int RESIZE_ARBITRARY
          A constant for use with the setResizeMode(int) method of HVisible which indicates that content should be scaled to fit the component.
static int RESIZE_NONE
          A constant for use with the setResizeMode(int) method of HVisible which indicates that content should not be scaled to fit the component.
static int RESIZE_PRESERVE_ASPECT
          A constant for use with the setResizeMode(int) method of HVisible which indicates that content should be scaled to fit the component while preserving the aspect ratio of the content.
static int SIZE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int STATE_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int TEXT_CONTENT_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int TEXT_VALUE_CHANGE
          Deprecated. This constant shall not be used for the hinting mechanism. Looks shall treat it as UNKNOWN_CHANGE. See also CARET_POSITION_CHANGE and TEXT_CONTENT_CHANGE.
static int THUMB_OFFSETS_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int UNKNOWN_CHANGE
          A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook).
static int VALIGN_BOTTOM
          A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be vertically aligned to the bottom of the component.
static int VALIGN_CENTER
          A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be centered vertically.
static int VALIGN_JUSTIFY
          A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be fully justified (vertically).
static int VALIGN_TOP
          A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be vertically aligned to the top of the component.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.havi.ui.HState
ACTIONED_FOCUSED_STATE, ACTIONED_STATE, ACTIONED_STATE_BIT, ALL_STATES, DISABLED_ACTIONED_FOCUSED_STATE, DISABLED_ACTIONED_STATE, DISABLED_FOCUSED_STATE, DISABLED_STATE, DISABLED_STATE_BIT, FIRST_STATE, FOCUSED_STATE, FOCUSED_STATE_BIT, LAST_STATE, NORMAL_STATE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HVisible()
          Creates an HVisible component with no HLook.
HVisible(HLook hlook)
          Creates an HVisible component with the given HLook.
HVisible(HLook hlook, int x, int y, int width, int height)
          Creates an HVisible component with the given HLook and the specified location and size.
 
Method Summary
 java.awt.Image[] getAnimateContent(int state)
          Gets the animate content for this component.
 int getBackgroundMode()
          Get the background mode of this HVisible.
 boolean getBordersEnabled()
          Returns the current border mode.
 java.lang.Object getContent(int state)
          Gets the content for this component.
 java.awt.Dimension getDefaultSize()
          Returns the default preferred size to be used for this component when a layout manager is in use.
 java.awt.Image getGraphicContent(int state)
          Gets the graphic content for this component.
 int getHorizontalAlignment()
          Get the horizontal alignment of any state-based content rendered by an associated HLook.
 int getInteractionState()
          Return the interaction state the component is currently in.
 HLook getLook()
          Gets the HLook for this component.
 java.lang.Object getLookData(java.lang.Object key)
          Retrieve a look-specific private data object.
 java.awt.Dimension getMaximumSize()
          Gets the maximum size of the HVisible.
 java.awt.Dimension getMinimumSize()
          Gets the minimum size of the HVisible.
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of the HVisible.
 int getResizeMode()
          Get the scaling mode for scaling any state-based content rendered by an associated HLook.
 java.lang.String getTextContent(int state)
          Gets the text content for this component.
 HTextLayoutManager getTextLayoutManager()
          Gets the text layout manager that is being used to layout this text.
 int getVerticalAlignment()
          Get the vertical alignment of any state-based content rendered by an associated HLook.
 boolean isFocusTraversable()
          By default an HVisible component is not focus-traversable.
 boolean isOpaque()
          Returns true if the entire HVisible area, as given by the java.awt.Component#getBounds method, is fully opaque, i.e. its HLook guarantees that all pixels are painted in an opaque Color.
 void paint(java.awt.Graphics g)
          Draws the current state of the component, by calling the HLook.showLook(java.awt.Graphics, org.havi.ui.HVisible, int) method of the associated HLook.
 void setAnimateContent(java.awt.Image[] imageArray, int state)
          Sets an array of graphical content (primarily used for animation), per state.
 void setBackgroundMode(int mode)
          Set the background drawing mode.
 void setBordersEnabled(boolean enable)
          The method en- or disables rendering of platform-specific borders.
 void setContent(java.lang.Object object, int state)
          Sets a single piece of content for this component, per state.
 void setDefaultSize(java.awt.Dimension defaultSize)
          Set the preferred default size for this component when a layout manager is in use.
 void setEnabled(boolean b)
          Modifies the HState of this HVisible by calling setInteractionState, depending on the value of b.
 void setGraphicContent(java.awt.Image image, int state)
          Sets a single piece of graphical content for this component, per state.
 void setHorizontalAlignment(int halign)
          Set the horizontal alignment of any state-based content rendered by an associated HLook.
protected  void setInteractionState(int state)
          Set the interaction state for this component.
 void setLook(HLook hlook)
          Sets the HLook for this component.
 void setLookData(java.lang.Object key, java.lang.Object data)
          Set a look-specific private data object.
 void setResizeMode(int resize)
          Set the resize mode of this HVisible.
 void setTextContent(java.lang.String string, int state)
          Sets a single piece of text content for this component, per state.
 void setTextLayoutManager(HTextLayoutManager manager)
          Sets the text layout manager that should be used to layout the text for this component.
 void setVerticalAlignment(int valign)
          Set the vertical alignment of any state-based content rendered by an associated HLook.
 void update(java.awt.Graphics g)
          The update() method in HVisible overrides that in Component and does not clear the background of the component, it simply modifies the current Color of the Graphics object to match that of the components background Color, and calls the paint() method.
 
Methods inherited from class org.havi.ui.HComponent
getMatte, isDoubleBuffered, isEnabled, processEvent, setMatte
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setCursor, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HALIGN_LEFT

public static final int HALIGN_LEFT
A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be left aligned.

See Also:
Constant Field Values

HALIGN_CENTER

public static final int HALIGN_CENTER
A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be centered horizontally.

See Also:
Constant Field Values

HALIGN_RIGHT

public static final int HALIGN_RIGHT
A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be right aligned.

See Also:
Constant Field Values

HALIGN_JUSTIFY

public static final int HALIGN_JUSTIFY
A constant for use with the setHorizontalAlignment(int) method of HVisible which indicates that content should be fully justified (horizontally).

See Also:
Constant Field Values

VALIGN_TOP

public static final int VALIGN_TOP
A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be vertically aligned to the top of the component.

See Also:
Constant Field Values

VALIGN_CENTER

public static final int VALIGN_CENTER
A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be centered vertically.

See Also:
Constant Field Values

VALIGN_BOTTOM

public static final int VALIGN_BOTTOM
A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be vertically aligned to the bottom of the component.

See Also:
Constant Field Values

VALIGN_JUSTIFY

public static final int VALIGN_JUSTIFY
A constant for use with the setVerticalAlignment(int) method of HVisible which indicates that content should be fully justified (vertically).

See Also:
Constant Field Values

RESIZE_NONE

public static final int RESIZE_NONE
A constant for use with the setResizeMode(int) method of HVisible which indicates that content should not be scaled to fit the component.

See Also:
Constant Field Values

RESIZE_PRESERVE_ASPECT

public static final int RESIZE_PRESERVE_ASPECT
A constant for use with the setResizeMode(int) method of HVisible which indicates that content should be scaled to fit the component while preserving the aspect ratio of the content. Areas of the component that are not filled by the content will be look dependent.

See Also:
Constant Field Values

RESIZE_ARBITRARY

public static final int RESIZE_ARBITRARY
A constant for use with the setResizeMode(int) method of HVisible which indicates that content should be scaled to fit the component. Aspect ratios of the content need not be preserved.

See Also:
Constant Field Values

NO_BACKGROUND_FILL

public static final int NO_BACKGROUND_FILL
A constant for use with the setBackgroundMode(int) method of HVisible which indicates that an associated HLook should not fill the bounding rectangle of the HVisible with its current background color before drawing any content. Therefore any previous content will NOT necessarily be erased during the repainting of the HVisible.

See Also:
Constant Field Values

BACKGROUND_FILL

public static final int BACKGROUND_FILL
A constant for use with the setBackgroundMode(int) method of HVisible which indicates that an associated HLook should fill the bounding rectangle of the HVisible with its current background color before drawing any content. Any previous content will be erased during the repainting of the HVisible.

See Also:
Constant Field Values

FIRST_CHANGE

public static final int FIRST_CHANGE
A constant which indicates the first change value for use with the hinting mechanism.

See Also:
Constant Field Values

TEXT_CONTENT_CHANGE

public static final int TEXT_CONTENT_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the text content has changed. The value for this hint is an array, java.lang.Object[9], which contains the state for which the content changed (a java.lang.Integer) and the old content (a java.lang.String) for all 8 states.

See Also:
Constant Field Values

GRAPHIC_CONTENT_CHANGE

public static final int GRAPHIC_CONTENT_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the graphical content has changed. The value for this hint is an array, java.lang.Object[9], which contains the state for which the content changed (a java.lang.Integer) and the old content (a java.awt.Image) for all 8 states.

See Also:
Constant Field Values

ANIMATE_CONTENT_CHANGE

public static final int ANIMATE_CONTENT_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the animated content has changed. The value for this hint is an array, java.lang.Object[9], which contains the state for which the content changed (a java.lang.Integer) and the old content (a java.awt.Image[]) for all 8 states.

See Also:
Constant Field Values

CONTENT_CHANGE

public static final int CONTENT_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the miscellaneous content has changed. The value for this hint is an array, java.lang.Object[9], which contains the state for which the content changed (a java.lang.Integer) and the old content (a java.lang.Object) for all 8 states.

See Also:
Constant Field Values

STATE_CHANGE

public static final int STATE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the interaction state has changed. The value for this hint is a java.lang.Integer which has the value of the old state.

See Also:
Constant Field Values

CARET_POSITION_CHANGE

public static final int CARET_POSITION_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the caret position has changed. The value for this hint is a java.lang.Integer which has the value of the old caret position.

See Also:
Constant Field Values

ECHO_CHAR_CHANGE

public static final int ECHO_CHAR_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the echo character has changed. The value for this hint is a java.lang.Character which has the value of the old echo character.

See Also:
Constant Field Values

EDIT_MODE_CHANGE

public static final int EDIT_MODE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the editing mode, adjustment mode or selection mode of the widget has changed. The value for this hint is a java.lang.Boolean which has the value of the old mode.

See Also:
Constant Field Values

MIN_MAX_CHANGE

public static final int MIN_MAX_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the range of an HAdjustmentValue component has changed. The value for this hint is an array, java.lang.Object[2], which contains the old minimum and maximum extents of the range as java.lang.Integer.

See Also:
Constant Field Values

THUMB_OFFSETS_CHANGE

public static final int THUMB_OFFSETS_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the thumb offsets of an HAdjustmentValue component have changed. The value for this hint is an array, java.lang.Object[2], which contains the old minimum and maximum thumb offsets as java.lang.Integer.

See Also:
Constant Field Values

ADJUSTMENT_VALUE_CHANGE

public static final int ADJUSTMENT_VALUE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the value of an HAdjustmentValue component has changed. The value for this hint is a java.lang.Integer which contains the old index.

See Also:
Constant Field Values

ORIENTATION_CHANGE

public static final int ORIENTATION_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the orientation of an HOrientable component has changed. The value for this hint is a java.lang.Integer which has the value of the old orientation.

See Also:
Constant Field Values

TEXT_VALUE_CHANGE

public static final int TEXT_VALUE_CHANGE
Deprecated. This constant shall not be used for the hinting mechanism. Looks shall treat it as UNKNOWN_CHANGE. See also CARET_POSITION_CHANGE and TEXT_CONTENT_CHANGE.

A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the value of an HTextValue component has changed. The value for this hint is a java.lang.Integer which contains the old value.

See Also:
Constant Field Values

ITEM_VALUE_CHANGE

public static final int ITEM_VALUE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the value of an HItemValue component has changed. The value for this hint is a java.lang.Integer which contains the old value.

See Also:
Constant Field Values

LIST_CONTENT_CHANGE

public static final int LIST_CONTENT_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the content of an HListGroup component has changed. The value for this hint is a java.lang.Integer which contains the old content.

See Also:
Constant Field Values

LIST_ICONSIZE_CHANGE

public static final int LIST_ICONSIZE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the iconsize of an HListGroup component has changed. The value for this hint is a java.lang.Integer which contains the old size.

See Also:
Constant Field Values

LIST_LABELSIZE_CHANGE

public static final int LIST_LABELSIZE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the labelsize of an HListGroup component has changed. The value for this hint is a java.lang.Integer which contains the old size.

See Also:
Constant Field Values

LIST_MULTISELECTION_CHANGE

public static final int LIST_MULTISELECTION_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the multiselection setting of an HListGroup component has changed. The value for this hint is a java.lang.Integer which contains the old setting.

See Also:
Constant Field Values

LIST_SCROLLPOSITION_CHANGE

public static final int LIST_SCROLLPOSITION_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the scrollposition of an HListGroup component has changed. The value for this hint is a java.lang.Integer which contains the old position.

See Also:
Constant Field Values

SIZE_CHANGE

public static final int SIZE_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the size of an HVisible component has changed. The value for this hint is a java.lang.Dimension which contains the old size.

See Also:
Constant Field Values

BORDER_CHANGE

public static final int BORDER_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the border mode has changed. The value for this hint is a java.lang.Boolean which has the value of the old border mode.

See Also:
Constant Field Values

REPEAT_COUNT_CHANGE

public static final int REPEAT_COUNT_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that HAnimateEffect.setRepeatCount(int) was called. Note that this hint is also used, when the actual value has not changed. This is to notify a reset of an internal counter. The value for this hint is a java.lang.Integer which has the value of the old repeat count.

See Also:
Constant Field Values

ANIMATION_POSITION_CHANGE

public static final int ANIMATION_POSITION_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the value of an HStaticAnimation component has changed. The value for this hint is a java.lang.Integer which contains the old value.

See Also:
Constant Field Values

LIST_SELECTION_CHANGE

public static final int LIST_SELECTION_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that the selection in HListGroup was changed. The value for this hint is an HListElement[] or null for the old selection.

See Also:
Constant Field Values

UNKNOWN_CHANGE

public static final int UNKNOWN_CHANGE
A constant for use with the hinting mechanism (see the HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) method in HLook). This hint indicates that some unspecified change has occurred. The value for this hint is a java.lang.Integer which also has the value UNKNOWN_CHANGE.

See Also:
Constant Field Values

LAST_CHANGE

public static final int LAST_CHANGE
A constant which indicates the last defined value for use with the hinting mechanism.

See Also:
Constant Field Values

NO_DEFAULT_WIDTH

public static final int NO_DEFAULT_WIDTH
A constant for use with the setDefaultSize(java.awt.Dimension) and getDefaultSize() methods of HVisible which indicates that no default width is desired for the HVisible.

See Also:
Constant Field Values

NO_DEFAULT_HEIGHT

public static final int NO_DEFAULT_HEIGHT
A constant for use with the setDefaultSize(java.awt.Dimension) and getDefaultSize() methods of HVisible which indicates that no default height is desired for the HVisible.

See Also:
Constant Field Values

NO_DEFAULT_SIZE

public static final java.awt.Dimension NO_DEFAULT_SIZE
A constant for use with the setDefaultSize(java.awt.Dimension) and getDefaultSize() methods of HVisible which indicates that no default size is desired for the HVisible.

The contents of the Dimension object cannot be relied upon. Comparisons must always be done using object identity, i.e. using the "==" operator.

Constructor Detail

HVisible

public HVisible()
Creates an HVisible component with no HLook. See the class description for details of constructor parameters and default values.


HVisible

public HVisible(HLook hlook)
Creates an HVisible component with the given HLook. See the class description for details of constructor parameters and default values.

Applications shall not use HLooks with this constructor unless those HLooks are specified as working with HVisible. If an HLook is used which is specified as only working with specific sub-classes of HVisible then the failure mode is implementation dependent.

Parameters:
hlook - The HLook associated with the HVisible component.

HVisible

public HVisible(HLook hlook,
                int x,
                int y,
                int width,
                int height)
Creates an HVisible component with the given HLook and the specified location and size. See the class description for details of constructor parameters and default values.

Parameters:
hlook - The HLook associated with the HVisible component.
x - the x-coordinate of the HVisible component within its Container.
y - the y-coordinate of the HVisible component within its Container.
width - the width of the HVisible component in pixels.
height - the height of the HVisible component in pixels.
Method Detail

isFocusTraversable

public boolean isFocusTraversable()
By default an HVisible component is not focus-traversable.

Returns:
false
See Also:
Component.isFocusTraversable()

paint

public void paint(java.awt.Graphics g)
Draws the current state of the component, by calling the HLook.showLook(java.awt.Graphics, org.havi.ui.HVisible, int) method of the associated HLook. If no HLook is associated with the component, (i.e. the HVisible was created with a null HLook or the look has been set to null using setLook(org.havi.ui.HLook)) then the paint method should do nothing. This mechanism may be used for components that wish to extend HVisible, and override the paint method, without supporting the HLook interface.

Parameters:
g - the graphics context to use for painting.

update

public void update(java.awt.Graphics g)
The update() method in HVisible overrides that in Component and does not clear the background of the component, it simply modifies the current Color of the Graphics object to match that of the components background Color, and calls the paint() method.

Parameters:
g - the graphics context to use for updating.

setTextContent

public void setTextContent(java.lang.String string,
                           int state)
Sets a single piece of text content for this component, per state. Different (single pieces of) content can be associated with the different states of a component.

If the HVisible has an associated HLook, then it should repaint itself.

Parameters:
string - The content. If the content is null, then any currently assigned content shall be removed for the specified state.
state - The state of the component for which this content should be displayed. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.

setGraphicContent

public void setGraphicContent(java.awt.Image image,
                              int state)
Sets a single piece of graphical content for this component, per state. Different (single pieces of) content can be associated with the different states of a component.

Note that the content is not copied, merely its object reference.

If the HVisible has an associated HLook, then it should repaint itself.

Parameters:
image - The content. If the content is null, then any currently assigned content shall be removed for the specified state.
state - The state of the component for which this content should be displayed. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.

setAnimateContent

public void setAnimateContent(java.awt.Image[] imageArray,
                              int state)
Sets an array of graphical content (primarily used for animation), per state. Different (single arrays of) content can be associated with the different states of a component.

Note that the content is not copied, merely its object reference.

If the HVisible has an associated HLook, then it should repaint itself.

Parameters:
imageArray - An array of images that make up the animation. If the array is null, then any currently assigned content shall be removed for the specified state.
state - The state of the component for which this content should be displayed. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.

setContent

public void setContent(java.lang.Object object,
                       int state)
Sets a single piece of content for this component, per state. Different (single pieces of) content can be associated with the different states of a component.

Note that the content is not copied, merely its object reference.

If the HVisible has an associated HLook, then it should repaint itself.

Parameters:
object - The content. If the content is null, then any currently assigned content shall be removed for the specified state.
state - The state of the component for which this content should be displayed. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.

getTextContent

public java.lang.String getTextContent(int state)
Gets the text content for this component.

Parameters:
state - The state for which content is to be retrieved. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.
Returns:
The text content associated with the specified state. If no text content has been set for the specified state, then null is returned.

getGraphicContent

public java.awt.Image getGraphicContent(int state)
Gets the graphic content for this component.

Parameters:
state - The state for which content is to be retrieved. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.
Returns:
The graphical content associated with the specified state. If no graphical content has been set for the specified state, then null is returned.

getAnimateContent

public java.awt.Image[] getAnimateContent(int state)
Gets the animate content for this component.

Parameters:
state - The state for which content is to be retrieved. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.
Returns:
The animate content associated with the specified state. If no animate content has been set for the specified state, then null is returned.

getContent

public java.lang.Object getContent(int state)
Gets the content for this component.

Parameters:
state - The state for which content is to be retrieved. Note that content is set on the XXX_STATE constants defined in HState, and not on the XXX_STATE_BIT constants. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.
Returns:
The content associated with the specified state. If no content has been set for the specified state, then null is returned.

setLook

public void setLook(HLook hlook)
             throws HInvalidLookException
Sets the HLook for this component.

Parameters:
hlook - The HLook that is to be used for this component. Note that this parameter may be null, in which case the component will not draw itself until a look is set.
Throws:
HInvalidLookException - If the Look is not compatible with this type of component, for example a graphic look being set on a text component, an HInvalidLookException is thrown. Note that HVisible itself will never throw this exception, but it may be thrown by a subclass which has overridden this method.

getLook

public HLook getLook()
Gets the HLook for this component.

Returns:
the HLook that is being used by this component - if no HLook has been set, then returns null.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of the HVisible. The getPreferredSize method of the HLook that is associated with this HVisible will be called to calculate the dimensions.

Returns:
A dimension object indicating this HVisible's preferred size - if no HLook has been associated with the HVisible, then the current HVisible dimensions as determined with getSize will be returned.
See Also:
HLook.getPreferredSize(org.havi.ui.HVisible)

getMaximumSize

public java.awt.Dimension getMaximumSize()
Gets the maximum size of the HVisible. The getMaximumSize method of the HLook that is associated with this HVisible will be called to calculate the dimensions.

Returns:
A dimension object indicating this HVisible's maximum size - if no HLook has been associated with the HVisible, then the current HVisible dimensions as determined with getSize will be returned.
See Also:
HLook.getMaximumSize(org.havi.ui.HVisible)

getMinimumSize

public java.awt.Dimension getMinimumSize()
Gets the minimum size of the HVisible. The getMinimumSize method of the HLook that is associated with this HVisible will be called to calculate the dimensions.

Returns:
A dimension object indicating this HVisible's minimum size - if no HLook has been associated with the HVisible, then the current HVisible dimensions as determined with getSize will be returned.
See Also:
HLook.getMinimumSize(org.havi.ui.HVisible)

setInteractionState

protected void setInteractionState(int state)
Set the interaction state for this component. This method is provided for the use by subclasses of HVisible to change the interaction state of the HVisible. Subclasses MUST NOT manipulate the state by any other mechanism.

Attempts to set states which are not valid for the subclass will cause an java.lang.IllegalArgumentException to be thrown. See the class descriptions of each component for the definitions of which states are valid.

Parameters:
state - the interaction state for this component. A java.lang.IllegalArgumentException will be thrown if a STATE_BIT rather than a STATE is passed.
See Also:
HState

getInteractionState

public int getInteractionState()
Return the interaction state the component is currently in.

Returns:
the interaction state the component is currently in.
See Also:
HState

setTextLayoutManager

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

Parameters:
manager - the HTextLayoutManager to be used by this component.

getTextLayoutManager

public HTextLayoutManager getTextLayoutManager()
Gets the text layout manager that is being used to layout this text.

Returns:
The HTextLayoutManager that is being used by this component.

getBackgroundMode

public int getBackgroundMode()
Get the background mode of this HVisible. The return value specifies how the look should draw the background (i.e. a rectangle filling the bounds of the HVisible).

Returns:
one of NO_BACKGROUND_FILL or BACKGROUND_FILL.

setBackgroundMode

public void setBackgroundMode(int mode)
Set the background drawing mode. The value specifies how the look should draw the background (i.e. a rectangle filling the bounds of the HVisible).

Parameters:
mode - one of NO_BACKGROUND_FILL or BACKGROUND_FILL

isOpaque

public boolean isOpaque()
Returns true if the entire HVisible area, as given by the java.awt.Component#getBounds method, is fully opaque, i.e. its HLook guarantees that all pixels are painted in an opaque Color.

This method will call the HLook.isOpaque(org.havi.ui.HVisible) method of an associated HLook if one is set. If no HLook is associated this method returns false.

The default return value is implementation specific and depends on the background painting mode of the given HVisible. The consequences of an invalid overridden value are implementation specific.

Specified by:
isOpaque in interface TestOpacity
Overrides:
isOpaque in class HComponent
Returns:
true if all the pixels with the java.awt.Component#getBounds method are fully opaque, i.e. its associated HLook guarantees that all pixels are painted in an opaque Color.

setDefaultSize

public void setDefaultSize(java.awt.Dimension defaultSize)
Set the preferred default size for this component when a layout manager is in use.

Note that the size set with this method is not a guaranteed size; if set it will be passed to the layout manager through the HLook.getPreferredSize(org.havi.ui.HVisible) method. The default size of a component is to be interpreted as the area in which the component can be rendered, excluding look-specific borders.

Valid arguments include NO_DEFAULT_SIZE, and Dimensions containing NO_DEFAULT_WIDTH or NO_DEFAULT_HEIGHT.

Parameters:
defaultSize - specifies the default preferred size. If this parameter is null a java.lang.NullPointerException will be thrown.

If this parameter specifies a size smaller than an implementation-defined minimum size, the preferred size of this component shall be set to that implementation-defined minimum size.


getDefaultSize

public java.awt.Dimension getDefaultSize()
Returns the default preferred size to be used for this component when a layout manager is in use. If no default size has been set using the setDefaultSize(java.awt.Dimension) method NO_DEFAULT_SIZE is returned.

If the parent Container into which the HVisible is placed has no layout manager the default preferred size has no effect.

The default size of a component is to be interpreted as the area in which the component can be rendered, excluding look-specific borders.

Returns:
the default preferred size to be used for this component when a layout manager is in use.

getLookData

public java.lang.Object getLookData(java.lang.Object key)
Retrieve a look-specific private data object. Instances of HLook may use this method to retrieve private data (e.g. layout hints, cached images etc.) from the HVisible. Use of this mechanism is an implementation option. If this mechanism is not used by an implementation, or no data has been set for the specified key this method returns null.

Parameters:
key - an object which uniquely identifies the type of look for which the private data is to be retrieved. Keys need not be unique across different instances of the same look class.
Returns:
a private data object as previously set using setLookData(java.lang.Object, java.lang.Object), or null.
See Also:
HLook, setLookData(java.lang.Object, java.lang.Object)

setLookData

public void setLookData(java.lang.Object key,
                        java.lang.Object data)
Set a look-specific private data object. Instances of HLook may use this method to set private data (e.g. layout hints, cached images etc.) on the HVisible. Use of this mechanism is an implementation option. If this mechanism is not used by an implementation, this method will have no effect and calls to getLookData(java.lang.Object) shall return null. If for this specified key a data object has been set,the old data object shall be replaced with the new one.

Parameters:
key - an object which uniquely identifies the type of look for which the private data is to be retrieved. Keys need not be unique across different instances of the same look class.
data - a private data object, or null to remove any current object set on this HVisible.
See Also:
HLook, getLookData(java.lang.Object)

setHorizontalAlignment

public void setHorizontalAlignment(int halign)
Set the horizontal alignment of any state-based content rendered by an associated HLook. If content is not used in the rendering of this HVisible calls to this method shall change the current alignment mode, but this will not affect the rendered representation.

Parameters:
halign - the new horizontal alignment mode, one of HALIGN_LEFT, HALIGN_CENTER, HALIGN_RIGHT or HALIGN_JUSTIFY.

setVerticalAlignment

public void setVerticalAlignment(int valign)
Set the vertical alignment of any state-based content rendered by an associated HLook. If content is not used in the rendering of this HVisible calls to this method shall change the current alignment mode, but this will not affect the rendered representation.

Parameters:
valign - the new vertical alignment mode, one of VALIGN_TOP, VALIGN_CENTER, VALIGN_BOTTOM or VALIGN_JUSTIFY.

getHorizontalAlignment

public int getHorizontalAlignment()
Get the horizontal alignment of any state-based content rendered by an associated HLook. If content is not used in the rendering of this HVisible the value returned shall be valid, but has no affect on the rendered representation.

Returns:
the current horizontal alignment mode, one of HALIGN_LEFT, HALIGN_CENTER, HALIGN_RIGHT or HALIGN_JUSTIFY.

getVerticalAlignment

public int getVerticalAlignment()
Get the vertical alignment of any state-based content rendered by an associated HLook. If content is not used in the rendering of this HVisible the value returned shall be valid, but has no affect on the rendered representation.

Returns:
the current vertical alignment mode, one of VALIGN_TOP, VALIGN_CENTER, VALIGN_BOTTOM or VALIGN_JUSTIFY.

setResizeMode

public void setResizeMode(int resize)
Set the resize mode of this HVisible. If the associated HLook does not render content or if scaling is not supported, changing the mode may have no visible effect.

Parameters:
resize - the new scaling mode, one of RESIZE_NONE, RESIZE_PRESERVE_ASPECT or RESIZE_ARBITRARY

getResizeMode

public int getResizeMode()
Get the scaling mode for scaling any state-based content rendered by an associated HLook. If content is not used in the rendering of this HVisible the value returned shall be valid, but has no affect on the rendered representation.

Returns:
the current scaling mode, one of RESIZE_NONE, RESIZE_PRESERVE_ASPECT or RESIZE_ARBITRARY

setEnabled

public void setEnabled(boolean b)
Modifies the HState of this HVisible by calling setInteractionState, depending on the value of b. This method should invoke the superclass method.

Overrides:
setEnabled in class HComponent
Parameters:
b - If true, this HVisible is enabled; otherwise this HVisible is disabled.

setBordersEnabled

public void setBordersEnabled(boolean enable)
The method en- or disables rendering of platform-specific borders. If enable is true, the associated HLook may render borders, if supported. If the specified parameter is false, no borders will be rendered and the whole area is available to the content Additionally, all values of the insets objects returned by HLook.getInsets(org.havi.ui.HVisible) will be zero.

The setting shall only be used by HAnimateLook, HGraphicLook and HTextLook. Only for these looks shall HLook.widgetChanged(org.havi.ui.HVisible, org.havi.ui.HChangeData[]) with BORDER_CHANGE be called. All other looks shall ignore this value and the method shall not be called. The behavior of third party looks is not defined. The default value is true.

Parameters:
enable - the new border mode to enable or disable border rendering
See Also:
getBordersEnabled()

getBordersEnabled

public boolean getBordersEnabled()
Returns the current border mode. Applications should rather call HLook.getInsets(org.havi.ui.HVisible) to find out, if any borders are rendered.

Returns:
the current border mode
See Also:
setBordersEnabled(boolean)