com.tensegrity.gui.graphdocument
Class ElementConflictListener

java.lang.Object
  extended bycom.tensegrity.gui.graphdocument.ElementConflictListener
All Implemented Interfaces:
ClipboardListener, GraphPanelDragListener

public abstract class ElementConflictListener
extends java.lang.Object
implements GraphPanelDragListener, ClipboardListener

ElementConflictListener

Author:
BurkhardWick

Field Summary
static int LAYOUT_CONFLICT_MASK
          Constant to use with setConflictMask(int), enables layout conflict resolving
static java.lang.String PREFERENCESKEY_LAYOUT_DEFAULT_OPTION
          PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of the default option
static java.lang.String PREFERENCESKEY_LAYOUT_SUPPRESS_DIALOG
          PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of suppressing of the conflict dialog
static java.lang.String PREFERENCESKEY_RULES_DEFAULT_OPTION
          PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of the default option
static java.lang.String PREFERENCESKEY_RULES_SUPPRESS_DIALOG
          PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of suppressing of the conflict dialog
static java.lang.String PREFERENCESVALUE_LAYOUT_DISCARD_INSERTED
          PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "discard inserted"
static java.lang.String PREFERENCESVALUE_LAYOUT_OVERWRITE_EXISTING
          PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "overwrite existing"
static java.lang.String PREFERENCESVALUE_LAYOUT_RENAME_INSERTED
          PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "rename inserted"
static java.lang.String PREFERENCESVALUE_RULES_DISCARD_INSERTED
          PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "discard inserted"
static java.lang.String PREFERENCESVALUE_RULES_OVERWRITE_EXISTING
          PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "overwrite existing"
static java.lang.String PREFERENCESVALUE_RULES_RENAME_INSERTED
          PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "rename inserted"
static int RULE_CONFLICT_MASK
          Constant to use with setConflictMask(int), enables rule conflict resolving
 
Constructor Summary
ElementConflictListener(RuleRegistry rrApplication)
          Constructor
 
Method Summary
 void copyBegin(ClipboardEvent clipboardevent)
          This method is invoked when a copy operation starts.
 void copyEnd(ClipboardEvent clipboardevent)
          This method is invoked when a copy operation has ended.
 void cutBegin(ClipboardEvent clipboardevent)
          This method is invoked when a cut operation starts.
 void cutEnd(ClipboardEvent clipboardevent)
          This method is invoked when a cut operation has ended.
 void dragDrop(GraphPanelDragEvent event)
          Called when a VisualGraphObject has been dropped into the graph panel
 void dragEnter(GraphPanelDragEvent event)
          Called when a VisualGraphObject has been dragged into the bounds of a VisualGraphObject in the view or into the bounds of the view itself (in this case the GraphPanelDragEvent.getTargetGraphObject() will return null).
 void dragExit(GraphPanelDragEvent event)
          Called when a VisualGraphObject has been dragged out of the bounds of a VisualGraphObject in the view or out of the bounds of the view itself (in this case the GraphPanelDragEvent.getTargetGraphObject() will return null).
 void dragMove(GraphPanelDragEvent event)
          Called when a VisualGraphObject has been dragged over the graph panel
 void dragPreDrop(GraphPanelDragEvent event)
          Called when a VisualGraphObject will be dropped into the graph panel
static VisualGraphObject[] getSubVGOs(VisualGraphObject vgo)
          Returns an array containing all VisualGraphObjects contained in the given VisualGraphObject if it is a VisualGraphObjectContainer or null if it is not.
 void pasteBegin(ClipboardEvent clipboardevent)
          This method is invoked when a paste operation starts.
 void pasteEnd(ClipboardEvent clipboardevent)
          This method is invoked when a paste operation has ended.
protected abstract  void resolveConflicts(java.util.List ruleConflicts, java.util.List layoutConflicts, LayoutController lcSource, VisualGraphView vgv, VisualGraphObject[] vgos)
           
 void setConflictMask(int mask)
          Sets the conflicts that should be resolved by this listener.
 void vetoableCopyOnMove(VisualGraphView visualgraphview, CompositeHierarchy hierarchySelection, VisualGraphObject originalVisualGraphObject, VisualGraphObject copiedVisualGraphObject)
          This method is invoked once per VisualGraphObject that is copied-on-move (e.g. copied when the control key is pressed).
 void vetoablePaste(VisualGraphView visualgraphview, VisualGraphObjectContainer visualgraphobjectcontainer, VisualGraphObject visualgraphobject, VisualGraphView origin)
          This method is invoked once per VisualGraphObject that is about to be pasted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULE_CONFLICT_MASK

public static final int RULE_CONFLICT_MASK
Constant to use with setConflictMask(int), enables rule conflict resolving

See Also:
Constant Field Values

LAYOUT_CONFLICT_MASK

public static final int LAYOUT_CONFLICT_MASK
Constant to use with setConflictMask(int), enables layout conflict resolving

See Also:
Constant Field Values

PREFERENCESKEY_RULES_DEFAULT_OPTION

