ucar.unidata.idv.ui
Class IdvLegend

java.lang.Object
  extended by ucar.unidata.idv.ui.IdvLegend
All Implemented Interfaces:
Removable
Direct Known Subclasses:
BottomLegend, SideLegend

public abstract class IdvLegend
extends Object
implements Removable

An abstract base class used to represents display control legends for view managers.

Author:
IDV development team

Field Summary
static ImageIcon ICON_DOCKED
          _more_
static ImageIcon ICON_FLOAT
          _more_
protected static ImageIcon ICON_PROPERTIES
          The icon used to bring up the display properties window
static ImageIcon ICON_REMOVE
          Icon used to remove displays
static String STATE_DOCKED
          _more_
static String STATE_FLOAT
          _more_
static String STATE_HIDDEN
          _more_
protected  ViewManager viewManager
          The ViewManager this legend is part of
 
Constructor Summary
IdvLegend()
          Parameterless constructor for xml persistence
IdvLegend(ViewManager viewManager)
          Create the legend with the given ViewManager
 
Method Summary
 void doClose()
          The ViewManager in which thie legend is a part of has been closed.
protected abstract  JComponent doMakeContents()
          To be overrode by derived classes to return the actual GUI contents.
 void doRemove()
          _more_
 void fillLegend()
          This is called when there is a change to the list of DisplayControls shown in this legend.
protected abstract  void fillLegendSafely()
          To be overrode by derived classes to fill the legend.
 void floatLegend()
          Float the legend in its own window.
 JComponent getContainer()
          Get the Container property.
 JComponent getContents()
          Create, if needed, and return the GUI contents.
protected  JButton getFloatButton()
          Create, if needed, and return the floatButton.
protected  String getTitle()
          Get the window title to use.
protected  JButton makePropertiesButton(DisplayControl control)
          Create an icon button for showing the window for the given display control.
 void setColors(Color foreground, Color background)
          No-op.
 void setContentsToUse(JComponent contents)
          _more_
 void setTheContainer(JComponent value)
          Set the Container property.
 void setViewManager(ViewManager viewManager)
          Set the view manager that this legend is part of
 void showLegend()
          This will float the legend.
 void unFloatLegend()
          _more_
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_HIDDEN

public static final String STATE_HIDDEN
_more_

See Also:
Constant Field Values

STATE_DOCKED

public static final String STATE_DOCKED
_more_

See Also:
Constant Field Values

STATE_FLOAT

public static final String STATE_FLOAT
_more_

See Also:
Constant Field Values

ICON_FLOAT

public static final ImageIcon ICON_FLOAT
_more_


ICON_DOCKED

public static final ImageIcon ICON_DOCKED
_more_


ICON_PROPERTIES

protected static ImageIcon ICON_PROPERTIES
The icon used to bring up the display properties window


ICON_REMOVE

public static ImageIcon ICON_REMOVE
Icon used to remove displays


viewManager

protected ViewManager viewManager
The ViewManager this legend is part of

Constructor Detail

IdvLegend

public IdvLegend()
Parameterless constructor for xml persistence


IdvLegend

public IdvLegend(ViewManager viewManager)
Create the legend with the given ViewManager

Parameters:
viewManager - The view manager this legend is a part of
Method Detail

setContentsToUse

public void setContentsToUse(JComponent contents)
_more_

Parameters:
contents - _more_

getContents

public JComponent getContents()
Create, if needed, and return the GUI contents.

Returns:
The GUI contents

setViewManager

public void setViewManager(ViewManager viewManager)
Set the view manager that this legend is part of

Parameters:
viewManager - The view manager

setTheContainer

public void setTheContainer(JComponent value)
Set the Container property. This is the container in the parent ViewManager that this legend is shown in. This method is differently named from the getContainer method so that the value is not persisted when doing xml encoding.

Parameters:
value - The new value for Container

getContainer

public JComponent getContainer()
Get the Container property.

Returns:
The Container

setColors

public void setColors(Color foreground,
                      Color background)
No-op. To be overrode by any subclasses that might use the colors of the ViewManager

Parameters:
foreground - The foreground color of the ViewManager
background - The background color of the ViewManager

getFloatButton

protected JButton getFloatButton()
Create, if needed, and return the floatButton.

Returns:
The float button

showLegend

public void showLegend()
This will float the legend.


doMakeContents

protected abstract JComponent doMakeContents()
To be overrode by derived classes to return the actual GUI contents.

Returns:
The GUI contents

fillLegend

public final void fillLegend()
This is called when there is a change to the list of DisplayControls shown in this legend. It simply is a wrapper around fillLegendSafely, synchronizing on a MUTEX lock.


fillLegendSafely

protected abstract void fillLegendSafely()
To be overrode by derived classes to fill the legend. This is called from fillLegend() within a synchronized block.


makePropertiesButton

protected JButton makePropertiesButton(DisplayControl control)
Create an icon button for showing the window for the given display control.

Parameters:
control - The display control
Returns:
The button used to show the window

doClose

public void doClose()
The ViewManager in which thie legend is a part of has been closed. This method disposes of the floatFrame if it is non-null.


doRemove

public void doRemove()
_more_

Specified by:
doRemove in interface Removable

getTitle

protected String getTitle()
Get the window title to use.

Returns:
The window title

unFloatLegend

public void unFloatLegend()
_more_


floatLegend

public void floatLegend()
Float the legend in its own window.