ucar.unidata.idv.control
Class DisplayControlImpl

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.idv.control.DisplayControlBase
          extended by ucar.unidata.idv.control.DisplayControlImpl
All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, ControlListener, DisplayListener
Direct Known Subclasses:
AerologicalSoundingControl, AnimationTextControl, AudioControl, ChatLogControl, DrawingControl, GridDisplayControl, ImageMovieControl, LocationIndicatorControl, MapDisplayControl, MovieDisplayControl, MultiDisplayHolder, NoteControl, ObsDisplayControl, OmniControl, ProbeControl, ProfilerControl, RadarGridControl, RangeAndBearingControl, ShapefileControl, StormTrackControl, TextDisplayControl

public abstract class DisplayControlImpl
extends DisplayControlBase
implements DisplayControl, ActionListener, ItemListener, DataChangeListener, HyperlinkListener, DisplayListener, PropertyChangeListener, ControlListener, Prototypable

This is the main base class for all DisplayControls.

Version:
$Revision: 1.726 $
Author:
IDV development team

Nested Class Summary
static class DisplayControlImpl.SideLegendLabel
          Class SideLegendLabel Does the underline
 
Field Summary
protected  List categories
          This is the list of DataCategory-s that were defined for this DisplayControl by the idv/controls.properties and ControlDescriptor code.
protected  ColorScaleInfo colorScaleInfo
          Holds the color scale information
protected  List colorScales
          This is the color scale widget for a display
protected  ContourInfo contourInfo
          Used to hold contour information if this control is enabled for it.
protected  String contourInfoParams
          Used by the isl to override selective parameters in the default contourInfo
protected  ControlContext controlContext
          This is the context in whcih this display control exists (typically an instance of the IntegratedDataViewer but we use the ControlContext interface to keep us honest and not sloppy).
protected  ColorTableWidget ctw
          This is the color table gui widget for controls enabled for color tables
protected  ContourWidget cw
          This is the contour info gui widget for controls enabled for contours
protected  DataSelection dataSelection
          The DataSelection that holds any data subsetting specifications (e.g., time).
protected  String defaultView
          The name of the ViewManager that any displays should be added to
protected  ViewManager defaultViewManager
          This can be used to temporarily set a ViewManager that is to be used.
protected  String DISPLAY_LIST_NAME
          The name for the text type for the display list.
protected  Hashtable displayListTable
          This is the table of the view manager display list displayables
protected  List displayMasters
          Holds the DisplayMaster-s that this control wholly owns (e.g., profile display master).
protected  Unit displayUnit
          The Unit (may be null) that is used to display data.
protected  String helpUrl
          The url to show help for this control.
protected  String initNoteText
          This is the initial text note text.
protected  boolean instantiatedWithNoData
          This gets set to track when we have been re-instantiated from a bundle without any data.
protected  JTextArea noteTextArea
          The text area widget used for the control text notes
protected  JComponent noteWrapper
          The Container that holds the noteTextArea.
protected  String paramName
          The name of the parameter (if there is one)
protected  Hashtable requestProperties
          A hashtable that is used to hold extra properties that are passed to the DataChoice through the getData called.
protected  boolean settingVisibility
          A flag to check if this control is in the middle of toggling its visibility checkboxes.
protected  List sharables
          Contains a list of all Sharable objects (e.g., AnimationWidget) that are created by this control.
protected  boolean showNoteText
          Do we show the note text?
protected  JSlider skipSlider
          slider for setting skip values
protected  SelectRangeWidget srw
          This is the contour info gui widget for controls enabled for contours
protected  double version
          version
protected  List viewManagers
          Holds the ViewManager-s that this control has created.
 
