public class MultiReferenceSWTRenderer extends AbstractControlSWTRenderer<VControl>
CUSTOM_VARIANT
Constructor and Description |
---|
MultiReferenceSWTRenderer(VControl vElement,
ViewModelContext viewContext,
ReportService reportService,
EMFFormsDatabinding emfFormsDatabinding,
EMFFormsLabelProvider emfFormsLabelProvider,
VTViewTemplateProvider vtViewTemplateProvider,
ImageRegistryService imageRegistryService)
Legacy constructor, initializing me without a localization service.
|
MultiReferenceSWTRenderer(VControl vElement,
ViewModelContext viewContext,
ReportService reportService,
EMFFormsDatabinding emfFormsDatabinding,
EMFFormsLabelProvider emfFormsLabelProvider,
VTViewTemplateProvider vtViewTemplateProvider,
ImageRegistryService imageRegistryService,
EMFFormsLocalizationService localizationService)
Complete constructor, supplying all dependencies.
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyEnable()
Allows implementers to set a control to enabled.
|
protected void |
applyReadOnly()
Marks a controls as readonly.
|
protected void |
applyValidation()
Allows implementers to display the validation state of the control.
|
protected int |
compare(int direction,
Object object1,
Object object2)
Sorts two objects based on their labels and the given sorting direction.
|
protected org.eclipse.emf.common.notify.AdapterFactory |
createAdapterFactory()
Creates a new
AdapterFactory . |
protected org.eclipse.swt.widgets.Button |
createAddExistingButton(org.eclipse.swt.widgets.Composite parent,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Creates a button that enables the addition of existing references to the given
EStructuralFeature . |
protected org.eclipse.swt.widgets.Button |
createAddNewButton(org.eclipse.swt.widgets.Composite parent,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Creates a button that enables the addition of newly created references to the given
EStructuralFeature . |
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 given
Composite if
necessary. |
protected org.eclipse.swt.widgets.Composite |
createControlComposite(org.eclipse.swt.widgets.Composite composite)
Creates the composite which will be the parent for the table.
|
protected VTTableStyleProperty |
createDefaultTableStyleProperty()
Creates the default
VTTableStyleProperty . |
protected org.eclipse.swt.widgets.Button |
createDeleteButton(org.eclipse.swt.widgets.Composite parent,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Creates a button that enables the removal of existing references from the given
EStructuralFeature . |
protected org.eclipse.swt.widgets.Control |
createErrorLabel(org.eclipse.swt.widgets.Composite parent,
Exception ex)
Creates an error label for the given
Exception . |
protected org.eclipse.jface.viewers.ILabelProvider |
createLabelProvider()
Creates a new
ILabelProvider for the table viewer. |
protected org.eclipse.swt.widgets.Button |
createMoveDownButton(org.eclipse.swt.widgets.Composite parent,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Creates a button that enables reordering the references by the given
EStructuralFeature . |
protected org.eclipse.swt.widgets.Button |
createMoveUpButton(org.eclipse.swt.widgets.Composite parent,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Creates a button that enables reordering the references by the given
EStructuralFeature . |
protected void |
createTitleComposite(org.eclipse.swt.widgets.Composite parent)
Creates a composite with a label, a validation icon and a button composite.
|
protected void |
dispose()
Disposes all resources used by the renderer.
|
protected org.eclipse.emf.common.notify.AdapterFactory |
getAdapterFactory()
Returns the
AdapterFactory used by this renderer. |
protected Optional<org.eclipse.emf.ecore.EObject> |
getContainer()
Returns the
EObject that contains the elements rendered in this multi reference. |
protected VTReferenceStyleProperty |
getDefaultReferenceStyle()
Creates and returns a default version of a
VTReferenceStyleProperty . |
protected org.eclipse.emf.ecore.EStructuralFeature |
getEStructuralFeature()
Returns the observed
EStructuralFeature . |
SWTGridDescription |
getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.
|
protected org.eclipse.swt.graphics.Image |
getImage(String path)
Returns an
Image from the image registry. |
protected org.eclipse.jface.viewers.ILabelProvider |
getLabelProvider()
Returns the
ILabelProvider used by this renderer. |
protected org.eclipse.core.databinding.observable.list.IObservableList<?> |
getReferencedElementsList()
Computes and returns the observable list of the referenced elements shown by this renderer.
|
protected String |
getReferenceDisplayName()
Obtains a user-presentable name for the reference that I edit, to be used for example
in button tool-tips.
|
protected ReferenceService |
getReferenceService()
Override to customize linking and creation of EObjects in this renderer's EReference.
|
protected int |
getTableHeightHint()
Returns the height for the table that will be created.
|
protected VTTableStyleProperty |
getTableStyleProperty()
Returns the
VTTableStyleProperty . |
protected org.eclipse.jface.viewers.TableViewer |
getTableViewer()
Gives access to the tableViewer used to display the attributes.
|
protected void |
handleAddExisting(org.eclipse.jface.viewers.TableViewer tableViewer,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Method for adding an existing element.
|
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 |
handleDelete(org.eclipse.jface.viewers.TableViewer tableViewer,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Method for deleting elements.
|
protected void |
handleDoubleClick(org.eclipse.emf.ecore.EObject selectedObject)
Method for handling a double click.
|
protected void |
handleMoveDown(org.eclipse.jface.viewers.TableViewer tableViewer,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Method for moving down elements.
|
protected void |
handleMoveUp(org.eclipse.jface.viewers.TableViewer tableViewer,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Method for moving up elements.
|
protected boolean |
ignoreEnableOnReadOnly()
Returns
true when read only will always force control to be disabled. |
protected org.eclipse.swt.widgets.Control |
renderControl(SWTGridCell cell,
org.eclipse.swt.widgets.Composite parent)
Renders the passed
VElement . |
protected org.eclipse.swt.widgets.Control |
renderMultiReferenceControl(SWTGridCell cell,
org.eclipse.swt.widgets.Composite parent)
Renders the MultiReference Control.
|
protected void |
rootDomainModelChanged()
This method is called in
AbstractControlSWTRenderer.notifyChange() when the root domain model of the view model context changes. |
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 |
updateButtons()
Updates button visibility and enablement.
|
protected void |
updateButtonVisibility()
Updates the visibility of 'addExisting', 'addNew', 'delete', 'moveUp' and 'moveDown' buttons according to the
bound input.
|
protected org.eclipse.core.databinding.observable.list.IObservableList<?> |
updateTableViewerInputList()
Updates the table viewer's input observable list.
|
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, init, isRenderingFinished, preInit, scrollToReveal, scrollToReveal, setControlEnabled
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
public MultiReferenceSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService)
viewContext
.vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- The EMFFormsDatabinding
emfFormsLabelProvider
- The EMFFormsLabelProvider
reportService
- The ReportService
vtViewTemplateProvider
- The VTViewTemplateProvider
imageRegistryService
- The ImageRegistryService
@Inject public MultiReferenceSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsLocalizationService localizationService)
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- The EMFFormsDatabinding
emfFormsLabelProvider
- The EMFFormsLabelProvider
reportService
- The ReportService
vtViewTemplateProvider
- The VTViewTemplateProvider
imageRegistryService
- The ImageRegistryService
localizationService
- the localization servicepublic SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
AbstractSWTRenderer
getGridDescription
in class AbstractSWTRenderer<VControl>
gridDescription
- the current SWTGridDescription
protected final org.eclipse.core.databinding.observable.list.IObservableList<?> updateTableViewerInputList() throws DatabindingFailedException
Note: This method only updates the input list but does not trigger button enablement etc.
null
DatabindingFailedException
- if the new list cannot be resolvedprotected boolean showAddExistingButton()
protected boolean showAddNewButton()
protected VTReferenceStyleProperty getDefaultReferenceStyle()
VTReferenceStyleProperty
.VTReferenceStyleProperty
protected boolean showDeleteButton()
protected boolean showMoveUpButton()
protected boolean showMoveDownButton()
protected org.eclipse.emf.ecore.EStructuralFeature getEStructuralFeature() throws DatabindingFailedException
EStructuralFeature
.EStructuralFeature
.DatabindingFailedException
- when databinding fails.protected Optional<org.eclipse.emf.ecore.EObject> getContainer()
EObject
that contains the elements rendered in this multi reference.EObject
containing the elements rendered in this multi reference or nothing if the container
couldn't be computed.protected VTTableStyleProperty createDefaultTableStyleProperty()
VTTableStyleProperty
.VTTableStyleProperty
protected VTTableStyleProperty getTableStyleProperty()
VTTableStyleProperty
.VTTableStyleProperty
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
AbstractSWTRenderer
VElement
.renderControl
in class AbstractSWTRenderer<VControl>
cell
- the GridCell
of the control to renderparent
- the Composite
to render onControl
NoRendererFoundException
- this is thrown when a renderer cannot be foundNoPropertyDescriptorFoundExeption
- this is thrown when no property descriptor can be foundprotected org.eclipse.swt.widgets.Control renderMultiReferenceControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
RenderMode
is set to
RenderMode.DEFAULT
. Only renders the
MultiReference control without validation and buttons when renderMode is set to
RenderMode.COMPACT_VERTICALLY
.cell
- the SWTGridCell
.parent
- the Composite
.Control
NoRendererFoundException
- the NoRendererFoundException
.NoPropertyDescriptorFoundExeption
- the NoPropertyDescriptorFoundExeption
.protected org.eclipse.swt.widgets.Composite createControlComposite(org.eclipse.swt.widgets.Composite composite)
composite
- the parent compositeprotected int getTableHeightHint()
protected org.eclipse.jface.viewers.TableViewer getTableViewer()
protected org.eclipse.swt.widgets.Control createErrorLabel(org.eclipse.swt.widgets.Composite parent, Exception ex)
Exception
.parent
- The parent of the Label
ex
- The Exception
causing the errorLabel
protected org.eclipse.emf.common.notify.AdapterFactory createAdapterFactory()
AdapterFactory
.AdapterFactory
.protected final org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory()
AdapterFactory
used by this renderer. To customize the used AdapterFactory
override
createAdapterFactory()
.AdapterFactory
used by this renderercreateAdapterFactory()
protected org.eclipse.jface.viewers.ILabelProvider createLabelProvider()
ILabelProvider
for the table viewer.ILabelProvider
.protected void dispose()
dispose
in class AbstractControlSWTRenderer<VControl>
AbstractControlSWTRenderer.dispose()
protected org.eclipse.swt.widgets.Button createMoveUpButton(org.eclipse.swt.widgets.Composite parent, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
EStructuralFeature
.parent
- The parent of the created Button
structuralFeature
- The EStructuralFeature
which's references are moved up.Button
protected org.eclipse.swt.widgets.Button createMoveDownButton(org.eclipse.swt.widgets.Composite parent, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
EStructuralFeature
.parent
- The parent of the created Button
structuralFeature
- The EStructuralFeature
which's references are moved down.Button
protected org.eclipse.swt.widgets.Button createAddExistingButton(org.eclipse.swt.widgets.Composite parent, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
EStructuralFeature
.parent
- The parent of the created Button
structuralFeature
- The EStructuralFeature
to which references are addedButton
protected org.eclipse.swt.widgets.Button createAddNewButton(org.eclipse.swt.widgets.Composite parent, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
EStructuralFeature
.parent
- The parent of the created Button
structuralFeature
- The EStructuralFeature
to which references are addedButton
protected org.eclipse.swt.widgets.Button createDeleteButton(org.eclipse.swt.widgets.Composite parent, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
EStructuralFeature
.parent
- The parent of the newly created Button
structuralFeature
- The EStructuralFeature
from which references are removedButton
protected void updateButtons()
protected void updateButtonEnabling()
protected void updateButtonVisibility()
protected org.eclipse.swt.widgets.Composite createButtonComposite(org.eclipse.swt.widgets.Composite parent) throws DatabindingFailedException
Composite
if
necessary.parent
- The parent of the created Composite
DatabindingFailedException
- thrown if the databinding could not be executed successfullyprotected void createTitleComposite(org.eclipse.swt.widgets.Composite parent) throws DatabindingFailedException
parent
- The parent of the created Composite
DatabindingFailedException
- thrown if the databinding could not be executed successfullyprotected org.eclipse.swt.graphics.Image getImage(String path)
Image
from the image registry.path
- the path to the imageprotected String getReferenceDisplayName()
protected void handleDoubleClick(org.eclipse.emf.ecore.EObject selectedObject)
selectedObject
- the selected EObject
protected void handleAddExisting(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
tableViewer
- the TableViewer
eObject
- The EObject
to add tostructuralFeature
- The corresponding EStructuralFeature
protected void handleAddNew(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
tableViewer
- the TableViewer
eObject
- The EObject
to add tostructuralFeature
- The corresponding EStructuralFeature
protected ReferenceService getReferenceService()
ReferenceService
used to link and create new EObjects in this renderer's reference.protected void handleDelete(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
tableViewer
- the TableViewer
eObject
- The EObject
to delete fromstructuralFeature
- The corresponding EStructuralFeature
protected void handleMoveUp(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
tableViewer
- the TableViewer
eObject
- The EObject
to delete fromstructuralFeature
- The corresponding EStructuralFeature
protected void handleMoveDown(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
tableViewer
- the TableViewer
eObject
- The EObject
to delete fromstructuralFeature
- The corresponding EStructuralFeature
protected void rootDomainModelChanged() throws DatabindingFailedException
AbstractControlSWTRenderer
AbstractControlSWTRenderer.notifyChange()
when the root domain model of the view model context changes.rootDomainModelChanged
in class AbstractControlSWTRenderer<VControl>
DatabindingFailedException
- If the databinding failedprotected org.eclipse.core.databinding.observable.list.IObservableList<?> getReferencedElementsList() throws DatabindingFailedException
IObservableList
of the referenced elementsDatabindingFailedException
- If computing the list failed due to failed databindingprotected boolean ignoreEnableOnReadOnly()
AbstractSWTRenderer
true
when read only will always force control to be disabled.ignoreEnableOnReadOnly
in class AbstractSWTRenderer<VControl>
true
when read only will always force control to be disabled.protected void applyEnable()
AbstractControlSWTRenderer
applyEnable
in class AbstractControlSWTRenderer<VControl>
AbstractSWTRenderer.applyEnable()
protected void applyReadOnly()
AbstractControlSWTRenderer
applyReadOnly
in class AbstractControlSWTRenderer<VControl>
AbstractSWTRenderer.applyReadOnly()
protected void applyValidation()
AbstractSWTRenderer
applyValidation
in class AbstractSWTRenderer<VControl>
protected int compare(int direction, Object object1, Object object2)
Sorts two objects based on their labels and the given sorting direction.
Override this method to provide a custom sorting algorithm for the objects shown in this control's table.
direction
- The sorting direction: 0 == NONE, 1 == UP, 2 == DOWNobject1
- The first object of the comparisonobject2
- The second object of the comparisonprotected org.eclipse.jface.viewers.ILabelProvider getLabelProvider()
ILabelProvider
used by this renderer.ILabelProvider
Copyright © 2019. All rights reserved.