Package org.eclipse.gef.ui.palette

# Interface PaletteViewerPreferences

All Known Implementing Classes:
  `DefaultPaletteViewerPreferences`

public interface PaletteViewerPreferences
`PaletteViewerPreferences` is used to store/persist the various settings of a GEF palette.

IMPORTANT: This interface is not intended to be implemented by clients. Clients should inherit from `DefaultPaletteViewerPreferences`. New methods may be added in the future.

@noimplement
  This interface is not intended to be implemented by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`COLLAPSE_ALWAYS`
This is a constant for one of the auto-collapse options.
`static final int`
`COLLAPSE_AS_NEEDED`
This is a constant for one of the auto-collapse options.
`static final int`
`COLLAPSE_NEVER`
This is a constant for one of the auto-collapse options.
`static final int`
`LAYOUT_COLUMNS`
This is a constant for one of the layout options.
`static final int`
`LAYOUT_DETAILS`
This is a constant for one of the layout options.
`static final int`
`LAYOUT_FOLDER`
Deprecated.
Use LAYOUT_COLUMNS instead.
`static final int`
`LAYOUT_ICONS`
This is a constant for one of the layout options.
`static final int`
`LAYOUT_LIST`
This is a constant for one of the layout options.
`static final String`
`PREFERENCE_AUTO_COLLAPSE`
Property name for the auto-collapse setting.
`static final String`
`PREFERENCE_COLUMNS_ICON_SIZE`
Property name for the large icon setting for columns layout.
`static final String`
`PREFERENCE_DETAILS_ICON_SIZE`
Property name for the large icon setting for details layout.
`static final String`
`PREFERENCE_FOLDER_ICON_SIZE`
Deprecated.
Use PREFERENCE_COLUMNS_ICON_SIZE instead.
`static final String`
`PREFERENCE_FONT`
Property name for the palette font setting.
`static final String`
`PREFERENCE_ICONS_ICON_SIZE`
Property name for the large icon setting for icons only layout.
`static final String`
`PREFERENCE_LAYOUT`
Property name for the layout setting.
`static final String`
`PREFERENCE_LIST_ICON_SIZE`
Property name for the large icon setting for list layout.
`static final String`
`PREFERENCE_SCROLLBARS_MODE`
Linux Only Property name for enabling or disabling the scrollbars overlay.

## Method Summary

