visad.ss
Class FancySSCell

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by visad.ss.BasicSSCell
                      extended by visad.ss.FancySSCell
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, DisplayListener, MessageListener, SSCellListener
Direct Known Subclasses:
TestProxyCluster, TestSSCluster, TestWRFCluster

public class FancySSCell
extends BasicSSCell
implements SSCellListener

FancySSCell is an extension of BasicSSCell with extra options, such as a file loader dialog and a dialog to set up ScalarMaps. It provides an example of GUI extensions to BasicSSCell.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean AutoDetect
          Whether this cell should auto-detect mappings for data.
protected  boolean AutoShowControls
          Whether this cell should auto-display its widget frame.
protected  boolean AutoSwitch
          Whether this cell should auto-switch to 3-D.
static Border B_DIRECT
          Border for cell with data set directly.
static Border B_EMPTY
          Border for cell with no data.
static Border B_FORMULA
          Border for cell with formula.
static Border B_HIGHLIGHT
          Border for selected cell.
static Border B_MULTI
          Border for cell with multiple data objects.
static Border B_REMOTE
          Border for cell with data from a remote source.
static Border B_RMI
          Border for cell with RMI address.
static Border B_UNKNOWN
          Border for cell with data from an unknown source.
static Border B_URL
          Border for cell with file or URL.
static Color DARK_BLUE
          Dark blue.
static Color DARK_CYAN
          Dark cyan.
static Color DARK_GREEN
          Dark green.
static Color DARK_PURPLE
          Dark purple.
static Color DARK_RED
          Dark red.
static Color DARK_YELLOW
          Dark yellow.
protected static JFileChooser FileBox
          File chooser for loading and saving data.
protected  Frame Parent
          Parent frame.
protected  boolean Selected
          Whether this cell is selected.
protected  JFrame WidgetFrame
          Associated JFrame, for use with VisAD Controls.
 
Fields inherited from class visad.ss.BasicSSCell
ADD_DATA, ADD_SOURCE, CanDo3D, CellData, CollabID, DEBUG, DEBUG_LEVEL, defaultFM, Dim, DIRECT_SOURCE, DisplayEnabled, DListen, Errors, fm, FORMULA_SOURCE, HasDisplay, HasMappings, IsRemote, IsSlave, JAVA2D_2D, JAVA3D_2D, JAVA3D_3D, Loading, Lock, MAX_ID, MDisplay, messages, Name, NewClient, POLLING_INTERVAL, Possible3D, REMOTE_SOURCE, RemoteMDisplay, RemoteVDisplay, RemoteVServer, RemoteVSlave, REMOVE_DATA, RMI_SOURCE, Saving, Servers, SET_DIM, SET_ERRORS, SET_MAPS, SListen, SSCellVector, STATUS, UNKNOWN_SOURCE, UPDATE_DATA, UPDATE_DEPENDENCIES, URL_SOURCE, VDisplay, VDPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FancySSCell(String name)
          Constructs a new FancySSCell with the given name.
FancySSCell(String name, FormulaManager fman, Frame parent)
          Constructs a new FancySSCell with the given name, formula manager, and parent Frame.
FancySSCell(String name, FormulaManager fman, RemoteServer rs, boolean slave, String save, Frame parent)
          Constructs a new, possibly slaved, FancySSCell with the given name, formula manager, remote server, save string, and parent Frame.
FancySSCell(String name, FormulaManager fman, RemoteServer rs, String save, Frame parent)
          Constructs a new FancySSCell with the given name, formula manager, remote server, save string, and parent Frame.
FancySSCell(String name, Frame parent)
          Constructs a new FancySSCell with the given name and parent Frame.
FancySSCell(String name, RemoteServer rs, Frame parent)
          Constructs a new FancySSCell with the given name, remote server, and parent Frame.
FancySSCell(String name, String save, Frame parent)
          Constructs a new FancySSCell with the given name, save string, and parent Frame.
 
Method Summary
 void addMapDialog()
          Lets the user specify mappings between this cell's data and display.
protected  SSCellData addReferenceImpl(int id, DataReferenceImpl ref, ConstantMap[] cmaps, String source, int type, boolean notify, boolean checkErrors)
          Does the work of adding the given DataReference, from the given source of the specified type.
