Class MultiSegmentChildDmrsSWTRenderer
- 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.internal.control.multireference.MultiReferenceSWTRenderer
-
- org.eclipse.emfforms.internal.view.multisegment.tooling.MultiSegmentChildDmrsSWTRenderer
-
- All Implemented Interfaces:
RootDomainModelChangeListener
public class MultiSegmentChildDmrsSWTRenderer extends MultiReferenceSWTRenderer
Renderer to view and edit the child domain model references of a multisegment which is contained in a DMR.- Author:
- Lucas Koehler
-
-
Field Summary
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description MultiSegmentChildDmrsSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsLocalizationService localizationService)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.swt.widgets.Composite
createButtonComposite(org.eclipse.swt.widgets.Composite parent)
Adds a composite with the buttons 'AddExisting', 'AddNew' and 'Delete' to the givenComposite
if necessary.protected org.eclipse.jface.viewers.ILabelProvider
createLabelProvider()
Creates a newILabelProvider
for the table viewer.protected void
dispose()
Disposes all resources used by the renderer.protected java.util.Optional<org.eclipse.emf.ecore.EObject>
getContainer()
Returns theEObject
that contains the elements rendered in this multi reference.protected org.eclipse.emf.ecore.EReference
getEStructuralFeature()
Returns the observedEStructuralFeature
.protected org.eclipse.core.databinding.observable.list.IObservableList<?>
getReferencedElementsList()
Returns anIObservableList
that tracks all child dmrs of the table defined by this renderer's parentVTableControl
.protected void
handleAddNew(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Method for adding a new element.protected void
postInit()
Use this method to initialize objects which are needed during rendering.protected org.eclipse.swt.widgets.Control
renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent)
Renders the passedVElement
.protected boolean
showAddExistingButton()
Returns true if the 'AddExisting' button is shown, false otherwise.protected boolean
showAddNewButton()
Returns true if the 'AddNew' button is shown, false otherwise.protected boolean
showDeleteButton()
Returns true if the 'Delete' button is shown, false otherwise.protected boolean
showMoveDownButton()
Returns true if the 'MoveDown' button is shown, false otherwise.protected boolean
showMoveUpButton()
Returns true if the 'MoveUp' button is shown, false otherwise.protected void
updateButtonEnabling()
Updates the enablement of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.protected void
updateButtonVisibility()
Updates the visibility of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.-
Methods inherited from class org.eclipse.emf.ecp.view.internal.control.multireference.MultiReferenceSWTRenderer
applyEnable, applyReadOnly, applyValidation, compare, createAdapterFactory, createAddExistingButton, createAddNewButton, createControlComposite, createDefaultTableStyleProperty, createDeleteButton, createErrorLabel, createMoveDownButton, createMoveUpButton, createTitleComposite, getAdapterFactory, getDefaultReferenceStyle, getGridDescription, getImage, getLabelProvider, getReferenceDisplayName, getReferenceService, getTableHeightHint, getTableStyleProperty, getTableViewer, handleAddExisting, handleDelete, handleDoubleClick, handleMoveDown, handleMoveUp, ignoreEnableOnReadOnly, renderMultiReferenceControl, rootDomainModelChanged, updateButtons, updateTableViewerInputList
-
Methods inherited from class org.eclipse.emf.ecp.view.spi.core.swt.AbstractControlSWTRenderer
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, init, isRenderingFinished, preInit, scrollToReveal, scrollToReveal, setControlEnabled
-
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
-
-
-
-
Constructor Detail
-
MultiSegmentChildDmrsSWTRenderer
@Inject public MultiSegmentChildDmrsSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsLocalizationService localizationService)
Default constructor.- Parameters:
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- TheEMFFormsDatabinding
emfFormsLabelProvider
- TheEMFFormsLabelProvider
reportService
- TheReportService
vtViewTemplateProvider
- TheVTViewTemplateProvider
imageRegistryService
- TheImageRegistryService
localizationService
- the localization service
-
-
Method Detail
-
postInit
protected void postInit()
Description copied from class:AbstractSWTRenderer
Use this method to initialize objects which are needed during rendering.- Overrides:
postInit
in classAbstractControlSWTRenderer<VControl>
-
renderControl
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Description copied from class:AbstractSWTRenderer
Renders the passedVElement
.- Overrides:
renderControl
in classMultiReferenceSWTRenderer
- Parameters:
cell
- 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
-
createButtonComposite
protected org.eclipse.swt.widgets.Composite createButtonComposite(org.eclipse.swt.widgets.Composite parent) throws DatabindingFailedException
Description copied from class:MultiReferenceSWTRenderer
Adds a composite with the buttons 'AddExisting', 'AddNew' and 'Delete' to the givenComposite
if necessary.- Overrides:
createButtonComposite
in classMultiReferenceSWTRenderer
- Parameters:
parent
- The parent of the createdComposite
- Returns:
- the created Composite
- Throws:
DatabindingFailedException
- thrown if the databinding could not be executed successfully
-
updateButtonEnabling
protected void updateButtonEnabling()
Description copied from class:MultiReferenceSWTRenderer
Updates the enablement of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.- Overrides:
updateButtonEnabling
in classMultiReferenceSWTRenderer
-
updateButtonVisibility
protected void updateButtonVisibility()
Description copied from class:MultiReferenceSWTRenderer
Updates the visibility of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.- Overrides:
updateButtonVisibility
in classMultiReferenceSWTRenderer
-
getContainer
protected java.util.Optional<org.eclipse.emf.ecore.EObject> getContainer()
Description copied from class:MultiReferenceSWTRenderer
Returns theEObject
that contains the elements rendered in this multi reference.- Overrides:
getContainer
in classMultiReferenceSWTRenderer
- Returns:
- The
EObject
containing the elements rendered in this multi reference or nothing if the container couldn't be computed.
-
getEStructuralFeature
protected org.eclipse.emf.ecore.EReference getEStructuralFeature()
Description copied from class:MultiReferenceSWTRenderer
Returns the observedEStructuralFeature
.- Overrides:
getEStructuralFeature
in classMultiReferenceSWTRenderer
- Returns:
- the observed
EStructuralFeature
.
-
showAddExistingButton
protected boolean showAddExistingButton()
Description copied from class:MultiReferenceSWTRenderer
Returns true if the 'AddExisting' button is shown, false otherwise.- Overrides:
showAddExistingButton
in classMultiReferenceSWTRenderer
- Returns:
- true if the 'AddExisting' button is shown, false otherwise
-
showAddNewButton
protected boolean showAddNewButton()
Description copied from class:MultiReferenceSWTRenderer
Returns true if the 'AddNew' button is shown, false otherwise.- Overrides:
showAddNewButton
in classMultiReferenceSWTRenderer
- Returns:
- true if the 'AddNew' button is shown, false otherwise
-
showDeleteButton
protected boolean showDeleteButton()
Description copied from class:MultiReferenceSWTRenderer
Returns true if the 'Delete' button is shown, false otherwise.- Overrides:
showDeleteButton
in classMultiReferenceSWTRenderer
- Returns:
- true if the 'Delete' button is shown, false otherwise
-
showMoveUpButton
protected boolean showMoveUpButton()
Description copied from class:MultiReferenceSWTRenderer
Returns true if the 'MoveUp' button is shown, false otherwise. Returning true will disable any sorting behavior.- Overrides:
showMoveUpButton
in classMultiReferenceSWTRenderer
- Returns:
- true if the 'MoveUp' button is shown, false otherwise
-
showMoveDownButton
protected boolean showMoveDownButton()
Description copied from class:MultiReferenceSWTRenderer
Returns true if the 'MoveDown' button is shown, false otherwise. Returning true will disable any sorting behavior.- Overrides:
showMoveDownButton
in classMultiReferenceSWTRenderer
- Returns:
- true if the 'MoveDown' button is shown, false otherwise
-
handleAddNew
protected void handleAddNew(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Description copied from class:MultiReferenceSWTRenderer
Method for adding a new element.- Overrides:
handleAddNew
in classMultiReferenceSWTRenderer
- Parameters:
tableViewer
- theTableViewer
eObject
- TheEObject
to add tostructuralFeature
- The correspondingEStructuralFeature
-
getReferencedElementsList
protected org.eclipse.core.databinding.observable.list.IObservableList<?> getReferencedElementsList() throws DatabindingFailedException
Returns anIObservableList
that tracks all child dmrs of the table defined by this renderer's parentVTableControl
. The child dmrs are stored in the last segment of theVTableControl's
segment. This segment is a multi segment.IMPORTANT: Can only be used after the field
tableControl
has been set- Overrides:
getReferencedElementsList
in classMultiReferenceSWTRenderer
- Returns:
- The
IObservableList
of the referenced elements - Throws:
DatabindingFailedException
- If computing the list failed due to failed databinding- See Also:
MultiReferenceSWTRenderer.getReferencedElementsList()
-
dispose
protected void dispose()
Description copied from class:MultiReferenceSWTRenderer
Disposes all resources used by the renderer. Don't forget to call super.dispose if overwriting this method.- Overrides:
dispose
in classMultiReferenceSWTRenderer
- See Also:
AbstractControlSWTRenderer.dispose()
-
createLabelProvider
protected org.eclipse.jface.viewers.ILabelProvider createLabelProvider()
Description copied from class:MultiReferenceSWTRenderer
Creates a newILabelProvider
for the table viewer.- Overrides:
createLabelProvider
in classMultiReferenceSWTRenderer
- Returns:
- the newly created
ILabelProvider
.
-
-