Package ucar.unidata.ui.colortable
Class ColorTableManager
java.lang.Object
ucar.unidata.util.ResourceManager
ucar.unidata.ui.colortable.ColorTableManager
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternFileFilter
File filter used for ACT color tablesstatic final PatternFileFilter
File filter used for AWIPS II ".cmap" color tables.static final PatternFileFilter
File filter used for Gempak color tablesstatic final PatternFileFilter
File filter used for IDV color tablesstatic final PatternFileFilter
File filter used for McIdas color tablesstatic final PatternFileFilter
File filter used for PAL color tablesstatic final String
THe name of the default color tablestatic final String
The cancel property for PropertyChangeListenersstatic final String
The close property for PropertyChangeListenersstatic final String
The color table property for PropertyChangeListenersstatic final String
The range property for PropertyChangeListenersXml tag nameXml tag nameXml tag nameFields inherited from class ucar.unidata.util.ResourceManager
listOfResourceLists, log_, LU, nameToObject, PROP_RESOURCECHANGE, PROP_RESOURCEREMOVE, resources, usersList, writablePath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doExport
(NamedObject object, String file) _more_doImport
(boolean makeUnique) Import a color tableedit
(ColorTable colorTable, PropertyChangeListener listener) Create a ColorTableEditor for editing the given color tableReturn a list (String) of the categories defined by the color tablesgetColorTable
(String name) Lookup and return the color table identified by the given nameReturn a list of all ColorTable objectsFind and return the default color tableprotected 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.static ColorTableManager
Get the singletonReturn the file filters used for writing a file on an importgetTitle()
Overwrite the base class (ResourceManager) method to return the name of the resource we deal with.Return the file filters used for writing a file on an exportprotected Object
initResource
(ResourceCollection resources, int index) Check to see if these are any of the special resourcesstatic void
Merge the programmaticcally created color tables with the ones given on the command line.void
makeColorTableMenu
(ObjectListener listener, List l) Make the set of color table menus.void
makeColorTableMenu
(ObjectListener listener, List l, boolean showLocal) Make the set of color table menus.static void
setManager
(ColorTableManager theManager) set the singleton managerMethods inherited from class ucar.unidata.util.ResourceManager
addPropertyChangeListener, addUsers, doExport, doImport, doImport, doNew, doNew, doNew, doSaveAs, firePropertyChange, firePropertyChange, getDefault, getEncoder, getFileFilters, getFileSuffix, getObject, getResources, getResourceTimestamp, getUsersIndex, getUsersObject, hasUsers, init, initDone, isUsers, processObject, reloadResources, removePropertyChangeListener, removeUsers, resourceExists, shouldWeIgnoreThisXml, toObject, toObject
-
Field Details
-
NAME_DEFAULT
THe name of the default color table- See Also:
-
PROP_COLORTABLE
The color table property for PropertyChangeListeners- See Also:
-
PROP_RANGE
The range property for PropertyChangeListeners- See Also:
-
PROP_CANCEL
The cancel property for PropertyChangeListeners- See Also:
-
PROP_CLOSE
The close property for PropertyChangeListeners- See Also:
-
TAG_COLORTABLES
Xml tag name -
TAG_COLORTABLE
Xml tag name -
TAG_NAME
Xml tag name -
FILTER_IDV
File filter used for IDV color tables -
FILTER_GEM
File filter used for Gempak color tables -
FILTER_MCI
File filter used for McIdas color tables -
FILTER_PAL
File filter used for PAL color tables -
FILTER_ACT
File filter used for ACT color tables -
FILTER_AWIPS2
File filter used for AWIPS II ".cmap" color tables.
-
-
Constructor Details
-
ColorTableManager
public ColorTableManager()Create me
-
-
Method Details
-
doExport
Description copied from class:ResourceManager
_more_- Overrides:
doExport
in classResourceManager
- Parameters:
object
-file
-
-
setManager
set the singleton manager- Parameters:
theManager
- The singleton manager
-
getManager
Get the singleton- Returns:
- The color table manager
-
getWriteFileFilters
Return the file filters used for writing a file on an export- Overrides:
getWriteFileFilters
in classResourceManager
- Returns:
- Write file filters
-
getReadFileFilters
Return the file filters used for writing a file on an import- Overrides:
getReadFileFilters
in classResourceManager
- Returns:
- Read file filters
-
getTitle
Overwrite the base class (ResourceManager) method to return the name of the resource we deal with.- Overrides:
getTitle
in classResourceManager
- Returns:
- The resource title
-
getColorTables
Return a list of all ColorTable objects- Returns:
- List of color tables
-
getCategories
Return a list (String) of the categories defined by the color tables- Returns:
- List of color table categories
-
getDefaultColorTable
Find and return the default color table- Returns:
- The default color table
-
getColorTable
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
Create a ColorTableEditor for editing the given color table- Parameters:
colorTable
- The color table to editlistener
- Who should get changes sent to (may be null)- Returns:
- The new color table editor
-
makeColorTableMenu
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
-
makeColorTableMenu
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 toshowLocal
- If true then add "" to the menu item names for local color tables.
-
main
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
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 classResourceManager
- Parameters:
object
- The color tablefile
- The file name- Returns:
- The contents to be written to the file
-
initResource
Check to see if these are any of the special resources- Overrides:
initResource
in classResourceManager
- Parameters:
resources
- resourcesindex
- which one- Returns:
- The resource instantiated
-
doImport
Import a color table- Overrides:
doImport
in classResourceManager
- Parameters:
makeUnique
- If true then we change the name of the color table so it is unique- Returns:
- The imported color table
-