ucar.unidata.ui
Class ChooserPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ucar.unidata.ui.ChooserPanel
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
IdvChooser, SoundingSelector

public class ChooserPanel
extends JPanel
implements ActionListener

Common class for the chooser panels

Version:
$Id: ChooserPanel.java,v 1.34 2007/07/27 13:52:12 jeffmc Exp $
Author:
Unidata Metapps development team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JButton cancelButton
          Cancel button
static String CMD_LOAD
          Text for the load button
protected  JComponent contents
          Panel holding the contents
protected static Insets GRID_INSETS
          Used by derived classes when they do a GuiUtils.doLayout
protected static int GRID_SPACING
          The spacing used in the grid layout
protected  boolean haveData
          Flag for whether data has been chosen or not
protected  String helpPath
          Where can we find help for this panel
protected  JButton loadButton
          Load button
static Color MAP_COLOR
          The color for station maps
protected  boolean simpleMode
          _more_
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ChooserPanel()
          Construct an object for selecting a data source from the current directory and from a default ADDE server
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Receive the update,cancel, load commands and call: doUpdate, doCancel or doLoad.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void clearWaitCursor()
          Clear any outstanding cursor waits
 void doCancel()
          Gets called when the user presses Cancel in multipleSelect mode This can get overwritten by a derived class to do something.
protected  void doClose()
          Gets called to close the panel
 void doHelp()
          Gets called when the user presses the Help button.
 void doLoad()
          Gets called when the user presses CMD_LOAD button.
 void doLoadInThread()
          Gets called by doLoad in a thread when the user presses the load button.
protected  JComponent doMakeContents()
          _more_
 void doUpdate()
          Gets called when the user presses the Update button.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Fires a PropertyChangeEvent.
protected  String[] getButtonLabels()
          Get the names for the buttons.
 JComponent getContents()
          Hides the fact that this is really a JPanel
 JComponent getDefaultButtons()
          Get the default buttons for this chooser panel.
 JComponent getDefaultButtons(ActionListener listener)
          _more_
 boolean getHaveData()
           
protected  String getLoadCommandName()
          This allows for derived classes to define their own name for the "Add source" button.
protected  String getLoadToolTip()
          Get the tooltip for the load button
 boolean getSimpleMode()
          _more_
protected  JComponent getStatusComponent()
          _more_
protected  JLabel getStatusLabel()
          Create (if needed) and return the JLabel that shows the status messages.
protected  String getUpdateToolTip()
          Get the tooltip for the update button
 void logException(String msg, Exception exc)
          Convenience method to LogUtil.logException(String, Throwable).
protected  JComponent registerStatusComp(String name, JComponent comp)
          _more_
 void revalidate()
          _more_
 void setHaveData(boolean have)
          Set whether the user has made a selection that contains data.
 void setHelpPath(String path)
          Set the help path used for this chooser.
 void setStatus(String msg)
          Set the status message.
 void setStatus(String msg, String compId)
          _more_
 void showNormalCursor()
          Set the normal cursor over this panel
 void showWaitCursor()
          Set the wait cursor over this panel
protected  void updateStatus()
          _more_
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GRID_SPACING

protected static final int GRID_SPACING
The spacing used in the grid layout

See Also:
Constant Field Values

GRID_INSETS

protected static final Insets GRID_INSETS
Used by derived classes when they do a GuiUtils.doLayout


MAP_COLOR

public static final Color MAP_COLOR
The color for station maps


CMD_LOAD

public static final String CMD_LOAD
Text for the load button

See Also:
Constant Field Values

helpPath

protected String helpPath
Where can we find help for this panel


contents

protected JComponent contents
Panel holding the contents


loadButton

protected JButton loadButton
Load button


cancelButton

protected JButton cancelButton
Cancel button


haveData

protected boolean haveData
Flag for whether data has been chosen or not


simpleMode

protected boolean simpleMode
_more_

