Package ucar.unidata.ui.drawing
Class EditCanvas
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ucar.unidata.ui.drawing.DisplayCanvas
ucar.unidata.ui.drawing.EditCanvas
- All Implemented Interfaces:
ActionListener
,FocusListener
,KeyListener
,MouseListener
,MouseMotionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
- Direct Known Subclasses:
StationModelCanvas
,TestCanvas
public class EditCanvas
extends DisplayCanvas
implements MouseListener, MouseMotionListener, ActionListener, FocusListener, KeyListener
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class ShapeDescriptor _more_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
FieldsModifier and TypeFieldDescriptionstatic final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
_more_static final String
static final String
static final String
static final String
_more_static final String
_more_static final String
_more_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
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
accessibleContext, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
actionPerformed
(ActionEvent event) _more_cloneGlyphs
(List from) _more_void
Align the set of selected glyphs with the given command (e.g., align.top, align.bottom, etc.)void
doCopy()
_more_void
doCut()
_more_protected void
doDoubleClick
(Glyph nearestGlyph) _more_boolean
doGroup()
protected Component
_more_doMakeMenuItems
(Glyph g, List l) /** _more_Create the Glyph creation palettedoMakeToolbar
(JToolBar toolbar) _more_void
doPaste()
_more_void
Paste the given vector of glyphs.void
doToBack()
_more_void
_more_protected void
doZoomIn()
zoom inprotected void
zoom outvoid
_more_void
_more_boolean
_more_protected JComponent
_more__more__more_void
group()
_more_boolean
_more_void
initMenuBar
(JMenuBar menuBar) _more_void
keyPressed
(KeyEvent evt) _more_void
_more_void
_more_void
_more_makeDescriptor
(String className, String name, String iconName, String attrs) _more__more_makeEditMenu
(JMenu editMenu) _more_protected JMenuItem
makeMenuItem
(String label, char mnem, String command) _more_protected JMenuItem
makeMenuItem
(String label, String command) _more_protected JMenuItem
makeSelectionMenuItem
(String label, char mnem, String command, boolean enabled) _more__more_makeViewMenu
(JMenu viewMenu) _more_void
mouseClicked
(MouseEvent event) Handle mouse click events.void
_more_void
Handle mouse entered events.void
Handle mouse exited events.void
Handle mouse moved events.void
_more_boolean
_more_void
_more_void
notifyGlyphChanged
(Glyph theGlyph, String attr) _more_void
notifyGlyphChangeDone
(Glyph theGlyph, String attr) _more_void
notifyGlyphCreateComplete
(Glyph g, boolean diddleSelection, boolean fromPaste) _more_void
notifyGlyphMoveComplete
(Glyph theGlyph) _more_void
notifyGlyphMoved
(Glyph theGlyph) We have these hooks here so that derived classes can do things based on glyph events (e.g., tell the whiteboard server that a Glyph movedboolean
_more_void
Called from the base class.void
_more_void
_more_void
Set the color of the glyph from a color chooser dialog.void
Set the color of the glyph from a color chooser dialog.void
setCommand
(CanvasCommand newCommand) _more_void
_more_void
setHaveChanged
(boolean v) _more_boolean
_more_void
void
spaceH()
void
spaceV()
void
togglePressed
(JToggleButton pressed) _more_void
unGroup()
_more_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, setHighlight, setShowGrid, snap, transformInput, transformInput, transformInputX, transformInputY, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
CMD_ZOOMIN
_more_- See Also:
-
CMD_ZOOMOUT
_more_- See Also:
-
CMD_ZOOMRESET
_more_- See Also:
-
CMD_EDIT_CUT
_more_- See Also:
-
CMD_EDIT_COPY
_more_- See Also:
-
CMD_EDIT_PASTE
_more_- See Also:
-
CMD_EDIT_SELECTALL
_more_- See Also:
-
CMD_EDIT_GROUP
_more_- See Also:
-
CMD_EDIT_UNGROUP
_more_- See Also:
-
CMD_EDIT_TOFRONT
_more_- See Also:
-
CMD_EDIT_TOBACK
_more_- See Also:
-
CMD_ALIGN_PREFIX
_more_- See Also:
-
CMD_ALIGN_TOP
_more_- See Also:
-
CMD_ALIGN_CENTER
_more_- See Also:
-
CMD_ALIGN_BOTTOM
_more_- See Also:
-
CMD_ALIGN_LEFT
_more_- See Also:
-
CMD_ALIGN_MIDDLE
_more_- See Also:
-
CMD_ALIGN_RIGHT
_more_- See Also:
-
CMD_SPACE_H
- See Also:
-
CMD_SPACE_V
- See Also:
-
CMD_SNAP
- See Also:
-
-
Constructor Details
-
EditCanvas
public EditCanvas()_more_
-
-
Method Details
-
setDefaultCursor
public void setDefaultCursor()_more_ -
okToPaintHighlight
public boolean okToPaintHighlight()_more_- Returns:
- _more_
-
paint
Called from the base class. It calls the parent to paint the list of Glyphs and then it tells any highlighted glyph to paint. And then it tells the currentCommand to paint.- Overrides:
paint
in classDisplayCanvas
- Parameters:
g
-
-
haveCommand
public boolean haveCommand()_more_- Returns:
- _more_
-
getHaveChanged
public boolean getHaveChanged()_more_- Returns:
- _more_
-
setHaveChanged
public void setHaveChanged(boolean v) _more_- Parameters:
v
-
-
setCommand
_more_- Parameters:
newCommand
-
-
notifyGlyphMoved
We have these hooks here so that derived classes can do things based on glyph events (e.g., tell the whiteboard server that a Glyph moved- Overrides:
notifyGlyphMoved
in classDisplayCanvas
- Parameters:
theGlyph
-
-
notifyGlyphMoveComplete
_more_- Overrides:
notifyGlyphMoveComplete
in classDisplayCanvas
- Parameters:
theGlyph
-
-
notifyGlyphChanged
_more_- Parameters:
theGlyph
-attr
-
-
notifyGlyphChangeDone
_more_- Parameters:
theGlyph
-attr
-
-
notifyGlyphCreateComplete
_more_- Overrides:
notifyGlyphCreateComplete
in classDisplayCanvas
- Parameters:
g
-diddleSelection
-fromPaste
-
-
focusGained
_more_- Specified by:
focusGained
in interfaceFocusListener
- Parameters:
e
-
-
focusLost
_more_- Specified by:
focusLost
in interfaceFocusListener
- Parameters:
e
-
-
keyReleased
_more_- Specified by:
keyReleased
in interfaceKeyListener
- Parameters:
e
-
-
keyTyped
_more_- Specified by:
keyTyped
in interfaceKeyListener
- Parameters:
evt
-
-
keyPressed
_more_- Specified by:
keyPressed
in interfaceKeyListener
- Parameters:
evt
-
-
makeSelectionMenuItem
_more_- Parameters:
label
-mnem
-command
-enabled
-- Returns:
- _more_
-
makeMenuItem
_more_- Parameters:
label
-mnem
-command
-- Returns:
- _more_
-
makeMenuItem
_more_- Parameters:
label
-command
-- Returns:
- _more_
-
makeEditMenu
_more_- Returns:
- _more_
-
makeViewMenu
_more_- Returns:
- _more_
-
selectionChanged
public void selectionChanged()_more_- Overrides:
selectionChanged
in classDisplayCanvas
-
makeEditMenu
_more_- Parameters:
editMenu
-- Returns:
- _more_
-
makeViewMenu
_more_- Parameters:
viewMenu
-- Returns:
- _more_
-
doGroup
public boolean doGroup() -
doZoomIn
protected void doZoomIn()zoom in -
doZoomOut
protected void doZoomOut()zoom out -
actionPerformed
_more_- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
event
-
-
group
public void group()_more_ -
unGroup
public void unGroup()_more_ -
doPaste
Paste the given vector of glyphs. We find the upper left point of the set of glyphs to get an offset from the given x,y coords.- Parameters:
l
-x
-y
-
-
doPaste
public void doPaste()_more_ -
cloneGlyphs
_more_- Parameters:
from
-- Returns:
- _more_
-
doToFront
public void doToFront()_more_ -
doToBack
public void doToBack()_more_ -
doCopy
public void doCopy()_more_ -
doCut
public void doCut()_more_ -
selectAll
public void selectAll()_more_ -
spaceH
public void spaceH() -
spaceV
public void spaceV() -
doAlign
Align the set of selected glyphs with the given command (e.g., align.top, align.bottom, etc.)- Parameters:
cmd
-
-
snapToGrid
public void snapToGrid() -
doMakeMenuItems
/** _more_- Parameters:
g
-l
-- Returns:
- _more_
-
setColor
Set the color of the glyph from a color chooser dialog.- Parameters:
g
-Glyph
to color.foreground
- true if the color is for the foreground
-
setColor
Set the color of the glyph from a color chooser dialog.- Parameters:
g
-Glyph
to color.foreground
- true if the color is for the foregroundnewColor
- newColor
for thisGlyph
-
mouseClicked
Handle mouse click events.- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
event
-MouseEvent
-
mouseEntered
Handle mouse entered events. NO-OP in this implementation.- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
e
-MouseEvent
-
mouseExited
Handle mouse exited events. NO-OP in this implementation.- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
e
-MouseEvent
-
mouseMoved
Handle mouse moved events.- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Parameters:
e
-MouseEvent
-
getShapeDescriptors
_more_- Returns:
- _more_
-
getMenuBar
_more_- Returns:
- _more_
-
doMakeContents
_more_- Overrides:
doMakeContents
in classDisplayCanvas
- Returns:
- _more_
-
getLabelComponent
_more_- Returns:
- _more_
-
initMenuBar
_more_- Parameters:
menuBar
-
-
togglePressed
_more_- Parameters:
pressed
-
-
doMakeToolbar
_more_- Parameters:
toolbar
-- Returns:
- _more_
-
doMakePalette
Create the Glyph creation palette- Returns:
- _more_
-
showTextInPalette
public boolean showTextInPalette()_more_- Returns:
- _more_
-
mousePressed
_more_- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
-
-
doDoubleClick
_more_- Parameters:
nearestGlyph
- _more_
-
mousePressedInner
_more_- Parameters:
e
-- Returns:
- _more_
-
mouseDragged
_more_- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Parameters:
e
-
-
loadXml
_more_- Parameters:
root
-
-
mouseReleased
_more_- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
-
-
makeDescriptor
public EditCanvas.ShapeDescriptor makeDescriptor(String className, String name, String iconName, String attrs) _more_- Parameters:
className
- _more_name
- _more_iconName
- _more_attrs
- _more_- Returns:
- _more_
-