ucar.unidata.ui.symbol
Class StationModelCanvas

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 ucar.unidata.ui.drawing.DisplayCanvas
                      extended by ucar.unidata.ui.drawing.EditCanvas
                          extended by ucar.unidata.ui.symbol.StationModelCanvas
All Implemented Interfaces:
ActionListener, FocusListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class StationModelCanvas
extends EditCanvas

Class StationModelCanvas Manages the station model gui

Version:
$Revision: 1.69 $
Author:
IDV Development Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.unidata.ui.drawing.EditCanvas
EditCanvas.ShapeDescriptor
 
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
 
Fields inherited from class ucar.unidata.ui.drawing.EditCanvas
CMD_ALIGN_BOTTOM, CMD_ALIGN_CENTER, CMD_ALIGN_LEFT, CMD_ALIGN_MIDDLE, CMD_ALIGN_PREFIX, CMD_ALIGN_RIGHT, CMD_ALIGN_TOP, CMD_EDIT_COPY, CMD_EDIT_CUT, CMD_EDIT_GROUP, CMD_EDIT_PASTE, CMD_EDIT_SELECTALL, CMD_EDIT_TOBACK, CMD_EDIT_TOFRONT, CMD_EDIT_UNGROUP, CMD_SNAP, CMD_SPACE_H, CMD_SPACE_V, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_ZOOMRESET
 
Fields inherited from class ucar.unidata.ui.drawing.DisplayCanvas
canvasBg, CMD_CHANGE, CMD_CREATE, CMD_MOVE, CMD_REMOVE, CMD_TOBACK, CMD_TOFRONT, DEFAULT_CURSOR, glyphs, gridSpacing, HAND_CURSOR, highlightedGlyph, MOVE_CURSOR, NW_CURSOR, scaleFactor, showGrid, TEXT_CURSOR
 
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
StationModelCanvas(StationModelManager smm, boolean editable, JFrame frame)
          Make me
StationModelCanvas(StationModelManager smm, JFrame frame)
          Make me
 
Method Summary
 void actionPerformed(ActionEvent event)
          Handle ui actions.
protected  void closeDialogs()
          Close any open property dialogs
protected  void doClose()
          Close the gui
protected  void doDoubleClick(Glyph glyph)
          User double clicked on the glyph.
 boolean doGroup()
          Does this canvas support grouping of glyphs.
protected  Component doMakeContents()
          Make the gui
 List doMakeMenuItems(Glyph g, List l)
          Make popup menu items for the given glyph
protected  List doMakeMetSymbolMenu(MetSymbol metSymbol, List l, boolean forPopup)
          Make menu items for the given glyph
protected  void doNew()
          Create a new station model
protected  void doRemove()
          Remove the current station model
protected  void doRename()
          Rename the current station model
 void doSave()
          Save the current station model
 Point getCenter()
          Return the center point of the canvas.
static List getDefaultFormatList(double value)
          Get list of format string
static List getDefaultUnitList()
          Get list of default units TFO for the gui
protected  JComponent getLabelComponent()
          Create the name label if needed.
 List getShapeDescriptors()
          Create the list of shape descriptors form the xml
 boolean getShowParams()
          Determine whether the editor should show parameters or not.
 StationModel getStationModel()
          Get the current station model
protected  void initializeGlyphFromXml(Glyph g, Element symbolNode)
          Initialize the new glyph from the given xml node.
 void initMenuBar(JMenuBar menuBar)
          Add the menus into the menu bar
 void initSymbolsMenu(JMenu m)
          initialize the symbols menu
 void keyReleased(KeyEvent e)
          handle event
 JMenu makeEditMenu(JMenu editMenu)
          Make the edit menu
static List makeStationModelMenuItems(List symbols, ObjectListener listener, StationModelManager smm)
          _more_
 JMenu makeViewMenu(JMenu viewMenu)
          Make the view menu
 void notifyGlyphCreateComplete(Glyph newGlyph, boolean diddleSelection, boolean fromPaste)
          Gets called when a new glyph has bee created.
 void paint(Graphics g)
          Override the pain method do draw the axis lines
static void setHelpTopDir(String topDir)
           
 void setHighlight(Glyph g)
          Ovedrride the method so we can set the highlight label
 void setName(String n)
          Set the label
 void setPropertiesOnSelected()
           
 void setStationModel(StationModel l)
          Set the current station model_
 void setStationModel(StationModel newModel, boolean closeDialogs)
          Set the current station model
 boolean shouldShowAlignmentPoints()
          Should we draw the alignment points in the canvas
 void showProperties(MetSymbol metSymbol)
          Show the properties dialog for the given symbol.
 boolean showTextInPalette()
          Determine whether this canvas should show text in a palette or not.
 String toString()
          Return the station model name
 Point transformInput(Point r)
          Transform a Point from Java (screen) coordinates to canvas coordinates.
 Rectangle transformInput(Rectangle r)
          Transform a Rectangle from Java (screen) coordinates to canvas coordinates.
 int transformInputX(int x)
          Transform an X coordinate from Java coordinates to canvas coordinates.
 int transformInputY(int y)
          Transform a Y coordinate from Java coordinates to canvas coordinates.
 Point xxxtransformOutput(Point r)
          Transform a Point from canvas coordinates to Java (screen) coordinates.
 Rectangle xxxtransformOutput(Rectangle r)
          Transform a Rectangle from canvas coordinates to Java (screen) coordinates.
 int xxxtransformOutputX(int x)
          Transform an X coordinate from canvas coordinates to Java (screen) coordinates.
 int xxxtransformOutputY(int y)
          Transform a Y coordinate from canvas coordinates to Java (screen) coordinates.
 