Fields inherited from class ucar.unidata.idv.control.DisplayControlBase
CMD_BARBSIZE, CMD_COLORS, CMD_COLORTABLE, CMD_INTERVAL, CMD_LEVEL, CMD_LINEWIDTH, CMD_POPUP, CMD_REMOVE, DEFAULT_POINT_SIZE, DEFAULT_SAMPLING_MODE, FIND_ALL, FIND_CATEGORY, FIND_CLASS, FIND_SPECIAL, FIND_THIS, FIND_WITHDATA, FIND_WITHTHISDATA, FIND_WITHTHISFIELD, FIND_WITHTHISVIEW, FLAG_COLOR, FLAG_COLORTABLE, FLAG_COLORUNIT, FLAG_CONTOUR, FLAG_DATACONTROL, FLAG_DISPLAYUNIT, FLAG_LINEWIDTH, FLAG_NONE, FLAG_SELECTRANGE, FLAG_SKIPFACTOR, FLAG_TIMERANGE, FLAG_ZPOSITION, GRID_INSETS, ICON_LOCK, ICON_REMOVE, ICON_UNLOCK, LABEL_NONE, log_, MACRO_DATASOURCENAME, MACRO_DISPLAYNAME, MACRO_DISPLAYUNIT, MACRO_LONGNAME, MACRO_POSITION, MACRO_SHORTNAME, MACRO_TIMESTAMP, MACRO_VALUE, NEAREST_NEIGHBOR, PREF_DISPLAYLIST_TEMPLATE, PREF_EXTRALABEL_TEMPLATE, PREF_LEGENDLABEL_TEMPLATE, PROP_REMOVED, SETTINGS_GROUP_DISPLAY, SETTINGS_GROUP_FLAGS, SHARE_CHOICES, SHARE_COLOR, SHARE_COLORSCALE, SHARE_COLORTABLE, SHARE_DISPLAYUNIT, SHARE_POSITION, SHARE_SELECTRANGE, SHARE_SKIPVALUE, SHARE_TRANSECT, SHARE_VISIBILITY, WEIGHTED_AVERAGE
 
Fields inherited from interface ucar.unidata.idv.DisplayControl
BOTTOM_LEGEND, DEFAULT_PROBEFORMAT, PREF_PREFIX, PREF_PROBEFORMAT, PREF_REMOVEONWINDOWCLOSE, PREF_SAMPLING_MODE, PREF_STANDALONE_REMOVEONCLOSE, PREF_STANDALONE_REMOVEONCLOSE_ASK, PROP_LEGENDICON, SIDE_LEGEND
 
Constructor Summary
DisplayControlImpl()
          Default constructor.
DisplayControlImpl(ControlContext controlContext)
          Create a DisplayControlImple from a ControlContext
 
Method Summary
 void actionPerformed(ActionEvent event)
          Process the actions of any of the controls created with the doMake...Control method calls.
protected  void activateDisplays()
          Activate each DisplayInfo
protected  void addAttributedDisplayable(Displayable d)
          Add the given Displayable to the list of attribute displayables.
protected  void addAttributedDisplayable(Displayable d, int attributeFlags)
          Add the given Displayable to the list of displayables.
protected  void addAttributedDisplayable(Displayable d, int attributeFlags, int notGlobalFlags)
          Add the given Displayable into the list of attributed displayables managed by this DisplayControl.
protected  void addAttributeFlags(int f)
          Add the given attribute flag (e.g., FLAG_COLORTABLE) to the attrbiute flag map.
protected  void addCheckBoxSettings(List comps, Hashtable methodNameToSettingsMap)
          Add checkbox type settings to the Properties panel
 boolean addDataChoice(DataChoice c)
          Add the given DataChoice to the list of data choices and return true if this is a new DataChoice.
 ViewManager addDisplayable(Displayable d)
          Add the given Displayable into a ViewManager
 ViewManager addDisplayable(Displayable theDisplay, int attributeFlag)
          A wrapper around addDisplayable (Displayable theDisplay, ViewDescriptor viewDescriptor), passing in the default LASTACTIVE ViewDescriptor.
 ViewManager addDisplayable(Displayable theDisplay, ViewDescriptor viewDescriptor)
          Find the ViewManager defined by the given ViewDescriptor.
 ViewManager addDisplayable(Displayable theDisplay, ViewDescriptor viewDescriptor, int flag)
          Add the given Displayable into the ViewManager identified by the given ViewDescriptor
 DisplayInfo addDisplayable(Displayable theDisplay, ViewManager viewManager)
          Add the given Displayable into the given ViewManager
 ViewManager addDisplayable(Displayable theDisplay, ViewManager viewManager, int flag)
          Add the given Displayable into the given ViewManager
protected  void addDisplayMaster(DisplayMaster s)
          A sub-class can register any DisplayMaster-s created and managed by them.
protected  void addDisplaySettings(DisplaySettingsDialog dsd)
          Add property values for this DisplaySettingsDialog
