ARoad0.Gui2
Class GraphicSketchView

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 ARoad0.Gui2.GraphicView
                      extended by ARoad0.Gui2.GraphicEPRView
                          extended by ARoad0.Gui2.GraphicSketchView
All Implemented Interfaces:
MVC_View, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class GraphicSketchView
extends GraphicEPRView

This class is responsible for displaying an EPRViewInBase in the sketch view of any BaseObject selected in the desktop, which is named the view center. The sketch view displays all the direct access sources and direct access targets of the center, in a diagram where the center sources on the top line, and the center targets at the bottom line under the center node.

Sees the parent GraphicEPRView, for a general understanding of this class work. In GraphicSketchView, GraphicEPRView.l_AccessTargetSources_ and l_NoSourceTargets_ never contain the center object. GraphicView.l_allNodesInLinks_ is never used since there is no extended view. l_AccessTargetSources_ and l_SourcesForCenter_ are set from the links ViewInBase_Facade.populateSketchView() discovers, while l_NoSourceTargets_ is set from the ViewInBase. This means there is never a source without a link to the center, and it is possible to have a target without link from the center. The GraphicView function of node moving and switching is disabled. As resetGraphicView() is called after a full change of the view nodes, the node storing during a node adding is also disabled.

The method setGraphicNodesPositions() produces an empty sketcher in grey, if the number of nodes around the center is superior to 21, or if there are more than 10 sources or more than 10 targets.

See Also:
EPRViewInBaseImpl, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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  int accessTargetSourcesCount_
          The size of GraphicEPRView.l_AccessTargetSources_, which does not include the center.
protected  BaseObject center_
          This is the central object for which the access sources and targets are displayed in the sketch view.
protected  java.util.List l_SourcesForCenter_
          List of sources that are access sources for the center, to put above the center node.
protected  int sourcesForCenterCount_
          The size of l_SourcesForCenter_
 
Fields inherited from class ARoad0.Gui2.GraphicEPRView
l_AccessTargetSources_, l_NoSourceTargets_, noSourceTargetsCount_, sourcesCount_
 
Fields inherited from class ARoad0.Gui2.GraphicView
ARROW_HEAD_ANGLE, ARROW_HEAD_LENGTH, BASIC_STROKE, BORDER, DASHED_DOUBLEWIDTH_STROKE, DASHED_STROKE, DOUBLEWIDTH_STROKE, dragSourceNodeName_, dragTargetNodeName_, INITIAL_CAPACITY, l_allNodesInLinks_, l_currentArrowsAndRightsStarts_, l_LinksAndRights_, l_rightsRelatedBaseObjects_, m_GraphicNodes_, m_GraphicNodesBounds_, m_l_DisplayableLinks_, mouseDragged_, NODE_DISTANCE, nodesNumber_, NULL_SHAPE_ARRAY, PRIME, RIGHTS_SHIFT, viewInBase_, WAITING_TEXT, whyText_
 
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
GraphicSketchView(EPRViewInBase _view)
          This constructor prepare a sketch view where a central object is displayed with all its near-access objects around it.
 
Method Summary
 void finalizeForGui()
          Called by InternalFrame to finalize the instance and to set is a a new object before the initialization, with the exception of whyText_ that is set to null to indicate the finalizing operation.
protected  BaseObject getSelectedObjectOnMouseClicked(java.awt.event.MouseEvent _e)
          Called by mouseClicked() to find the BaseObject in the view on which the user has clicked.
protected  void initialize(java.util.Map _m_l_DisplayableLinks)
          This method must be called through resetGraphicView() to have an operational instance.
 void mouseDragged(java.awt.event.MouseEvent _e)
          This method deletes the GraphicView process of switching between nodes.
 void mouseReleased(java.awt.event.MouseEvent _e)
          This method deletes the GraphicView process of switching between nodes.
 int resetGraphicView(BaseObject _center, java.util.Map _m_l_DisplayableLinks)
          This method must be called after the constructor to have an operational instance.
 void resetRights()
          UNUSED - Draws the new arrows and rights after a change in the rights, without changing in GraphicNodes.
protected  void setGraphicNodes()
          Sets the GraphicNodes in a 7, 11 or 21 nodes layout in the JPanel, with their absolute coordinates in 3 levels.
