Class SimpleControlSWTRenderer
- java.lang.Object
-
- org.eclipse.emf.ecp.view.model.common.AbstractRenderer<VELEMENT>
-
- org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer<VCONTROL>
-
- org.eclipse.emf.ecp.view.spi.core.swt.AbstractControlSWTRenderer<VControl>
-
- org.eclipse.emf.ecp.view.spi.core.swt.SimpleControlSWTRenderer
-
- All Implemented Interfaces:
RootDomainModelChangeListener
- Direct Known Subclasses:
SimpleControlJFaceViewerSWTRenderer
,SimpleControlSWTControlSWTRenderer
,TableColumnsDMRTableControl
public abstract class SimpleControlSWTRenderer extends AbstractControlSWTRenderer<VControl>
- Author:
- Eugen
-
-
Field Summary
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description SimpleControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider)
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
applyReadOnly()
Marks a controls as readonly.protected void
applyValidation()
Allows implementers to display the validation state of the control.protected abstract org.eclipse.swt.widgets.Control
createControl(org.eclipse.swt.widgets.Composite parent)
Creates the control itself.protected SWTGridCell
createControlCell(int column)
Creates the control cell.protected VTUnsettableStyleProperty
createDefaultUnsettableStyleProperty()
Creates the defaultVTUnsettableStyleProperty
.protected SWTGridCell
createLabelCell(int column)
Creates the label cell if necessary.protected SWTGridCell
createValidationCell(int column)
Creates the validation cell.protected void
dispose()
Disposes all resources used by the renderer.SWTGridDescription
getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.protected Optional<java.lang.Integer>
getLabelWidth()
protected VTUnsettableStyleProperty
getUnsettableStyleProperty()
Returns theVTUnsettableStyleProperty
.protected abstract java.lang.String
getUnsetText()
Provide the unset text to show on the label when value is unset.protected boolean
isUnsettable()
Returns true if the control is unsettable.protected org.eclipse.swt.widgets.Control
renderControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent)
Renders the passedVElement
.protected void
rootDomainModelChanged()
This method is called inAbstractControlSWTRenderer.notifyChange()
when the root domain model of the view model context changes.protected void
setControlEnabled(SWTGridCell gridCell, org.eclipse.swt.widgets.Control control, boolean enabled)
Wraps the call to enable/disable a control.protected void
setControlIdData(org.eclipse.swt.widgets.Control control)
This method will set the element id data on the control created bycreateControl(Composite)
.protected void
setValidationColor(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color validationColor)
Set the provided validation color as the background for the provided control.protected void
setValidationForegroundColor(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color validationColor)
Set the provided validation color as the foreground for the provided control.-
Methods inherited from class org.eclipse.emf.ecp.view.spi.core.swt.AbstractControlSWTRenderer
applyEnable, applyUnchangeableFeature, canHandleControlProcessor, createLabel, createValidationIcon, defaultHandleControlProcessor, defaultHandleControlProcessorForCell, getDataBindingContext, getEditingDomain, getEMFFormsDatabinding, getEMFFormsLabelProvider, getLabelStyleBits, getModelValue, getValidationBackgroundColor, getValidationBackgroundColor, getValidationForegroundColor, getValidationForegroundColor, getValidationIcon, getValidationIcon, getVTViewTemplateProvider, hasLeftLabelAlignment, isUnchangeableFeature, notifyChange, postInit, render
-
Methods inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
applyValidation, applyVisible, canReveal, finalizeRendering, getControls, getDefaultFontName, ignoreEnableOnReadOnly, init, isRenderingFinished, preInit, scrollToReveal, scrollToReveal
-
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
-
-
-
-
Constructor Detail
-
SimpleControlSWTRenderer
public SimpleControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider)
Default constructor.- Parameters:
vElement
- the view model element to be renderedviewContext
- the view contextreportService
- TheReportService
emfFormsDatabinding
- TheEMFFormsDatabinding
emfFormsLabelProvider
- TheEMFFormsLabelProvider
vtViewTemplateProvider
- TheVTViewTemplateProvider
- Since:
- 1.6
-
-
Method Detail
-
getGridDescription
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.- Specified by:
getGridDescription
in classAbstractSWTRenderer<VControl>
- Parameters:
gridDescription
- the currentSWTGridDescription
- Returns:
- the number of controls per row
- See Also:
AbstractSWTRenderer.getGridDescription(SWTGridDescription)
-
createLabelCell
protected SWTGridCell createLabelCell(int column)
Creates the label cell if necessary.- Parameters:
column
- column number within the grid row- Returns:
- created and configured label cell
- Since:
- 1.9
-
getLabelWidth
protected Optional<java.lang.Integer> getLabelWidth()
- Returns:
- an optional width for the control's label
- Since:
- 1.16
-
createValidationCell
protected SWTGridCell createValidationCell(int column)
Creates the validation cell.- Parameters:
column
- column number within the grid row- Returns:
- created and configured label cell
- Since:
- 1.9
-
createControlCell
protected SWTGridCell createControlCell(int column)
Creates the control cell.- Parameters:
column
- column number within the grid row- Returns:
- created and configured label cell
- Since:
- 1.9
-
renderControl
protected final org.eclipse.swt.widgets.Control renderControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Renders the passedVElement
.- Specified by:
renderControl
in classAbstractSWTRenderer<VControl>
- Parameters:
gridCell
- theGridCell
of the control to renderparent
- theComposite
to render on- Returns:
- the rendered
Control
- Throws:
NoRendererFoundException
- this is thrown when a renderer cannot be foundNoPropertyDescriptorFoundExeption
- this is thrown when no property descriptor can be found- See Also:
org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer#renderControl(int, org.eclipse.swt.widgets.Composite, org.eclipse.emf.ecp.view.spi.model.VElement, org.eclipse.emf.ecp.view.spi.context.ViewModelContext)
-
isUnsettable
protected boolean isUnsettable() throws DatabindingFailedException
Returns true if the control is unsettable.- Returns:
- true if unsettable, false otherwise
- Throws:
DatabindingFailedException
- if the databinding fails
-
getUnsetText
protected abstract java.lang.String getUnsetText()
Provide the unset text to show on the label when value is unset.- Returns:
- the text to show on the unset label
-
setValidationColor
protected void setValidationColor(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color validationColor)
Set the provided validation color as the background for the provided control.- Parameters:
control
- the control to set the color onvalidationColor
- the validation color to set
-
setValidationForegroundColor
protected void setValidationForegroundColor(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color validationColor)
Set the provided validation color as the foreground for the provided control.- Parameters:
control
- the control to set the color onvalidationColor
- the validation color to set- Since:
- 1.10
-
setControlEnabled
protected void setControlEnabled(SWTGridCell gridCell, org.eclipse.swt.widgets.Control control, boolean enabled)
Description copied from class:AbstractSWTRenderer
Wraps the call to enable/disable a control.- Overrides:
setControlEnabled
in classAbstractSWTRenderer<VControl>
- Parameters:
gridCell
- theSWTGridCell
to enable/disablecontrol
- theControl
to enable/disableenabled
- true if control should be enabled, false otherwise
-
applyValidation
protected final void applyValidation()
Description copied from class:AbstractSWTRenderer
Allows implementers to display the validation state of the control. The default implementation does nothing.- Overrides:
applyValidation
in classAbstractSWTRenderer<VControl>
-
createControl
protected abstract org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent) throws DatabindingFailedException
Creates the control itself.- Parameters:
parent
- theComposite
to render onto- Returns:
- the rendered control
- Throws:
DatabindingFailedException
- if the databinding of the control fails
-
setControlIdData
protected void setControlIdData(org.eclipse.swt.widgets.Control control)
This method will set the element id data on the control created bycreateControl(Composite)
.- Parameters:
control
- the control created bycreateControl(Composite)
- Since:
- 1.9
-
dispose
protected void dispose()
Disposes all resources used by the renderer. Don't forget to call super.dispose if overwriting this method.- Overrides:
dispose
in classAbstractControlSWTRenderer<VControl>
- See Also:
AbstractSWTRenderer.dispose()
-
rootDomainModelChanged
protected void rootDomainModelChanged() throws DatabindingFailedException
Description copied from class:AbstractControlSWTRenderer
This method is called inAbstractControlSWTRenderer.notifyChange()
when the root domain model of the view model context changes.- Overrides:
rootDomainModelChanged
in classAbstractControlSWTRenderer<VControl>
- Throws:
DatabindingFailedException
- If the databinding failed
-
createDefaultUnsettableStyleProperty
protected VTUnsettableStyleProperty createDefaultUnsettableStyleProperty()
Creates the defaultVTUnsettableStyleProperty
.- Returns:
- the default
VTUnsettableStyleProperty
- Since:
- 1.14
-
getUnsettableStyleProperty
protected VTUnsettableStyleProperty getUnsettableStyleProperty()
Returns theVTUnsettableStyleProperty
.- Returns:
- the
VTUnsettableStyleProperty
- Since:
- 1.14
-
applyReadOnly
protected void applyReadOnly()
Description copied from class:AbstractControlSWTRenderer
Marks a controls as readonly.- Overrides:
applyReadOnly
in classAbstractControlSWTRenderer<VControl>
- See Also:
AbstractSWTRenderer.applyReadOnly()
-
-