public static final java.lang.String PREFERENCESKEY_RULES_DEFAULT_OPTION
PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of the default option

See Also:
Constant Field Values

PREFERENCESKEY_RULES_SUPPRESS_DIALOG

public static final java.lang.String PREFERENCESKEY_RULES_SUPPRESS_DIALOG
PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of suppressing of the conflict dialog

See Also:
Constant Field Values

PREFERENCESVALUE_RULES_OVERWRITE_EXISTING

public static final java.lang.String PREFERENCESVALUE_RULES_OVERWRITE_EXISTING
PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "overwrite existing"

See Also:
Constant Field Values

PREFERENCESVALUE_RULES_RENAME_INSERTED

public static final java.lang.String PREFERENCESVALUE_RULES_RENAME_INSERTED
PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "rename inserted"

See Also:
Constant Field Values

PREFERENCESVALUE_RULES_DISCARD_INSERTED

public static final java.lang.String PREFERENCESVALUE_RULES_DISCARD_INSERTED
PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "discard inserted"

See Also:
Constant Field Values

PREFERENCESKEY_LAYOUT_DEFAULT_OPTION

public static final java.lang.String PREFERENCESKEY_LAYOUT_DEFAULT_OPTION
PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of the default option

See Also:
Constant Field Values

PREFERENCESKEY_LAYOUT_SUPPRESS_DIALOG

public static final java.lang.String PREFERENCESKEY_LAYOUT_SUPPRESS_DIALOG
PREFERENCESKEY_DEFAULT_OPTION: Preferences key of the setting of suppressing of the conflict dialog

See Also:
Constant Field Values

PREFERENCESVALUE_LAYOUT_OVERWRITE_EXISTING

public static final java.lang.String PREFERENCESVALUE_LAYOUT_OVERWRITE_EXISTING
PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "overwrite existing"

See Also:
Constant Field Values

PREFERENCESVALUE_LAYOUT_RENAME_INSERTED

public static final java.lang.String PREFERENCESVALUE_LAYOUT_RENAME_INSERTED
PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "rename inserted"

See Also:
Constant Field Values

PREFERENCESVALUE_LAYOUT_DISCARD_INSERTED

public static final java.lang.String PREFERENCESVALUE_LAYOUT_DISCARD_INSERTED
PREFERENCESVALUE_OVERWRITE_EXISTING: Preferences value for option "discard inserted"

See Also:
Constant Field Values
Constructor Detail

ElementConflictListener

public ElementConflictListener(RuleRegistry rrApplication)
Constructor

Parameters:
rrApplication - The ruleregistry used as default and for the repository
Method Detail

setConflictMask

public void setConflictMask(int mask)
Sets the conflicts that should be resolved by this listener.

Parameters:
mask - The conflict mask containing values of the mask constants defined in this class

dragDrop

public void dragDrop(GraphPanelDragEvent event)
Description copied from interface: GraphPanelDragListener
Called when a VisualGraphObject has been dropped into the graph panel

Specified by:
dragDrop in interface GraphPanelDragListener
Parameters:
event - The GraphPanelDragEvent event

dragPreDrop

public void dragPreDrop(GraphPanelDragEvent event)
Description copied from interface: GraphPanelDragListener
Called when a VisualGraphObject will be dropped into the graph panel

Specified by:
dragPreDrop in interface GraphPanelDragListener
Parameters:
event - The GraphPanelDragEvent event

dragMove

public void dragMove(GraphPanelDragEvent event)
Description copied from interface: GraphPanelDragListener
Called when a VisualGraphObject has been dragged over the graph panel

Specified by:
dragMove in interface GraphPanelDragListener
Parameters:
event - The GraphPanelDragEvent event

dragEnter

public void dragEnter(GraphPanelDragEvent event)
Description copied from interface: GraphPanelDragListener
Called when a VisualGraphObject has been dragged into the bounds of a VisualGraphObject in the view or into the bounds of the view itself (in this case the GraphPanelDragEvent.getTargetGraphObject() will return null).

Specified by:
dragEnter in interface GraphPanelDragListener
Parameters:
event - The GraphPanelDragEvent event

dragExit

public void dragExit(GraphPanelDragEvent event)
Description copied from interface: GraphPanelDragListener
Called when a VisualGraphObject has been dragged out of the bounds of a VisualGraphObject in the view or out of the bounds of the view itself (in this case the GraphPanelDragEvent.getTargetGraphObject() will return null).

Specified by:
dragExit in interface GraphPanelDragListener
Parameters:
event - The GraphPanelDragEvent event

vetoableCopyOnMove

public void vetoableCopyOnMove(VisualGraphView visualgraphview,
                               CompositeHierarchy hierarchySelection,
                               VisualGraphObject originalVisualGraphObject,
                               VisualGraphObject copiedVisualGraphObject)
                        throws VisualGraphEventVetoException
Description copied from interface: ClipboardListener
This method is invoked once per VisualGraphObject that is copied-on-move (e.g. copied when the control key is pressed).

