|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
templates.presentation.TemplateCanvas
templates.presentation.TemplateEditableCanvas
public class TemplateEditableCanvas
A TemplateCanvas which allows the manipulation of a
TemplateModel by the user via the GUI.
| Nested Class Summary | |
|---|---|
protected static class |
TemplateEditableCanvas.CanvasSettings
Canvas appearance settings. |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected static java.lang.String |
CANVAS_SETTINGS
The key to be used to annotate a TemplateModel with the
appearance settings of the canvas (zoom level and viewport position). |
protected java.awt.Point |
connectorOrigin
The point of origin for the new connector when the user is drawing a new connector. |
protected boolean |
drawConnector
Information about whether to paint the line representing the new connector when the user is drawing a new connector. |
protected DiagramElement |
hilitedElement
The diagram element which is highlighted. |
protected boolean |
ignoreNextMouseEvent
Toggle to turn on and off the processing of mouse events by the canvas when a dialog appears over the canvas (e.g., when the user enters a new label for an entity). |
protected MouseInterpreter |
interpreter
The interpreter of the mouse events for this canvas. |
protected java.awt.Rectangle |
selectionBox
The rectangle which defines the boundaries of the selection box when the user drags the mouse around diagram components to select them. |
protected static java.awt.Stroke |
SELECTIONBOX_STROKE
The stroke used to paint the boundary of the selection box when the user drags the mouse around diagram components to select them. |
| Fields inherited from class templates.presentation.TemplateCanvas |
|---|
diagram, DIAGRAM, graphics, model, scaleFactor, scaleToFit |
| 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 | |
|---|---|
TemplateEditableCanvas(TemplateModel model)
Construct a new canvas to enable the editing of the given template design. |
|
| Method Summary | |
|---|---|
protected void |
autoScroll()
Scroll the viewport of the canvas to the rectangle stored as an annotation in the template design. |
protected void |
autoZoom()
Set the scaling factor according to the zoom level setting stored as an annotation in the template design. |
java.awt.Point |
componentToLocal(java.awt.Point p)
Transform a point from the space of the canvas component to the space of the template diagram, accounting for the scaling factor. |
void |
finishConnector()
Stop painting a line to denote a new connector. |
javax.swing.JComponent |
getGUI()
|
DiagramElement |
getHighlightedElement()
Get the currently highlighted diagram element. |
java.awt.Rectangle |
getSelectionBox()
Retrieve the rectangle which defines the boundaries of the selection box when the user drags the mouse around diagram components to select them. |
void |
highlight(DiagramElement element)
Specify which diagram element should be highlighted. |
boolean |
isDrawingConnector()
Determine if the canvas is set to paint a line to denote a new connector. |
java.awt.Point |
localToComponent(java.awt.Point p)
Transform a point from the space of the template diagram to the space of canvas component, accounting for the scaling factor. |
java.awt.Point |
localToScreen(java.awt.Point p)
Transform a point from the space of the template diagram to the space of the screen, accounting for the scaling factor and the location of the canvas on the screen. |
void |
mouseClicked(java.awt.event.MouseEvent arg0)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
mouseEntered(java.awt.event.MouseEvent arg0)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
mouseExited(java.awt.event.MouseEvent arg0)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
mousePressed(java.awt.event.MouseEvent arg0)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
mouseReleased(java.awt.event.MouseEvent arg0)
Transform the mouse cursor coordinates accounting for the scaling factor and forward the event to the mouse event interpreter. |
void |
paint(java.awt.Graphics g)
|
protected void |
paintCore(java.awt.Graphics2D g2d)
In addition to painting the template diagram, also paint the highlighting of the highlighted diagram element (if any). |
void |
refresh()
Refresh the rendering of the diagram. |
void |
release()
Before releasing the template design, annotate it with the current appearance settings so that they can be reloaded if the user activates again the model in the workspace. |
void |
removeHighlight()
Stop highlighting the currently highlighted diagram element. |
void |
setSelectionBox(java.awt.Rectangle r)
Update the rectangle which defines the boundaries of the selection box when the user drags the mouse around diagram components to select them. |
void |
setUIInteraction(boolean b)
Specify whether the user is engaged in an interaction with a dialog which appears over the canvas (e.g., when the user enters a new label for an entity). |
void |
startConnector(java.awt.Point origin)
Start painting a line to denote a new connector with the given origin. |
protected void |
storeCanvasInfo()
Create a descriptor of the appearance settings of the canvas and create an annotation with it in the template design. |
void |
templateDiagramChanged(TemplateDiagramMessage message)
In addition to refreshing the rendering of the template diagram, update the highlighting of diagram elements. |
java.awt.event.MouseEvent |
transformMouseCoords(java.awt.event.MouseEvent me)
Construct a new mouse event based on the given mouse event, where the mouse cursor coordinates are transformed to account for the scaling factor used in painting the template diagram. |
| Methods inherited from class templates.presentation.TemplateCanvas |
|---|
forceRepaint, getDiagram, getModel, getPreferredSize, setTrackModel, templateDiagramSelectionChanged |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI |
| 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, 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 |
| Methods inherited from interface ides.api.plugin.presentation.Presentation |
|---|
getName |
| Field Detail |
|---|
protected static final java.lang.String CANVAS_SETTINGS
TemplateModel with the
appearance settings of the canvas (zoom level and viewport position).
This annotation is used to restore the last appearance of the template
diagram when the user re-activates the diagram in the workspace.
Annotable,
Constant Field Valuesprotected static final java.awt.Stroke SELECTIONBOX_STROKE
protected boolean ignoreNextMouseEvent
true to turn off the processing
of mouse events, set to false to turn on the processing of
mouse events. The mouse event of releasing the mouse button always sets
this toggle to false as the user is assumed to have started
interacting with the canvas directly.
setUIInteraction(boolean)protected MouseInterpreter interpreter
protected DiagramElement hilitedElement
null.
protected java.awt.Rectangle selectionBox
null.
protected java.awt.Point connectorOrigin
protected boolean drawConnector
true to paint the connector, set to false
otherwise.
| Constructor Detail |
|---|
public TemplateEditableCanvas(TemplateModel model)
model - the template design which the user will manipulate| Method Detail |
|---|
public javax.swing.JComponent getGUI()
getGUI in interface ides.api.plugin.presentation.PresentationgetGUI in class TemplateCanvaspublic void paint(java.awt.Graphics g)
paint in class TemplateCanvasprotected void paintCore(java.awt.Graphics2D g2d)
paintCore in class TemplateCanvasg2d - the graphics context where the template diagram should be
paintedpublic void templateDiagramChanged(TemplateDiagramMessage message)
templateDiagramChanged in interface TemplateDiagramSubscribertemplateDiagramChanged in class TemplateCanvasmessage - the description of the changeprotected void autoZoom()
1.
TemplateEditableCanvas.CanvasSettings,
Annotableprotected void autoScroll()
TemplateEditableCanvas.CanvasSettings,
Annotableprotected void storeCanvasInfo()
TemplateEditableCanvas.CanvasSettings,
Annotablepublic void refresh()
TemplateCanvas
refresh in class TemplateCanvaspublic void release()
release in interface ides.api.plugin.presentation.Presentationrelease in class TemplateCanvaspublic java.awt.event.MouseEvent transformMouseCoords(java.awt.event.MouseEvent me)
me - the original mouse event
public java.awt.Point localToScreen(java.awt.Point p)
p - the point in the space of the template diagram
public java.awt.Point localToComponent(java.awt.Point p)
p - the point in the space of the template diagram
public java.awt.Point componentToLocal(java.awt.Point p)
p - the point in the space of the canvas component
public void setUIInteraction(boolean b)
b - set to true when the user engages in an
interaction with a dialog which appears over the canvas; set
to false when the user finishes interacting with
a dialog which appears over the canvasignoreNextMouseEventpublic void setSelectionBox(java.awt.Rectangle r)
r - the new boundaries of the selection boxpublic java.awt.Rectangle getSelectionBox()
public void mouseClicked(java.awt.event.MouseEvent arg0)
mouseClicked in interface java.awt.event.MouseListenerinterpreterpublic void mouseEntered(java.awt.event.MouseEvent arg0)
mouseEntered in interface java.awt.event.MouseListenerinterpreterpublic void mouseExited(java.awt.event.MouseEvent arg0)
mouseExited in interface java.awt.event.MouseListenerinterpreterpublic void mousePressed(java.awt.event.MouseEvent arg0)
mousePressed in interface java.awt.event.MouseListenerinterpreterpublic void mouseReleased(java.awt.event.MouseEvent arg0)
mouseReleased in interface java.awt.event.MouseListenerinterpreterpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerinterpreterpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerinterpreterpublic void highlight(DiagramElement element)
element - the diagram element to be highlightedpublic DiagramElement getHighlightedElement()
null otherwisepublic void removeHighlight()
public void startConnector(java.awt.Point origin)
origin - the origin of the line denoting a new connectorpublic void finishConnector()
public boolean isDrawingConnector()
true if the canvas is set to paint a line to denote
a new connector; false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||