ucar.unidata.ui.drawing
Class DisplayCanvas

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
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
EditCanvas

public class DisplayCanvas
extends JPanel

Class DisplayCanvas

Author:
IDV development team
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  Color canvasBg
          _more_
static String CMD_CHANGE
          _more_
static String CMD_CREATE
          _more_
static String CMD_MOVE
          _more_
static String CMD_REMOVE
          _more_
static String CMD_TOBACK
          _more_
static String CMD_TOFRONT
          _more_
static Cursor DEFAULT_CURSOR
          _more_
protected  List glyphs
          _more_
 int gridSpacing
           
static Cursor HAND_CURSOR
          _more_
protected  Glyph highlightedGlyph
          _more_
static Cursor MOVE_CURSOR
          _more_
static Cursor NW_CURSOR
          _more_
protected  double scaleFactor
          The scaling
 boolean showGrid
           
static Cursor TEXT_CURSOR
          _more_
 
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
DisplayCanvas()
          _more_
 
Method Summary
 void addGlyph(Glyph g)
          _more_
 void addSelection(Glyph g)
          _more_
 void clearAll()
          _more_
 void clearSelection()
          _more_
 Glyph createGlyph(String glyphClass, int x, int y)
          _more_
 void decreaseGridSpacing()
           
protected  Component doMakeContents()
          _more_
 void doRemove(Glyph g)
          _more_
 Glyph findGlyph(int x, int y)
          _more_
static Glyph findGlyph(List glyphs, int x, int y, double threshold)
          _more_
 Glyph findGlyph(String id)
          _more_
 Component getContents()
          _more_
protected  List getGlyphs()
          _more_
 Image getImage(String path)
          _more_
 List getSelection()
          _more_
 boolean getShowGrid()
          Get the ShowGrid property.
 void glyphChanged(Glyph g)
          _more_
 boolean hasSelection()
          _more_
 void increaseGridSpacing()
           
 boolean isFocusTraversable()
          _more_
 boolean isSelected(Glyph g)
          _more_
 void justRemoveGlyph(Glyph g)
          _more_
 void moveToBack(Glyph theGlyph)
          _more_
 void moveToFront(Glyph theGlyph)
          _more_
 void notifyGlyphCreateComplete(Glyph g)
          _more_
 void notifyGlyphCreateComplete(Glyph g, boolean diddleSelection, boolean fromPaste)
          _more_
 void notifyGlyphMoveComplete(Glyph theGlyph)
          _more_
 void notifyGlyphMoved(Glyph theGlyph)
          _more_
 void paint(Graphics g)
          _more_
 void paintGrid(Graphics g)
           
 void removeGlyph(Glyph g)
          _more_
 void removeSelection(Glyph g)
          _more_
 void repaint(Glyph g)
          _more_
 void select(Rectangle r)
          _more_
 void selectionChanged()
          _more_
 void setCanvasBackground(Color c)
          _more_
protected  void setGlyphs(List newGlyphs)
          _more_
 void setHighlight(Glyph g)
          _more_
 void setShowGrid(boolean value)
          Set the ShowGrid property.
 int snap(int p)
           
 Point transformInput(Point r)
          _more_
 Rectangle transformInput(Rectangle r)
          _more_
 int transformInputX(int x)
          _more_
 int transformInputY(int x)
          _more_
 Point transformOutput(Point r)
          _more_
 Rectangle transformOutput(Rectangle r)
          _more_
 int transformOutputX(int x)
          _more_
 int transformOutputY(int x)
          _more_
 
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, 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

CMD_CREATE

public static final String CMD_CREATE
_more_

See Also:
Constant Field Values

CMD_TOFRONT

public static final String CMD_TOFRONT
_more_

See Also:
Constant Field Values

CMD_TOBACK

public static final String CMD_TOBACK
_more_

See Also:
Constant Field Values

CMD_CHANGE

public static final String CMD_CHANGE
_more_

See Also:
Constant Field Values

CMD_REMOVE

public static final String CMD_REMOVE
_more_

See Also:
Constant Field Values

CMD_MOVE

public static final String CMD_MOVE
_more_

See Also:
Constant Field Values

DEFAULT_CURSOR

public static final Cursor DEFAULT_CURSOR
_more_


HAND_CURSOR

public static final Cursor HAND_CURSOR
_more_


MOVE_CURSOR

public static final Cursor MOVE_CURSOR
_more_


TEXT_CURSOR

public static final Cursor TEXT_CURSOR
_more_


NW_CURSOR

public static final Cursor NW_CURSOR
_more_


gridSpacing

public int gridSpacing

showGrid

public boolean showGrid

scaleFactor

protected double scaleFactor
The scaling


canvasBg

protected Color canvasBg
_more_


glyphs

protected List glyphs
_more_


highlightedGlyph

protected Glyph highlightedGlyph
_more_

Constructor Detail

