Package ucar.unidata.ui
Class ChooserPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ucar.unidata.ui.ChooserPanel
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
- Direct Known Subclasses:
IdvChooser
Common class for the chooser panels.
- Author:
- Unidata Metapps development team
- See Also:
-
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JButton
Cancel button.static final String
Text for the load button.protected JComponent
Panel holding the contents.protected static final Insets
Used by derived classes when they do a GuiUtils.doLayoutprotected static final int
The spacing used in the grid layout.protected static final int
The Constant GRID_SPACING_H.protected static final int
The Constant GRID_SPACING_V.protected boolean
Flag for whether data has been chosen or not.protected String
Where can we find help for this panel.protected JButton
Load button.static final Color
The color for station maps.protected boolean
_more_.protected JLabel
Shows the status.Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
ConstructorsConstructorDescriptionConstruct an object for selecting a data source from the current directory and from a default ADDE server. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Receive the update,cancel, load commands and call: doUpdate, doCancel or doLoad.void
Adds a PropertyChangeListener.boolean
Can do update.void
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 pressesCMD_LOAD
button.void
Gets called by doLoad in a thread when the user presses the load button.protected JComponent
Do make contents.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[]
Get the names for the buttons.Hides the fact that this is really a JPanel.Get the default buttons for this chooser panel.getDefaultButtons
(ActionListener listener) Gets the default buttons.boolean
Gets the have data.protected String
This allows for derived classes to define their own name for the "Add source" button.protected String
Get the tooltip for the load button.protected String
Gets the message template.boolean
Gets the simple mode.protected JComponent
Gets the status component.protected JLabel
Create (if needed) and return the JLabel that shows the status messages.Gets the status label background.Gets the status label foreground.protected String
Get the tooltip for the update button.void
logException
(String msg, Exception exc) Convenience method toLogUtil.logException(String, Throwable)
.Pad label.protected JComponent
registerStatusComp
(String name, JComponent comp) Register status comp.void
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
setMessageTemplate
(String template) Sets the message template.void
Set the status message.void
Sets the status.void
Set the normal cursor over this panel.void
showNormalCursor
(JComponent comp) Set the normal cursor over this panel.void
Set the wait cursor over this panel.void
showWaitCursor
(JComponent comp) Set the wait cursor over this panel.protected void
Update status.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, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
GRID_SPACING
protected static final int GRID_SPACINGThe spacing used in the grid layout.- See Also:
-
GRID_SPACING_V
protected static final int GRID_SPACING_VThe Constant GRID_SPACING_V.- See Also:
-
GRID_SPACING_H
protected static final int GRID_SPACING_HThe Constant GRID_SPACING_H.- See Also:
-
GRID_INSETS
Used by derived classes when they do a GuiUtils.doLayout -
MAP_COLOR
The color for station maps. -
CMD_LOAD
Text for the load button.- See Also:
-
helpPath
Where can we find help for this panel. -
contents
Panel holding the contents. -
loadButton
Load button. -
cancelButton
Cancel button. -
haveData
protected boolean haveDataFlag for whether data has been chosen or not. -
statusLabel
Shows the status. -
simpleMode
protected boolean simpleMode_more_.
-
-
Constructor Details
-
ChooserPanel
public ChooserPanel()Construct an object for selecting a data source from the current directory and from a default ADDE server.
-
-
Method Details
-
setMessageTemplate
Sets the message template.- Parameters:
template
- the new message template
-
getMessageTemplate
Gets the message template.- Returns:
- the message template
-
addPropertyChangeListener
Adds a PropertyChangeListener.- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
listener
- The PropertyChangeListener to add.
-
firePropertyChange
Fires a PropertyChangeEvent.- Overrides:
firePropertyChange
in classComponent
- 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()- Overrides:
revalidate
in classJComponent
-
registerStatusComp
Register status comp.- Parameters:
name
- the namecomp
- the comp- Returns:
- the JComponent
-
setStatus
Set the status message.- Parameters:
msg
- The status message
-
getSimpleMode
public boolean getSimpleMode()Gets the simple mode.- Returns:
- the simple mode
-
setStatus
Sets the status.- Parameters:
msg
- the msgcompId
- the comp id
-
getStatusLabel
Create (if needed) and return the JLabel that shows the status messages.- Returns:
- The status label
-
getStatusLabelBackground
Gets the status label background.- Returns:
- the status label background
-
getStatusLabelForeground
Gets the status label foreground.- Returns:
- the status label foreground
-
getStatusComponent
Gets the status component.- Returns:
- the status component
-
actionPerformed
Receive the update,cancel, load commands and call: doUpdate, doCancel or doLoad.- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
ae
- ActionEvent to process
-
getLoadCommandName
This allows for derived classes to define their own name for the "Add source" button.- Returns:
- custom name
-
getDefaultButtons
Get the default buttons for this chooser panel.- Returns:
- panel of buttons
-
getDefaultButtons
Gets the default buttons.- Parameters:
listener
- the listener- Returns:
- the default buttons
-
canDoUpdate
public boolean canDoUpdate()Can do update.- Returns:
- true, if successful
-
getButtonLabels
Get the names for the buttons.- Returns:
- array of button names
-
getLoadToolTip
Get the tooltip for the load button.- Returns:
- The tooltip for the load button
-
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()Gets the have data.- Returns:
- the have data
-
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. -
showWaitCursor
Set the wait cursor over this panel.- Parameters:
comp
- the comp
-
showNormalCursor
Set the normal cursor over this panel.- Parameters:
comp
- the comp
-
padLabel
Pad label.- Parameters:
s
- the string- Returns:
- the JComponent
-
getContents
Hides the fact that this is really a JPanel.- Returns:
- the contents
-
doMakeContents
Do make contents.- Returns:
- the JComponent
-
updateStatus
protected void updateStatus()Update status. -
doLoad
public void doLoad()Gets called when the user pressesCMD_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
Convenience method toLogUtil.logException(String, Throwable)
.- Parameters:
msg
- message to logexc
- Exception to log
-
setHelpPath
Set the help path used for this chooser.- Parameters:
path
- the new help path
-