Class RichTextControlSWTRenderer
- 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
-
- org.eclipse.emf.ecp.view.spi.core.swt.SimpleControlSWTControlSWTRenderer
-
- org.eclipse.emf.ecp.view.spi.core.swt.renderer.TextControlSWTRenderer
-
- org.eclipse.emfforms.spi.swt.control.text.richtext.renderer.RichTextControlSWTRenderer
-
- All Implemented Interfaces:
RootDomainModelChangeListener
public class RichTextControlSWTRenderer extends TextControlSWTRenderer
The multi line text control renderer displays the text in a read only fashion. Once the user starts editing (pressing any key except tab), a popupcontrol is displayed allowing the user to edit the contents.- Author:
- Jonas Helming
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.emf.ecp.view.spi.core.swt.renderer.TextControlSWTRenderer
TextControlSWTRenderer.ModelToTargetUpdateStrategy, TextControlSWTRenderer.TargetToModelUpdateStrategy
-
-
Field Summary
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description RichTextControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsEditSupport emfFormsEditSupport)
Constructs a newRichTextControlSWTRenderer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 PopupWindow
createPopupWindow()
creates the popup window.protected org.eclipse.swt.widgets.Control
createSWTControl(org.eclipse.swt.widgets.Composite parent)
Creates the Control.protected int
getMaxTextHeight()
The maximum height in pixels for the text control.protected int
getMaxVisibleLines()
The maximum number of visible lines in the text control.protected int
getMinTextHeight()
The minimum height in pixels for the text control.protected int
getMinVisibleLines()
The minimum number of visible lines in the text control.protected int
getPreferrredPopupHeight()
Specifies the preferred size of the popup window.protected int
getTextHeightHint()
The preferred height in pixels for the text control.protected boolean
isOpenKey(org.eclipse.swt.events.KeyEvent e)
Determines, whether the popup shall be opened on a specific KeyEvent on the regular Text Control.protected void
postInit()
Use this method to initialize objects which are needed during rendering.-
Methods inherited from class org.eclipse.emf.ecp.view.spi.core.swt.renderer.TextControlSWTRenderer
convert, createBindings, createTooltipBinding, getControlCompositeFromControl, getDefaultAlignment, getEMFFormsEditSupport, getTextFromTextField, getTextMessage, getTextVariantID, getTextWidgetStyle, getUnsetText, isUnsetButtonLeftOfControlComposite, setControlEnabled, setValidationColor, setValidationForegroundColor, useOnModifyDatabinding
-
Methods inherited from class org.eclipse.emf.ecp.view.spi.core.swt.SimpleControlSWTControlSWTRenderer
createControl, getFeature, rootDomainModelChanged, withPreSetValidation
-
Methods inherited from class org.eclipse.emf.ecp.view.spi.core.swt.SimpleControlSWTRenderer
applyReadOnly, applyValidation, createControlCell, createDefaultUnsettableStyleProperty, createLabelCell, createValidationCell, dispose, getGridDescription, getLabelWidth, getUnsettableStyleProperty, isUnsettable, renderControl, setControlIdData
-
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, 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
-
RichTextControlSWTRenderer
@Inject public RichTextControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsEditSupport emfFormsEditSupport)
Constructs a newRichTextControlSWTRenderer
.- Parameters:
vElement
- the view model element to be renderedviewContext
- the view contextreportService
- TheReportService
emfFormsDatabinding
- TheEMFFormsDatabinding
emfFormsLabelProvider
- TheEMFFormsLabelProvider
vtViewTemplateProvider
- TheVTViewTemplateProvider
emfFormsEditSupport
- TheEMFFormsEditSupport
-
-
Method Detail
-
getPreferrredPopupHeight
protected int getPreferrredPopupHeight()
Specifies the preferred size of the popup window.- Returns:
- the size in pixel
-
createPopupWindow
protected PopupWindow createPopupWindow()
creates the popup window.- Returns:
- a new
PopupWindow
-
bindValue
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. Databinding is set to SWT.Modify, because we cannot guarantee that the focus of the text field is lost after the popup windows is closed.- Overrides:
bindValue
in classTextControlSWTRenderer
- Parameters:
text
- theText
to bindmodelValue
- theIObservableValue
to binddataBindingContext
- theDataBindingContext
to usetargetToModel
- theUpdateValueStrategy
from target to ModelmodelToTarget
- theUpdateValueStrategy
from model to target- Returns:
- the created
Binding
- See Also:
TextControlSWTRenderer.bindValue(org.eclipse.swt.widgets.Control, org.eclipse.core.databinding.observable.value.IObservableValue, org.eclipse.core.databinding.DataBindingContext, org.eclipse.core.databinding.UpdateValueStrategy, org.eclipse.core.databinding.UpdateValueStrategy)
-
createSWTControl
protected org.eclipse.swt.widgets.Control createSWTControl(org.eclipse.swt.widgets.Composite parent)
Description copied from class:SimpleControlSWTControlSWTRenderer
Creates the Control.- Overrides:
createSWTControl
in classTextControlSWTRenderer
- Parameters:
parent
- theComposite
to use as a parent- Returns:
- the created control
-
isOpenKey
protected boolean isOpenKey(org.eclipse.swt.events.KeyEvent e)
Determines, whether the popup shall be opened on a specific KeyEvent on the regular Text Control. By default the popup opens on any key except SHIFT and ALT, but additional keys can be added by overriding the method.- Parameters:
e
- theKeyEvent
on the regularText
- Returns:
- whether the popup should open
- Since:
- 1.14
-
postInit
protected void postInit()
Use this method to initialize objects which are needed during rendering.- Overrides:
postInit
in classAbstractControlSWTRenderer<VControl>
- See Also:
AbstractControlSWTRenderer.postInit()
-
getTextHeightHint
protected int getTextHeightHint()
The preferred height in pixels for the text control.- Returns:
- the height hint
- See Also:
GridData.heightHint
-
getMaxTextHeight
protected int getMaxTextHeight()
The maximum height in pixels for the text control.- Returns:
- the maximum height
-
getMinTextHeight
protected int getMinTextHeight()
The minimum height in pixels for the text control.- Returns:
- the minimum height
-
getMinVisibleLines
protected int getMinVisibleLines()
The minimum number of visible lines in the text control.- Returns:
- the minimum visible lines
-
getMaxVisibleLines
protected int getMaxVisibleLines()
The maximum number of visible lines in the text control.- Returns:
- the maximum visible lines
-
-