Constructor Detail

ChooserPanel

public ChooserPanel()
Construct an object for selecting a data source from the current directory and from a default ADDE server

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener.

Overrides:
addPropertyChangeListener in class Container
Parameters:
listener - The PropertyChangeListener to add.

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Fires a PropertyChangeEvent.

Overrides:
firePropertyChange in class Component
Parameters:
propertyName - The name of the property.
oldValue - The old value of the property.
newValue - The new Value of the property.

revalidate

public void revalidate()
_more_

Overrides:
revalidate in class JComponent

registerStatusComp

protected JComponent registerStatusComp(String name,
                                        JComponent comp)
_more_

Parameters:
name - _more_
comp - _more_
Returns:
_more_

setStatus

public void setStatus(String msg)
Set the status message.

Parameters:
msg - The status message

getSimpleMode

public boolean getSimpleMode()
_more_

Returns:
_more_

setStatus

public void setStatus(String msg,
                      String compId)
_more_

Parameters:
msg - _more_
compId - _more_

getStatusLabel

protected JLabel getStatusLabel()
Create (if needed) and return the JLabel that shows the status messages.

Returns:
The status label

getStatusComponent

protected JComponent getStatusComponent()
_more_

Returns:
_more_

actionPerformed

public void actionPerformed(ActionEvent ae)
Receive the update,cancel, load commands and call: doUpdate, doCancel or doLoad.

Specified by:
actionPerformed in interface ActionListener
Parameters:
ae - ActionEvent to process

getLoadCommandName

protected String getLoadCommandName()
This allows for derived classes to define their own name for the "Add source" button.

Returns:
custom name

getDefaultButtons

public JComponent getDefaultButtons()
Get the default buttons for this chooser panel.

Returns:
panel of buttons

getDefaultButtons

public JComponent getDefaultButtons(ActionListener listener)
_more_

Parameters:
listener - _more_
Returns:
_more_

getButtonLabels

protected String[] getButtonLabels()
Get the names for the buttons.

Returns:
array of button names

getLoadToolTip

protected String getLoadToolTip()
Get the tooltip for the load button

Returns:
The tooltip for the load button

getUpdateToolTip

protected String getUpdateToolTip()
Get the tooltip for the update button

Returns:
The tooltip for the update button

setHaveData

public void setHaveData(boolean have)
Set whether the user has made a selection that contains data.

Parameters:
have - true to set the haveData property. Enables the loading button

getHaveData

public boolean getHaveData()

clearWaitCursor

public void clearWaitCursor()
Clear any outstanding cursor waits


showWaitCursor

public void showWaitCursor()
Set the wait cursor over this panel


showNormalCursor

public void showNormalCursor()
Set the normal cursor over this panel


getContents

public JComponent getContents()
Hides the fact that this is really a JPanel

Returns:
the contents

doMakeContents

protected JComponent doMakeContents()
_more_

Returns:
_more_

updateStatus

protected void updateStatus()
_more_


doLoad

public void doLoad()
Gets called when the user presses CMD_LOAD button. This can get overwritten by a derived class to do something. By default this calls doLoadDataInThread in a separate thread


doLoadInThread

public void doLoadInThread()
Gets called by doLoad in a thread when the user presses the load button. Should be overwritten by a derived class.


doUpdate

public void doUpdate()
Gets called when the user presses the Update button. This can get overwritten by a derived class to do something.


doHelp

public void doHelp()
Gets called when the user presses the Help button.


doCancel

public void doCancel()
Gets called when the user presses Cancel in multipleSelect mode This can get overwritten by a derived class to do something.


doClose

protected void doClose()
Gets called to close the panel


logException

public void logException(String msg,
                         Exception exc)
Convenience method to LogUtil.logException(String, Throwable).

Parameters:
msg - message to log
exc - Exception to log

setHelpPath

public void setHelpPath(String path)
Set the help path used for this chooser.

Parameters:
path -