Class ChooserPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
IdvChooser

public class ChooserPanel extends JPanel implements ActionListener
Common class for the chooser panels.
Author:
Unidata Metapps development team
See Also:
  • Field Details

    • GRID_SPACING

      protected static final int GRID_SPACING
      The spacing used in the grid layout.
      See Also:
    • GRID_SPACING_V

      protected static final int GRID_SPACING_V
      The Constant GRID_SPACING_V.
      See Also:
    • GRID_SPACING_H

      protected static final int GRID_SPACING_H
      The Constant GRID_SPACING_H.
      See Also:
    • 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:
    • 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.
    • statusLabel

      protected JLabel 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

      public void setMessageTemplate(String template)
      Sets the message template.
      Parameters:
      template - the new message template
    • getMessageTemplate

      protected String getMessageTemplate()
      Gets the message template.
      Returns:
      the message template
    • 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()
      Overrides:
      revalidate in class JComponent
    • registerStatusComp

      protected JComponent registerStatusComp(String name, JComponent comp)
      Register status comp.
      Parameters:
      name - the name
      comp - the comp
      Returns:
      the JComponent
    • setStatus

      public void setStatus(String msg)
      Set the status message.
      Parameters:
      msg - The status message
    • getSimpleMode

      public boolean getSimpleMode()
      Gets the simple mode.
      Returns:
      the simple mode
    • setStatus

      public void setStatus(String msg, String compId)
      Sets the status.
      Parameters:
      msg - the msg
      compId - the comp id
    • getStatusLabel

      protected JLabel getStatusLabel()
      Create (if needed) and return the JLabel that shows the status messages.
      Returns:
      The status label
    • getStatusLabelBackground

      public Color getStatusLabelBackground()
      Gets the status label background.
      Returns:
      the status label background
    • getStatusLabelForeground

      public Color getStatusLabelForeground()
      Gets the status label foreground.
      Returns:
      the status label foreground
    • getStatusComponent

      protected JComponent getStatusComponent()
      Gets the status component.
      Returns:
      the status component
    • 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)
      Gets the default buttons.
      Parameters:
      listener - the listener
      Returns:
      the default buttons
    • canDoUpdate

      public boolean canDoUpdate()
      Can do update.
      Returns:
      true, if successful
    • 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()
      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

      public void showWaitCursor(JComponent comp)
      Set the wait cursor over this panel.
      Parameters:
      comp - the comp
    • showNormalCursor

      public void showNormalCursor(JComponent comp)
      Set the normal cursor over this panel.
      Parameters:
      comp - the comp
    • padLabel

      public JComponent padLabel(String s)
      Pad label.
      Parameters:
      s - the string
      Returns:
      the JComponent
    • getContents

      public JComponent getContents()
      Hides the fact that this is really a JPanel.
      Returns:
      the contents
    • doMakeContents

      protected JComponent doMakeContents()
      Do make contents.
      Returns:
      the JComponent
    • updateStatus

      protected void updateStatus()
      Update status.
    • 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)
      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 - the new help path