Methods inherited from class ucar.unidata.ui.drawing.EditCanvas
cloneGlyphs, doAlign, doCopy, doCut, doMakePalette, doMakeToolbar, doPaste, doPaste, doToBack, doToFront, doZoomIn, doZoomOut, focusGained, focusLost, getHaveChanged, getMenuBar, group, haveCommand, keyPressed, keyTyped, loadXml, makeDescriptor, makeEditMenu, makeMenuItem, makeMenuItem, makeSelectionMenuItem, makeViewMenu, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mousePressedInner, mouseReleased, notifyGlyphChanged, notifyGlyphChangeDone, notifyGlyphMoveComplete, notifyGlyphMoved, okToPaintHighlight, selectAll, selectionChanged, setColor, setColor, setCommand, setDefaultCursor, setHaveChanged, snapToGrid, spaceH, spaceV, togglePressed, unGroup
 
Methods inherited from class ucar.unidata.ui.drawing.DisplayCanvas
addGlyph, addSelection, clearAll, clearSelection, createGlyph, decreaseGridSpacing, doRemove, findGlyph, findGlyph, findGlyph, getContents, getGlyphs, getImage, getSelection, getShowGrid, glyphChanged, hasSelection, increaseGridSpacing, isFocusTraversable, isSelected, justRemoveGlyph, moveToBack, moveToFront, notifyGlyphCreateComplete, paintGrid, removeGlyph, removeSelection, repaint, select, setCanvasBackground, setGlyphs, setShowGrid, snap, transformOutput, transformOutput, transformOutputX, transformOutputY
 
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, 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, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, 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, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StationModelCanvas

public StationModelCanvas(StationModelManager smm,
                          JFrame frame)
Make me

Parameters:
smm - The manager
frame - The frame to put me in

StationModelCanvas

public StationModelCanvas(StationModelManager smm,
                          boolean editable,
                          JFrame frame)
Make me

Parameters:
smm - The manager
editable - Is this editable
frame - The frame to put me in
Method Detail

setHighlight

public void setHighlight(Glyph g)
Ovedrride the method so we can set the highlight label

Overrides:
setHighlight in class DisplayCanvas
Parameters:
g - Highlighted glyph

getLabelComponent

protected JComponent getLabelComponent()
Create the name label if needed.

Overrides:
getLabelComponent in class EditCanvas
Returns:
The component that holds the name label.

setName

public void setName(String n)
Set the label

Overrides:
setName in class Component
Parameters:
n - The name of the station model

setStationModel

public void setStationModel(StationModel l)
Set the current station model_

Parameters:
l - The station model

setStationModel

public void setStationModel(StationModel newModel,
                            boolean closeDialogs)
Set the current station model

Parameters:
newModel - The station model
closeDialogs - If true then close any dialog windows

doGroup

public boolean doGroup()
Does this canvas support grouping of glyphs.

Overrides:
doGroup in class EditCanvas
Returns:
Support grouping of glyphs.

getStationModel

public StationModel getStationModel()
Get the current station model

Returns:
The current station model

toString

public String toString()
Return the station model name

Overrides:
toString in class Component
Returns:
The station model name

initMenuBar

public void initMenuBar(JMenuBar menuBar)
Add the menus into the menu bar

Overrides:
initMenuBar in class EditCanvas
Parameters:
menuBar - The menu bar

makeEditMenu

public JMenu makeEditMenu(JMenu editMenu)
Make the edit menu

Overrides:
makeEditMenu in class EditCanvas
Parameters:
editMenu - edit menu
Returns:
edit menu

setPropertiesOnSelected

public void setPropertiesOnSelected()

initSymbolsMenu

public void initSymbolsMenu(JMenu m)
initialize the symbols menu

Parameters:
m - menu

shouldShowAlignmentPoints

public boolean shouldShowAlignmentPoints()
Should we draw the alignment points in the canvas

Returns:
Draw the alignment points in the canvas

makeViewMenu

public JMenu makeViewMenu(JMenu viewMenu)
Make the view menu

Overrides:
makeViewMenu in class EditCanvas
Parameters:
viewMenu - view menu
Returns:
The view menu

setHelpTopDir

public static void setHelpTopDir(String topDir)

makeStationModelMenuItems

public static List makeStationModelMenuItems(List symbols,
                                             ObjectListener listener,
                                             StationModelManager smm)
_more_

Parameters:
symbols - _more_
listener - _more_
smm - _more_
Returns:
_more_

actionPerformed

public void actionPerformed(ActionEvent event)
Handle ui actions.

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class EditCanvas
Parameters:
event - The action event

