VCONTROL
- the VControl
of this renderer.public abstract class AbstractControlSWTRenderer<VCONTROL extends VControl> extends AbstractSWTRenderer<VCONTROL> implements RootDomainModelChangeListener
CUSTOM_VARIANT
Constructor and Description |
---|
AbstractControlSWTRenderer(VCONTROL vElement,
ViewModelContext viewContext,
ReportService reportService,
EMFFormsDatabinding emfFormsDatabinding,
EMFFormsLabelProvider emfFormsLabelProvider,
VTViewTemplateProvider vtViewTemplateProvider)
Default constructor.
|
AbstractControlSWTRenderer(VCONTROL vElement,
ViewModelContext viewContext,
ReportService reportService,
EMFFormsDatabinding emfFormsDatabinding,
EMFFormsLabelProvider emfFormsLabelProvider,
VTViewTemplateProvider vtViewTemplateProvider,
SWTValidationHelper swtValidationHelper)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyEnable()
Allows implementers to set a control to enabled.
|
protected void |
applyReadOnly()
Marks a controls as readonly.
|
protected void |
applyUnchangeableFeature()
This method is applied if the control's feature is configured as unchangeable.
|
protected boolean |
canHandleControlProcessor()
Indicates if the given Control SWT renderer 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 org.eclipse.swt.widgets.Label |
createValidationIcon(org.eclipse.swt.widgets.Composite composite)
Creates a validation icon.
|
protected void |
defaultHandleControlProcessor(org.eclipse.swt.widgets.Control control)
Calls a possibly existing
EMFFormsControlProcessorService for the given control . |
protected void |
defaultHandleControlProcessorForCell(org.eclipse.swt.widgets.Control control,
SWTGridCell cell)
This method is called by {link
render(SWTGridCell, Composite) for each
control and cell if canHandleControlProcessor() returns false . |
protected void |
dispose()
Disposes all resources used by the renderer.
|
protected org.eclipse.core.databinding.DataBindingContext |
getDataBindingContext()
Creates a new
DataBindingContext . |
protected org.eclipse.emf.edit.domain.EditingDomain |
getEditingDomain(org.eclipse.emf.ecore.EObject domainModel)
Returns the
EditingDomain for the provided domain model . |
protected EMFFormsDatabinding |
getEMFFormsDatabinding()
The
EMFFormsDatabinding to use. |
protected EMFFormsLabelProvider |
getEMFFormsLabelProvider()
The
EMFFormsLabelProvider to use. |
protected int |
getLabelStyleBits() |
protected org.eclipse.core.databinding.observable.value.IObservableValue |
getModelValue()
Returns an
IObservableValue based on the control's domain model reference and domain model. |
protected org.eclipse.swt.graphics.Color |
getValidationBackgroundColor(int severity)
Returns the background color for a control with the given validation severity.
|
protected org.eclipse.swt.graphics.Color |
getValidationForegroundColor(int severity)
Returns the foreground color for a control with the given validation severity.
|
protected org.eclipse.swt.graphics.Image |
getValidationIcon(int severity)
Returns the validation icon matching the given severity.
|
protected VTViewTemplateProvider |
getVTViewTemplateProvider()
The
VTViewTemplateProvider to use. |
protected boolean |
hasLeftLabelAlignment()
Whether the label for this control should be rendered on the left of the control.
|
protected boolean |
isUnchangeableFeature()
Checks if the value referenced by the DMR can be changed or not by the user.
|
void |
notifyChange()
Notifies this listener that the domain model of the
EMFFormsViewContext has changed. |
protected void |
postInit()
Use this method to initialize objects which are needed during rendering.
|
org.eclipse.swt.widgets.Control |
render(SWTGridCell cell,
org.eclipse.swt.widgets.Composite parent)
Renders the passed
VElement . |
protected void |
rootDomainModelChanged()
This method is called in
notifyChange() when the root domain model of the view model context changes. |
applyValidation, applyValidation, applyVisible, canReveal, finalizeRendering, getControls, getDefaultFontName, getGridDescription, ignoreEnableOnReadOnly, init, isRenderingFinished, preInit, renderControl, scrollToReveal, scrollToReveal, setControlEnabled
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
public AbstractControlSWTRenderer(VCONTROL vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider)
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- The EMFFormsDatabinding
emfFormsLabelProvider
- The EMFFormsLabelProvider
reportService
- The ReportService
vtViewTemplateProvider
- The VTViewTemplateProvider
public AbstractControlSWTRenderer(VCONTROL vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, SWTValidationHelper swtValidationHelper)
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- The EMFFormsDatabinding
emfFormsLabelProvider
- The EMFFormsLabelProvider
reportService
- The ReportService
vtViewTemplateProvider
- The VTViewTemplateProvider
swtValidationHelper
- The SWTValidationHelper
protected EMFFormsDatabinding getEMFFormsDatabinding()
EMFFormsDatabinding
to use.protected EMFFormsLabelProvider getEMFFormsLabelProvider()
EMFFormsLabelProvider
to use.protected VTViewTemplateProvider getVTViewTemplateProvider()
VTViewTemplateProvider
to use.protected void postInit()
AbstractSWTRenderer
postInit
in class AbstractSWTRenderer<VCONTROL extends VControl>
protected boolean isUnchangeableFeature()
true
if the value cannot be changed.public org.eclipse.swt.widgets.Control render(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
AbstractSWTRenderer
VElement
.render
in class AbstractSWTRenderer<VCONTROL extends VControl>
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 foundprotected void applyUnchangeableFeature()
protected boolean canHandleControlProcessor()
Indicates if the given Control SWT renderer takes the responsibility to call a possibly existing
EMFFormsControlProcessorService
itself.
The default implementation returns false
.
true
if the Control SWT renderer can handle the EMFFormsControlProcessorService
itself,
false
otherwise.protected void defaultHandleControlProcessorForCell(org.eclipse.swt.widgets.Control control, SWTGridCell cell)
render(SWTGridCell, Composite)
for each
control
and cell
if canHandleControlProcessor()
returns false
. The default
implementation forwards to defaultHandleControlProcessor(Control)
if the cell's column is 2
.control
- The Control
which is to be processed by the EMFFormsControlProcessorService
.cell
- The SWTGridCell
for the given control
.protected void defaultHandleControlProcessor(org.eclipse.swt.widgets.Control control)
EMFFormsControlProcessorService
for the given control
.control
- The Control
which is to be processed by the EMFFormsControlProcessorService
.protected void dispose()
AbstractSWTRenderer
dispose
in class AbstractSWTRenderer<VCONTROL extends VControl>
protected final org.eclipse.swt.graphics.Image getValidationIcon(int severity)
severity
- the severity of the Diagnostic
null
when no icon is to be displayedprotected final org.eclipse.swt.graphics.Color getValidationBackgroundColor(int severity)
severity
- severity the severity of the Diagnostic
protected final org.eclipse.swt.graphics.Color getValidationForegroundColor(int severity)
severity
- severity the severity of the Diagnostic
protected final org.eclipse.core.databinding.DataBindingContext getDataBindingContext()
DataBindingContext
.DataBindingContext
each time this method is calledprotected final org.eclipse.core.databinding.observable.value.IObservableValue getModelValue() throws DatabindingFailedException
IObservableValue
based on the control's domain model reference and domain model.IObservableValue
DatabindingFailedException
- if the databinding of the domain model object fails.protected final org.eclipse.emf.edit.domain.EditingDomain getEditingDomain(org.eclipse.emf.ecore.EObject domainModel)
EditingDomain
for the provided domain model
.domainModel
- The provided domain model
EditingDomain
of this domain model
protected org.eclipse.swt.widgets.Control createLabel(org.eclipse.swt.widgets.Composite parent)
Control
displaying the label of the current VControl
.parent
- the Composite
to render ontoControl
or nullprotected int getLabelStyleBits()
protected boolean hasLeftLabelAlignment()
VControl.getLabelAlignment()
is set to LabelAlignment.LEFT
or LabelAlignment.DEFAULT
.true
if label should be on the left, false
otherwiseprotected org.eclipse.swt.widgets.Label createValidationIcon(org.eclipse.swt.widgets.Composite composite)
composite
- the Composite
to create ontoprotected void applyEnable()
applyEnable
in class AbstractSWTRenderer<VCONTROL extends VControl>
AbstractSWTRenderer.applyEnable()
public void notifyChange()
EMFFormsViewContext
has changed.notifyChange
in interface RootDomainModelChangeListener
RootDomainModelChangeListener.notifyChange()
protected void rootDomainModelChanged() throws DatabindingFailedException
notifyChange()
when the root domain model of the view model context changes.DatabindingFailedException
- If the databinding failedprotected void applyReadOnly()
applyReadOnly
in class AbstractSWTRenderer<VCONTROL extends VControl>
AbstractSWTRenderer.applyReadOnly()
Copyright © 2019. All rights reserved.