Implementors of this method have the option to veto the copy-on-move for specific items by throwing a VisualGraphEventVetoException.

When vetoing the copy-on-move action the node is omitted from the copy-on-move processing and remains at its original place. Also the veto'ed item is unselected.

Notice: changes to the selection state of the original VisualGraphObject or the copied VisualGraphObject have no effect except when the copy-on-move action is vetoed.

Specified by:
vetoableCopyOnMove in interface ClipboardListener
Parameters:
visualgraphview - the VisualGraphView in which the event occurs.
hierarchySelection - the hierarchy of selected VisualGraphObjects.
Notice: selected children of a selected VisualSubgraph} do not appear in the hierarchy.
originalVisualGraphObject - the VisualGraphObject that has been copied.
copiedVisualGraphObject - the copy of the original VisualGraphObject.
Throws:
VisualGraphEventVetoException - thrown by the implementor to indicate that the item should not be copied-on-move.

vetoablePaste

public void vetoablePaste(VisualGraphView visualgraphview,
                          VisualGraphObjectContainer visualgraphobjectcontainer,
                          VisualGraphObject visualgraphobject,
                          VisualGraphView origin)
                   throws VisualGraphEventVetoException
Description copied from interface: ClipboardListener
This method is invoked once per VisualGraphObject that is about to be pasted.

Implementors of this method have the option to veto the copy-on-move for specific items by throwing a VisualGraphEventVetoException.

Specified by:
vetoablePaste in interface ClipboardListener
Parameters:
visualgraphview - the VisualGraphView on which the event occurs.
visualgraphobjectcontainer - the VisualGraphObjectContainer that is the target for the pasted VisualGraphObject.
visualgraphobject - the VisualGraphObject that is to be pasted.
origin - the VisualGraphView where the subject VisualGraphObject is originating from. (may be null)
Throws:
VisualGraphEventVetoException - thrown by the implementor to indicate that the item should not be pasted.

cutBegin

public void cutBegin(ClipboardEvent clipboardevent)
Description copied from interface: ClipboardListener
This method is invoked when a cut operation starts. The needed information are given by the ClipboardEvent.

Specified by:
cutBegin in interface ClipboardListener
Parameters:
clipboardevent - the ClipboardEvent instance that carries the needed information
See Also:
ClipboardEvent

cutEnd

public void cutEnd(ClipboardEvent clipboardevent)
Description copied from interface: ClipboardListener
This method is invoked when a cut operation has ended. The needed information are given by the ClipboardEvent.

Specified by:
cutEnd in interface ClipboardListener
Parameters:
clipboardevent - the ClipboardEvent instance that carries the needed information
See Also:
ClipboardEvent

copyBegin

public void copyBegin(ClipboardEvent clipboardevent)
Description copied from interface: ClipboardListener
This method is invoked when a copy operation starts. The needed information are given by the ClipboardEvent.

Specified by:
copyBegin in interface ClipboardListener
Parameters:
clipboardevent - the ClipboardEvent instance that carries the needed information
See Also:
ClipboardEvent

copyEnd

public void copyEnd(ClipboardEvent clipboardevent)
Description copied from interface: ClipboardListener
This method is invoked when a copy operation has ended. The needed information are given by the ClipboardEvent.

Specified by:
copyEnd in interface ClipboardListener
Parameters:
clipboardevent - the ClipboardEvent instance that carries the needed information
See Also:
ClipboardEvent

pasteBegin

public void pasteBegin(ClipboardEvent clipboardevent)
Description copied from interface: ClipboardListener
This method is invoked when a paste operation starts. The needed information are given by the ClipboardEvent.

Specified by:
pasteBegin in interface ClipboardListener
Parameters:
clipboardevent - the ClipboardEvent instance that carries the needed information
See Also:
ClipboardEvent

pasteEnd

public void pasteEnd(ClipboardEvent clipboardevent)
Description copied from interface: ClipboardListener
This method is invoked when a paste operation has ended. The needed information are given by the ClipboardEvent.

Specified by:
pasteEnd in interface ClipboardListener
Parameters:
clipboardevent - the ClipboardEvent instance that carries the needed information
See Also:
ClipboardEvent

resolveConflicts

protected abstract void resolveConflicts(java.util.List ruleConflicts,
                                         java.util.List layoutConflicts,
                                         LayoutController lcSource,
                                         VisualGraphView vgv,
                                         VisualGraphObject[] vgos)
Parameters:
ruleConflicts -
layoutConflicts -
lcSource -
vgv -
vgos -

getSubVGOs

public static VisualGraphObject[] getSubVGOs(VisualGraphObject vgo)
Returns an array containing all VisualGraphObjects contained in the given VisualGraphObject if it is a VisualGraphObjectContainer or null if it is not.

Parameters:
vgo - The VisualGraphObject to check for children
Returns:
an array containing all VisualGraphObjects contained in the given VisualGraphObject if it is a VisualGraphObjectContainer or null if it is not.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.