com.sysord.mad.ui.swt.widget
Class AbstractSWTWidget

java.lang.Object
  extended by com.sysord.mad.widget.AbstractSpecificWidget
      extended by com.sysord.mad.ui.swt.widget.AbstractSWTWidget
All Implemented Interfaces:
com.sysord.mad.widget.SpecificWidget
Direct Known Subclasses:
DialogListWidget, DialogPickListWidget, GoogleMapWidget, HyperlinkWidget, ListSingleSelectWidget, PickListWidget, SWTBasicTypeWidget, SWTComboWidget, SWTComposedWidget, SWTElementDslWidget, SWTFlexibleWidget, SWTMultiSelectWidget, SWTNavigationListWidget, SWTOutputTextWidget, SWTTextDslWidget, TextAreaWidget

public abstract class AbstractSWTWidget
extends AbstractSpecificWidget

XXX Comment role class

Author:
Fabien Vignal

Field Summary
protected static int GRAY
           
protected static int NAVIGATION_COLOR
           
protected static int PALE_RED
           
protected  com.sysord.mad.widget.SpecificContextHolder specificContextHolder
           
protected static int WHITE
           
 
Fields inherited from class com.sysord.mad.widget.AbstractSpecificWidget
ID
 
Constructor Summary
AbstractSWTWidget()
           
 
Method Summary
protected  void addCommandsButtons(org.eclipse.swt.widgets.Composite container, org.eclipse.ui.forms.widgets.FormToolkit toolkit, com.sysord.mad.widget.Widget<?> widget, org.eclipse.swt.widgets.Control control)
          Add the command buttons for the specified MAD widget.
protected  void addControlDisposedListener(com.sysord.mad.widget.Widget<?> madWidget, org.eclipse.swt.widgets.Control swtWidget)
          Adds the disposed listeners to the MAD widget and its corresponding SWT widget.
protected  void addFlexibleCommandsButtons(org.eclipse.swt.widgets.Composite container, org.eclipse.ui.forms.widgets.FormToolkit toolkit, com.sysord.mad.widget.FlexibleWidget<?> widget)
          Add the command buttons for the specified MAD widget.
protected  void addVisibilityListener(com.sysord.mad.widget.Widget<?> madWidget, org.eclipse.swt.widgets.Control swtWidget)
          Adds the visibility listeners to he MAD widget and its corresponding SWT widget.
protected
<T extends com.sysord.mad.widget.Widget<?>>
T
castWidget(com.sysord.mad.widget.Widget<?> widget)
          Casts the given widget into the needed type.
protected abstract  void checkMadWidget(com.sysord.mad.widget.Widget<?> widget)
          Checks the widget type and raises an exception if the type is not valid for this specific widget.
protected  void createCommandButton(org.eclipse.swt.widgets.Composite container, org.eclipse.ui.forms.widgets.FormToolkit toolkit, com.sysord.mad.widget.Widget<?> widget, com.sysord.mad.configuration.CommandDefinition command)
          Creates an SWT button in the specified container and add a mouseUp listener executing the command commandId contained in the given widget.
protected abstract  org.eclipse.swt.widgets.Control createSpecificWidget(com.sysord.mad.widget.Widget<?> madWidget)
          Creates the SWT widget.
 java.lang.Object createWidget(com.sysord.mad.widget.SpecificContextHolder specificContextHolder, com.sysord.mad.widget.Widget<?> madWidget)
           
protected  SWTSpecificWidgetContext getSwtContext()
           
protected  java.util.List<com.sysord.mad.configuration.CommandDefinition> getUsedCommands(com.sysord.mad.widget.Widget<?> widget)
           
protected  void refreshView()
           
 
Methods inherited from class com.sysord.mad.widget.AbstractSpecificWidget
candidatesToElementList, createLabelColumn, createSelection, createSelection, getFormatExprEvaluationService, getId, getInjector, getLogger, getMao, getValidationService, getViewBuilder, setId, toCandidateElement, toCandidateList, validate, widgetValueEqualsCandidate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAVIGATION_COLOR

protected static final int NAVIGATION_COLOR

GRAY

protected static final int GRAY

PALE_RED

protected static final int PALE_RED

WHITE

protected static final int WHITE

specificContextHolder

protected com.sysord.mad.widget.SpecificContextHolder specificContextHolder
Constructor Detail

AbstractSWTWidget

public AbstractSWTWidget()
Method Detail

getSwtContext

protected SWTSpecificWidgetContext getSwtContext()

createWidget

public java.lang.Object createWidget(com.sysord.mad.widget.SpecificContextHolder specificContextHolder,
                                     com.sysord.mad.widget.Widget<?> madWidget)

addControlDisposedListener

protected void addControlDisposedListener(com.sysord.mad.widget.Widget<?> madWidget,
                                          org.eclipse.swt.widgets.Control swtWidget)
Adds the disposed listeners to the MAD widget and its corresponding SWT widget.

Parameters:
madWidget -
swtWidget -

addVisibilityListener

protected void addVisibilityListener(com.sysord.mad.widget.Widget<?> madWidget,
                                     org.eclipse.swt.widgets.Control swtWidget)
Adds the visibility listeners to he MAD widget and its corresponding SWT widget.

Parameters:
madWidget -
swtWidget -

createSpecificWidget

protected abstract org.eclipse.swt.widgets.Control createSpecificWidget(com.sysord.mad.widget.Widget<?> madWidget)
Creates the SWT widget.

This method is called after #checkMadWidget(), the widget can be casted with

Parameters:
madWidget -
Returns:
the created SWT widget.

checkMadWidget

protected abstract void checkMadWidget(com.sysord.mad.widget.Widget<?> widget)
Checks the widget type and raises an exception if the type is not valid for this specific widget.

Throws:
java.lang.IllegalStateException - if the widget is of an incorrect type.

castWidget

protected <T extends com.sysord.mad.widget.Widget<?>> T castWidget(com.sysord.mad.widget.Widget<?> widget)
Casts the given widget into the needed type.

Parameters:
widget -
Returns:
the MAD widget casted into the needed type.

getUsedCommands

protected java.util.List<com.sysord.mad.configuration.CommandDefinition> getUsedCommands(com.sysord.mad.widget.Widget<?> widget)

addCommandsButtons

protected void addCommandsButtons(org.eclipse.swt.widgets.Composite container,
                                  org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                  com.sysord.mad.widget.Widget<?> widget,
                                  org.eclipse.swt.widgets.Control control)
Add the command buttons for the specified MAD widget.
Change the layout data of the control if there is no button.

Parameters:
container -
widget -
control -

addFlexibleCommandsButtons

protected void addFlexibleCommandsButtons(org.eclipse.swt.widgets.Composite container,
                                          org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                          com.sysord.mad.widget.FlexibleWidget<?> widget)
Add the command buttons for the specified MAD widget.
Change the layout data of the control if there is no button.

Parameters:
container -
widget -
control -

createCommandButton

protected void createCommandButton(org.eclipse.swt.widgets.Composite container,
                                   org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                   com.sysord.mad.widget.Widget<?> widget,
                                   com.sysord.mad.configuration.CommandDefinition command)
Creates an SWT button in the specified container and add a mouseUp listener executing the command commandId contained in the given widget.

Parameters:
container - The SWT button container.
widget - The widget containing the command.
commandID - The ID of the command to execute.
commandLabel - The label to set on the button.

refreshView

protected void refreshView()