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.CompositecreateButtonComposite(org.eclipse.swt.widgets.Composite parent)Adds a composite with the buttons 'AddExisting', 'AddNew' and 'Delete' to the givenCompositeif necessary.protected org.eclipse.jface.viewers.ILabelProvidercreateLabelProvider()Creates a newILabelProviderfor the table viewer.protected voiddispose()Disposes all resources used by the renderer.protected java.util.Optional<org.eclipse.emf.ecore.EObject>getContainer()Returns theEObjectthat contains the elements rendered in this multi reference.protected org.eclipse.emf.ecore.EReferencegetEStructuralFeature()Returns the observedEStructuralFeature.protected org.eclipse.core.databinding.observable.list.IObservableList<?>getReferencedElementsList()Returns anIObservableListthat tracks all child dmrs of the table defined by this renderer's parentVTableControl.protected voidhandleAddNew(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 voidpostInit()Use this method to initialize objects which are needed during rendering.protected org.eclipse.swt.widgets.ControlrenderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent)Renders the passedVElement.protected booleanshowAddExistingButton()Returns true if the 'AddExisting' button is shown, false otherwise.protected booleanshowAddNewButton()Returns true if the 'AddNew' button is shown, false otherwise.protected booleanshowDeleteButton()Returns true if the 'Delete' button is shown, false otherwise.protected booleanshowMoveDownButton()Returns true if the 'MoveDown' button is shown, false otherwise.protected booleanshowMoveUpButton()Returns true if the 'MoveUp' button is shown, false otherwise.protected voidupdateButtonEnabling()Updates the enablement of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.protected voidupdateButtonVisibility()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- TheEMFFormsDatabindingemfFormsLabelProvider- TheEMFFormsLabelProviderreportService- TheReportServicevtViewTemplateProvider- TheVTViewTemplateProviderimageRegistryService- TheImageRegistryServicelocalizationService- the localization service
-
-
Method Detail
-
postInit
protected void postInit()
Description copied from class:AbstractSWTRendererUse this method to initialize objects which are needed during rendering.- Overrides:
postInitin 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:AbstractSWTRendererRenders the passedVElement.- Overrides:
renderControlin classMultiReferenceSWTRenderer- 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
-
createButtonComposite
protected org.eclipse.swt.widgets.Composite createButtonComposite(org.eclipse.swt.widgets.Composite parent) throws DatabindingFailedExceptionDescription copied from class:MultiReferenceSWTRendererAdds a composite with the buttons 'AddExisting', 'AddNew' and 'Delete' to the givenCompositeif necessary.- Overrides:
createButtonCompositein 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:MultiReferenceSWTRendererUpdates the enablement of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.- Overrides:
updateButtonEnablingin classMultiReferenceSWTRenderer
-
updateButtonVisibility
protected void updateButtonVisibility()
Description copied from class:MultiReferenceSWTRendererUpdates the visibility of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the bound input.- Overrides:
updateButtonVisibilityin classMultiReferenceSWTRenderer
-
getContainer
protected java.util.Optional<org.eclipse.emf.ecore.EObject> getContainer()
Description copied from class:MultiReferenceSWTRendererReturns theEObjectthat contains the elements rendered in this multi reference.- Overrides:
getContainerin classMultiReferenceSWTRenderer- Returns:
- The
EObjectcontaining 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:MultiReferenceSWTRendererReturns the observedEStructuralFeature.- Overrides:
getEStructuralFeaturein classMultiReferenceSWTRenderer- Returns:
- the observed
EStructuralFeature.
-
showAddExistingButton
protected boolean showAddExistingButton()
Description copied from class:MultiReferenceSWTRendererReturns true if the 'AddExisting' button is shown, false otherwise.- Overrides:
showAddExistingButtonin classMultiReferenceSWTRenderer- Returns:
- true if the 'AddExisting' button is shown, false otherwise
-
showAddNewButton
protected boolean showAddNewButton()
Description copied from class:MultiReferenceSWTRendererReturns true if the 'AddNew' button is shown, false otherwise.- Overrides:
showAddNewButtonin classMultiReferenceSWTRenderer- Returns:
- true if the 'AddNew' button is shown, false otherwise
-
showDeleteButton
protected boolean showDeleteButton()
Description copied from class:MultiReferenceSWTRendererReturns true if the 'Delete' button is shown, false otherwise.- Overrides:
showDeleteButtonin classMultiReferenceSWTRenderer- Returns:
- true if the 'Delete' button is shown, false otherwise
-
showMoveUpButton
protected boolean showMoveUpButton()
Description copied from class:MultiReferenceSWTRendererReturns true if the 'MoveUp' button is shown, false otherwise. Returning true will disable any sorting behavior.- Overrides:
showMoveUpButtonin classMultiReferenceSWTRenderer- Returns:
- true if the 'MoveUp' button is shown, false otherwise
-
showMoveDownButton
protected boolean showMoveDownButton()
Description copied from class:MultiReferenceSWTRendererReturns true if the 'MoveDown' button is shown, false otherwise. Returning true will disable any sorting behavior.- Overrides:
showMoveDownButtonin 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:MultiReferenceSWTRendererMethod for adding a new element.- Overrides:
handleAddNewin classMultiReferenceSWTRenderer- Parameters:
tableViewer- theTableViewereObject- TheEObjectto add tostructuralFeature- The correspondingEStructuralFeature
-
getReferencedElementsList
protected org.eclipse.core.databinding.observable.list.IObservableList<?> getReferencedElementsList() throws DatabindingFailedExceptionReturns anIObservableListthat tracks all child dmrs of the table defined by this renderer's parentVTableControl. The child dmrs are stored in the last segment of theVTableControl'ssegment. This segment is a multi segment.IMPORTANT: Can only be used after the field
tableControlhas been set- Overrides:
getReferencedElementsListin classMultiReferenceSWTRenderer- Returns:
- The
IObservableListof 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:MultiReferenceSWTRendererDisposes all resources used by the renderer. Don't forget to call super.dispose if overwriting this method.- Overrides:
disposein classMultiReferenceSWTRenderer- See Also:
AbstractControlSWTRenderer.dispose()
-
createLabelProvider
protected org.eclipse.jface.viewers.ILabelProvider createLabelProvider()
Description copied from class:MultiReferenceSWTRendererCreates a newILabelProviderfor the table viewer.- Overrides:
createLabelProviderin classMultiReferenceSWTRenderer- Returns:
- the newly created
ILabelProvider.
-
-