closeDialogs

protected void closeDialogs()
Close any open property dialogs


doClose

protected void doClose()
Close the gui


doSave

public void doSave()
Save the current station model


doRemove

protected void doRemove()
Remove the current station model


doRename

protected void doRename()
Rename the current station model


doNew

protected void doNew()
Create a new station model


getShapeDescriptors

public List getShapeDescriptors()
Create the list of shape descriptors form the xml

Overrides:
getShapeDescriptors in class EditCanvas
Returns:
List of shape descriptors

initializeGlyphFromXml

protected void initializeGlyphFromXml(Glyph g,
                                      Element symbolNode)
Initialize the new glyph from the given xml node. Only do this if the glyph is a MetSymbol

Parameters:
g - The new glyph
symbolNode - The xml it was created from

doMakeContents

protected Component doMakeContents()
Make the gui

Overrides:
doMakeContents in class EditCanvas
Returns:
_gui

paint

public void paint(Graphics g)
Override the pain method do draw the axis lines

Overrides:
paint in class EditCanvas
Parameters:
g - The graphics to paint to

keyReleased

public void keyReleased(KeyEvent e)
handle event

Specified by:
keyReleased in interface KeyListener
Overrides:
keyReleased in class EditCanvas
Parameters:
e - event

doMakeMenuItems

public List doMakeMenuItems(Glyph g,
                            List l)
Make popup menu items for the given glyph

Overrides:
doMakeMenuItems in class EditCanvas
Parameters:
g - The glyph
l - List to put menu items into
Returns:
The list

doMakeMetSymbolMenu

protected List doMakeMetSymbolMenu(MetSymbol metSymbol,
                                   List l,
                                   boolean forPopup)
Make menu items for the given glyph

Parameters:
metSymbol - The glyph
l - List ot put items in
forPopup - Is this for a popup menu
Returns:
The list

showTextInPalette

public boolean showTextInPalette()
Determine whether this canvas should show text in a palette or not.

Overrides:
showTextInPalette in class EditCanvas
Returns:
Should text be shown

doDoubleClick

protected void doDoubleClick(Glyph glyph)
User double clicked on the glyph. Show the properties dialog.

Overrides:
doDoubleClick in class EditCanvas
Parameters:
glyph - Glyph that was clicked.

getShowParams

public boolean getShowParams()
Determine whether the editor should show parameters or not.

Returns:
true to show parameter selection.

notifyGlyphCreateComplete

public void notifyGlyphCreateComplete(Glyph newGlyph,
                                      boolean diddleSelection,
                                      boolean fromPaste)
Gets called when a new glyph has bee created.

Overrides:
notifyGlyphCreateComplete in class EditCanvas
Parameters:
newGlyph -
diddleSelection -
fromPaste -

showProperties

public void showProperties(MetSymbol metSymbol)
Show the properties dialog for the given symbol.

Parameters:
metSymbol - The symbol.

getDefaultFormatList

public static List getDefaultFormatList(double value)
Get list of format string

Parameters:
value - The value
Returns:
The format strings

getDefaultUnitList

public static List getDefaultUnitList()
Get list of default units TFO for the gui

Returns:
List of TFOS for choosing units

getCenter

public Point getCenter()
Return the center point of the canvas.

Returns:
center point in canvas coordinates.

transformInputX

public int transformInputX(int x)
Transform an X coordinate from Java coordinates to canvas coordinates.

Overrides:
transformInputX in class DisplayCanvas
Parameters:
x -
Returns:
x in canvas coordinates

transformInputY

public int transformInputY(int y)
Transform a Y coordinate from Java coordinates to canvas coordinates.

Overrides:
transformInputY in class DisplayCanvas
Parameters:
y -
Returns:
y in canvas coordinates

xxxtransformOutputX

public int xxxtransformOutputX(int x)
Transform an X coordinate from canvas coordinates to Java (screen) coordinates.

Parameters:
x -
Returns:
x in screen coordinates

xxxtransformOutputY

public int xxxtransformOutputY(int y)
Transform a Y coordinate from canvas coordinates to Java (screen) coordinates.

Parameters:
y -
Returns:
x in screen coordinates

xxxtransformOutput

public Rectangle xxxtransformOutput(Rectangle r)
Transform a Rectangle from canvas coordinates to Java (screen) coordinates.

Parameters:
r -
Returns:
rectangle in screen coordinates

transformInput

public Rectangle transformInput(Rectangle r)
Transform a Rectangle from Java (screen) coordinates to canvas coordinates.

Overrides:
transformInput in class DisplayCanvas
Parameters:
r -
Returns:
rectangle in canvas coordinates

xxxtransformOutput

public Point xxxtransformOutput(Point r)
Transform a Point from canvas coordinates to Java (screen) coordinates.

Parameters:
r -
Returns:
point in screen coordinates

transformInput

public Point transformInput(Point r)
Transform a Point from Java (screen) coordinates to canvas coordinates.

Overrides:
transformInput in class DisplayCanvas
Parameters:
r -
Returns:
rectangle in canvas coordinates