Class LinkControlSWTRenderer
- 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.internal.core.swt.renderer.LinkControlSWTRenderer
-
- All Implemented Interfaces:
RootDomainModelChangeListener
- Direct Known Subclasses:
ColumnEnablementConfigurationDMRRenderer
,TemplateInstanceRenderer
,WidthConfigurationDMRRenderer
public class LinkControlSWTRenderer extends SimpleControlSWTControlSWTRenderer
SWT Renderer for link controls.- Author:
- Alexandra Buzila
-
-
Field Summary
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description LinkControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsLocalizationService localizationService, ImageRegistryService imageRegistryService)
LinkControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsLocalizationService localizationService, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport)
Deprecated.with 1.22
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyReadOnly()
Marks a controls as readonly.protected void
createAddReferenceButton(org.eclipse.swt.widgets.Composite parent, java.lang.String elementDisplayName)
Called bycreateButtons(Composite)
to create the add existing reference button.protected org.eclipse.core.databinding.Binding[]
createBindings(org.eclipse.swt.widgets.Control control)
Create theBindings
for this controls.protected void
createButtons(org.eclipse.swt.widgets.Composite parent)
Called bycreateSWTControl(Composite)
in order to create the buttons.protected void
createDeleteReferenceButton(org.eclipse.swt.widgets.Composite parent, java.lang.String elementDisplayName)
Called bycreateButtons(Composite)
to create the delete reference button.protected void
createNewReferenceButton(org.eclipse.swt.widgets.Composite parent, java.lang.String elementDisplayName)
Called bycreateButtons(Composite)
to create the create new reference button.protected org.eclipse.swt.widgets.Control
createSWTControl(org.eclipse.swt.widgets.Composite parent)
Creates the Control.protected void
dispose()
Disposes all resources used by the renderer.protected org.eclipse.swt.graphics.Image
getAddReferenceButtonImage()
Returns the add reference image for button.protected VTReferenceStyleProperty
getDefaultReferenceStyle()
Creates and returns a default version of aVTReferenceStyleProperty
.protected org.eclipse.swt.graphics.Image
getDeleteReferenceButtonImage()
Returns the image for delete reference button.protected org.osgi.framework.Bundle
getIconBundle()
Returns the bundle where the icon file is located.protected org.eclipse.swt.graphics.Image
getImage(java.lang.Object value)
Returns the image to be used for the given linkedvalue
.protected org.eclipse.swt.graphics.Image
getImage(org.osgi.framework.Bundle bundle, java.lang.String iconPath)
Returns an image to be displayed given the bundle and path in the bundle where icon file can be found.protected org.eclipse.swt.graphics.Image
getNewReferenceButtonImage()
Returns the new reference image for button.protected int
getNumButtons()
protected ReferenceService
getReferenceService()
protected java.lang.String
getText(java.lang.Object value)
Returns the link text to be used for the given linkedvalue
.protected java.lang.String
getUnsetText()
Provide the unset text to show on the label when value is unset.protected void
linkClicked(org.eclipse.emf.ecore.EObject value)
This code is called whenever the link of the link widget is clicked.protected boolean
openNewReferenceInContext()
Whether a new reference should be opened in a new context.protected void
postInit()
Use this method to initialize objects which are needed during rendering.void
scrollToReveal()
If my control is rendered within a scrolled composite, scroll that composite to reveal me.protected void
updateButtonVisibility()
Updates the visibility of 'add reference', 'new reference', and 'delete reference' buttons according to the bound input.-
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
applyValidation, createControlCell, createDefaultUnsettableStyleProperty, createLabelCell, createValidationCell, getGridDescription, getLabelWidth, getUnsettableStyleProperty, isUnsettable, renderControl, setControlEnabled, setControlIdData, setValidationColor, setValidationForegroundColor
-
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
-
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
-
-
-
-
Constructor Detail
-
LinkControlSWTRenderer
@Deprecated @Inject public LinkControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsLocalizationService localizationService, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport)
Deprecated.with 1.22- Parameters:
vElement
- the element to renderviewContext
- the view model contextreportService
- the report serviceemfFormsDatabinding
- the data binding serviceemfFormsLabelProvider
- the label providervtViewTemplateProvider
- the view template providerlocalizationService
- the localization serviceimageRegistryService
- the image registry serviceemfFormsEditSupport
- the EMFFormsEditSupport
-
LinkControlSWTRenderer
@Inject public LinkControlSWTRenderer(VControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabinding emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, EMFFormsLocalizationService localizationService, ImageRegistryService imageRegistryService)
- Parameters:
vElement
- the element to renderviewContext
- the view model contextreportService
- the report serviceemfFormsDatabinding
- the data binding serviceemfFormsLabelProvider
- the label providervtViewTemplateProvider
- the view template providerlocalizationService
- the localization serviceimageRegistryService
- the image registry service
-
-
Method Detail
-
createBindings
protected org.eclipse.core.databinding.Binding[] createBindings(org.eclipse.swt.widgets.Control control) throws DatabindingFailedException
Description copied from class:SimpleControlSWTControlSWTRenderer
Create theBindings
for this controls.- Specified by:
createBindings
in classSimpleControlSWTControlSWTRenderer
- Parameters:
control
- theControl
to create the binding for- Returns:
- all the bindings created by this renderer
- Throws:
DatabindingFailedException
- if the creation of the bindings fails.
-
createSWTControl
protected org.eclipse.swt.widgets.Control createSWTControl(org.eclipse.swt.widgets.Composite parent) throws DatabindingFailedException
Description copied from class:SimpleControlSWTControlSWTRenderer
Creates the Control.- Specified by:
createSWTControl
in classSimpleControlSWTControlSWTRenderer
- Parameters:
parent
- theComposite
to use as a parent- Returns:
- the created control
- Throws:
DatabindingFailedException
- if the creation of the control fails due to databinding problems
-
createButtons
protected void createButtons(org.eclipse.swt.widgets.Composite parent)
Called bycreateSWTControl(Composite)
in order to create the buttons.- Parameters:
parent
- the parent composite
-
getDefaultReferenceStyle
protected VTReferenceStyleProperty getDefaultReferenceStyle()
Creates and returns a default version of aVTReferenceStyleProperty
.- Returns:
- The default
VTReferenceStyleProperty
-
createAddReferenceButton
protected void createAddReferenceButton(org.eclipse.swt.widgets.Composite parent, java.lang.String elementDisplayName)
Called bycreateButtons(Composite)
to create the add existing reference button.- Parameters:
parent
- the parent compositeelementDisplayName
- the display name of the reference
-
getAddReferenceButtonImage
protected org.eclipse.swt.graphics.Image getAddReferenceButtonImage()
Returns the add reference image for button.- Returns:
- the add reference image for button
-
createNewReferenceButton
protected void createNewReferenceButton(org.eclipse.swt.widgets.Composite parent, java.lang.String elementDisplayName)
Called bycreateButtons(Composite)
to create the create new reference button.- Parameters:
parent
- the parent compositeelementDisplayName
- the display name of the reference
-
getNewReferenceButtonImage
protected org.eclipse.swt.graphics.Image getNewReferenceButtonImage()
Returns the new reference image for button.- Returns:
- the new reference image for button
-
openNewReferenceInContext
protected boolean openNewReferenceInContext()
Whether a new reference should be opened in a new context. True to open in new context, false otherwise.- Returns:
- true to open in new context, false otherwise
-
createDeleteReferenceButton
protected void createDeleteReferenceButton(org.eclipse.swt.widgets.Composite parent, java.lang.String elementDisplayName)
Called bycreateButtons(Composite)
to create the delete reference button.- Parameters:
parent
- the parent compositeelementDisplayName
- the display name of the reference
-
getDeleteReferenceButtonImage
protected org.eclipse.swt.graphics.Image getDeleteReferenceButtonImage()
Returns the image for delete reference button.- Returns:
- the image for delete reference button
-
getImage
protected org.eclipse.swt.graphics.Image getImage(org.osgi.framework.Bundle bundle, java.lang.String iconPath)
Returns an image to be displayed given the bundle and path in the bundle where icon file can be found.The image found is not meant to be disposed by user.
- Parameters:
bundle
- the bundle where the image file is locatediconPath
- the path of the icon file in the bundle- Returns:
- the image to be displayed.
-
getIconBundle
protected org.osgi.framework.Bundle getIconBundle()
Returns the bundle where the icon file is located.- Returns:
- the bundle where the icon file is located
-
getText
protected java.lang.String getText(java.lang.Object value)
Returns the link text to be used for the given linkedvalue
.- Parameters:
value
- the value- Returns:
- The link text.
- Throws:
DatabindingFailedException
NoLabelFoundException
-
getImage
protected org.eclipse.swt.graphics.Image getImage(java.lang.Object value)
Returns the image to be used for the given linkedvalue
.- Parameters:
value
- the object for which the image is retrieved- Returns:
- the image
-
linkClicked
protected void linkClicked(org.eclipse.emf.ecore.EObject value)
This code is called whenever the link of the link widget is clicked. You can overwrite this to change the behavior.- Parameters:
value
- the EObject that is linked
-
getReferenceService
protected ReferenceService getReferenceService()
- Returns:
- the
ReferenceService
-
getNumButtons
protected int getNumButtons()
- Returns:
- number of buttons added by the link control.
-
getUnsetText
protected java.lang.String getUnsetText()
Description copied from class:SimpleControlSWTRenderer
Provide the unset text to show on the label when value is unset.- Specified by:
getUnsetText
in classSimpleControlSWTRenderer
- Returns:
- the text to show on the unset label
-
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>
-
dispose
protected void dispose()
Description copied from class:SimpleControlSWTRenderer
Disposes all resources used by the renderer. Don't forget to call super.dispose if overwriting this method.- Overrides:
dispose
in classSimpleControlSWTRenderer
- See Also:
AbstractSWTRenderer.dispose()
-
scrollToReveal
public void scrollToReveal()
Description copied from class:AbstractSWTRenderer
If my control is rendered within a scrolled composite, scroll that composite to reveal me.- Overrides:
scrollToReveal
in classAbstractSWTRenderer<VControl>
-
applyReadOnly
protected void applyReadOnly()
Description copied from class:AbstractControlSWTRenderer
Marks a controls as readonly.- Overrides:
applyReadOnly
in classSimpleControlSWTRenderer
- See Also:
AbstractSWTRenderer.applyReadOnly()
-
updateButtonVisibility
protected void updateButtonVisibility()
Updates the visibility of 'add reference', 'new reference', and 'delete reference' buttons according to the bound input.
-
-