protected  java.awt.Point[] setGraphicNodesPositions()
          Sets the allowed positions of the node in the view.
protected  void setViewSize(int _nodesNumber)
          Sets the size of the JPanel when the view contains less than 21 elements.
 
Methods inherited from class ARoad0.Gui2.GraphicEPRView
buildUpArrowsAndRights, hasFirstRateLinkInOneDLink, hasOwnerContainLinkToGroupIDMember, hasStrengthenLinksInOneDLink, initialize, setArrowHead, setRightsRelatedBaseObjects, setWhyText
 
Methods inherited from class ARoad0.Gui2.GraphicView
addWaitingMessage, drawArrowsAndRights, getAllNodesInLinks, getEorDataModel, getExportImage, getHiddenNodesInLinks, getIndexesOfNodeLocations, getLinksHashCode, getMaximumSize, getMinimumSize, getPreferredSize, getRightsRelatedBaseObjects, getWhyText, mouseClicked, mouseEntered, mouseExited, mouseMoved, mousePressed, paintComponent, removeWaitingMessage, resetGraphicView, setGraphicNodeLocations, setGraphicNodesPositions, setIndexesOfNodeLocations, setPoint2DForArrowAndRights
 
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, 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

center_

protected BaseObject center_
This is the central object for which the access sources and targets are displayed in the sketch view. The single node at the second line of the view.


l_SourcesForCenter_

protected final java.util.List l_SourcesForCenter_
List of sources that are access sources for the center, to put above the center node.


accessTargetSourcesCount_

protected int accessTargetSourcesCount_
The size of GraphicEPRView.l_AccessTargetSources_, which does not include the center.


sourcesForCenterCount_

protected int sourcesForCenterCount_
The size of l_SourcesForCenter_

Constructor Detail

GraphicSketchView

public GraphicSketchView(EPRViewInBase _view)
This constructor prepare a sketch view where a central object is displayed with all its near-access objects around it. On the contrary of the parent classes, this constructor does not provide an operational instance, since a resetGraphicView() call has to come after for defining the center and for obtaining a workable graphic view. No right updating is done by a GraphicViewBaseListenerImpl, and this is a major difference from the super classes.

Parameters:
_view - to associate to this instance.
Method Detail

initialize

protected final void initialize(java.util.Map _m_l_DisplayableLinks)
                         throws ProcessError
This method must be called through resetGraphicView() to have an operational instance. Initializes nodesNumber_, m_l_DisplayableLinks_, set the GraphicNode locations, and initializes l_NoSourceTargets_, l_AccessTargetSources_, l_SourcesForCenter_ and the counts. l_AccessTargetSources_ and l_SourcesForCenter_ are set from the links in _m_l_DisplayableLinks, while l_NoSourceTargets_ is set from the ViewInBase. l_allNodesInLinks_ is not initialized there since it is not used in this class to construct an extended view. Called by resetGraphicView(). This method is derived from the super.initialize() method, but with different arguments. Synchronized on viewInBase_.

Parameters:
_m_l_DisplayableLinks - is the map of DisplayableLinkImpls in this view. May be null only if center_ is null and viewInBase_ empty.
Throws:
ProcessError - if there is a loop in the rights search

finalizeForGui

public void finalizeForGui()
Called by InternalFrame to finalize the instance and to set is a a new object before the initialization, with the exception of whyText_ that is set to null to indicate the finalizing operation. Overrides the GraphicEPRView method and calls it.

Overrides:
finalizeForGui in class GraphicEPRView

resetRights

public final void resetRights()
                       throws ProcessError,
                              java.lang.InterruptedException
UNUSED - Draws the new arrows and rights after a change in the rights, without changing in GraphicNodes. Not called by GraphicViewBaseListener, since there is no right update. Calls RightsFactory_Facade.detectSketchRights(), buildUpArrowsAndRights(). This method call must be followed by a call to repaint() in the event dispatch thread. Override the super method.

Overrides:
resetRights in class GraphicEPRView
Throws:
ProcessError - if there is a loop in the rights search
java.lang.InterruptedException

resetGraphicView