DisplayCanvas

public DisplayCanvas()
_more_

Method Detail

setCanvasBackground

public void setCanvasBackground(Color c)
_more_

Parameters:
c - _more_

getGlyphs

protected List getGlyphs()
_more_

Returns:
_more_

setGlyphs

protected void setGlyphs(List newGlyphs)
_more_

Parameters:
newGlyphs -

isFocusTraversable

public boolean isFocusTraversable()
_more_

Overrides:
isFocusTraversable in class Component
Returns:
_more_

getContents

public Component getContents()
_more_

Returns:
_more_

snap

public int snap(int p)

setShowGrid

public void setShowGrid(boolean value)
Set the ShowGrid property.

Parameters:
value - The new value for ShowGrid

getShowGrid

public boolean getShowGrid()
Get the ShowGrid property.

Returns:
The ShowGrid

increaseGridSpacing

public void increaseGridSpacing()

decreaseGridSpacing

public void decreaseGridSpacing()

doMakeContents

protected Component doMakeContents()
_more_

Returns:
_more_

paintGrid

public void paintGrid(Graphics g)

paint

public void paint(Graphics g)
_more_

Overrides:
paint in class JComponent
Parameters:
g -

createGlyph

public Glyph createGlyph(String glyphClass,
                         int x,
                         int y)
_more_

Parameters:
glyphClass -
x -
y -
Returns:
_more_

repaint

public void repaint(Glyph g)
_more_

Parameters:
g -

addGlyph

public void addGlyph(Glyph g)
_more_

Parameters:
g -

select

public void select(Rectangle r)
_more_

Parameters:
r -

selectionChanged

public void selectionChanged()
_more_


hasSelection

public boolean hasSelection()
_more_

Returns:
_more_

addSelection

public void addSelection(Glyph g)
_more_

Parameters:
g -

isSelected

public boolean isSelected(Glyph g)
_more_

Parameters:
g -
Returns:
_more_

getSelection

public List getSelection()
_more_

Returns:
_more_

clearSelection

public void clearSelection()
_more_


clearAll

public void clearAll()
_more_


notifyGlyphMoved

public void notifyGlyphMoved(Glyph theGlyph)
_more_

Parameters:
theGlyph -

notifyGlyphMoveComplete

public void notifyGlyphMoveComplete(Glyph theGlyph)
_more_

Parameters:
theGlyph -

notifyGlyphCreateComplete

public void notifyGlyphCreateComplete(Glyph g,
                                      boolean diddleSelection,
                                      boolean fromPaste)
_more_

Parameters:
g -
diddleSelection -
fromPaste -

notifyGlyphCreateComplete

public void notifyGlyphCreateComplete(Glyph g)
_more_

Parameters:
g -

removeSelection

public void removeSelection(Glyph g)
_more_

Parameters:
g -

justRemoveGlyph

public void justRemoveGlyph(Glyph g)
_more_

Parameters:
g -

removeGlyph

public void removeGlyph(Glyph g)
_more_

Parameters:
g -

doRemove

public void doRemove(Glyph g)
_more_

Parameters:
g -

setHighlight

public void setHighlight(Glyph g)
_more_

Parameters:
g -

glyphChanged

public void glyphChanged(Glyph g)
_more_

Parameters:
g -

getImage

public Image getImage(String path)
_more_

Parameters:
path -
Returns:
_more_

findGlyph

public Glyph findGlyph(String id)
_more_

Parameters:
id -
Returns:
_more_

findGlyph

public Glyph findGlyph(int x,
                       int y)
_more_

Parameters:
x -
y -
Returns:
_more_

findGlyph

public static Glyph findGlyph(List glyphs,
                              int x,
                              int y,
                              double threshold)
_more_

Parameters:
glyphs -
x -
y -
threshold -
Returns:
_more_

moveToFront

public void moveToFront(Glyph theGlyph)
_more_

Parameters:
theGlyph -

moveToBack

public void moveToBack(Glyph theGlyph)
_more_

Parameters:
theGlyph -

transformInputX

public int transformInputX(int x)
_more_

Parameters:
x -
Returns:
_more_

transformInputY

public int transformInputY(int x)
_more_

Parameters:
x -
Returns:
_more_

transformOutputX

public int transformOutputX(int x)
_more_

Parameters:
x -
Returns:
_more_

transformOutputY

public int transformOutputY(int x)
_more_

Parameters:
x -
Returns:
_more_

transformOutput

public Rectangle transformOutput(Rectangle r)
_more_

Parameters:
r -
Returns:
_more_

transformInput

public Rectangle transformInput(Rectangle r)
_more_

Parameters:
r -
Returns:
_more_

transformOutput

public Point transformOutput(Point r)
_more_

Parameters:
r -
Returns:
_more_

transformInput

public Point transformInput(Point r)
_more_

Parameters:
r -
Returns:
_more_