Class CompoundControlSWTRenderer
- java.lang.Object
-
- org.eclipse.emf.ecp.view.model.common.AbstractRenderer<VELEMENT>
-
- org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer<VCompoundControl>
-
- org.eclipse.emf.ecp.view.spi.compoundcontrol.swt.CompoundControlSWTRenderer
-
public class CompoundControlSWTRenderer extends AbstractSWTRenderer<VCompoundControl>
AbstractSWTRendererfor theVCompoundControlview model.- Author:
- jfaltermeier
-
-
Field Summary
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description CompoundControlSWTRenderer(VCompoundControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsLabelProvider labelProvider, EMFFormsRendererFactory rendererFactory, VTViewTemplateProvider viewTemplateProvider, EMFFormsDatabindingEMF databindingService)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.swt.widgets.ControlcreateControls(org.eclipse.swt.widgets.Composite parent)Creates the controls composite.protected org.eclipse.swt.widgets.ControlcreateControls(org.eclipse.swt.widgets.Composite parent, int cellsToSkip)Creates the controls composite.protected org.eclipse.swt.widgets.ControlcreateDummyValidationIcon(org.eclipse.swt.widgets.Composite parent)Creates the validation icon of the first cell of the first child may not be used as the validation icon.protected org.eclipse.swt.widgets.ControlcreateLabel(org.eclipse.swt.widgets.Composite parent)Creates the label composite.protected org.eclipse.swt.widgets.ControlcreateValidationIcon(org.eclipse.swt.widgets.Composite parent)Return the validation cell of the fist child.protected voiddispose()Disposes all resources used by the renderer.protected org.eclipse.swt.widgets.LayoutgetColumnLayout(int numColumns, boolean equalWidth)For testing purposes.protected org.eclipse.core.databinding.DataBindingContextgetDataBindingContext()Returns theDataBindingContext.protected EMFFormsDatabindingEMFgetDatabindingService()protected java.util.LinkedHashMap<VContainedElement,AbstractSWTRenderer<VElement>>getElementRendererMap()SWTGridDescriptiongetGridDescription(SWTGridDescription gridDescription)Returns the GridDescription for this Renderer.protected EMFFormsLabelProvidergetLabelProvider()Returns theEMFFormsLabelProvider.protected intgetLabelStyleBits()protected Optional<java.lang.Integer>getLabelWidth()protected java.lang.ObjectgetLayoutData(SWTGridCell gridCell, SWTGridDescription controlGridDescription, SWTGridDescription currentRowGridDescription, SWTGridDescription fullGridDescription, VElement vElement, org.eclipse.emf.ecore.EObject domainModel, org.eclipse.swt.widgets.Control control)For testing purposes.protected EMFFormsRendererFactorygetRendererFactory()Returns theEMFFormsRendererFactory.protected java.lang.ObjectgetSpanningLayoutData(VContainedElement child, int spanX, int spanY)For testing purposes.protected VTViewTemplateProvidergetViewTemplateProvider()protected voidinitChildRendererMap()Initialises the child control to renderer map.protected org.eclipse.swt.widgets.ControlrenderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent)Renders the passedVElement.protected voidsetFirstControlValidationIconUsed(boolean used)Whether the first cell of the first child control was used to renderer our validation icon.-
Methods inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
applyEnable, applyReadOnly, applyValidation, applyValidation, applyVisible, canReveal, finalizeRendering, getControls, getDefaultFontName, ignoreEnableOnReadOnly, init, isRenderingFinished, postInit, preInit, render, scrollToReveal, scrollToReveal, setControlEnabled
-
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
-
-
-
-
Constructor Detail
-
CompoundControlSWTRenderer
@Inject public CompoundControlSWTRenderer(VCompoundControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsLabelProvider labelProvider, EMFFormsRendererFactory rendererFactory, VTViewTemplateProvider viewTemplateProvider, EMFFormsDatabindingEMF databindingService)
Default constructor.- Parameters:
vElement- the view model element to be renderedviewContext- the view contextreportService- theReportServicelabelProvider- thelabel providerrendererFactory- therenderer factoryviewTemplateProvider-VTViewTemplateProviderdatabindingService-EMFFormsDatabindingEMF- Since:
- 1.17
-
-
Method Detail
-
getLabelProvider
protected EMFFormsLabelProvider getLabelProvider()
Returns theEMFFormsLabelProvider.- Returns:
- the label provider
- Since:
- 1.8
-
getRendererFactory
protected EMFFormsRendererFactory getRendererFactory()
Returns theEMFFormsRendererFactory.- Returns:
- the renderer factory
- Since:
- 1.8
-
getDatabindingService
protected EMFFormsDatabindingEMF getDatabindingService()
- Returns:
- the
EMFFormsDatabindingEMF. - Since:
- 1.17
-
getDataBindingContext
protected org.eclipse.core.databinding.DataBindingContext getDataBindingContext()
Returns theDataBindingContext.- Returns:
- the databining context
- Since:
- 1.8
-
getElementRendererMap
protected java.util.LinkedHashMap<VContainedElement,AbstractSWTRenderer<VElement>> getElementRendererMap()
- Returns:
- child control to renderer map
- Since:
- 1.16
-
getViewTemplateProvider
protected VTViewTemplateProvider getViewTemplateProvider()
- Returns:
- the viewTemplateProvider
- Since:
- 1.16
-
getGridDescription
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
Description copied from class:AbstractSWTRendererReturns the GridDescription for this Renderer.- Specified by:
getGridDescriptionin classAbstractSWTRenderer<VCompoundControl>- Parameters:
gridDescription- the currentSWTGridDescription- Returns:
- the number of controls per row
-
renderControl
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Description copied from class:AbstractSWTRendererRenders the passedVElement.- Specified by:
renderControlin classAbstractSWTRenderer<VCompoundControl>- Parameters:
cell- theGridCellof the control to renderparent- theCompositeto 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
-
createLabel
protected org.eclipse.swt.widgets.Control createLabel(org.eclipse.swt.widgets.Composite parent)
Creates the label composite.- Parameters:
parent- the parent composite- Returns:
- the label
- Since:
- 1.8
-
getLabelStyleBits
protected int getLabelStyleBits()
- Returns:
- the style bits for the control's label
- Since:
- 1.17
-
getLabelWidth
protected Optional<java.lang.Integer> getLabelWidth()
- Returns:
- an optional width for the control's label
- Since:
- 1.16
-
createValidationIcon
protected org.eclipse.swt.widgets.Control createValidationIcon(org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeptionReturn the validation cell of the fist child. If no children or strange first cell, return a dummy validation icon.- Parameters:
parent- the parent to render on- Returns:
- the validation control
- Throws:
NoRendererFoundException- this is thrown when a renderer cannot be foundNoPropertyDescriptorFoundExeption- this is thrown when no property descriptor can be found- Since:
- 1.17
-
setFirstControlValidationIconUsed
protected void setFirstControlValidationIconUsed(boolean used)
Whether the first cell of the first child control was used to renderer our validation icon.- Parameters:
used-trueif used,falseotherwise- Since:
- 1.17
-
createDummyValidationIcon
protected org.eclipse.swt.widgets.Control createDummyValidationIcon(org.eclipse.swt.widgets.Composite parent)
Creates the validation icon of the first cell of the first child may not be used as the validation icon.- Parameters:
parent- the parent- Returns:
- the validation icon
- Since:
- 1.17
-
createControls
protected org.eclipse.swt.widgets.Control createControls(org.eclipse.swt.widgets.Composite parent)
Creates the controls composite.- Parameters:
parent- the parent composite- Returns:
- the controls
- Since:
- 1.8
-
createControls
protected org.eclipse.swt.widgets.Control createControls(org.eclipse.swt.widgets.Composite parent, int cellsToSkip)Creates the controls composite. May skip the first cell(s).- Parameters:
parent- the parent compositecellsToSkip- number of cells to skip- Returns:
- the controls
- Since:
- 1.16
-
initChildRendererMap
protected void initChildRendererMap()
Initialises the child control to renderer map.- Since:
- 1.16
-
getColumnLayout
protected org.eclipse.swt.widgets.Layout getColumnLayout(int numColumns, boolean equalWidth)For testing purposes.- Parameters:
numColumns- numColumnsequalWidth- equalWidth- Returns:
- ColumnLayout
- Since:
- 1.8
-
getSpanningLayoutData
protected java.lang.Object getSpanningLayoutData(VContainedElement child, int spanX, int spanY)
For testing purposes.- Parameters:
child- the element for which the spanning layout is requestedspanX- spanXspanY- spanY- Returns:
- SpanningLayoutData
- Since:
- 1.8
-
getLayoutData
protected java.lang.Object getLayoutData(SWTGridCell gridCell, SWTGridDescription controlGridDescription, SWTGridDescription currentRowGridDescription, SWTGridDescription fullGridDescription, VElement vElement, org.eclipse.emf.ecore.EObject domainModel, org.eclipse.swt.widgets.Control control)
For testing purposes.- Parameters:
gridCell- gridCellcontrolGridDescription- controlGridDescriptioncurrentRowGridDescription- currentRowGridDescriptionfullGridDescription- fullGridDescriptionvElement- vElementdomainModel- domainModelcontrol- control- Returns:
- LayoutData
- Since:
- 1.8
-
dispose
protected void dispose()
Description copied from class:AbstractSWTRendererDisposes all resources used by the renderer. Don't forget to call super.dispose if overwriting this method.- Overrides:
disposein classAbstractSWTRenderer<VCompoundControl>
-
-