com.sysord.mad.widget
Class AbstractSpecificWidget

java.lang.Object
  extended by com.sysord.mad.widget.AbstractSpecificWidget
All Implemented Interfaces:
com.sysord.mad.widget.SpecificWidget
Direct Known Subclasses:
AbstractSWTWidget

public abstract class AbstractSpecificWidget
extends java.lang.Object
implements com.sysord.mad.widget.SpecificWidget

Abstract implementation of a SpecificWidget for SWT.

Author:
Fabien Vignal

Field Summary
protected  java.lang.String ID
           
 
Constructor Summary
AbstractSpecificWidget()
           
 
Method Summary
protected  java.util.Collection<java.lang.Object> candidatesToElementList(java.util.Collection<java.lang.Object> candidates)
          Extract the elements from the candidate collection.
protected static org.eclipse.swt.widgets.Label createLabelColumn(org.eclipse.ui.forms.widgets.FormToolkit toolkit, org.eclipse.swt.widgets.Composite container, com.sysord.mad.widget.Widget<?> widget)
          Create a label and set its GridData.
protected  org.eclipse.jface.viewers.IStructuredSelection createSelection(java.util.Collection<java.lang.Object> values)
          Create a IStructuredSelection for the given values.
protected  org.eclipse.jface.viewers.IStructuredSelection createSelection(java.lang.Object value)
          Create a IStructuredSelection for the given value.
protected  com.sysord.mad.evaluator.FormatExpressionEvaluationService getFormatExprEvaluationService()
          retrieves and returns the FormatExpressionEvaluationService using injector
 java.lang.String getId()
           
protected  com.google.inject.Injector getInjector()
           
protected  com.sysord.eclipse.tools.runtime.ConsoleLogger getLogger()
           
protected  com.sysord.mad.mao.ModelAccessObject getMao()
           
protected  com.sysord.mad.validator.WidgetValueValidationService getValidationService()
          Returns the value validation service.
protected  com.sysord.mad.emitter.ViewBuilder getViewBuilder()
           
 void setId(java.lang.String ID)
           
protected  com.sysord.mad.widget.Candidate toCandidateElement(java.util.List<com.sysord.mad.widget.Candidate> candidates, java.lang.Object selected)
          Return the corresponding candidate of the specified selected Object with the candidates list.
protected  java.util.Collection<com.sysord.mad.widget.Candidate> toCandidateList(java.util.List<com.sysord.mad.widget.Candidate> candidates, java.util.Collection<java.lang.Object> selected)
          Create a list of Candidates with the specified objects collection contained by the candidates collection.
protected  java.lang.String validate(com.sysord.mad.widget.InputWidget<?> widget, java.lang.Object value)
          Validates the value to put on the given widget.
protected  boolean widgetValueEqualsCandidate(com.sysord.mad.widget.OutputWidget<?> widget, java.lang.Object candidateOrValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sysord.mad.widget.SpecificWidget
createWidget
 

Field Detail

ID

protected java.lang.String ID
Constructor Detail

AbstractSpecificWidget

public AbstractSpecificWidget()
Method Detail

getId

public java.lang.String getId()
Specified by:
getId in interface com.sysord.mad.widget.SpecificWidget

setId

public void setId(java.lang.String ID)
Specified by:
setId in interface com.sysord.mad.widget.SpecificWidget

toCandidateList

protected java.util.Collection<com.sysord.mad.widget.Candidate> toCandidateList(java.util.List<com.sysord.mad.widget.Candidate> candidates,
                                                                                java.util.Collection<java.lang.Object> selected)
Create a list of Candidates with the specified objects collection contained by the candidates collection.

Parameters:
selected -
Returns:
the created list of Candidates.

toCandidateElement

protected com.sysord.mad.widget.Candidate toCandidateElement(java.util.List<com.sysord.mad.widget.Candidate> candidates,
                                                             java.lang.Object selected)
Return the corresponding candidate of the specified selected Object with the candidates list.

Parameters:
selected -
Returns:
the created list of Candidates.

candidatesToElementList

protected java.util.Collection<java.lang.Object> candidatesToElementList(java.util.Collection<java.lang.Object> candidates)
Extract the elements from the candidate collection.

Parameters:
candidates -
Returns:
the list of extracted Object from the candidates collection.

createSelection

protected org.eclipse.jface.viewers.IStructuredSelection createSelection(java.util.Collection<java.lang.Object> values)
Create a IStructuredSelection for the given values.

If a value is null it will be transformed in a Candidate with a null value.

Parameters:
values -
Returns:
the IStructuredSelection corresponding to the given values.

createSelection

protected org.eclipse.jface.viewers.IStructuredSelection createSelection(java.lang.Object value)
Create a IStructuredSelection for the given value.

If the value is null it will be transformed in a Candidate with a null value.

Parameters:
value -
Returns:
the IStructuredSelection corresponding to the given value.

widgetValueEqualsCandidate

protected boolean widgetValueEqualsCandidate(com.sysord.mad.widget.OutputWidget<?> widget,
                                             java.lang.Object candidateOrValue)

validate

protected java.lang.String validate(com.sysord.mad.widget.InputWidget<?> widget,
                                    java.lang.Object value)
Validates the value to put on the given widget.

Parameters:
widget -
value -
Returns:
the error message if the validation fails;
null otherwise.

createLabelColumn

protected static org.eclipse.swt.widgets.Label createLabelColumn(org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                                                 org.eclipse.swt.widgets.Composite container,
                                                                 com.sysord.mad.widget.Widget<?> widget)
Create a label and set its GridData.

Parameters:
toolkit -
container -
widget -
Returns:
the error message label

getValidationService

protected com.sysord.mad.validator.WidgetValueValidationService getValidationService()
Returns the value validation service.

Returns:
the value validation service.

getFormatExprEvaluationService

protected com.sysord.mad.evaluator.FormatExpressionEvaluationService getFormatExprEvaluationService()
retrieves and returns the FormatExpressionEvaluationService using injector

Returns:

getMao

protected com.sysord.mad.mao.ModelAccessObject getMao()

getViewBuilder

protected com.sysord.mad.emitter.ViewBuilder getViewBuilder()

getLogger

protected com.sysord.eclipse.tools.runtime.ConsoleLogger getLogger()

getInjector

protected com.google.inject.Injector getInjector()