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 classClass ShapeDescriptor _more_Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested 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 Stringstatic final Stringstatic final Stringstatic 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_CURSORFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) _more_cloneGlyphs(List from) _more_voidAlign the set of selected glyphs with the given command (e.g., align.top, align.bottom, etc.)voiddoCopy()_more_voiddoCut()_more_protected voiddoDoubleClick(Glyph nearestGlyph) _more_booleandoGroup()protected Component_more_doMakeMenuItems(Glyph g, List l) /** _more_Create the Glyph creation palettedoMakeToolbar(JToolBar toolbar) _more_voiddoPaste()_more_voidPaste the given vector of glyphs.voiddoToBack()_more_void_more_protected voiddoZoomIn()zoom inprotected voidzoom outvoid_more_void_more_boolean_more_protected JComponent_more__more__more_voidgroup()_more_boolean_more_voidinitMenuBar(JMenuBar menuBar) _more_voidkeyPressed(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 JMenuItemmakeMenuItem(String label, char mnem, String command) _more_protected JMenuItemmakeMenuItem(String label, String command) _more_protected JMenuItemmakeSelectionMenuItem(String label, char mnem, String command, boolean enabled) _more__more_makeViewMenu(JMenu viewMenu) _more_voidmouseClicked(MouseEvent event) Handle mouse click events.void_more_voidHandle mouse entered events.voidHandle mouse exited events.voidHandle mouse moved events.void_more_boolean_more_void_more_voidnotifyGlyphChanged(Glyph theGlyph, String attr) _more_voidnotifyGlyphChangeDone(Glyph theGlyph, String attr) _more_voidnotifyGlyphCreateComplete(Glyph g, boolean diddleSelection, boolean fromPaste) _more_voidnotifyGlyphMoveComplete(Glyph theGlyph) _more_voidnotifyGlyphMoved(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_voidCalled from the base class.void_more_void_more_voidSet the color of the glyph from a color chooser dialog.voidSet the color of the glyph from a color chooser dialog.voidsetCommand(CanvasCommand newCommand) _more_void_more_voidsetHaveChanged(boolean v) _more_boolean_more_voidvoidspaceH()voidspaceV()voidtogglePressed(JToggleButton pressed) _more_voidunGroup()_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, transformOutputYMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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:
paintin 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:
notifyGlyphMovedin classDisplayCanvas- Parameters:
theGlyph-
-
notifyGlyphMoveComplete
_more_- Overrides:
notifyGlyphMoveCompletein classDisplayCanvas- Parameters:
theGlyph-
-
notifyGlyphChanged
_more_- Parameters:
theGlyph-attr-
-
notifyGlyphChangeDone
_more_- Parameters:
theGlyph-attr-
-
notifyGlyphCreateComplete
_more_- Overrides:
notifyGlyphCreateCompletein classDisplayCanvas- Parameters:
g-diddleSelection-fromPaste-
-
focusGained
_more_- Specified by:
focusGainedin interfaceFocusListener- Parameters:
e-
-
focusLost
_more_- Specified by:
focusLostin interfaceFocusListener- Parameters:
e-
-
keyReleased
_more_- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e-
-
keyTyped
_more_- Specified by:
keyTypedin interfaceKeyListener- Parameters:
evt-
-
keyPressed
_more_- Specified by:
keyPressedin 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:
selectionChangedin 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:
actionPerformedin 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-Glyphto color.foreground- true if the color is for the foreground
-
setColor
Set the color of the glyph from a color chooser dialog.- Parameters:
g-Glyphto color.foreground- true if the color is for the foregroundnewColor- newColorfor thisGlyph
-
mouseClicked
Handle mouse click events.- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
event-MouseEvent
-
mouseEntered
Handle mouse entered events. NO-OP in this implementation.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e-MouseEvent
-
mouseExited
Handle mouse exited events. NO-OP in this implementation.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e-MouseEvent
-
mouseMoved
Handle mouse moved events.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
e-MouseEvent
-
getShapeDescriptors
_more_- Returns:
- _more_
-
getMenuBar
_more_- Returns:
- _more_
-
doMakeContents
_more_- Overrides:
doMakeContentsin 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:
mousePressedin interfaceMouseListener- Parameters:
e-
-
doDoubleClick
_more_- Parameters:
nearestGlyph- _more_
-
mousePressedInner
_more_- Parameters:
e-- Returns:
- _more_
-
mouseDragged
_more_- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
e-
-
loadXml
_more_- Parameters:
root-
-
mouseReleased
_more_- Specified by:
mouseReleasedin 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_
-