com.tensegrity.gui.swt.dialog
Class SWTElementConflictDialog

java.lang.Object
  extended byorg.eclipse.swt.widgets.Dialog
      extended bycom.tensegrity.gui.swt.dialog.SwtBaseDialog
          extended bycom.tensegrity.gui.swt.dialog.SWTElementConflictDialog
All Implemented Interfaces:
Disposable, Evaluable, java.util.EventListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.internal.SWTEventListener

public class SWTElementConflictDialog
extends SwtBaseDialog

TODO IMPLEMENT THIS DIALOG!!!

Version:
$Id: SWTElementConflictDialog.java,v 1.3 2005/11/09 11:34:33 ArndHouben Exp $
Author:
S�bastien Guyon

Field Summary
static int CONFLICT_LAYOUTS
          CONFLICT_LAYOUTS
static int CONFLICT_RULES
          CONFLICT_RULES
 
Fields inherited from class com.tensegrity.gui.swt.dialog.SwtBaseDialog
resourceClass, resourcePath
 
Constructor Summary
SWTElementConflictDialog(UIManager uiManager, org.eclipse.swt.widgets.Display display, int style, boolean showRules, Rule[] conflictRules, RuleRegistry rrDoc, boolean showLayout, java.lang.String[] conflictLayouts, LayoutController lcSource, LayoutController lcTarget)
           Creates and initializes the dialog used in order to resolve rules and layout conflicts.
SWTElementConflictDialog(UIManager uiManager, org.eclipse.swt.widgets.Display display, int style, java.lang.String keyTitle, java.lang.String keyDescription, boolean showRules, Rule[] conflictRules, RuleRegistry rrDoc, boolean showLayout, java.lang.String[] conflictLayouts, LayoutController lcSource, LayoutController lcTarget)
           Creates and initializes the dialog used in order to resolve rules and layout conflicts.
 
Method Summary
 int getIndex(Rule rule)
          Returns the index of the given rule
 java.lang.String getNewName(int conflictType, int index)
          Returns the new name for a rule, if the option "rename inserted" or "use existing" has been chosen.
 int getOption(int conflictType, int index)
          Returns the option the user has selected for the rule with the given index
 Rule getRule(int index)
          Returns the rule with the given index
protected  org.eclipse.swt.layout.GridData getTextCompositeLayoutData()
           Subclasses should override this method in order to set the Layout Data Use for the text composite of the base dialog.
 void resolveLayoutConflicts(VisualGraphObject[] VGOs)
          Resolves the layout conflicts by using the selected options after displaying the dialog.
 void resolveRuleConflict(VisualGraphView vgv, VisualGraphObject[] VGOs)
          Resolves the rule conflicts by using the selected options after displaying the dialog.
 void setDefaultOption(int conflictType, int option)
          Sets the default option for a given conflict type
 
Methods inherited from class com.tensegrity.gui.swt.dialog.SwtBaseDialog
applyEvList, dispose, getDialog, getUIManager, installEvList, keyPressed, keyReleased, setDefaultResourceClassAndURL, setDescriptionText, setResourceClassAndURL, setTitleText, show
 
Methods inherited from class org.eclipse.swt.widgets.Dialog
checkSubclass, getParent, getStyle, getText, setText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFLICT_RULES

public static final int CONFLICT_RULES
CONFLICT_RULES

See Also:
Constant Field Values

CONFLICT_LAYOUTS

public static final int CONFLICT_LAYOUTS
CONFLICT_LAYOUTS

See Also:
Constant Field Values
Constructor Detail

SWTElementConflictDialog

public SWTElementConflictDialog(UIManager uiManager,
                                org.eclipse.swt.widgets.Display display,
                                int style,
                                java.lang.String keyTitle,
                                java.lang.String keyDescription,
                                boolean showRules,
                                Rule[] conflictRules,
                                RuleRegistry rrDoc,
                                boolean showLayout,
                                java.lang.String[] conflictLayouts,
                                LayoutController lcSource,
                                LayoutController lcTarget)

Creates and initializes the dialog used in order to resolve rules and layout conflicts.