public final int resetGraphicView(BaseObject _center,
                                  java.util.Map _m_l_DisplayableLinks)
                           throws ProcessError
This method must be called after the constructor to have an operational instance. Builds up the map of (BaseObject, center_) pair linked by DisplayableLinks, then sets the JPanel size, its GraphicNodes, constructs the arrows and the visible rights shapes to be drawn in paintComponents(). The main work is done there by buildUpArrowsAndRights(), so that the paint action is fast. Called by ActionOpenSketcher.openSelection() in the main thread. Calls finalizeForGui(), initialize(), buildUpArrowsAndRights() and repaint(). Derived from GraphiView.resetGraphicView().

Parameters:
_center - is the central object of the view for which this sketch view is displayed. May be null if the EPRViewInBase has currently no elements.
_m_l_DisplayableLinks - is the map of DisplayableLinkImpls in this view. No use if _center is null. May be null.
Returns:
-1 if the view is too complex to be drawn, or return nodesNumber_
Throws:
ProcessError - if there is a loop in the rights search, or InternalError if the center is not in the view.

getSelectedObjectOnMouseClicked

protected BaseObject getSelectedObjectOnMouseClicked(java.awt.event.MouseEvent _e)
Called by mouseClicked() to find the BaseObject in the view on which the user has clicked. In setGraphicNodes(), m_GraphicNodesBounds_ uses a special key which is not the BaseObject name when the BaseObject is two times in the view. The key of the second display in m_GraphicNodes_ and m_GraphicNodesBounds_ is BaseObject name extended by ''. So, after a click on the second display of a BaseObject, this method converts the node name to find the right object. Overrides the GraphicView method.

Overrides:
getSelectedObjectOnMouseClicked in class GraphicView
Parameters:
_e - is the event
Returns:
the selected BaseObject or null
Since:
0.7.0

mouseReleased

public final void mouseReleased(java.awt.event.MouseEvent _e)
This method deletes the GraphicView process of switching between nodes. Override the GraphicView method

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class GraphicView
Parameters:
_e - is the event

mouseDragged

public final void mouseDragged(java.awt.event.MouseEvent _e)
This method deletes the GraphicView process of switching between nodes. Override the GraphicView method

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class GraphicView
Parameters:
_e - is the event
See Also:
GraphicView.mouseReleased(java.awt.event.MouseEvent)

setViewSize

protected void setViewSize(int _nodesNumber)
Sets the size of the JPanel when the view contains less than 21 elements. The size has three values if _nodesNumber is inferior to 8, to 12 or not. No operation if it is superior to twenty one or negative, and nodesNumber_ is then set to '-1'. Called by setGraphicNodes(). Overrides the super method and oes not call it.

Overrides:
setViewSize in class GraphicView
Parameters:
_nodesNumber - is the number of BaseObjects in the view.

setGraphicNodes

protected final void setGraphicNodes()
Sets the GraphicNodes in a 7, 11 or 21 nodes layout in the JPanel, with their absolute coordinates in 3 levels. The center node is the single node at the second level. Called by intialize(). No operation if center_ is null. No operation if the view cannot be processed, and nodesNumber_ is then set to '-1'. Updates m_GraphicNodes_, m_GraphicNodesBounds_ from the values in l_SourcesForCenter_, l_AccessTargetSources_, l_NoSourceTargets_. When a BaseObject is drawn twice in the graphic view, the second node is put on the bottom line of the access targets, and its key in m_GraphicNodes_ and m_GraphicNodesBounds_ is its name extended by ''. Overrides the GraphicEPRView method.

Overrides:
setGraphicNodes in class GraphicEPRView

setGraphicNodesPositions

protected final java.awt.Point[] setGraphicNodesPositions()
Sets the allowed positions of the node in the view. There are 3 sets of node positions: one if nodesNumber_ is inferior to 8, one between 8 and 11, and one for the values from 12 to 21. Each position is at the top left corner of the node. This method must be called after setViewSize(). Called by setGraphicNodes(). Does not override the GraphicView method since the parameters are not used there.

Returns:
the array of node positions, in the correct order; equal to Point[0] if nodesNumber_ is superior to 21, or more than 10 sources or more than 10 targets.