protected  void autoDetectMappings()
          Guesses a good set of mappings for this cell's data and applies them.
 void captureDialog()
          Captures display image and saves to a file selected by the user, in JPEG format.
 boolean confirmClear()
          Asks user to confirm clearing the cell if any other cell depends on it.
 boolean getAutoDetect()
          Returns whether this FancySSCell auto-detects its mappings.
 boolean getAutoShowControls()
          Returns whether this FancySSCell auto-displays its widget frame.
 boolean getAutoSwitch()
          Returns whether this FancySSCell auto-switches to 3-D.
 boolean hasControls()
          Returns whether the cell has any associated controls.
 void hideWidgetFrame()
          Hides the widgets for altering controls.
 void loadDataDialog()
          Imports data from a file selected by the user.
 void loadDataRMI(String s)
          Deprecated. Use loadDataSource(String, RMI_SOURCE) instead.
 void loadDataSource(String source)
          Imports a data object from the given source of unknown type, in a separate thread.
 void loadDataSource(String source, int type)
          Imports a data object from the given source of the specified type, in a separate thread.
 void loadDataString(String s)
          Deprecated. Use loadDataSource(String, URL_SOURCE) instead.
 void loadDataURL(URL u)
          Deprecated. Use loadDataSource(String, URL_SOURCE) instead.
 void removeData(String varName)
          Removes the Data object corresponding to the given variable name from this cell.
 void saveDataDialog(boolean netcdf)
          Deprecated. Use saveDataDialog(String, Form) instead.
 void saveDataDialog(Form saveForm)
          Deprecated. Use saveDataDialog(String, Form) instead.
 void saveDataDialog(String varName, Form saveForm)
          Saves a Data object to a file selected by the user, using the given data form.
 void setAutoDetect(boolean value)
          Specifies whether this FancySSCell should auto-detect its mappings.
 void setAutoShowControls(boolean value)
          Specifies whether this FancySSCell should auto-display its widget frame.
 void setAutoSwitch(boolean value)
          Specifies whether this FancySSCell should auto-switch to 3-D.
 void setBorderEnabled(boolean value)
          Specifies whether the FancySSCell has a border.
 void setMaps(ScalarMap[] maps)
          Sets the ScalarMaps for this cell and creates needed control widgets.
 void setMapsAuto(ScalarMap[] maps)
          Switches to 3-D mode if necessary and available.
 void setSelected(boolean value)
          Specifies whether the FancySSCell has a highlighted border.
 void showWidgetFrame()
          Shows the widgets for altering controls (if there are any).
 boolean smartClear()
          Clears the cell if no other cell depends on it; otherwise, ask the user "Are you sure?
 boolean smartDestroy()
          Permanently destroy this cell, asking user for confirmation first if other cells depend on it; return true if the cell was destroyed.
 void ssCellChanged(SSCellChangeEvent e)
          Re-detects mappings when this cell's data changes.
 void waitForMaps()
          Blocks until mapping auto-detection is complete.
 
Methods inherited from class visad.ss.BasicSSCell
addData, addData, addData, addDataSource, addDataSource, addDisplayListener, addReference, addReference, addSSCellChangeListener, addSSCellListener, addToRemoteServer, addVar, arraysEqual, canDo3D, captureImage, clearCell, clearDisplay, clearMaps, constructDisplay, createVar, destroyCell, disable3D, displayChanged, enable3D, getCellDataByName, getData, getData, getDataCount, getDataRef, getDataSource, getDataSources, getDataSourceType, getDataSourceTypes, getDimension, getDisplay, getFilename, getFileURL, getFirstFreeId, getFirstVariableName, getFormula, getFormulaManager, getLastVariableName, getMaps, getName, getPartialSaveString, getReference, getReference, getReferences, getRemoteDataRef, getRemoteDisplay, getRemoteId, getRemoteReference, getRemoteReferences, getRMIAddress, getSaveString, getSSCellByName, getSSCellString, getVariableNames, hasData, hasDisplay, hasFormula, hasMappings, invoke, isRemote, isSaving, isSlave, loadData, loadData, loadRMI, makeLocal, othersDepend, othersDepend, possible3D, receiveMessage, removeAllListeners, removeAllReferences, removeAllReferences, removeAllReferences, removeAllSSCellListeners, removeData, removeDataImpl, removeDisplayListener, removeFromRemoteServer, removeListener, removeReference, removeSSCellListener, saveData, saveData, saveData, setData, setDimension, setDimension, setErrors, setFormula, setPartialSaveString, setSaveString, setSSCellString, setupClient, setupServer, stringsToTuple, tupleToStrings, waitForData, waitForData, waitForFormula
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DARK_RED