protected  void addLabelMacros(String template, List patterns, List values)
          Add any macro name/value pairs.
protected  void addNewData(List newChoices)
          Called when the user chooses new data for this display
protected  void addNoteText(JPanel mainPanel, JComponent noteWrapper)
          Insert the given noteWrapper (which holds the note text TextArea) into the gui
protected  void addPropertiesComponents(JTabbedPane jtp)
          Add tabs to the properties dialog.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener.
 void addSharable(SharableImpl s)
          A sub-class can register any SharableImpl-s created and managed by them.
 void addToRangeMenu(ColorTableWidget cw, List items)
          Deprecated. use #addToRangeMenu(RangeWidget)
 void addToRangeMenu(RangeDialog srw, List items)
          Deprecated. use #addToRangeMenu(RangeWidget)
 void addToRangeMenu(RangeWidget rw, List items)
          A hook to add an entry into the range menu
protected  void addViewManager(ViewManager s)
          A sub-class can register any ViewManager-s created and managed by them.
 void appendDataChoices(List newDataChoices)
          Append the given list of DataChoice-s to the myDataChoices list
protected  void applyAttributesToDisplayables()
          Used to apply all of the display attributes taht are active to the Displayable-s
protected  void applyColor()
          If the color is non-null then apply it to the Displayables in the displayables list that are flagged with the FLAG_COLOR
protected  void applyColorScaleInfo()
          If the colorScaleInfo is non-null then apply it to the Displayables in the displayables list that are flagged with the FLAG_COLORTABLE
protected  void applyColorTable()
          If the color table is non-null then apply it to the Displayables in the displayables list that are flagged with the FLAG_COLORTABLE
protected  void applyColorUnit()
          If the color unit (gotten from a call to getUnitForColor) is non-null then apply it to the Displayables in the displayables list that are flagged with the FLAG_COLORUNIT
protected  void applyContourInfo()
          If the contourInfo is non-null then apply it to the Displayables in the displayables list that are flagged with the FLAG_CONTOUR
 void applyDisplaySetting(DisplaySetting displaySetting)
          Apply a display setting to this control
protected  void applyDisplayUnit()
          If the color unit (gotten from a call to getUnitForColor) is non-null then apply it to the Displayables in the displayables list that are flagged with the FLAG_DISPLAYUNIT
protected  void applyLineWidth()
          Apply the line width to the displayables with FLAG_LINEWIDTH set
 void applyPreferences()
          Apply preferences to this control.
 boolean applyProperties()
          Apply the properties from the dialog
protected  void applyProperties(Hashtable properties)
           
 void applyPropertyValues(List props)
          Apply the property values in the list
protected  void applyRange()
          Apply the range it to the Displayables in the displayables list that are flagged with the FLAG_COLORTABLE
protected  void applySelectRange()
          Apply the range it to the Displayables in the displayables list that are flagged with the FLAG_SELECTRANGE
protected  void applySkipFactor()
          Use the value of the skip factor to subset the data.
 void applyTimeRange()
          Called when we have set the time range.
protected  void applyZPosition()
          Apply the z position to the displayables with FLAG_ZPOSITION set
protected  boolean boundsClose(double a, double b)
          See if two values are close
 boolean canBeDocked()
          Can this be docked
 boolean canExportData()
          Can this display control write out data.
protected  boolean canSaveDataInCache()
          See if this can save data in cache.
 void captureWindow()
          Screen snapshot of window
 void changeColorUnit()
          Change the color unit.
 void changeDisplayUnit()
          Change the display unit.
protected  boolean checkFlag(int f)
          Test if the given flag is set in the attrbiuteFlags
protected  boolean checkIfDataOk(DataInstance di)
          Implements the default check if the new DataInstance/DataChoice pair holds valid data.
protected  void checkImageSize(FieldImpl image)
          If image is bigger than threshold then set the skip value
protected  void clearDataInstance()
          Clear the DataInstance
 void clearPrototype()
          Clear the prototype (default) for this display control
protected  void clearViewManagers()
          Runs through the list of ViewManager-s and tells each to destroy.
 void close()
          Close the window.
