public class DefaultPaletteViewerPreferences extends java.lang.Object implements PaletteViewerPreferences
It is recommended that the default constructor be used (which will use the
preference store in the GEF plugin) as that will cause the preferences to be
shared across different types of editors. If the client does not wish to
share one of the existing preferences for their editor (say the auto-collapse
setting), they will have to sub-class this class and override the necessary
methods (in this case, getAutoCollapseSetting() and
setAutoCollapseSetting(int)) and save that preference in some other
preference store. Sub-classes can add newer preferences to the store by using
getPreferenceStore().
COLLAPSE_ALWAYS, COLLAPSE_AS_NEEDED, COLLAPSE_NEVER, LAYOUT_COLUMNS, LAYOUT_DETAILS, LAYOUT_FOLDER, LAYOUT_ICONS, LAYOUT_LIST, PREFERENCE_AUTO_COLLAPSE, PREFERENCE_COLUMNS_ICON_SIZE, PREFERENCE_DETAILS_ICON_SIZE, PREFERENCE_FOLDER_ICON_SIZE, PREFERENCE_FONT, PREFERENCE_ICONS_ICON_SIZE, PREFERENCE_LAYOUT, PREFERENCE_LIST_ICON_SIZE| Constructor and Description |
|---|
DefaultPaletteViewerPreferences()
Default Constructor
Uses the GEF Plugin's IPreferenceStore to store the preferences.
|
DefaultPaletteViewerPreferences(IPreferenceStore store)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
NOTE: The
oldValue field of the
PropertyChangeEvent used to notify listeners will always be
null. |
static java.lang.String |
convertLayoutToPreferenceName(int layout)
This is a convenience method that converts the given layout mode to the
matching preference name.
|
static int |
convertPreferenceNameToLayout(java.lang.String preference)
This convenience method converts the given preference to the matching
layout mode.
|
protected void |
firePropertyChanged(java.lang.String property,
java.lang.Object newVal)
The oldValue of the PropertyChangeEvent that is fired will always be
null. |
int |
getAutoCollapseSetting()
Returns the current auto-collapse setting.
|
FontData |
getFontData() |
int |
getLayoutSetting()
Returns the current layout setting.
|
protected IPreferenceStore |
getPreferenceStore() |
int[] |
getSupportedLayoutModes()
Returns the layout modes that are supported.
|
protected void |
handlePreferenceStorePropertyChanged(java.lang.String property)
This method is invoked when the preference store fires a property change.
|
boolean |
isSupportedLayoutMode(int layout)
This is a convenience method.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
setAutoCollapseSetting(int newVal)
Sets the auto-collapse setting.
|
void |
setCurrentUseLargeIcons(boolean newVal)
Sets the "Use Large Icons" option for the currently active layout.
|
void |
setFontData(FontData data)
Sets the FontData for the palette.
|
void |
setLayoutSetting(int newVal)
Sets the given setting as the current layout.
|
void |
setSupportedLayoutModes(int[] modes)
NOTE: Restricting the layout modes here does not in any way restrict
those values from being stored in the preference store.
|
void |
setUseLargeIcons(int layout,
boolean newVal)
Sets the "Use Large Icons" option for the given layout.
|
boolean |
useLargeIcons() |
boolean |
useLargeIcons(int layout)
Indicated whether large icons should be used with the given layout mode.
|
public DefaultPaletteViewerPreferences()
Uses the GEF Plugin's IPreferenceStore to store the preferences.
public DefaultPaletteViewerPreferences(IPreferenceStore store)
store - The IPreferenceStore where the settings are to be saved.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
oldValue field of the
PropertyChangeEvent used to notify listeners will always be
null.addPropertyChangeListener in interface PaletteViewerPreferenceslistener - the PropertyChangeListener to be notified of changesPaletteViewerPreferences.addPropertyChangeListener(PropertyChangeListener)public static java.lang.String convertLayoutToPreferenceName(int layout)
layout - LAYOUT_LIST, LAYOUT_DETAILS, LAYOUT_COLUMNS, or LAYOUT_ICONSpublic static int convertPreferenceNameToLayout(java.lang.String preference)
preference - PREFERENCE_DETAILS_ICON_SIZE, PREFERENCE_COLUMNS_ICON_SIZE,
PREFERENCE_ICONS_ICON_SIZE or PREFERENCE_LIST_ICON_SIZEprotected void firePropertyChanged(java.lang.String property,
java.lang.Object newVal)
null.property - The programmatic name of the property that was changednewVal - The new value of the propertyPropertyChangeSupport.firePropertyChange(java.lang.String,
java.lang.Object, java.lang.Object)public int getAutoCollapseSetting()
PaletteViewerPreferencesPossible values returned:
getAutoCollapseSetting in interface PaletteViewerPreferencesPaletteViewerPreferences.getAutoCollapseSetting()public FontData getFontData()
getFontData in interface PaletteViewerPreferencesPaletteViewerPreferences.getFontData()public int getLayoutSetting()
PaletteViewerPreferencesPossible values returned:
getLayoutSetting in interface PaletteViewerPreferencesPaletteViewerPreferences.getLayoutSetting()public int[] getSupportedLayoutModes()
PaletteViewerPreferencesgetSupportedLayoutModes in interface PaletteViewerPreferencesPaletteViewerPreferences.getSupportedLayoutModes()protected void handlePreferenceStorePropertyChanged(java.lang.String property)
property - The property String used for the change fired by the
preference storeprotected IPreferenceStore getPreferenceStore()
public boolean isSupportedLayoutMode(int layout)
PaletteViewerPreferencesisSupportedLayoutMode in interface PaletteViewerPreferenceslayout - LAYOUT_COLUMNS, LAYOUT_LIST, LAYOUT_ICONS, or LAYOUT_DETAILStrue if the given layout is a supported modePaletteViewerPreferences.isSupportedLayoutMode(int)public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface PaletteViewerPreferenceslistener - the PropertyChangeListener that should not be notified
hereafterPaletteViewerPreferences.removePropertyChangeListener(PropertyChangeListener)public void setAutoCollapseSetting(int newVal)
PaletteViewerPreferencesPossible values:
setAutoCollapseSetting in interface PaletteViewerPreferencesnewVal - One of the above-mentioned constantsPaletteViewerPreferences.setAutoCollapseSetting(int)public void setFontData(FontData data)
PaletteViewerPreferencessetFontData in interface PaletteViewerPreferencesdata - The FontData for the font to be used in the palettePaletteViewerPreferences.setFontData(FontData)public void setLayoutSetting(int newVal)
PaletteViewerPreferencesPossible values:
setLayoutSetting in interface PaletteViewerPreferencesnewVal - One of the above-mentioned constantsPaletteViewerPreferences.setLayoutSetting(int)public void setCurrentUseLargeIcons(boolean newVal)
PaletteViewerPreferencessetCurrentUseLargeIcons in interface PaletteViewerPreferencesnewVal - true if large icons are to be used with the
current layout settingPaletteViewerPreferences.setCurrentUseLargeIcons(boolean)public void setSupportedLayoutModes(int[] modes)
setSupportedLayoutModes in interface PaletteViewerPreferencesmodes - an array of layout modes desiredPaletteViewerPreferences.setSupportedLayoutModes(int[])public void setUseLargeIcons(int layout,
boolean newVal)
PaletteViewerPreferencestruefalsetruefalsesetUseLargeIcons in interface PaletteViewerPreferenceslayout - any of the above-mentioned constantsnewVal - true if large icons are to be used with the given
layoutPaletteViewerPreferences.setUseLargeIcons(int,
boolean)public boolean useLargeIcons(int layout)
PaletteViewerPreferencestruefalsetruefalseuseLargeIcons in interface PaletteViewerPreferenceslayout - any of the above-mentioned constantstrue if large icons are to be used with the given
layoutPaletteViewerPreferences.useLargeIcons(int)public boolean useLargeIcons()
useLargeIcons in interface PaletteViewerPreferencestrue if large icons are to be used with the
currently active layoutPaletteViewerPreferences.useLargeIcons()Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.