Class CellEditDialog
- java.lang.Object
-
- org.eclipse.jface.window.Window
-
- org.eclipse.jface.dialogs.Dialog
-
- org.eclipse.nebula.widgets.nattable.edit.gui.CellEditDialog
-
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider,ICellEditDialog
- Direct Known Subclasses:
TickUpdateCellEditDialog
public class CellEditDialog extends org.eclipse.jface.dialogs.Dialog implements ICellEditDialog
Dialog that supports editing of cells in NatTable. Is used for multi cell editing and for dialog only editors.
-
-
Field Summary
Fields Modifier and Type Field Description protected ILayerCellcellThe cell that should be edited.protected DialogEditHandlercellEditHandlerTheICellEditHandlerthat should be used by the editor.protected ICellEditorcellEditorThe cell editor that should be integrated and activated in this dialog.protected IConfigRegistryconfigRegistryTheIConfigRegistrycontaining the configuration of the current NatTable instance the command should be executed for.protected Map<String,Object>editDialogSettingsMap that contains custom configurations for thisCellEditDialog.protected ObjectoriginalCanonicalValueThe value that should be propagated to the editor control.-
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
-
Fields inherited from interface org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog
DIALOG_MESSAGE, DIALOG_SHELL_ICON, DIALOG_SHELL_LOCATION, DIALOG_SHELL_RESIZABLE, DIALOG_SHELL_SIZE, DIALOG_SHELL_TITLE
-
-
Constructor Summary
Constructors Constructor Description CellEditDialog(org.eclipse.swt.widgets.Shell parentShell, Object originalCanonicalValue, ILayerCell cell, ICellEditor cellEditor, IConfigRegistry configRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcalculateValue(Object currentValue, Object processValue)In caseICellEditDialog.getEditType()returns an edit type for processing values, this method should implemented to do that transformation.protected voidcancelPressed()protected voidconfigureShell(org.eclipse.swt.widgets.Shell newShell)protected org.eclipse.swt.widgets.ControlcreateDialogArea(org.eclipse.swt.widgets.Composite parent)ObjectgetCommittedValue()EditTypeEnumgetEditType()protected org.eclipse.swt.events.KeyListenergetEscKeyListener()protected org.eclipse.swt.graphics.PointgetInitialLocation(org.eclipse.swt.graphics.Point initialSize)protected org.eclipse.swt.graphics.PointgetInitialSize()protected booleanisResizable()protected voidokPressed()voidsetDialogSettings(Map<String,Object> editDialogSettings)Allows to customize the appearance of the dialog.-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createButtonsForButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
-
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog
open
-
-
-
-
Field Detail
-
originalCanonicalValue
protected final Object originalCanonicalValue
The value that should be propagated to the editor control. Needed because for multi cell editing or editor activation by letter/digit key will result in a different value to populate for some editors than populating the value out of the cell/ data model directly.
-
cellEditor
protected final ICellEditor cellEditor
The cell editor that should be integrated and activated in this dialog.
-
cellEditHandler
protected DialogEditHandler cellEditHandler
TheICellEditHandlerthat should be used by the editor.
-
cell
protected final ILayerCell cell
The cell that should be edited. Needed because editor activation retrieves the configuration for editing directly out of the cell.
-
configRegistry
protected final IConfigRegistry configRegistry
TheIConfigRegistrycontaining the configuration of the current NatTable instance the command should be executed for. This is necessary because the edit controllers in the current architecture are not aware of the instance they are running in and therefore it is needed for activation of editors.
-
editDialogSettings
protected Map<String,Object> editDialogSettings
Map that contains custom configurations for thisCellEditDialog. We do not use theIDialogSettingsprovided by JFace, because they are used to store and load the settings in XML rather than overriding the behaviour.
-
-
Constructor Detail
-
CellEditDialog
public CellEditDialog(org.eclipse.swt.widgets.Shell parentShell, Object originalCanonicalValue, ILayerCell cell, ICellEditor cellEditor, IConfigRegistry configRegistry)- Parameters:
parentShell- the parent shell, ornullto create a top-level shelloriginalCanonicalValue- The value that should be propagated to the editor control. Needed because for multi cell editing or editor activation by letter/digit key will result in a different value to populate for some editors than populating the value out of the cell/data model directly.cell- The cell that should be edited. Needed because editor activation retrieves the configuration for editing directly out of the cell.cellEditor- TheICellEditorthat will be used as editor control within the dialog.configRegistry- TheIConfigRegistrycontaining the configuration of the current NatTable instance the command should be executed for. This is necessary because the edit controllers in the current architecture are not aware of the instance they are running in and therefore it is needed for activation of editors.
-
-
Method Detail
-
configureShell
protected void configureShell(org.eclipse.swt.widgets.Shell newShell)
- Overrides:
configureShellin classorg.eclipse.jface.window.Window
-
isResizable
protected boolean isResizable()
- Overrides:
isResizablein classorg.eclipse.jface.dialogs.Dialog
-
getInitialLocation
protected org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point initialSize)
- Overrides:
getInitialLocationin classorg.eclipse.jface.dialogs.Dialog
-
getInitialSize
protected org.eclipse.swt.graphics.Point getInitialSize()
- Overrides:
getInitialSizein classorg.eclipse.jface.dialogs.Dialog
-
okPressed
protected void okPressed()
- Overrides:
okPressedin classorg.eclipse.jface.dialogs.Dialog
-
cancelPressed
protected void cancelPressed()
- Overrides:
cancelPressedin classorg.eclipse.jface.dialogs.Dialog
-
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
- Overrides:
createDialogAreain classorg.eclipse.jface.dialogs.Dialog
-
getCommittedValue
public Object getCommittedValue()
- Specified by:
getCommittedValuein interfaceICellEditDialog- Returns:
- The canonical value that was committed to the editor control.
-
getEditType
public EditTypeEnum getEditType()
- Specified by:
getEditTypein interfaceICellEditDialog- Returns:
- The edit type that has impact on how the set value will be
updated to the data model. By default
EditTypeEnum.SETis returned, which will simply set the committed value to the data model. Every other edit type will do some calculation based on the committed value and the current value in the data model.
-
calculateValue
public Object calculateValue(Object currentValue, Object processValue)
In caseICellEditDialog.getEditType()returns an edit type for processing values, this method should implemented to do that transformation.- Specified by:
calculateValuein interfaceICellEditDialog- Parameters:
currentValue- The current value for the cell before data model updateprocessValue- The value committed to the editor that should be used for calculation on the current value.- Returns:
- This implementation will always return processValue, as there is
no processing specified in this
ICellEditDialogimplementation and therefore the value that was committed to the editor will be updated to the data model.
-
getEscKeyListener
protected org.eclipse.swt.events.KeyListener getEscKeyListener()
- Returns:
- KeyListener that intercepts the ESC key to cancel editing, close the editor and close the dialog.
-
setDialogSettings
public void setDialogSettings(Map<String,Object> editDialogSettings)
Allows to customize the appearance of the dialog. This method will be called by the framework at creation time of the dialog via theCellEditDialogFactory.The map containing the settings can be registered to the
IConfigRegistryfor the keyEditConfigAttributes.EDIT_DIALOG_SETTINGS. The keys that are valid for this map are specified below.This implementation will check if the given map contains a value for
ICellEditDialog.DIALOG_SHELL_RESIZABLE. If there is a value found for that configuration, the Shell style will be recalculated based on the specified value. The style bits are calculated the same way like in theDialogconstructor. This is performed in here because setting the Shell style bits after the creation of the Shell would have no effect.- Specified by:
setDialogSettingsin interfaceICellEditDialog- Parameters:
editDialogSettings- Map containing the settings to customize the edit dialog appearance.- See Also:
ICellEditDialog.DIALOG_SHELL_TITLE,ICellEditDialog.DIALOG_SHELL_ICON,ICellEditDialog.DIALOG_SHELL_LOCATION,ICellEditDialog.DIALOG_SHELL_SIZE,ICellEditDialog.DIALOG_SHELL_RESIZABLE,ICellEditDialog.DIALOG_MESSAGE,EditConfigAttributes.EDIT_DIALOG_SETTINGS
-
-