Class PreferenceWindow
- java.lang.Object
-
- org.eclipse.nebula.widgets.opal.preferencewindow.PreferenceWindow
-
public class PreferenceWindow extends java.lang.Object
This class is a preference window
-
-
Field Summary
Fields Modifier and Type Field Description private PWTabContainer
container
private static PreferenceWindow
instance
private org.eclipse.swt.widgets.Shell
parentShell
private boolean
returnedValue
private int
selectedTab
private org.eclipse.swt.widgets.Shell
shell
private java.util.List<PWTab>
tabs
private java.util.Map<java.lang.String,ValueAndAssociatedWidgets>
values
-
Constructor Summary
Constructors Modifier Constructor Description private
PreferenceWindow(org.eclipse.swt.widgets.Shell parent, java.util.Map<java.lang.String,java.lang.Object> values)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRowGroupLinkedTo(java.lang.String propertyKey, PWRowGroup rowGroup)
Add a row group that is linked to a given propertyPWTab
addTab(org.eclipse.swt.graphics.Image image, java.lang.String text)
Add a tab to the preference windowvoid
addWidgetLinkedTo(java.lang.String propertyKey, PWWidget widget)
Add a widget that is linked to a given propertyprivate void
buildButtons()
Builds the buttonsprivate void
buildShell()
Builds the shellstatic PreferenceWindow
create(java.util.Map<java.lang.String,java.lang.Object> values)
Create a preference window (a singleton)static PreferenceWindow
create(org.eclipse.swt.widgets.Shell parent, java.util.Map<java.lang.String,java.lang.Object> values)
Create a preference window (a singleton)void
fireEnablers()
Fire all enablersstatic PreferenceWindow
getInstance()
int
getSelectedTab()
org.eclipse.swt.widgets.Shell
getShell()
java.lang.Object
getValueFor(java.lang.String key)
java.util.Map<java.lang.String,java.lang.Object>
getValues()
boolean
open()
Open the preference windowprivate void
openShell()
Open the shellvoid
setSelectedTab(int selectedTab)
Set the selected tabvoid
setValue(java.lang.String key, java.lang.Object value)
Store a value associated to the key
-
-
-
Field Detail
-
values
private final java.util.Map<java.lang.String,ValueAndAssociatedWidgets> values
-
tabs
private final java.util.List<PWTab> tabs
-
parentShell
private final org.eclipse.swt.widgets.Shell parentShell
-
returnedValue
private boolean returnedValue
-
shell
private org.eclipse.swt.widgets.Shell shell
-
instance
private static PreferenceWindow instance
-
container
private PWTabContainer container
-
selectedTab
private int selectedTab
-
-
Method Detail
-
create
public static PreferenceWindow create(org.eclipse.swt.widgets.Shell parent, java.util.Map<java.lang.String,java.lang.Object> values)
Create a preference window (a singleton)- Parameters:
parent
- parent shell (may be null)values
- a map that contains all values that will be displayed in widgets- Returns:
-
create
public static PreferenceWindow create(java.util.Map<java.lang.String,java.lang.Object> values)
Create a preference window (a singleton)- Parameters:
values
- a map that contains all values that will be displayed in widgets- Returns:
-
getInstance
public static PreferenceWindow getInstance()
- Returns:
- an instance of the preference window
-
addTab
public PWTab addTab(org.eclipse.swt.graphics.Image image, java.lang.String text)
Add a tab to the preference window- Parameters:
image
- image associated to the tabtext
- text associated to the image- Returns:
- the
-
addWidgetLinkedTo
public void addWidgetLinkedTo(java.lang.String propertyKey, PWWidget widget)
Add a widget that is linked to a given property- Parameters:
propertyKey
- the propertywidget
- the widget
-
addRowGroupLinkedTo
public void addRowGroupLinkedTo(java.lang.String propertyKey, PWRowGroup rowGroup)
Add a row group that is linked to a given property- Parameters:
propertyKey
- the propertyrowGroup
- the widget
-
open
public boolean open()
Open the preference window- Returns:
true
if the user pressed on the Ok button,false
if the user pressed on the Cancel button
-
buildShell
private void buildShell()
Builds the shell
-
buildButtons
private void buildButtons()
Builds the buttons
-
openShell
private void openShell()
Open the shell
-
fireEnablers
public void fireEnablers()
Fire all enablers
-
getSelectedTab
public int getSelectedTab()
- Returns:
- the selected tab
-
getValueFor
public java.lang.Object getValueFor(java.lang.String key)
- Parameters:
key
-- Returns:
- the value associated to the key
-
getValues
public java.util.Map<java.lang.String,java.lang.Object> getValues()
- Returns:
- the list of all values
-
setValue
public void setValue(java.lang.String key, java.lang.Object value)
Store a value associated to the key- Parameters:
key
-value
-
-
setSelectedTab
public void setSelectedTab(int selectedTab)
Set the selected tab- Parameters:
selectedTab
-
-
getShell
public org.eclipse.swt.widgets.Shell getShell()
- Returns:
- the shell that contains the preferences window
-
-