|
||||||||||
| 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.EventLinker
public class EventLinker
The UI element which handles the user actions to establish links between the
events of two template design components. This is an element which displays
the events of the template components and the links between them, and lets
the user modify the linking of events. Employed by EventLinksDialog .
EventLinksDialog,
Serialized Form| Nested Class Summary | |
|---|---|
protected class |
EventLinker.AddEventToModel
Action to mark an event for addition to the underlying model of the corresponding template component when the user commits all changes. |
protected class |
EventLinker.EventLabel
The UI component used to render an event label in the event linker. |
protected class |
EventLinker.LabelLink
The UI component used to render a link between two events. |
| 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 Connector |
connector
The connector connecting the template components whose event links are displayed. |
protected TemplateDiagram |
diagram
The diagram which contains the Connector connecting the template
components whose event links are displayed. |
protected static int |
EVENT_SPACING
The top and bottom margins of event labels (in pixels). |
protected boolean |
isLeftLeft
Information about whether the left Entity of the
Connector is located to the left of the right Entity of
the Connector. |
protected java.util.Set<EventLinker.EventLabel> |
labels
The event labels for the events of the template components. |
protected static int |
LINK_SENSITIVITY
The degree of proximity to be used when checking if a point lies on the link between events (in pixels). |
protected static int |
LINK_SPACING
The left and right margins of event labels (in pixels). |
protected java.util.Set<EventLinker.LabelLink> |
links
The representations of the links between events. |
protected java.awt.FontMetrics |
metrics
The FontMetrics to be used when computing the sizes of the event
labels on the screen. |
protected static int |
MIN_HEIGHT
The minimal height of the event linker component (in pixels). |
protected static int |
MIN_LINK_WIDTH
The minimal horizontal space which should be available to render event links (in pixels). |
protected EventLinker.EventLabel |
mouseDownOn
The event label on which the user pressed the mouse button, if any. |
protected static int |
NOTE_SPACE
The space which should be available next to event labels to paint the warning sign that an event is not a part of the alphabet of the underlying model of the corresponding template component (in pixels). |
protected static java.awt.Color |
SELECTED_COLOR
The color for event links selected by the user. |
protected EventLinker.LabelLink |
selectedLink
The event link selected by the user. |
protected boolean |
wasDragging
Information about whether the user was dragging the mouse cursor before releasing the mouse button. |
| 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 | |
|---|---|
EventLinker(TemplateDiagram diagram,
Connector connector)
Construct and set up the event linker component. |
|
| Method Summary | |
|---|---|
void |
addExtraLeftEvent(java.lang.String name)
Add an event to the left template component of the Connector. |
void |
addExtraRightEvent(java.lang.String name)
Add an event to the right template component of the Connector. |
void |
commitChanges()
Commit all changes to the linking of events, as well as the addition of events to the underlying models of the template components linked by the Connector. |
protected EventLinker.EventLabel |
findMatchingRightLabel(java.lang.String name)
Retrieve the event label for an event from the right template component of the Connector. |
protected EventLinker.EventLabel |
getLabel(java.lang.String name,
Entity mom)
Retrieve the event label for the event with the given name, part of the template component of the given Entity. |
protected EventLinker.EventLabel |
getLabelAt(java.awt.Point p)
Retrieve the event label which contains the given point. |
protected int |
getLabelMaxY()
Retrieve the maximum of the vertical positions of all event labels (including the label heights). |
protected int |
getMaxLabelWidth()
Retrieve the maximum of the widths of all event labels. |
java.awt.Dimension |
getMinimumSize()
|
java.awt.Dimension |
getPreferredSize()
|
protected void |
linkLabels(EventLinker.EventLabel first,
EventLinker.EventLabel second)
Establish a link between the event from the given event labels. |
void |
matchEvents()
Remove all existing links between events and only establish links between events with the same name. |
void |
mouseClicked(java.awt.event.MouseEvent arg0)
Do nothing. |
void |
mouseDragged(java.awt.event.MouseEvent arg0)
Record the fact that the mouse was dragged. |
void |
mouseEntered(java.awt.event.MouseEvent arg0)
Do nothing. |
void |
mouseExited(java.awt.event.MouseEvent arg0)
Do nothing. |
void |
mouseMoved(java.awt.event.MouseEvent arg0)
Repaint the UI element to reflect the updated position of the mouse cursor. |
void |
mousePopupTrigger(java.awt.event.MouseEvent arg0)
Show the context (right-click) pop-up menu for the item under the mouse cursor. |
void |
mousePressed(java.awt.event.MouseEvent arg0)
Process the depression of the mouse button to perform any relevant action such as starting the drawing of a new link, completing an already started link, etc. |
void |
mouseReleased(java.awt.event.MouseEvent arg0)
Process the release of the mouse button to perform any relevant action such as selecting a link, completing an already started link, etc. |
void |
paint(java.awt.Graphics g)
|
void |
unlinkAll()
Remove all links between the events of the template components connected by the Connector given during initialization. |
void |
unlinkLabel(EventLinker.EventLabel label)
Remove all links which link the event from the given event label. |
void |
update()
Update the positions of the event labels. |
| 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, 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 |
| Field Detail |
|---|
protected static final int EVENT_SPACING
protected static final int LINK_SPACING
protected static final int LINK_SENSITIVITY
protected static final int MIN_LINK_WIDTH
protected static final int MIN_HEIGHT
protected static final int NOTE_SPACE
protected static final java.awt.Color SELECTED_COLOR
protected boolean isLeftLeft
Entity of the
Connector is located to the left of the right Entity of
the Connector. Set to true if the left entity is
located to the left of the right entity, set to false
otherwise.
protected TemplateDiagram diagram
Connector connecting the template
components whose event links are displayed.
protected Connector connector
protected java.awt.FontMetrics metrics
FontMetrics to be used when computing the sizes of the event
labels on the screen.
protected java.util.Set<EventLinker.EventLabel> labels
protected java.util.Set<EventLinker.LabelLink> links
protected EventLinker.EventLabel mouseDownOn
protected boolean wasDragging
protected EventLinker.LabelLink selectedLink
| Constructor Detail |
|---|
public EventLinker(TemplateDiagram diagram,
Connector connector)
diagram - the diagram which contains the Connector connecting
the template components whose event links are to be displayedconnector - the connector connecting the template components whose event
links are to be displayed| Method Detail |
|---|
public void update()
protected EventLinker.EventLabel getLabel(java.lang.String name,
Entity mom)
Entity.
name - the name of the eventmom - the Entity to whose TemplateComponent the
event belongs
null
otherwisepublic void addExtraLeftEvent(java.lang.String name)
Connector.
The event will appear in the list of events available for linking, however, it will not be added to the underlying model of the template component.
name - the name for the new eventpublic void addExtraRightEvent(java.lang.String name)
Connector.
The event will appear in the list of events available for linking, however, it will not be added to the underlying model of the template component.
name - the name for the new eventprotected int getMaxLabelWidth()
0
if there are no event labelsprotected int getLabelMaxY()
0 if there are no
event labelsprotected EventLinker.EventLabel getLabelAt(java.awt.Point p)
p - the point
null otherwisepublic java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic java.awt.Dimension getMinimumSize()
getMinimumSize in class javax.swing.JComponentpublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponent
protected void linkLabels(EventLinker.EventLabel first,
EventLinker.EventLabel second)
first - the event label with the first event to be linkedsecond - the event label with the second event to be linkedpublic void unlinkLabel(EventLinker.EventLabel label)
label - the event label with the event whose links should be removedpublic void unlinkAll()
Connector given during initialization.
protected EventLinker.EventLabel findMatchingRightLabel(java.lang.String name)
Connector.
name - the name of the event
Connector, if the right template component has an
event with the given name; null otherwisepublic void matchEvents()
public void mouseDragged(java.awt.event.MouseEvent arg0)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent arg0)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseClicked(java.awt.event.MouseEvent arg0)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent arg0)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent arg0)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent arg0)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent arg0)
mouseReleased in interface java.awt.event.MouseListenerpublic void mousePopupTrigger(java.awt.event.MouseEvent arg0)
arg0 - the description of the mouse eventpublic void commitChanges()
Connector.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||