Parameters:
uiManager - the UIManager used for Strings localization
display - a Display required for example to create the logo used on the dialog, or to create Fonts
style - the style of the internal Shell representing the dialog
keyTitle - the key used for the localized title of the dialog
keyDescription - the key used for the localized description of the dialog
showRules - indicates whether or not the rules section of the dialog is to be displayed
conflictRules - the conflicting rules
rrDoc - the RuleRegistry which might be updated depending upon the user choice
showLayout - indicates whether or not the layout section of the dialog is to be displayed
conflictLayouts - the conflicting layouts
lcSource - current LayoutController
lcTarget - LayoutController after the layout conflicts have been resolved

SWTElementConflictDialog

public SWTElementConflictDialog(UIManager uiManager,
                                org.eclipse.swt.widgets.Display display,
                                int style,
                                boolean showRules,
                                Rule[] conflictRules,
                                RuleRegistry rrDoc,
                                boolean showLayout,
                                java.lang.String[] conflictLayouts,
                                LayoutController lcSource,
                                LayoutController lcTarget)

Creates and initializes the dialog used in order to resolve rules and layout conflicts. Keys for the title and description of this dialog are respectively GUIItem.DIALOG_ELEMENTCONFLICT_TITLE and GUIItem.DIALOG_ELEMENTCONFLICT_DESCRIPTION.

Parameters:
uiManager - the UIManager used for Strings localization
display - a Display required for example to create the logo used on the dialog, or to create Fonts
style - the style of the internal Shell representing the dialog
showRules - indicates whether or not the rules section of the dialog is to be displayed
conflictRules - the conflicting rules
rrDoc - the RuleRegistry which might be updated depending upon the user choice
showLayout - indicates whether or not the layout section of the dialog is to be displayed
conflictLayouts - the conflicting layouts
lcSource - current LayoutController
lcTarget - LayoutController after the layout conflicts have been resolved
Method Detail

getTextCompositeLayoutData

protected org.eclipse.swt.layout.GridData getTextCompositeLayoutData()
Description copied from class: SwtBaseDialog

Subclasses should override this method in order to set the Layout Data Use for the text composite of the base dialog. The text composite is a Composite containing both the title and description of the dialog. It is especially usefull to override this method when the description has to be wrapped.

Overrides:
getTextCompositeLayoutData in class SwtBaseDialog
Returns:
the GridData for the text composite layout

getNewName

public java.lang.String getNewName(int conflictType,
                                   int index)
Returns the new name for a rule, if the option "rename inserted" or "use existing" has been chosen.

Parameters:
conflictType - The type of the requested conflict: CONFLICT_RULES or CONFLICT_LAYOUTS
index - The index of the rule in the array passed to the constructor
Returns:
The new name for the rule to resolve the conflict

getRule

public Rule getRule(int index)
Returns the rule with the given index

Parameters:
index - The index of the rule to return
Returns:
the rule with the given index

getIndex

public int getIndex(Rule rule)
Returns the index of the given rule

Parameters:
rule - The rule to return the index of
Returns:
The index of the given rule or -1 if the rule is not in the list

getOption

public int getOption(int conflictType,
                     int index)
Returns the option the user has selected for the rule with the given index

Parameters:
conflictType - The type of the requested conflict: CONFLICT_RULES or CONFLICT_LAYOUTS
index - The index of the rule in the array passed to the constructor
Returns:
One of the constants of this class defining how to resolve the conflict

setDefaultOption

public void setDefaultOption(int conflictType,
                             int option)
Sets the default option for a given conflict type

Parameters:
conflictType - The type of the requested conflict: CONFLICT_RULES or CONFLICT_LAYOUTS
option - The default option for the given conflict type

resolveLayoutConflicts

public void resolveLayoutConflicts(VisualGraphObject[] VGOs)
Resolves the layout conflicts by using the selected options after displaying the dialog.

Parameters:
VGOs - The VisualGraphObjects that have been inserted

resolveRuleConflict

public void resolveRuleConflict(VisualGraphView vgv,
                                VisualGraphObject[] VGOs)
Resolves the rule conflicts by using the selected options after displaying the dialog.

Parameters:
vgv - The VisualGraphView containing the elements
VGOs - The VisualGraphObjects that have been inserted


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