Modifier and Type
Method
Description
`void`
`addPropertyChangeListener(PropertyChangeListener listener)`
`int`
`getAutoCollapseSetting()`
Returns the current auto-collapse setting.
`FontData`
`getFontData()`
`int`
`getLayoutSetting()`
Returns the current layout setting.
`int`
`getScrollbarsMode()`
Returns whether overlay scrolling is enabled for the palette viewer .
`int[]`
`getSupportedLayoutModes()`
Returns the layout modes that are supported.
`boolean`
`isSupportedLayoutMode(int layout)`
This is a convenience method.
`void`
`removePropertyChangeListener(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`
`setScrollbarsMode(int mode)`
Enables or disables overlay scrolling for the palette viewer.
`void`
`setSupportedLayoutModes(int[] modes)`
The client can restrict the modes that the palette supports using this method.
`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.

## Field Details

### COLLAPSE_ALWAYS

static final int COLLAPSE_ALWAYS
This is a constant for one of the auto-collapse options.
Indicates that containers should always auto-collapse.

See Also:
  - Constant Field Values

### COLLAPSE_NEVER

static final int COLLAPSE_NEVER
This is a constant for one of the auto-collapse options.
Indicates that containers should never auto-collapse.

See Also:
  - Constant Field Values

### COLLAPSE_AS_NEEDED

static final int COLLAPSE_AS_NEEDED
This is a constant for one of the auto-collapse options.
Indicates that containers should auto-collapse only when there is not enough room on the palette. This is the default auto-collapse setting.

See Also:
  - Constant Field Values

### LAYOUT_COLUMNS

static final int LAYOUT_COLUMNS
This is a constant for one of the layout options.
Indicates that the palette should be displayed in the columns mode.

See Also:
  - Constant Field Values

### LAYOUT_FOLDER

@Deprecated static final int LAYOUT_FOLDER
Deprecated.
Use LAYOUT_COLUMNS instead.

See Also:
  - Constant Field Values

### LAYOUT_LIST

static final int LAYOUT_LIST
This is a constant for one of the layout options.
Indicates that the palette should be displayed in the list mode. This is the default layout setting.

See Also:
  - Constant Field Values

### LAYOUT_ICONS

static final int LAYOUT_ICONS
This is a constant for one of the layout options.
Indicates that the palette should be displayed in the icons only mode.

See Also:
  - Constant Field Values

### LAYOUT_DETAILS

static final int LAYOUT_DETAILS
This is a constant for one of the layout options.
Indicates that the palette should be displayed in the details mode.

See Also:
  - Constant Field Values

### PREFERENCE_LAYOUT

static final String PREFERENCE_LAYOUT
Property name for the layout setting. If the PropertyChangeEvent fired has this property name, it means that the layout setting was changed.

See Also:
  - Constant Field Values

### PREFERENCE_AUTO_COLLAPSE

static final String PREFERENCE_AUTO_COLLAPSE
Property name for the auto-collapse setting. If the PropertyChangeEvent fired has this property name, it means that the auto-collapse setting was changed.

See Also:
  - Constant Field Values

### PREFERENCE_COLUMNS_ICON_SIZE

static final String PREFERENCE_COLUMNS_ICON_SIZE
Property name for the large icon setting for columns layout. If the PropertyChangeEvent fired has this property name, it means that the large icon setting was changed for columns layout. Large icons are default.

See Also:
  - Constant Field Values

### PREFERENCE_FOLDER_ICON_SIZE

@Deprecated static final String PREFERENCE_FOLDER_ICON_SIZE
Deprecated.
Use PREFERENCE_COLUMNS_ICON_SIZE instead.

See Also:
  - Constant Field Values

### PREFERENCE_LIST_ICON_SIZE

static final String PREFERENCE_LIST_ICON_SIZE
Property name for the large icon setting for list layout. If the PropertyChangeEvent fired has this property name, it means that the large icon setting was changed for list layout. Small icons are default.

See Also:
  - Constant Field Values

### PREFERENCE_ICONS_ICON_SIZE

static final String PREFERENCE_ICONS_ICON_SIZE
Property name for the large icon setting for icons only layout. If the PropertyChangeEvent fired has this property name, it means that the large icon setting was changed for icons only layout. Large icons are default.

See Also:
  - Constant Field Values

### PREFERENCE_DETAILS_ICON_SIZE

static final String PREFERENCE_DETAILS_ICON_SIZE
Property name for the large icon setting for details layout. If the PropertyChangeEvent fired has this property name, it means that the large icon setting was changed for details layout. Small icons are default.

See Also:
  - Constant Field Values

### PREFERENCE_FONT

static final String PREFERENCE_FONT
Property name for the palette font setting. If the PropertyChangeEvent fired has this property name, it means that the palette font was changed.

See Also:
  - Constant Field Values

### PREFERENCE_SCROLLBARS_MODE

static final String PREFERENCE_SCROLLBARS_MODE
Linux Only Property name for enabling or disabling the scrollbars overlay.

Since:
  3.20
See Also:
  - Constant Field Values

## Method Details

### addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)

Parameters:
  `listener` - the PropertyChangeListener to be notified of changes
See Also:
  - `PropertyChangeSupport.addPropertyChangeListener(java.beans.PropertyChangeListener)`

### getAutoCollapseSetting

int getAutoCollapseSetting()
Returns the current auto-collapse setting.

Possible values returned:

- COLLAPSE_ALWAYS (Always collapse)
- COLLAPSE_AS_NEEDED (Collapse when needed)
- COLLAPSE_NEVER (Never collapse)

Returns:
  One of the above-mentioned constants

### getFontData

FontData getFontData()

Returns:
  The FontData for the font to be used in the palette.

### getLayoutSetting

int getLayoutSetting()
Returns the current layout setting.

Possible values returned:

- LAYOUT_COLUMNS (columns View)
- LAYOUT_LIST (List View)
- LAYOUT_ICONS (Icons Only View)
- LAYOUT_DETAILS (Details View)

Returns:
  One of the above-mentioned constants

### getSupportedLayoutModes

int[] getSupportedLayoutModes()
Returns the layout modes that are supported. All four layout modes -- LAYOUT_COLUMNS, LAYOUT_LIST, LAYOUT_ICONS, LAYOUT_DETAILS -- are supported by default.

Returns:
  The layout modes that are supported
See Also:
  - `setSupportedLayoutModes(int[])`

### isSupportedLayoutMode

boolean isSupportedLayoutMode(int layout)
This is a convenience method. Instead of getting the supported layout modes and checking to see if a certain layout is supported, you can call this method.

Parameters:
  `layout` - LAYOUT_COLUMNS, LAYOUT_LIST, LAYOUT_ICONS, or LAYOUT_DETAILS
Returns:
  `true` if the given layout is a supported mode

### removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)

Parameters:
  `listener` - the PropertyChangeListener that should not be notified hereafter
See Also:
  - `PropertyChangeSupport.removePropertyChangeListener(java.beans.PropertyChangeListener)`

### setAutoCollapseSetting

void setAutoCollapseSetting(int newVal)
Sets the auto-collapse setting.

Possible values:

- COLLAPSE_ALWAYS (Always collapse)
- COLLAPSE_AS_NEEDED (Collapse when needed)
- COLLAPSE_NEVER (Never collapse)

Parameters:
  `newVal` - One of the above-mentioned constants

### setFontData

void setFontData(FontData data)
Sets the FontData for the palette.

Parameters:
  `data` - The FontData for the font to be used in the palette

### setLayoutSetting

void setLayoutSetting(int newVal)
Sets the given setting as the current layout.

Possible values:

- LAYOUT_COLUMNS (Columns View)
- LAYOUT_LIST (List View)
- LAYOUT_ICONS (Icons Only View)
- LAYOUT_DETAILS (Details View)

Parameters:
  `newVal` - One of the above-mentioned constants

### setCurrentUseLargeIcons

void setCurrentUseLargeIcons(boolean newVal)
Sets the "Use Large Icons" option for the currently active layout.

Parameters:
  `newVal` - `true` if large icons are to be used with the current layout setting

### setSupportedLayoutModes

void setSupportedLayoutModes(int[] modes)
The client can restrict the modes that the palette supports using this method. By default, the palette will support all layout modes: LAYOUT_ICONS, LAYOUT_DETAILS, LAYOUT_COLUMNS, LAYOUT_LIST. Should the client wish to not support all these modes, they can call this method with an array of the desired modes. This method should be called during set-up as soon as the preferences are created, and not later.

If the default layout mode and/or the current layout mode are not in the given array, the first layout mode in the given array will be set to be the default/current layout.

NOTE: The given array of layout modes should have at least one, and is recommended to have at least two, of the recognized layout modes.

Parameters:
  `modes` - an array of layout modes desired

### setUseLargeIcons

void setUseLargeIcons(int layout, boolean newVal)
Sets the "Use Large Icons" option for the given layout.
The defaults are as follows:

- LAYOUT_COLUMNS - `true`
- LAYOUT_LIST - `false`
- LAYOUT_ICONS - `true`
- LAYOUT_DETAILS - `false`

Parameters:
  `layout` - any of the above-mentioned constants
  `newVal` - `true` if large icons are to be used with the given layout

### useLargeIcons

boolean useLargeIcons(int layout)
Indicated whether large icons should be used with the given layout mode.
The defaults are as follows:

- LAYOUT_COLUMNS - `true`
- LAYOUT_LIST - `false`
- LAYOUT_ICONS - `true`
- LAYOUT_DETAILS - `false`

Parameters:
  `layout` - any of the above-mentioned constants
Returns:
  `true` if large icons are to be used with the given layout

### useLargeIcons

boolean useLargeIcons()

Returns:
  `true` if large icons are to be used with the currently active layout

### setScrollbarsMode

void setScrollbarsMode(int mode)
Enables or disables overlay scrolling for the palette viewer. Supported values are:

- `SWT.NONE`
- `SWT.SCROLLBAR_OVERLAY`

Overlay scrollbars are only supported on `Linux`.

Since:
  3.20

### getScrollbarsMode

int getScrollbarsMode()
Returns whether overlay scrolling is enabled for the palette viewer . Overlay scrollbars are only supported on `Linux`.

Returns:
  One of `SWT.SCROLLBAR_OVERLAY` or `SWT.NONE`.
Since:
  3.20