Class PersistenceDialog
- java.lang.Object
-
- org.eclipse.jface.window.Window
-
- org.eclipse.jface.dialogs.Dialog
-
- org.eclipse.nebula.widgets.nattable.persistence.gui.PersistenceDialog
-
- All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
public class PersistenceDialog extends org.eclipse.jface.dialogs.Dialog
Dialog that allows to save and load NatTable state. It will operate on the the specified NatTable and Properties instances. If the Properties need to be persisted e.g. in the file system, the developer has to take care of that himself.It is possible to listen for state change events on the view configurations. Rather than adding listeners to this dialog yourself, you should register the listeners to the
DisplayColumnChooserCommandHandler
, as it will handle propagating the listeners to newly created instances of this dialog.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTIVE_VIEW_CONFIGURATION_KEY
Key under which the name of the active view configuration is stored within the properties.static int
DELETE_ID
Constant ID for the delete button of this dialog.static int
LOAD_ID
Constant ID for the load button of this dialog.static int
SAVE_ID
Constant ID for the save button of this dialog.-
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
-
-
Constructor Summary
Constructors Constructor Description PersistenceDialog(org.eclipse.swt.widgets.Shell parentShell, NatTable natTable, Properties properties)
Create a new dialog for handling NatTable state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllStateChangeListener(List<IStateChangedListener> listeners)
Adds the givenIStateChangedListener
s to the local list of listeners.void
addStateChangeListener(IStateChangedListener listener)
Add the givenIStateChangedListener
to the local list of listeners.protected void
buttonPressed(int buttonId)
protected void
configureShell(org.eclipse.swt.widgets.Shell newShell)
protected void
createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
protected org.eclipse.swt.widgets.Control
createDialogArea(org.eclipse.swt.widgets.Composite parent)
void
fireStateChange(StateChangeEvent event)
Inform all registered listeners about the state change.String
getActiveViewConfigurationName()
protected org.eclipse.swt.graphics.Point
getInitialSize()
Properties
getProperties()
void
removeAllStateChangeListener(List<IStateChangedListener> listeners)
Removes the givenIStateChangedListener
s from the local list of listeners.void
removeStateChangeListener(IStateChangedListener listener)
Removes the givenIStateChangedListener
from the local list of listeners.void
setActiveViewConfigurationName(String name)
Sets the name of the current active view configuration.void
setProperties(Properties properties)
-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, 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
-
-
-
-
Field Detail
-
ACTIVE_VIEW_CONFIGURATION_KEY
public static final String ACTIVE_VIEW_CONFIGURATION_KEY
Key under which the name of the active view configuration is stored within the properties. Used to indicate which view configuration is currently active and to be able to restore a view based on the last active one, when persisting the states to a file or database.- See Also:
- Constant Field Values
-
SAVE_ID
public static final int SAVE_ID
Constant ID for the save button of this dialog.- See Also:
- Constant Field Values
-
LOAD_ID
public static final int LOAD_ID
Constant ID for the load button of this dialog.- See Also:
- Constant Field Values
-
DELETE_ID
public static final int DELETE_ID
Constant ID for the delete button of this dialog.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PersistenceDialog
public PersistenceDialog(org.eclipse.swt.widgets.Shell parentShell, NatTable natTable, Properties properties)
Create a new dialog for handling NatTable state.- Parameters:
parentShell
- the parent shell, ornull
to create a top-level shellnatTable
- The NatTable instance to apply the save/load operations.properties
- The Properties instance that should be used for saving and loading.
-
-
Method Detail
-
createDialogArea
protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
- Overrides:
createDialogArea
in classorg.eclipse.jface.dialogs.Dialog
-
createButtonsForButtonBar
protected void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite parent)
- Overrides:
createButtonsForButtonBar
in classorg.eclipse.jface.dialogs.Dialog
-
buttonPressed
protected void buttonPressed(int buttonId)
- Overrides:
buttonPressed
in classorg.eclipse.jface.dialogs.Dialog
-
configureShell
protected void configureShell(org.eclipse.swt.widgets.Shell newShell)
- Overrides:
configureShell
in classorg.eclipse.jface.window.Window
-
getInitialSize
protected org.eclipse.swt.graphics.Point getInitialSize()
- Overrides:
getInitialSize
in classorg.eclipse.jface.dialogs.Dialog
-
getProperties
public Properties getProperties()
- Returns:
- The Properties instance that is used for saving and loading.
-
setProperties
public void setProperties(Properties properties)
- Parameters:
properties
- The Properties instance that should be used for saving and loading.
-
getActiveViewConfigurationName
public String getActiveViewConfigurationName()
- Returns:
- The name of the current active view configuration
-
setActiveViewConfigurationName
public void setActiveViewConfigurationName(String name)
Sets the name of the current active view configuration. Note that this method does not set the active view configuration programmatically. It is just used to support highlighting the current active view configuration in the viewer of this dialog.- Parameters:
name
- The name of the current active view configuration
-
addStateChangeListener
public void addStateChangeListener(IStateChangedListener listener)
Add the givenIStateChangedListener
to the local list of listeners.- Parameters:
listener
- The listener to add.
-
addAllStateChangeListener
public void addAllStateChangeListener(List<IStateChangedListener> listeners)
Adds the givenIStateChangedListener
s to the local list of listeners.- Parameters:
listeners
- The listeners to add.
-
removeStateChangeListener
public void removeStateChangeListener(IStateChangedListener listener)
Removes the givenIStateChangedListener
from the local list of listeners.- Parameters:
listener
- The listener to remove.
-
removeAllStateChangeListener
public void removeAllStateChangeListener(List<IStateChangedListener> listeners)
Removes the givenIStateChangedListener
s from the local list of listeners.- Parameters:
listeners
- The listeners to remove.
-
fireStateChange
public void fireStateChange(StateChangeEvent event)
Inform all registered listeners about the state change.- Parameters:
event
- TheStateChangeEvent
object.
-
-