org.havi.ui
Interface HExtendedLook

All Superinterfaces:
java.lang.Cloneable, HLook
All Known Implementing Classes:
HAnimateLook, HGraphicLook, HListGroupLook, HRangeLook, HSinglelineEntryLook, HTextLook

public interface HExtendedLook
extends HLook

The HExtendedLook interface is derived from the HLook interface and abstracts out the drawing of the look into separate background, border and visible data components. The interface allows the programmer to derive new looks from the default looks and have control over which component parts are drawn. This aids interoperability between platforms since no two manufacturer's HLook implementation look the same.

Since:
MHP 1.0.3/1.1.1
See Also:
HVisible.setLook(org.havi.ui.HLook), HVisible.setLookData(java.lang.Object, java.lang.Object), HVisible.paint(java.awt.Graphics), HVisible.setBackgroundMode(int), HVisible.setHorizontalAlignment(int), HVisible.setVerticalAlignment(int), HVisible.setResizeMode(int), HTextLook, HGraphicLook, HAnimateLook, HRangeLook, HSinglelineEntryLook, HMultilineEntryLook

Method Summary
 void fillBackground(java.awt.Graphics g, HVisible visible, int state)
          The fillBackground(java.awt.Graphics, org.havi.ui.HVisible, int) method paints the component with its current background Color according to the HVisible.setBackgroundMode(int) method of HVisible.
 void renderBorders(java.awt.Graphics g, HVisible visible, int state)
          The renderBorders(java.awt.Graphics, org.havi.ui.HVisible, int) method paints any implementation specific borders according to the HVisible.setBordersEnabled(boolean) method of HVisible.
 void renderVisible(java.awt.Graphics g, HVisible visible, int state)
          The renderVisible(java.awt.Graphics, org.havi.ui.HVisible, int) method paints any content or other data associated with the look's HVisible.
 void showLook(java.awt.Graphics g, HVisible visible, int state)
          The showLook method is the entry point for repainting the entire HVisible component.
 
Methods inherited from interface org.havi.ui.HLook
getInsets, getMaximumSize, getMinimumSize, getPreferredSize, isOpaque, widgetChanged
 

Method Detail

fillBackground

public void fillBackground(java.awt.Graphics g,
                           HVisible visible,
                           int state)
The fillBackground(java.awt.Graphics, org.havi.ui.HVisible, int) method paints the component with its current background Color according to the HVisible.setBackgroundMode(int) method of HVisible.

This method is only called from showLook within this HExtendedLook implementation. It's not the intention to call this method directly from outside of the HExtendedLook.

Regardless of the background mode, it is an implementation option for this method to render added decorations which may affect the look's transparency. This method shall not be used to render any HVisible related data or content associated with the HVisible. It is purely for background and decoration only.

The fillBackground method should not modify the clipRect (clipping rectangle) of the Graphics object that is passed to it in a way which includes any area not part of that original clipRect. If any modifications are made, the original clipRect shall be restored.

Parameters:
g - the graphics context.
visible - the visible.
state - the state parameter indicates the state of the visible
Since:
MHP 1.0.3/1.1.1
See Also:
HLook.isOpaque(org.havi.ui.HVisible)

renderBorders

public void renderBorders(java.awt.Graphics g,
                          HVisible visible,
                          int state)
The renderBorders(java.awt.Graphics, org.havi.ui.HVisible, int) method paints any implementation specific borders according to the HVisible.setBordersEnabled(boolean) method of HVisible. If borders are drawn, the border decoration shall be rendered within the border area as returned by getInsets. The behavior of this method, when a subclass overrides the method getInsets is undefined, except that it will never draw outside the border area as returned by getInsets.

This method is only called from showLook within this HExtendedLook implementation. It's not the intention to call this method directly from outside of the HExtendedLook.

The renderBorders(java.awt.Graphics, org.havi.ui.HVisible, int) method should not modify the clipRect (clipping rectangle) of the Graphics object that is passed to it in a way which includes any area not part of that original clipRect. If any modifications are made, the original clipRect shall be restored.

Parameters:
g - the graphics context.
visible - the visible.
state - the state parameter indicates the state of the visible
Since:
MHP 1.0.3/1.1.1

renderVisible

public void renderVisible(java.awt.Graphics g,
                          HVisible visible,
                          int state)
The renderVisible(java.awt.Graphics, org.havi.ui.HVisible, int) method paints any content or other data associated with the look's HVisible. This method shall not be used to render a background nor any other decoration. Its purpose is purely to render content or other value data stored on the HVisible. This may be set via HVisible methods such as setTextContent and setGraphicContent. Rendering shall take place within the bounds returned by the getInsets method.

This method is only called from showLook within this HExtendedLook implementation. It's not the intention to call this method directly from outside of the HExtendedLook.

For looks which draw content (e.g. HTextLook, HGraphicLook and HAnimateLook), if no content is associated with the component, this method does nothing.

The renderVisible(java.awt.Graphics, org.havi.ui.HVisible, int) method should not modify the clipRect (clipping rectangle) of the Graphics object that is passed to it in a way which includes any area not part of that original clipRect. If any modifications are made, the original clipRect shall be restored.

Parameters:
g - the graphics context.
visible - the visible.
state - the state parameter indicates the state of the visible
Since:
MHP 1.0.3/1.1.1

showLook

public void showLook(java.awt.Graphics g,
                     HVisible visible,
                     int state)
The showLook method is the entry point for repainting the entire HVisible component. This method delegates the responsibility of drawing the component background, borders and any HVisible related data or content to the fillBackground, renderVisible and renderBorders methods respectively, subject to the clipping rectangle of the Graphics object passed to it. This method shall call the methods fillBackground, renderVisible, and renderBorders in that order and shall not do any rendering itself.

The showLook method should not modify the clipRect (clipping rectangle) of the Graphics object that is passed to it in a way which includes any area not part of that original clipRect. If any modifications are made, the original clipRect shall be restored.

Any resources explicitly associated with an HExtendedLook should be loaded by the HExtendedLook during its creation, etc. Note that the "standard" looks don't load content by default.

This method is called from the HVisible.paint(java.awt.Graphics) method of HVisible and must never be called from elsewhere. Components wishing to redraw themselves should call their repaint method in the usual way.

Specified by:
showLook in interface HLook
Parameters:
g - the graphics context.
visible - the visible.
state - the state parameter indicates the state of the visible, allowing the look to render the appropriate content for that state. Note that some components (e.g. HStaticRange, HRange, HRangeValue) do not use state-based content.