public static final Color DARK_RED
Dark red.


DARK_GREEN

public static final Color DARK_GREEN
Dark green.


DARK_BLUE

public static final Color DARK_BLUE
Dark blue.


DARK_YELLOW

public static final Color DARK_YELLOW
Dark yellow.


DARK_PURPLE

public static final Color DARK_PURPLE
Dark purple.


DARK_CYAN

public static final Color DARK_CYAN
Dark cyan.


B_EMPTY

public static final Border B_EMPTY
Border for cell with no data.


B_HIGHLIGHT

public static final Border B_HIGHLIGHT
Border for selected cell.


B_UNKNOWN

public static final Border B_UNKNOWN
Border for cell with data from an unknown source.


B_DIRECT

public static final Border B_DIRECT
Border for cell with data set directly.


B_URL

public static final Border B_URL
Border for cell with file or URL.


B_FORMULA

public static final Border B_FORMULA
Border for cell with formula.


B_RMI

public static final Border B_RMI
Border for cell with RMI address.


B_REMOTE

public static final Border B_REMOTE
Border for cell with data from a remote source.


B_MULTI

public static final Border B_MULTI
Border for cell with multiple data objects.


FileBox

protected static JFileChooser FileBox
File chooser for loading and saving data. This variable is static so that the directory is remembered between each load or save command.


Parent

protected Frame Parent
Parent frame.


WidgetFrame

protected JFrame WidgetFrame
Associated JFrame, for use with VisAD Controls.


Selected

protected boolean Selected
Whether this cell is selected.


AutoSwitch

protected boolean AutoSwitch
Whether this cell should auto-switch to 3-D.


AutoDetect

protected boolean AutoDetect
Whether this cell should auto-detect mappings for data.


AutoShowControls

protected boolean AutoShowControls
Whether this cell should auto-display its widget frame.

Constructor Detail

FancySSCell

public FancySSCell(String name)
            throws VisADException,
                   RemoteException
Constructs a new FancySSCell with the given name.

Throws:
VisADException
RemoteException

FancySSCell

public FancySSCell(String name,
                   Frame parent)
            throws VisADException,
                   RemoteException
Constructs a new FancySSCell with the given name and parent Frame.

Throws:
VisADException
RemoteException

FancySSCell

public FancySSCell(String name,
                   FormulaManager fman,
                   Frame parent)
            throws VisADException,
                   RemoteException
Constructs a new FancySSCell with the given name, formula manager, and parent Frame.

Throws:
VisADException
RemoteException

FancySSCell

public FancySSCell(String name,
                   RemoteServer rs,
                   Frame parent)
            throws VisADException,
                   RemoteException
Constructs a new FancySSCell with the given name, remote server, and parent Frame.

Throws:
VisADException
RemoteException

FancySSCell

public FancySSCell(String name,
                   String save,
                   Frame parent)
            throws VisADException,
                   RemoteException
Constructs a new FancySSCell with the given name, save string, and parent Frame.

Throws:
VisADException
RemoteException

FancySSCell

public FancySSCell(String name,
                   FormulaManager fman,
                   RemoteServer rs,
                   String save,
                   Frame parent)
            throws VisADException,
                   RemoteException
Constructs a new FancySSCell with the given name, formula manager, remote server, save string, and parent Frame.

Throws:
VisADException
RemoteException

FancySSCell

public FancySSCell(String name,
                   FormulaManager fman,
                   RemoteServer rs,
                   boolean slave,
                   String save,
                   Frame parent)
            throws VisADException,
                   RemoteException
Constructs a new, possibly slaved, FancySSCell with the given name, formula manager, remote server, save string, and parent Frame.

Throws:
VisADException
RemoteException
Method Detail

removeData

public void removeData(String varName)
                throws VisADException,
                       RemoteException
Removes the Data object corresponding to the given variable name from this cell.

Overrides:
removeData in class BasicSSCell
Throws:
VisADException
RemoteException

loadDataSource

public void loadDataSource(String source)
Imports a data object from the given source of unknown type, in a separate thread.


loadDataSource

public void loadDataSource(String source,
                           int type)
