Class DisplayControlBase

java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.unidata.idv.control.DisplayControlBase
All Implemented Interfaces:
Sharable
Direct Known Subclasses:
DisplayControlImpl

public abstract class DisplayControlBase extends SharableImpl
Some display control oriented utilities
Version:
$Revision: 1.28 $
Author:
IDV development team
  • Field Details

    • log_

      public static LogUtil.LogCategory log_
      Use this member to log messages (through calls to LogUtil)
    • ICON_LOCK

      protected static ImageIcon ICON_LOCK
      The icon used to show locked legend components
    • ICON_UNLOCK

      protected static ImageIcon ICON_UNLOCK
      The icon used to show unlocked legend components
    • ICON_REMOVE

      public static ImageIcon ICON_REMOVE
      Icon used to remove displays
    • PROP_REMOVED

      public static final String PROP_REMOVED
      Name of the property removed propert
      See Also:
    • PREF_LEGENDLABEL_TEMPLATE

      public static final String PREF_LEGENDLABEL_TEMPLATE
      The preference id for the default label template for displays
      See Also:
    • PREF_EXTRALABEL_TEMPLATE

      public static final String PREF_EXTRALABEL_TEMPLATE
      The preference id for the default extra label template for displays
      See Also:
    • PREF_DISPLAYLIST_TEMPLATE

      public static final String PREF_DISPLAYLIST_TEMPLATE
      The preference id for the default label template for displays
      See Also:
    • MACRO_SHORTNAME

      public static final String MACRO_SHORTNAME
      Macro for the short parameter name for the label
      See Also:
    • MACRO_STATION

      public static final String MACRO_STATION
      Macro for station
      See Also:
    • MACRO_RESOLUTION

      public static final String MACRO_RESOLUTION
      Macro for the resolution for the label
      See Also:
    • MACRO_LONGNAME

      public static final String MACRO_LONGNAME
      Macro for the long parameter name for the label
      See Also:
    • MACRO_VALUE

      public static final String MACRO_VALUE
      Macro for the short parameter name for the label
      See Also:
    • MACRO_POSITION

      public static final String MACRO_POSITION
      Macro for the short parameter name for the label
      See Also:
    • MACRO_DATASOURCENAME

      public static final String MACRO_DATASOURCENAME
      Macro for the data source name (or names) for the label
      See Also:
    • MACRO_DISPLAYNAME

      public static final String MACRO_DISPLAYNAME
      Macro for the display name for the label
      See Also:
    • MACRO_DISPLAYUNIT

      public static final String MACRO_DISPLAYUNIT
      Macro for the display unit for the label
      See Also:
    • MACRO_TIMESTAMP

      public static final String MACRO_TIMESTAMP
      Macro for the display unit for the label
      See Also:
    • MACRO_FHOUR

      public static final String MACRO_FHOUR
      forecast hour macro
      See Also:
    • MACRO_FHOUR2

      public static final String MACRO_FHOUR2
      forecast hour macro without the 'H' -- user can format their own
      See Also:
    • CMD_COLORS

      public static final String CMD_COLORS
      String used as the action command for the color setting button
      See Also:
    • CMD_REMOVE

      public static final String CMD_REMOVE
      String used as the action command for removing this display control
      See Also:
    • CMD_POPUP

      public static final String CMD_POPUP
      String used as the action command for showing the control window
      See Also:
    • CMD_COLORTABLE

      public static final String CMD_COLORTABLE
      String used as the action command for setting the color table
      See Also:
    • CMD_BARBSIZE

      public static final String CMD_BARBSIZE
      String used as the action command for setting the size of wind barbs
      See Also:
    • CMD_INTERVAL

      public static final String CMD_INTERVAL
      String used as the action command for setting the wind barb interval
      See Also:
    • CMD_LEVEL

      public static final String CMD_LEVEL
      String used as the action command for setting the level
      See Also:
    • CMD_LINEWIDTH

      public static final String CMD_LINEWIDTH
      String used as the action command for setting the level
      See Also:
    • WEIGHTED_AVERAGE

      public static final String WEIGHTED_AVERAGE
      String used to set the sampling to be weighted average
      See Also:
    • NEAREST_NEIGHBOR

      public static final String NEAREST_NEIGHBOR
      String used the set the sampling to be nearest neighbor
      See Also:
    • DEFAULT_SAMPLING_MODE

      protected static String DEFAULT_SAMPLING_MODE
      What is the default samppling mode
    • APPEARANCE_IDV

      public static final String APPEARANCE_IDV
      String used to set the appearance mode
      See Also:
    • APPEARANCE_DARK

      public static final String APPEARANCE_DARK
      String used to set the appearance mode
      See Also:
    • APPEARANCE_LIGHT

      public static final String APPEARANCE_LIGHT
      String used to set the appearance mode
      See Also:
    • GRID_INSETS

      protected static final Insets GRID_INSETS
      Used for doing doLayout calls
    • SHARE_POSITION

      public static final String SHARE_POSITION
      Probe position property
      See Also:
    • SHARE_TRANSECT

      public static final String SHARE_TRANSECT
      Transect Line position property
      See Also:
    • SHARE_DISPLAYUNIT

      public static final String SHARE_DISPLAYUNIT
      Display unit property
      See Also:
    • SHARE_VISIBILITY

      public static final String SHARE_VISIBILITY
      Visiblity property
      See Also:
    • SHARE_COLORTABLE

      public static final String SHARE_COLORTABLE
      Color table property
      See Also:
    • SHARE_COLORSCALE

      public static final String SHARE_COLORSCALE
      Color scale property
      See Also:
    • SHARE_COLOR

      public static final String SHARE_COLOR
      Color property
      See Also:
    • SHARE_SELECTRANGE

      public static final String SHARE_SELECTRANGE
      select range property
      See Also:
    • SHARE_CHOICES

      public static final String SHARE_CHOICES
      data choices property
      See Also:
    • SHARE_SKIPVALUE

      public static final String SHARE_SKIPVALUE
      Probe position property
      See Also:
    • FLAG_CONTOUR

      public static final int FLAG_CONTOUR
      Bitmask for controls that use contour interval information
      See Also:
    • FLAG_COLOR

      public static final int FLAG_COLOR
      Bitmask for controls that use colors
      See Also:
    • FLAG_COLORTABLE

      public static final int FLAG_COLORTABLE
      Bitmask for controls that use color tables
      See Also:
    • FLAG_DATACONTROL

      public static final int FLAG_DATACONTROL
      Bitmask for controls that have the "Set data" button capability enabled
      See Also:
    • FLAG_DISPLAYUNIT

      public static final int FLAG_DISPLAYUNIT
      Bitmask for controls that can change their display units
      See Also:
    • FLAG_COLORUNIT

      public static final int FLAG_COLORUNIT
      Bitmask for controls that can change their color units
      See Also:
    • FLAG_ZPOSITION

      public static final int FLAG_ZPOSITION
      Bitmask for controls that have a fixed z position
      See Also:
    • FLAG_SELECTRANGE

      public static final int FLAG_SELECTRANGE
      Bitmask for controls that allow selecting a data range
      See Also:
    • FLAG_TIMERANGE

      public static final int FLAG_TIMERANGE
      Bitmask for controls that allow selecting a time range
      See Also:
    • FLAG_LINEWIDTH

      public static final int FLAG_LINEWIDTH
      Bitmask for controls that allow line width setting
      See Also:
    • FLAG_SKIPFACTOR

      public static final int FLAG_SKIPFACTOR
      Bitmask for controls that allow skip factor setting
      See Also:
    • FLAG_TEXTUREQUALITY

      public static final int FLAG_TEXTUREQUALITY
      Bitmask for controls that allow texture quality setting
      See Also:
    • FLAG_SMOOTHING

      public static final int FLAG_SMOOTHING
      Bitmask for controls that allow grid smoothing setting
      See Also:
    • FLAG_GRIDTRAJECTORY

      public static final int FLAG_GRIDTRAJECTORY
      flag for the trackcontrol to add marker widget or not
      See Also:
    • FLAG_NONE

      public static final int FLAG_NONE
      No-op for attributeFlags
      See Also:
    • DEFAULT_POINT_SIZE

      public static final int DEFAULT_POINT_SIZE
      Default selector point size.
      See Also:
    • LABEL_NONE

      public static final String LABEL_NONE
      A label for None
      See Also:
    • FIND_THIS

      public static final String FIND_THIS
      search string for this
      See Also:
    • FIND_ALL

      public static final String FIND_ALL
      search string for all
      See Also:
    • FIND_CLASS

      public static final String FIND_CLASS
      search string for class:
      See Also:
    • FIND_CATEGORY

      public static final String FIND_CATEGORY
      search string for category
      See Also:
    • FIND_WITHDATA

      public static final String FIND_WITHDATA
      search string for displays with data
      See Also:
    • FIND_WITHTHISDATA

      public static final String FIND_WITHTHISDATA
      search string for display like this with data
      See Also:
    • FIND_WITHTHISFIELD

      public static final String FIND_WITHTHISFIELD
      search string for display with this data
      See Also:
    • FIND_SPECIAL

      public static final String FIND_SPECIAL
      search string for special
      See Also:
    • FIND_WITHTHISVIEW

      public static final String FIND_WITHTHISVIEW
      search string with displays in this view
      See Also:
    • SETTINGS_GROUP_DISPLAY

      public static final String SETTINGS_GROUP_DISPLAY
      display group setting
      See Also:
    • SETTINGS_GROUP_FLAGS

      public static final String SETTINGS_GROUP_FLAGS
      group flags
      See Also:
  • Constructor Details

    • DisplayControlBase

      public DisplayControlBase()
      ctor
  • Method Details

    • getTmpProperty

      public Object getTmpProperty(Object key)
      Get the tmp property.
      Parameters:
      key - key
      Returns:
      property
    • putTmpProperty

      public void putTmpProperty(Object key, Object value)
      put the tmp property. These are not persisted off
      Parameters:
      key - key
      value - value
    • removeTmpProperty

      public Object removeTmpProperty(Object key)
      remove the tmp property
      Parameters:
      key - key
      Returns:
      the value or null if not found
    • setStations

      public static void setStations(List stationList, JComboBox box)
      A utility that takes a list of NamedStationImpl-s, wraps each of them in a TwoFacedObject, truncates their label and adds them to the given combobox.
      Parameters:
      stationList - Station list
      box - Combo box to set
    • setStations

      public static void setStations(List stationList, JComboBox box, boolean addMessage)
      A utility that takes a list of NamedStationImpl-s, wraps each of them in a TwoFacedObject, truncates their label and adds them to the given combobox.
      Parameters:
      stationList - Station list
      box - Combo box to set
      addMessage - true to add an entry message
    • createStationTfo

      public static TwoFacedObject createStationTfo(Object o)
      A utility to wrap the given object (which should be a NamedStationImpl) in a TwoFacedObject, truncating the label to a fixed size.
      Parameters:
      o - The station
      Returns:
      The tfo
    • getSelectedStation

      public static NamedStationImpl getSelectedStation(JComboBox box)
      A utility to find and return the NamedStationImpl which is selected in the given combobox. May return null.
      Parameters:
      box - The box.
      Returns:
      The selected station or null.
    • isLeftButtonDown

      public static boolean isLeftButtonDown(DisplayEvent event)
      Is the left button pressed
      Parameters:
      event - The event
      Returns:
      Is the left button pressed
    • getNavigatedDisplay

      public abstract NavigatedDisplay getNavigatedDisplay()
      We have this here so some of the utility methods can get the navigated display.
      Returns:
      The NavigatedDisplay this display control is in. My be null.
    • toEarth

      public EarthLocation toEarth(DisplayEvent event) throws VisADException, RemoteException
      Map the screen x/y of the event to an earth location
      Parameters:
      event - The event
      Returns:
      The earth location
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • boxToEarth

      public EarthLocation boxToEarth(double[] boxCoords) throws VisADException, RemoteException
      Map the visad box to an earth location
      Parameters:
      boxCoords - The box point
      Returns:
      The earth location
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • boxToEarth

      public EarthLocation boxToEarth(double[] boxCoords, boolean setZToZeroIfOverhead) throws VisADException, RemoteException
      Map the visad box to an earth location
      Parameters:
      boxCoords - The box point
      setZToZeroIfOverhead - If in the overhead view then set Z to 0
      Returns:
      The earth location
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • boxToEarth

      public EarthLocation boxToEarth(double x, double y, double z) throws VisADException, RemoteException
      Map the visad box to an earth location
      Parameters:
      x - x
      y - y
      z - z
      Returns:
      The earth location
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • boxToEarth

      public EarthLocation boxToEarth(double x, double y, double z, boolean setZToZeroIfOverhead) throws VisADException, RemoteException
      Map the visad box to an earth location
      Parameters:
      x - x
      y - y
      z - z
      setZToZeroIfOverhead - If in the overhead view then set Z to 0
      Returns:
      The earth location
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • boxToEarth

      public List boxToEarth(List boxPoints) throws VisADException, RemoteException
      Map the visad box points to earth locations
      Parameters:
      boxPoints - The box points
      Returns:
      The earth locations
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • earthToBox

      public List earthToBox(List earthLocations) throws VisADException, RemoteException
      Map the earth locations to box points
      Parameters:
      earthLocations - list of earth locations
      Returns:
      The box points
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • earthToBox

      public double[] earthToBox(EarthLocation el) throws VisADException, RemoteException
      Map an earth location to a visad box point
      Parameters:
      el - The earth location
      Returns:
      The box point
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • earthToBoxTuple

      public RealTuple earthToBoxTuple(EarthLocation el) throws VisADException, RemoteException
      Map an earth location to a visad box tuple
      Parameters:
      el - The earth location
      Returns:
      The tuple
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • makeEarthLocation

      public static EarthLocation makeEarthLocation(double lat, double lon, double alt) throws VisADException, RemoteException
      Make an earth location from the given lat,on and alt
      Parameters:
      lat - the lat
      lon - the lon
      alt - the alt
      Returns:
      The earth location
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • toBox

      public double[] toBox(DisplayEvent event) throws VisADException, RemoteException
      Map the screen x/y to a visad box point
      Parameters:
      event - The event
      Returns:
      The box point
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • screenToBox

      public double[] screenToBox(int screenX, int screenY) throws VisADException, RemoteException
      Map the screen x/y to a visad box point
      Parameters:
      screenX - x
      screenY - y
      Returns:
      The box point
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • screenToBox

      public double[] screenToBox(int screenX, int screenY, double zPosition) throws VisADException, RemoteException
      Map the screen x/y to a visad box point
      Parameters:
      screenX - screen x
      screenY - screen y
      zPosition - The visad Z position to use
      Returns:
      The box point
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • getScreenCenter

      public double[] getScreenCenter() throws VisADException, RemoteException
      Return the x/y coordinate of the center of the display
      Returns:
      The box point
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • boxToScreen

      public int[] boxToScreen(double[] xyz) throws VisADException, RemoteException
      Map a visad box point to the screen coords.
      Parameters:
      xyz - Visad box point
      Returns:
      Screen coords
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • screenToEarth

      public EarthLocation screenToEarth(int screenX, int screenY) throws VisADException, RemoteException
      Map screen position to earth location
      Parameters:
      screenX - x
      screenY - y
      Returns:
      The earth location
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • earthToScreen

      public int[] earthToScreen(EarthLocation el) throws VisADException, RemoteException
      Map earth to screen
      Parameters:
      el - Earth location
      Returns:
      Screen xy
      Throws:
      RemoteException - When bad things happen
      VisADException - When bad things happen
    • calculateRectangle

      protected Rectangle2D calculateRectangle()
      Calculates the rectangle that is the bounds of the VisAD display.
      Returns:
      bounds of the display
    • userMessage

      public static void userMessage(String msg)
      Utility method for creating user messages
      Parameters:
      msg - message to display
    • userErrorMessage

      public void userErrorMessage(String message)
      A utility method to show an error message to the user.
      Parameters:
      message - The message
    • logException

      public static void logException(Exception exc)
      Utility method for logging exceptions.
      Parameters:
      exc - Exception to handle
    • logException

      public static void logException(String desc, Exception exc)
      Utility method for logging exceptions with the given description. This is just a wrapper around the LogUtil call printException.
      Parameters:
      desc - description for exception
      exc - Exception to handle
    • formatLevels

      protected Object[] formatLevels(Object[] levels)
      Format the levels to make them look presentable
      Parameters:
      levels - array of levels
      Returns:
      formatted levels. Currently an array of TwoFacedObjects with formatted values as the label.
    • getLabeledReal

      protected TwoFacedObject getLabeledReal(Object level)
      Get a labeled Real
      Parameters:
      level - the level object
      Returns:
      a labeled level as a TwoFacedObject
    • getLevelReal

      protected Real getLevelReal(Object level)
      Get the real value from a level object
      Parameters:
      level - the level (TwoFacedObject, Real or number String);
      Returns:
      a corresponding Real or null