protected  void colorUnitChanged(Unit oldUnit, Unit newUnit)
          A hook that is called when the color unit is changed.
 void controlChanged(ControlEvent event)
          Noop for the ControlListener interface
 Range convertColorRange(Range rawRange, Unit rawUnit)
          Utility to convert the given raw data range into the display units
 Range convertRange(Range rawRange, Unit rawUnit, Unit outUnit)
          Utility to convert the given raw data range into the display units
protected  DisplayableData createDisplayListDisplayable(ViewManager view)
          Make the DisplayListDisplayable
protected  IdvWindow createIdvWindow()
          Create an IDV window
 void dataChanged()
          Implementation of DataChangeListener.
protected  void deactivateDisplays()
          DeActivate each DisplayInfo
 void debug(String msg)
          Debug
 void displayableToFront()
          Move the displayable to the front
 void displayChanged(DisplayEvent event)
          Noop for the DisplayListener interface
 void displayControlFailed()
          Method to do what needs to be done when the display control failed.
protected  void displayUnitChanged(Unit oldUnit, Unit newUnit)
          A hook that is called when the display unit is changed.
 boolean doApplyProperties()
          Apply the properties
protected  JComponent doMakeBottomLegendComponent()
          Create and return the gui component which is used to display this DisplayControl in the "legend" area of its ViewManager.
protected  JMenu doMakeChangeColorMenu()
          Utility to make the menu item for changing the color.
protected  JMenu doMakeChangeColorMenu(String name)
          Utility to make the menu item for changing the color.
protected  JMenuItem doMakeChangeParameterMenuItem()
          Utility to make the menu item for changing the data choice
 Component doMakeColorControl()
          A wrapper around doMakeColorControl (Color color), passing in null as the Color argument.
 Component doMakeColorControl(Color color)
          This creates a gui control for selecting a Color.
protected  void doMakeColorScales()
          Actually create the color scales
protected  Container doMakeContents()
          Make Gui contents
protected  DataInstance doMakeDataInstance(DataChoice dataChoice)
          Creates and returns the DataInstance corresponding to a DataChoice.
protected  JMenuBar doMakeMenuBar()
          Make the menu bar
protected  List doMakeMenuBarMenus(List menus)
          Make the menus to put in the menu bar
 JButton doMakeRemoveControl(String tooltip)
          Create the gui control (a JButton) that allows the user to remove this DisplayControl.
protected  JComponent doMakeSideLegendComponent()
          Create and return the gui component which is used to display this DisplayControl in the "legend" area of its ViewManager.
protected  Component doMakeSkipFactorSlider()
          Make the skip factor slider.
 JCheckBox doMakeVisibilityControl(String label)
          Get the toggle button JCheckBox that is source for item listener events to toggle visibility of the display.
protected  JComponent doMakeWidgetComponent()
          A helper method for constructing the ui.
protected  void doMakeWindow()
          Called by the derived class init method to create the gui window.
protected  JPanel doMakeZPositionSlider()
          Create the z position slider panel
 void doRemove()
          Remove this DisplayControl.
 void exportDisplayedData(String type)
          Export displayed data to file
protected  DisplayInfo findDisplayInfo(Displayable displayable)
          Find the DisplayInfo for a displayable
protected  List findDisplays(String key)
          Find displays based on the key
protected  List findDisplays(String key, List displays)
          Find displays with the particular key in the list of displays
protected  void firePropertyChangeEvent(PropertyChangeEvent event)
          Fire a property change event.
 void firstFrameDone()
          This gets called by the view manager when it has rcvd its first frame_done event.
protected  String formatForCursorReadout(Real r)
          Format a real for the cursor readout
 boolean getActive()
          Is this control active, i.e., has this control not gotten removed yet
 Animation getAnimation()
          Get the animation
protected  Animation getAnimation(boolean createOurOwn)
          Get the Animation for this display.
protected  Animation getAnimation(boolean createOurOwn, RealType timeType)
          Get the Animation for this display.
protected  Animation getAnimation(RealType timeType)
          Create, if needed, and return the Animation to use
 AnimationInfo getAnimationInfo()
          Get the AnimationInfo property.
 AnimationWidget getAnimationWidget()
          Create, if needed, and return the AnimationWidget
protected  int getAttributeFlags()
          Return the attribute flag map
 Hashtable getCachedData()
          Get the cache of data.
 boolean getCanDoRemoveAll()
          Used by the IDV to determine whether a control should be removed when the user does a remove all.
 List getCategories()
          Returns the list of data categories.
