Class ColorTableManager

java.lang.Object
ucar.unidata.util.ResourceManager
ucar.unidata.ui.colortable.ColorTableManager

public class ColorTableManager extends ResourceManager
A class to manage a collection of system and user color tables
Version:
$Id: ColorTableManager.java,v 1.25 2007/06/15 19:34:38 jeffmc Exp $
Author:
Metapps Development Team
  • Field Details

    • NAME_DEFAULT

      public static final String NAME_DEFAULT
      THe name of the default color table
      See Also:
    • PROP_COLORTABLE

      public static final String PROP_COLORTABLE
      The color table property for PropertyChangeListeners
      See Also:
    • PROP_RANGE

      public static final String PROP_RANGE
      The range property for PropertyChangeListeners
      See Also:
    • PROP_CANCEL

      public static final String PROP_CANCEL
      The cancel property for PropertyChangeListeners
      See Also:
    • PROP_CLOSE

      public static final String PROP_CLOSE
      The close property for PropertyChangeListeners
      See Also:
    • TAG_COLORTABLES

      public String TAG_COLORTABLES
      Xml tag name
    • TAG_COLORTABLE

      public String TAG_COLORTABLE
      Xml tag name
    • TAG_NAME

      public String TAG_NAME
      Xml tag name
    • FILTER_IDV

      public static final PatternFileFilter FILTER_IDV
      File filter used for IDV color tables
    • FILTER_GEM

      public static final PatternFileFilter FILTER_GEM
      File filter used for Gempak color tables
    • FILTER_MCI

      public static final PatternFileFilter FILTER_MCI
      File filter used for McIdas color tables
    • FILTER_PAL

      public static final PatternFileFilter FILTER_PAL
      File filter used for PAL color tables
    • FILTER_ACT

      public static final PatternFileFilter FILTER_ACT
      File filter used for ACT color tables
    • FILTER_AWIPS2

      public static final PatternFileFilter FILTER_AWIPS2
      File filter used for AWIPS II ".cmap" color tables.
  • Constructor Details

    • ColorTableManager

      public ColorTableManager()
      Create me
  • Method Details

    • doExport

      public void doExport(NamedObject object, String file)
      Description copied from class: ResourceManager
      _more_
      Overrides:
      doExport in class ResourceManager
      Parameters:
      object -
      file -
    • setManager

      public static void setManager(ColorTableManager theManager)
      set the singleton manager
      Parameters:
      theManager - The singleton manager
    • getManager

      public static ColorTableManager getManager()
      Get the singleton
      Returns:
      The color table manager
    • getWriteFileFilters

      public List getWriteFileFilters()
      Return the file filters used for writing a file on an export
      Overrides:
      getWriteFileFilters in class ResourceManager
      Returns:
      Write file filters
    • getReadFileFilters

      public List getReadFileFilters()
      Return the file filters used for writing a file on an import
      Overrides:
      getReadFileFilters in class ResourceManager
      Returns:
      Read file filters
    • getTitle

      public String getTitle()
      Overwrite the base class (ResourceManager) method to return the name of the resource we deal with.
      Overrides:
      getTitle in class ResourceManager
      Returns:
      The resource title
    • getColorTables

      public List getColorTables()
      Return a list of all ColorTable objects
      Returns:
      List of color tables
    • getCategories

      public List getCategories()
      Return a list (String) of the categories defined by the color tables
      Returns:
      List of color table categories
    • getDefaultColorTable

      public ColorTable getDefaultColorTable()
      Find and return the default color table
      Returns:
      The default color table
    • getColorTable

      public ColorTable getColorTable(String name)
      Lookup and return the color table identified by the given name
      Parameters:
      name - The color table name
      Returns:
      The color table or null if none found with the given name
    • edit

      public ColorTableEditor edit(ColorTable colorTable, PropertyChangeListener listener)
      Create a ColorTableEditor for editing the given color table
      Parameters:
      colorTable - The color table to edit
      listener - Who should get changes sent to (may be null)
      Returns:
      The new color table editor
    • makeColorTableMenu

      public void makeColorTableMenu(ObjectListener listener, List l)
      Make the set of color table menus. On an action event we will call the listeners actionPerformed \ method, passing in the chosen color table.
      Parameters:
      listener - The listener to pass events to.
      l - The list to add the JMenus to
    • getLabel

      public JLabel getLabel(String colorTableName)
    • makeColorTableMenu

      public void makeColorTableMenu(ObjectListener listener, List l, boolean showLocal)
      Make the set of color table menus. On an action event we will call the listeners actionPerformed \ method, passing in the chosen color table.
      Parameters:
      listener - The listener to pass events to.
      l - The list to add the JMenus to
      showLocal - If true then add "" to the menu item names for local color tables.
    • main

      public static void main(String[] args)
      Merge the programmaticcally created color tables with the ones given on the command line. If the first command line argument is "-merge" then don't load in the programmatic color tables, just merge the command line ones.
      Parameters:
      args - Command line arguments.
    • getExportContents

      protected String getExportContents(NamedObject object, String file)
      When we do an export this method is called to create the String contents that is actually written out. We implement this method here so if we are saving as a Gempak file we can write it out in that format.
      Overrides:
      getExportContents in class ResourceManager
      Parameters:
      object - The color table
      file - The file name
      Returns:
      The contents to be written to the file
    • initResource

      protected Object initResource(ResourceCollection resources, int index)
      Check to see if these are any of the special resources
      Overrides:
      initResource in class ResourceManager
      Parameters:
      resources - resources
      index - which one
      Returns:
      The resource instantiated
    • doImport

      public NamedObject doImport(boolean makeUnique)
      Import a color table
      Overrides:
      doImport in class ResourceManager
      Parameters:
      makeUnique - If true then we change the name of the color table so it is unique
      Returns:
      The imported color table