Imports a data object from the given source of the specified type, in a separate thread.


loadDataDialog

public void loadDataDialog()
Imports data from a file selected by the user.


saveDataDialog

public void saveDataDialog(String varName,
                           Form saveForm)
Saves a Data object to a file selected by the user, using the given data form.


waitForMaps

public void waitForMaps()
Blocks until mapping auto-detection is complete.


addReferenceImpl

protected SSCellData addReferenceImpl(int id,
                                      DataReferenceImpl ref,
                                      ConstantMap[] cmaps,
                                      String source,
                                      int type,
                                      boolean notify,
                                      boolean checkErrors)
                               throws VisADException,
                                      RemoteException
Does the work of adding the given DataReference, from the given source of the specified type.

Overrides:
addReferenceImpl in class BasicSSCell
Returns:
The newly created SSCellData object.
Throws:
VisADException
RemoteException

confirmClear

public boolean confirmClear()
Asks user to confirm clearing the cell if any other cell depends on it.


smartClear

public boolean smartClear()
                   throws VisADException,
                          RemoteException
Clears the cell if no other cell depends on it; otherwise, ask the user "Are you sure?" return true if the cell was cleared.

Throws:
VisADException
RemoteException

smartDestroy

public boolean smartDestroy()
                     throws VisADException,
                            RemoteException
Permanently destroy this cell, asking user for confirmation first if other cells depend on it; return true if the cell was destroyed.

Throws:
VisADException
RemoteException

setMapsAuto

public void setMapsAuto(ScalarMap[] maps)
                 throws VisADException,
                        RemoteException
Switches to 3-D mode if necessary and available.

Throws:
VisADException
RemoteException

setMaps

public void setMaps(ScalarMap[] maps)
             throws VisADException,
                    RemoteException
Sets the ScalarMaps for this cell and creates needed control widgets.

Overrides:
setMaps in class BasicSSCell
Throws:
VisADException
RemoteException

addMapDialog

public void addMapDialog()
Lets the user specify mappings between this cell's data and display.


autoDetectMappings

protected void autoDetectMappings()
                           throws VisADException,
                                  RemoteException
Guesses a good set of mappings for this cell's data and applies them.

Throws:
VisADException
RemoteException

showWidgetFrame

public void showWidgetFrame()
Shows the widgets for altering controls (if there are any).


hideWidgetFrame

public void hideWidgetFrame()
Hides the widgets for altering controls.


setBorderEnabled

public void setBorderEnabled(boolean value)
Specifies whether the FancySSCell has a border.


setSelected

public void setSelected(boolean value)
Specifies whether the FancySSCell has a highlighted border.


setAutoSwitch

public void setAutoSwitch(boolean value)
Specifies whether this FancySSCell should auto-switch to 3-D.


setAutoDetect

public void setAutoDetect(boolean value)
Specifies whether this FancySSCell should auto-detect its mappings.


setAutoShowControls

public void setAutoShowControls(boolean value)
Specifies whether this FancySSCell should auto-display its widget frame.


ssCellChanged

public void ssCellChanged(SSCellChangeEvent e)
Re-detects mappings when this cell's data changes.

Specified by:
ssCellChanged in interface SSCellListener

captureDialog

public void captureDialog()
Captures display image and saves to a file selected by the user, in JPEG format.


getAutoSwitch

public boolean getAutoSwitch()
Returns whether this FancySSCell auto-switches to 3-D.


getAutoDetect

public boolean getAutoDetect()
Returns whether this FancySSCell auto-detects its mappings.


getAutoShowControls

public boolean getAutoShowControls()
Returns whether this FancySSCell auto-displays its widget frame.


hasControls

public boolean hasControls()
Returns whether the cell has any associated controls.


loadDataRMI

public void loadDataRMI(String s)
Deprecated. Use loadDataSource(String, RMI_SOURCE) instead.


loadDataString

public void loadDataString(String s)
Deprecated. Use loadDataSource(String, URL_SOURCE) instead.


loadDataURL

public void loadDataURL(URL u)
Deprecated. Use loadDataSource(String, URL_SOURCE) instead.


saveDataDialog

public void saveDataDialog(boolean netcdf)
Deprecated. Use saveDataDialog(String, Form) instead.


saveDataDialog

public void saveDataDialog(Form saveForm)
Deprecated. Use saveDataDialog(String, Form) instead.