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.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JButtonCancel button.static final StringText for the load button.protected JComponentPanel holding the contents.protected static final InsetsUsed by derived classes when they do a GuiUtils.doLayoutprotected static final intThe spacing used in the grid layout.protected static final intThe Constant GRID_SPACING_H.protected static final intThe Constant GRID_SPACING_V.protected booleanFlag for whether data has been chosen or not.protected StringWhere can we find help for this panel.protected JButtonLoad button.static final ColorThe color for station maps.protected boolean_more_.protected JLabelShows 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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields 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 TypeMethodDescriptionvoidReceive the update,cancel, load commands and call: doUpdate, doCancel or doLoad.voidAdds a PropertyChangeListener.booleanCan do update.voidClear any outstanding cursor waits.voiddoCancel()Gets called when the user presses Cancel in multipleSelect mode This can get overwritten by a derived class to do something.protected voiddoClose()Gets called to close the panel.voiddoHelp()Gets called when the user presses the Help button.voiddoLoad()Gets called when the user pressesCMD_LOADbutton.voidGets called by doLoad in a thread when the user presses the load button.protected JComponentDo make contents.voiddoUpdate()Gets called when the user presses the Update button.protected voidfirePropertyChange(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.booleanGets the have data.protected StringThis allows for derived classes to define their own name for the "Add source" button.protected StringGet the tooltip for the load button.protected StringGets the message template.booleanGets the simple mode.protected JComponentGets the status component.protected JLabelCreate (if needed) and return the JLabel that shows the status messages.Gets the status label background.Gets the status label foreground.protected StringGet the tooltip for the update button.voidlogException(String msg, Exception exc) Convenience method toLogUtil.logException(String, Throwable).Pad label.protected JComponentregisterStatusComp(String name, JComponent comp) Register status comp.voidvoidsetHaveData(boolean have) Set whether the user has made a selection that contains data.voidsetHelpPath(String path) Set the help path used for this chooser.voidsetMessageTemplate(String template) Sets the message template.voidSet the status message.voidSets the status.voidSet the normal cursor over this panel.voidshowNormalCursor(JComponent comp) Set the normal cursor over this panel.voidSet the wait cursor over this panel.voidshowWaitCursor(JComponent comp) Set the wait cursor over this panel.protected voidUpdate status.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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:
addPropertyChangeListenerin classContainer- Parameters:
listener- The PropertyChangeListener to add.
-
firePropertyChange
Fires a PropertyChangeEvent.- Overrides:
firePropertyChangein 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:
revalidatein 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:
actionPerformedin 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_LOADbutton. 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
-