protected  String getChangeParameterLabel()
          A hook to allow derived classes to have their own label in the menu for the change data call.
 boolean getCollapseLegend()
          Get the collapsed legend property.
 Color getColor()
          Get the color for the selector.
 float getColorDimness()
          Get the ColorDimness property.
 ColorScaleInfo getColorScaleInfo()
          Get the contour information for any contours
 ColorTable getColorTable()
          Get the ColorTable property.
 float[][] getColorTableForDisplayable(ColorTable ct)
          The default is to use the alpha color table.
protected  ColorTable getColorTableToApply()
          Get the color table to use when applying to displayables
 ColorTableWidget getColorTableWidget(Range r)
          Get the ColorTableWidget using the specified range.
protected  Unit getColorUnit()
          Return the colorUnit The get and set methods here are protected so the XmlEncoder will not try to encode them.
 String getColorUnitName()
          This is used for xml persistence.
 String getColorWidgetLabel()
          Return the label that is to be used for the color widget This allows derived classes to override this and provide their own name,
 IdvComponentHolder getComponentHolder()
          Get the ComponentHolder property.
protected  Container getContents()
          Get the GUI contents
 ContourInfo getContourInfo()
          Get the contour information for any contours
protected  long getControlChangeSleepTime()
          This returns the time to sleep, in milliseconds, between checks for finally handling control changed events.
 ControlContext getControlContext()
          This is the IntegratedDataViewer
 void getControlWidgets(List controlWidgets)
          Add into the given the widgets for the different attributes
 List getCursorReadout(EarthLocation el, Real animationValue, int animationStep)
          Get the list of items for the cursor readout
protected  List getCursorReadoutInner(EarthLocation el, Real animationValue, int animationStep)
          Get the list of items, subclasses should override
 DataChoice getDataChoice()
          Return the single DataChoice
 List getDataChoices()
          Return the list of current DataChoice-s
 DataInstance getDataInstance()
          We have this here (in part) for xml persistence
 DataInstance getDataInstance(boolean forceCreation)
          We have this here (in part) for xml persistence
 MapProjection getDataProjection()
          get MapProjection of data to display
 MapProjection getDataProjectionForMenu()
          Get the MapProjection for this data; if have a single point data object make synthetic map projection for location
protected  String getDataProjectionLabel()
          Get the data projection label
 DataSelection getDataSelection()
          This is used for xml persistence.
protected  List getDataSources()
          Get the DataSources associated with this contol
 DataTimeRange getDataTimeRange()
          Get the DataTimeRange property.
 DataTimeRange getDataTimeRange(boolean createIfNeeded)
          Get the DataTimeRange property.
protected  Set getDataTimeSet()
          Collect the time animation set from the displayables.
protected  void getDebugDetails(StringBuffer sb)
          When we are iun debug mode this method gets called to add details html
protected  ColorScaleInfo getDefaultColorScaleInfo()
          Get the default color scale info
protected  Unit getDefaultDistanceUnit()
          Get the default distance unit
protected  boolean getDefaultFastRendering()
          Get the default for fast rendering
 String getDefaultSamplingMode()
          Get the perferred sampling mode.
 int getDefaultSamplingModeValue()
          Get the integer value of the default sampling mode
 String getDefaultView()
          Return the name of the first ViewManager found in the list of DisplayInfo-s.
 ViewDescriptor getDefaultViewDescriptor()
          Return the ViewDescriptor to use.
 ViewManager getDefaultViewManager()
          Return the name of the first ViewManager found in the list of DisplayInfo-s.
protected  String getDetailsContents()
          Get the contents of the details html
 DisplayRealType getDisplayAltitudeType()
          Utility method to get the altitude type of the display
 String getDisplayCategory()
          This is the category that is defined for this control.
 LatLonPoint getDisplayCenter()
          Get the center of the display
 DisplayConventions getDisplayConventions()
          Get the DisplayConventions to use.
protected  Data getDisplayedData()
          Get the DisplayedData
 String getDisplayId()
          The id of this control (from controls.xml) We have this here for xml persistence
 List getDisplayInfos()
          Return the list of DisplayInfo objects held by this control.
 Color getDisplayListColor()
          Get the DisplayListColor property.
protected  Data getDisplayListData()
          Add the data to the in display legend
 DisplayableData