public abstract class ECPAbstractCustomControlSWT extends Object
ECPAbstractCustomControlSWT
.Modifier and Type | Class and Description |
---|---|
class |
ECPAbstractCustomControlSWT.SWTCustomControlHelper
The
ECPAbstractCustomControlSWT.SWTCustomControlHelper allows the retrieval of SWT specific elements. |
Modifier and Type | Field and Description |
---|---|
static int |
ADD_IMAGE
Constant for an add image.
|
protected static String |
CUSTOM_VARIANT
Variant constant for indicating RAP controls.
|
static int |
DELETE_IMAGE
Constant for an delete image.
|
static int |
HELP_IMAGE
Constant for a help image.
|
static int |
VALIDATION_ERROR_IMAGE
Constant for an validation error image.
|
Constructor and Description |
---|
ECPAbstractCustomControlSWT() |
Modifier and Type | Method and Description |
---|---|
void |
applyEnable(Map<SWTGridCell,org.eclipse.swt.widgets.Control> controls)
Applies the current enable state.
|
void |
applyReadOnly(Map<SWTGridCell,org.eclipse.swt.widgets.Control> controls)
Applies the current readOnlyState.
|
void |
applyValidation()
Called by the framework to apply validation changes.
|
protected org.eclipse.core.databinding.Binding |
bindTargetToModel(VDomainModelReference modelFeature,
org.eclipse.core.databinding.observable.value.IObservableValue targetValue,
org.eclipse.core.databinding.UpdateValueStrategy targetToModel,
org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
Method for enabling databinding on the reference/attribute of the referenced object.
|
protected boolean |
canHandleControlProcessor()
Indicates if the given custom control takes the responsibility to call a possibly existing
EMFFormsControlProcessorService itself. |
protected org.eclipse.swt.widgets.Control |
createLabel(org.eclipse.swt.widgets.Composite parent)
Create the
Control displaying the label of the current VControl . |
protected SWTGridDescription |
createSimpleGrid(int rows,
int columns)
Creates a simple grid.
|
protected org.eclipse.swt.widgets.Label |
createValidationIcon(org.eclipse.swt.widgets.Composite composite)
Creates a Label which is used to display the validation icon.
|
protected void |
createViewerBinding(VDomainModelReference customControlFeature,
org.eclipse.jface.viewers.StructuredViewer viewer,
org.eclipse.core.databinding.property.value.IValueProperty[] labelProperties)
Creates a binding for a
StructuredViewer based on a ECPCustomControlFeature and the array of
IValueProperties for labels. |
void |
dispose()
Is called by the framework to trigger a dispose of the control.
|
protected abstract void |
disposeCustomControl()
This method is called during dispose and allows to dispose necessary objects.
|
protected <T extends ECPAbstractControl> |
getControl(Class<T> clazz,
VDomainModelReference domainModelReference)
Use this method to get an
ECPControl which can be used inside the ECPCustomControl . |
protected VCustomControl |
getCustomControl()
Return the
VCustomControl . |
protected org.eclipse.core.databinding.DataBindingContext |
getDataBindingContext()
Returns a
DataBindingContext for this control. |
protected org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain()
Provides the
EditingDomain for this custom control. |
protected org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
Returns the
EditingDomain for the provided EStructuralFeature.Setting . |
abstract SWTGridDescription |
getGridDescription()
Returns the GridDescription for this Renderer.
|
protected ECPAbstractCustomControlSWT.SWTCustomControlHelper |
getHelper()
This is a helper method which provides an
ECPAbstractCustomControlSWT.SWTCustomControlHelper . |
protected org.eclipse.emf.edit.provider.IItemPropertyDescriptor |
getItemPropertyDescriptor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
Return the
IItemPropertyDescriptor describing this EStructuralFeature.Setting . |
protected org.eclipse.core.databinding.observable.list.IObservableList |
getObservableList(VDomainModelReference domainModelReference)
Deprecated.
This method is deprecated and must not be used anymore. Use the
databinding service instead. |
protected VDomainModelReference |
getResolvedDomainModelReference(org.eclipse.emf.ecore.EStructuralFeature feature)
Finds the
VDomainModelReference which provides a specific EStructuralFeature . |
protected List<VDomainModelReference> |
getResolvedDomainModelReferences()
Returns a list of all
VDomainModelReferences which were already resolved and thus
can be used for binding etc. |
protected Object |
getValue(VDomainModelReference modelReference)
Returns the current set value of the feature.
|
protected ViewModelContext |
getViewModelContext()
Return the
ViewModelContext . |
protected abstract void |
handleContentValidation()
This is called so that an error can be shown by the user.
|
protected boolean |
hasLeftLabelAlignment()
Whether the label for this control should be rendered on the left of the control.
|
void |
init(VCustomControl customControl,
ViewModelContext viewModelContext)
Called by the framework to trigger an initialization.
|
protected void |
postInit()
This method is called after the initialization.
|
protected void |
registerChangeListener(VDomainModelReference modelReference,
ECPCustomControlChangeListener changeListener)
Registers a change listener on the referenced object.
|
abstract org.eclipse.swt.widgets.Control |
renderControl(SWTGridCell cell,
org.eclipse.swt.widgets.Composite parent)
Renders the control.
|
protected void |
setControlEnabled(SWTGridCell gridCell,
org.eclipse.swt.widgets.Control control,
boolean enabled)
Override this to control which and how controls should be enabled/disabled.
|
protected boolean |
setEditable(boolean editable)
Allows custom controls to call specific code for setting controls editable or not.
|
protected void |
setValue(VDomainModelReference modelReference,
Object newValue)
Sets the value of the feature to the new value.
|
protected static final String CUSTOM_VARIANT
public static final int VALIDATION_ERROR_IMAGE
public static final int ADD_IMAGE
public static final int DELETE_IMAGE
public static final int HELP_IMAGE
public final void init(VCustomControl customControl, ViewModelContext viewModelContext)
customControl
- the VCustomControl
to useviewModelContext
- the ViewModelContext
to useprotected void postInit()
public final void dispose()
protected abstract void disposeCustomControl()
protected final ViewModelContext getViewModelContext()
ViewModelContext
.ViewModelContext
of this controlprotected final VCustomControl getCustomControl()
VCustomControl
.VCustomControl
of this controlprotected final org.eclipse.core.databinding.DataBindingContext getDataBindingContext()
DataBindingContext
for this control.DataBindingContext
protected abstract void handleContentValidation()
protected final ECPAbstractCustomControlSWT.SWTCustomControlHelper getHelper()
ECPAbstractCustomControlSWT.SWTCustomControlHelper
. It allows to get an image based on the
constants defined in ECPAbstractCustomControlSWT
.ECPAbstractCustomControlSWT.SWTCustomControlHelper
to use to retrieve images.protected boolean hasLeftLabelAlignment()
VControl.getLabelAlignment()
is set to LabelAlignment.LEFT
or LabelAlignment.DEFAULT
.true
if label should be on the left, false
otherwiseprotected final org.eclipse.swt.widgets.Control createLabel(org.eclipse.swt.widgets.Composite parent) throws NoPropertyDescriptorFoundExeption
Control
displaying the label of the current VControl
.parent
- the Composite
to render ontoControl
or nullNoPropertyDescriptorFoundExeption
- thrown if the EStructuralFeature
of the VControl
doesn't have a registered IItemPropertyDescriptor
protected final org.eclipse.swt.widgets.Label createValidationIcon(org.eclipse.swt.widgets.Composite composite)
composite
- the Composite
to render ontoprotected final void createViewerBinding(VDomainModelReference customControlFeature, org.eclipse.jface.viewers.StructuredViewer viewer, org.eclipse.core.databinding.property.value.IValueProperty[] labelProperties)
StructuredViewer
based on a ECPCustomControlFeature
and the array of
IValueProperties
for labels.customControlFeature
- the ECPCustomControlFeature
to useviewer
- the StructuredViewer
to bindlabelProperties
- the array if IValueProperties
to use for labels@Deprecated protected final org.eclipse.core.databinding.observable.list.IObservableList getObservableList(VDomainModelReference domainModelReference)
databinding service
instead.IObservableList
based on a VDomainModelReference
.domainModelReference
- the VDomainModelReference
to useIObservableList
protected final org.eclipse.emf.edit.domain.EditingDomain getEditingDomain(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
EditingDomain
for the provided EStructuralFeature.Setting
.setting
- the provided EStructuralFeature.Setting
EditingDomain
of this EStructuralFeature.Setting
protected final <T extends ECPAbstractControl> T getControl(Class<T> clazz, VDomainModelReference domainModelReference)
ECPControl
which can be used inside the ECPCustomControl
.T
- the type of the control to retrieveclazz
- the Class
of the ECPControl
to retrievedomainModelReference
- the VDomainModelReference
to retrieve a control forECPControl
that is fitting the most for the ECPCustomControlFeature
. Can also be
null.protected final org.eclipse.emf.edit.provider.IItemPropertyDescriptor getItemPropertyDescriptor(org.eclipse.emf.ecore.EStructuralFeature.Setting setting)
IItemPropertyDescriptor
describing this EStructuralFeature.Setting
.setting
- the EStructuralFeature.Setting
to use for identifying the IItemPropertyDescriptor
.IItemPropertyDescriptor
protected final List<VDomainModelReference> getResolvedDomainModelReferences()
VDomainModelReferences
which were already resolved and thus
can be used for binding etc.VDomainModelReferences
protected final VDomainModelReference getResolvedDomainModelReference(org.eclipse.emf.ecore.EStructuralFeature feature)
VDomainModelReference
which provides a specific EStructuralFeature
.feature
- the EStructuralFeature
to find the VDomainModelReference
forVDomainModelReference
or nullprotected final org.eclipse.core.databinding.Binding bindTargetToModel(VDomainModelReference modelFeature, org.eclipse.core.databinding.observable.value.IObservableValue targetValue, org.eclipse.core.databinding.UpdateValueStrategy targetToModel, org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
IllegalStateException
if the VDomainModelReference
doesn't resolve to exactly one
EStructuralFeature.Setting
.modelFeature
- the VDomainModelReference
to bindtargetValue
- the target observerabletargetToModel
- update strategy target to modelmodelToTarget
- update strategy model to targetprotected final org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
EditingDomain
for this custom control.EditingDomain
for this controlprotected final Object getValue(VDomainModelReference modelReference)
IllegalStateException
if the VDomainModelReference
doesn't resolve to exactly one
EStructuralFeature.Setting
.modelReference
- the VDomainModelReference
to get the value forprotected final void setValue(VDomainModelReference modelReference, Object newValue)
IllegalStateException
if the VDomainModelReference
doesn't resolve to exactly one
EStructuralFeature.Setting
.modelReference
- the VDomainModelReference
to get the value fornewValue
- the value to be setprotected final void registerChangeListener(VDomainModelReference modelReference, ECPCustomControlChangeListener changeListener)
ECPCustomControlChangeListener.notifyChanged()
will
be called when a change on the referenced object is noticed.
Throws an IllegalStateException
if the VDomainModelReference
doesn't resolve to exactly one
EStructuralFeature.Setting
.modelReference
- the VDomainModelReference
to register a listener forchangeListener
- the change listener to registerpublic abstract SWTGridDescription getGridDescription()
public abstract org.eclipse.swt.widgets.Control renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
cell
- the SWTGridCell
of the control to renderparent
- the Composite
to render onControl
NoRendererFoundException
- this is thrown when a renderer cannot be foundNoPropertyDescriptorFoundExeption
- this is thrown when no property descriptor can be foundpublic final void applyValidation()
public final void applyReadOnly(Map<SWTGridCell,org.eclipse.swt.widgets.Control> controls)
controls
- the controls providedprotected void setControlEnabled(SWTGridCell gridCell, org.eclipse.swt.widgets.Control control, boolean enabled)
gridCell
- the SWTGridCell
to enable/disablecontrol
- the Control
to enable/disableenabled
- true if the control should be enabled false otherwisepublic final void applyEnable(Map<SWTGridCell,org.eclipse.swt.widgets.Control> controls)
controls
- the controlsprotected boolean setEditable(boolean editable)
editable
- if the current state is editableprotected final SWTGridDescription createSimpleGrid(int rows, int columns)
rows
- the number of rowscolumns
- the number of columnsGridDescription
protected boolean canHandleControlProcessor()
Indicates if the given custom control takes the responsibility to call a possibly existing
EMFFormsControlProcessorService
itself.
The default implementation returns false
.
true
if the custom control can handle the
EMFFormsControlProcessorService
itself, false
otherwise.Copyright © 2018. All rights reserved.