public class TextControlSWTRenderer extends SimpleControlSWTControlSWTRenderer
Modifier and Type | Class and Description |
---|---|
protected class |
TextControlSWTRenderer.ModelToTargetUpdateStrategy
The strategy to convert from model to target.
|
protected class |
TextControlSWTRenderer.TargetToModelUpdateStrategy
The strategy to convert from target to model.
|
CUSTOM_VARIANT
Constructor and Description |
---|
TextControlSWTRenderer(VControl vElement,
ViewModelContext viewContext,
ReportService reportService,
EMFFormsDatabinding emfFormsDatabinding,
EMFFormsLabelProvider emfFormsLabelProvider,
VTViewTemplateProvider vtViewTemplateProvider,
EMFFormsEditSupport emfFormsEditSupport)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected org.eclipse.core.databinding.Binding |
bindValue(org.eclipse.swt.widgets.Control text,
org.eclipse.core.databinding.observable.value.IObservableValue modelValue,
org.eclipse.core.databinding.DataBindingContext dataBindingContext,
org.eclipse.core.databinding.UpdateValueStrategy targetToModel,
org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
Creates a focus out binding for this control.
|
protected Object |
convert(org.eclipse.swt.widgets.Text text,
org.eclipse.emf.ecore.EDataType attributeType,
String value)
Convert the given value from target to model.
|
protected org.eclipse.core.databinding.Binding[] |
createBindings(org.eclipse.swt.widgets.Control control)
Create the
Bindings for this controls. |
protected org.eclipse.swt.widgets.Control |
createSWTControl(org.eclipse.swt.widgets.Composite parent)
Creates the Control.
|
protected org.eclipse.core.databinding.Binding |
createTooltipBinding(org.eclipse.swt.widgets.Control text,
org.eclipse.core.databinding.observable.value.IObservableValue modelValue,
org.eclipse.core.databinding.DataBindingContext dataBindingContext,
org.eclipse.core.databinding.UpdateValueStrategy targetToModel,
org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
Creates a tooltip binding for this control.
|
protected org.eclipse.swt.widgets.Control |
getControlCompositeFromControl(org.eclipse.swt.widgets.Control control)
Returns the control composite that contains the text field from the parent composite created by the
SimpleControlSWTRenderer . |
protected int |
getDefaultAlignment()
Return the default alignment value for this renderer.
|
protected EMFFormsEditSupport |
getEMFFormsEditSupport() |
protected String |
getTextFromTextField(org.eclipse.swt.widgets.Text text,
org.eclipse.emf.ecore.EDataType attributeType)
Gets the text displayed in the textfield.
|
protected String |
getTextMessage()
Returns the text which should be set as the message text on the Text field.
|
protected String |
getTextVariantID()
The VariantId to use e.g.
|
protected int |
getTextWidgetStyle()
The style to apply to the text widget.
|
protected String |
getUnsetText()
Provide the unset text to show on the label when value is unset.
|
protected boolean |
isUnsetButtonLeftOfControlComposite()
Returns whether the unset button is placed left of the control composite containing the text field.
|
protected void |
setControlEnabled(SWTGridCell gridCell,
org.eclipse.swt.widgets.Control control,
boolean enabled)
Wraps the call to enable/disable a control.
|
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.
|
protected boolean |
useOnModifyDatabinding()
Whether
SWT.Modify or SWT.FocusOut shall be used as the target databinding trigger. |
createControl, getFeature, rootDomainModelChanged, withPreSetValidation
applyReadOnly, applyValidation, createControlCell, createDefaultUnsettableStyleProperty, createLabelCell, createValidationCell, dispose, getGridDescription, getLabelWidth, getUnsettableStyleProperty, isUnsettable, renderControl, setControlIdData
applyEnable, applyUnchangeableFeature, canHandleControlProcessor, createLabel, createValidationIcon, defaultHandleControlProcessor, defaultHandleControlProcessorForCell, getDataBindingContext, getEditingDomain, getEMFFormsDatabinding, getEMFFormsLabelProvider, getLabelStyleBits, getModelValue, getValidationBackgroundColor, getValidationForegroundColor, getValidationIcon, getVTViewTemplateProvider, hasLeftLabelAlignment, isUnchangeableFeature, notifyChange, postInit, render
applyValidation, applyVisible, canReveal, finalizeRendering, getControls, getDefaultFontName, ignoreEnableOnReadOnly, init, isRenderingFinished, preInit, scrollToReveal, scrollToReveal
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
@Inject public TextControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsEditSupport emfFormsEditSupport)
vElement
- the view model element to be renderedviewContext
- the view contextreportService
- The ReportService
emfFormsDatabinding
- The EMFFormsDatabinding
emfFormsLabelProvider
- The EMFFormsLabelProvider
vtViewTemplateProvider
- The VTViewTemplateProvider
emfFormsEditSupport
- The EMFFormsEditSupport
protected org.eclipse.core.databinding.Binding[] createBindings(org.eclipse.swt.widgets.Control control) throws DatabindingFailedException
SimpleControlSWTControlSWTRenderer
Bindings
for this controls.createBindings
in class SimpleControlSWTControlSWTRenderer
control
- the Control
to create the binding forDatabindingFailedException
- if the creation of the bindings fails.protected org.eclipse.swt.widgets.Control createSWTControl(org.eclipse.swt.widgets.Composite parent)
SimpleControlSWTControlSWTRenderer
createSWTControl
in class SimpleControlSWTControlSWTRenderer
parent
- the Composite
to use as a parentprotected Object convert(org.eclipse.swt.widgets.Text text, org.eclipse.emf.ecore.EDataType attributeType, String value) throws DatabindingFailedException
text
- the Text controlattributeType
- the model data typevalue
- the target value to convertDatabindingFailedException
- in case the databinding failedprotected String getTextMessage()
protected org.eclipse.core.databinding.Binding bindValue(org.eclipse.swt.widgets.Control text, org.eclipse.core.databinding.observable.value.IObservableValue modelValue, org.eclipse.core.databinding.DataBindingContext dataBindingContext, org.eclipse.core.databinding.UpdateValueStrategy targetToModel, org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
text
- the Text
to bindmodelValue
- the IObservableValue
to binddataBindingContext
- the DataBindingContext
to usetargetToModel
- the UpdateValueStrategy
from target to ModelmodelToTarget
- the UpdateValueStrategy
from model to targetBinding
protected boolean useOnModifyDatabinding()
SWT.Modify
or SWT.FocusOut
shall be used as the target databinding trigger.true
if Modify should be used, false
otherwiseprotected org.eclipse.core.databinding.Binding createTooltipBinding(org.eclipse.swt.widgets.Control text, org.eclipse.core.databinding.observable.value.IObservableValue modelValue, org.eclipse.core.databinding.DataBindingContext dataBindingContext, org.eclipse.core.databinding.UpdateValueStrategy targetToModel, org.eclipse.core.databinding.UpdateValueStrategy modelToTarget)
text
- the Text
to bindmodelValue
- the IObservableValue
to binddataBindingContext
- the DataBindingContext
to usetargetToModel
- the UpdateValueStrategy
from target to ModelmodelToTarget
- the UpdateValueStrategy
from model to targetBinding
protected int getTextWidgetStyle()
protected EMFFormsEditSupport getEMFFormsEditSupport()
EMFFormsEditSupport
protected int getDefaultAlignment()
protected String getTextVariantID()
protected void setControlEnabled(SWTGridCell gridCell, org.eclipse.swt.widgets.Control control, boolean enabled)
AbstractSWTRenderer
setControlEnabled
in class SimpleControlSWTRenderer
gridCell
- the SWTGridCell
to enable/disablecontrol
- the Control
to enable/disableenabled
- true if control should be enabled, false otherwiseprotected String getTextFromTextField(org.eclipse.swt.widgets.Text text, org.eclipse.emf.ecore.EDataType attributeType)
text
- the Text
attributeType
- the EDataType
Text
protected String getUnsetText()
getUnsetText
in class SimpleControlSWTRenderer
SimpleControlSWTRenderer.getUnsetText()
protected void setValidationColor(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color validationColor)
SimpleControlSWTRenderer
setValidationColor
in class SimpleControlSWTRenderer
control
- the control to set the color onvalidationColor
- the validation color to setprotected void setValidationForegroundColor(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color validationColor)
SimpleControlSWTRenderer
setValidationForegroundColor
in class SimpleControlSWTRenderer
control
- the control to set the color onvalidationColor
- the validation color to setprotected boolean isUnsetButtonLeftOfControlComposite()
true
if the control is unsettable and the unset button is left of the text field,
false
otherwiseprotected org.eclipse.swt.widgets.Control getControlCompositeFromControl(org.eclipse.swt.widgets.Control control)
SimpleControlSWTRenderer
.control
- The edit control created by the
SimpleControlSWTRenderer
Copyright © 2019. All rights reserved.