Side of Software
Marker Bar Library 1.0

sos.marker
Class BasicMarkerBarUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by sos.marker.MarkerBarUI
          extended by sos.marker.BasicMarkerBarUI

public class BasicMarkerBarUI
extends MarkerBarUI

A basic implementation of the marker bar look and feel.

Since:
1.0
See Also:
JMarkerBar

Field Summary
static java.lang.String BACKGROUND_KEY
          The look-and-feel key for the default background color of a marker bar.
static java.lang.String FOREGROUND_KEY
          The look-and-feel key for the default foreground color of a marker bar.
static java.lang.String HEIGHT_KEY
          The look-and-feel key for the default height of a horizontal marker bar.
protected  JMarkerBar markerBar
          The marker bar for which this BasicMarkerBarUI is responsible.
static java.lang.String RENDERER_KEY
          The look-and-feel key for the default marker renderer for a marker bar.
protected  javax.swing.CellRendererPane rendererPane
          The renderer pane that is used to render the marker components.
static java.lang.String WIDTH_KEY
          The look-and-feel key for the default width of a vertical marker bar.
 
Constructor Summary
BasicMarkerBarUI()
          Creates an instance of BasicMarkerBarUI.
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the UI delegate for the specified component.
 java.awt.Rectangle getMarkerBounds(JMarkerBar markerBar, int markerIndex)
          Returns the rectangle for which the marker at the specified index is rendered, in the marker bar's coordinate system.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          Returns the specified component's preferred size appropriate for the look and feel.
protected  void installDefaults()
          Initializes the marker bar with its defaults.
 void installUI(javax.swing.JComponent c)
          Initializes the specified component (which must be a marker bar) by invoking installListeners() and installDefaults() and by adding the renderer pane.
 int[] locationToIndices(JMarkerBar markerBar, java.awt.Point point)
          Returns the indexes of the markers that are rendered at the specified point.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints the specified component appropriate for the look and feel.
protected  void uninstallDefaults()
          Removes the defaults set in installDefaults.
protected  void uninstallListeners()
          Unregisters the listeners registered in installListeners.
 void uninstallUI(javax.swing.JComponent c)
          Uninitializes the marker bar by invoking uninstallListeners() and uninstallDefaults().
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BACKGROUND_KEY

public static final java.lang.String BACKGROUND_KEY
The look-and-feel key for the default background color of a marker bar. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicMarkerBarUI.BACKGROUND_KEY, Color.blue );
 

See Also:
Constant Field Values

FOREGROUND_KEY

public static final java.lang.String FOREGROUND_KEY
The look-and-feel key for the default foreground color of a marker bar. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicMarkerBarUI.FOREGROUND_KEY, Color.blue );
 

See Also:
Constant Field Values

WIDTH_KEY

public static final java.lang.String WIDTH_KEY
The look-and-feel key for the default width of a vertical marker bar. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicMarkerBarUI.WIDTH_KEY, 20 );
 

See Also:
Constant Field Values

HEIGHT_KEY

public static final java.lang.String HEIGHT_KEY
The look-and-feel key for the default height of a horizontal marker bar. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicMarkerBarUI.HEIGHT_KEY, 20 );
 

See Also:
Constant Field Values

RENDERER_KEY

public static final java.lang.String RENDERER_KEY
The look-and-feel key for the default marker renderer for a marker bar. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicMarkerBarUI.RENDERER_KEY, new CustomerMarkerRenderer() );
 

See Also:
Constant Field Values

markerBar

protected JMarkerBar markerBar
The marker bar for which this BasicMarkerBarUI is responsible.


rendererPane

protected javax.swing.CellRendererPane rendererPane
The renderer pane that is used to render the marker components.

Constructor Detail

BasicMarkerBarUI

public BasicMarkerBarUI()
Creates an instance of BasicMarkerBarUI.

Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the UI delegate for the specified component.


getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Returns the specified component's preferred size appropriate for the look and feel.

Overrides:
getPreferredSize in class javax.swing.plaf.ComponentUI
Parameters:
c - the component whose preferred size is being queried; this argument is ignored.

installDefaults

protected void installDefaults()
Initializes the marker bar with its defaults.

See Also:
uninstallDefaults(), installUI(javax.swing.JComponent)

installUI

public void installUI(javax.swing.JComponent c)
Initializes the specified component (which must be a marker bar) by invoking installListeners() and installDefaults() and by adding the renderer pane.

Overrides:
installUI in class javax.swing.plaf.ComponentUI
Parameters:
c - the component for which this UI delegate is being installed
Throws:
java.lang.ClassCastException - if c is not a JMarkerBar
See Also:
uninstallUI(javax.swing.JComponent), installListeners(), installDefaults()

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints the specified component appropriate for the look and feel.

Overrides:
paint in class javax.swing.plaf.ComponentUI
Parameters:
g - the Graphics context in which to paint
c - the component being painted; this argument is ignored.

uninstallDefaults

protected void uninstallDefaults()
Removes the defaults set in installDefaults.

See Also:
installDefaults(), uninstallUI(javax.swing.JComponent)

uninstallListeners

protected void uninstallListeners()
Unregisters the listeners registered in installListeners.

See Also:
installListeners(), uninstallUI(javax.swing.JComponent)

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninitializes the marker bar by invoking uninstallListeners() and uninstallDefaults().

Overrides:
uninstallUI in class javax.swing.plaf.ComponentUI
See Also:
installUI(javax.swing.JComponent), uninstallListeners(), uninstallDefaults()

getMarkerBounds

public java.awt.Rectangle getMarkerBounds(JMarkerBar markerBar,
                                          int markerIndex)
Description copied from class: MarkerBarUI
Returns the rectangle for which the marker at the specified index is rendered, in the marker bar's coordinate system.

Specified by:
getMarkerBounds in class MarkerBarUI
Parameters:
markerBar - marker bar containing the marker in question
markerIndex - index of the marker in the marker bar's model for which the region is requested
Returns:
the rectangle where the specified marker is rendered, or null if the index is out of range

locationToIndices

public int[] locationToIndices(JMarkerBar markerBar,
                               java.awt.Point point)
Description copied from class: MarkerBarUI
Returns the indexes of the markers that are rendered at the specified point.

Specified by:
locationToIndices in class MarkerBarUI
Parameters:
markerBar - marker bar containing the markers
point - point in question
Returns:
the indexes of the markers rendered at the specified point

Side of Software
Marker Bar Library 1.0

Copyright 2009 Side of Software (SOS). All rights reserved.