Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.spi.palette/1 1.6.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.spi.palette
Class PaletteController

    java.lang.Object
      org.netbeans.spi.palette.PaletteController

    public final class PaletteController

extends Object

PaletteController provides access to data in the palette. If an instance of this class is in the `Lookup` of any `TopComponent` then the palette window opens and displays a new content when that `TopComponent` opens/activates.
Use `PaletteFactory` to construct a new instance of this class.

There's a number of attributes that can override the default palette behavior. If the palette data are defined in the layers then the palette looks for attributes of the folders and files (`FileObject.getAttribute`). If the palette data are defined as Nodes then the attributes are extracted using `Node.getValue`.

User can override attribute values in palette's user interface. Attribute values are persisted and restored after IDE restarts.

Field Summary
`static String` | `ATTR_HELP_ID` Use this attribut for palette's root, category or item to specify its help id.
`static String` | `ATTR_ICON_SIZE` Item icon size.
`static String` | `ATTR_IS_EXPANDED` "true" if palette category is expanded, "false" if category is collapsed.
`static String` | `ATTR_IS_READONLY` "true" if the category or item cannot be removed, "false" otherwise.
`static String` | `ATTR_IS_VISIBLE` "true" if palette category or item is visible in the palette, "false" if the category or item is visible in palette customizer only.
`static String` | `ATTR_ITEM_WIDTH` The width of palette items in pixels, if this attribute is set to -1 or is missing then the item width will be calculated dynamically depending on the length of item display names and may differ for each category (therefore each category may have a different number of columns).
`static String` | `ATTR_SHOW_ITEM_NAMES` "true" to show item names in the palette panel, "false" to show item icons only.
`static DataFlavor` | `ITEM_DATA_FLAVOR` `DataFlavor` of palette items dragged from palette to editor.
`static String` | `PROP_SELECTED_ITEM` Palette clients should listen to changes of this property if they want to notified when the selected item in palette has changed.

Method Summary
`void` | `addPropertyChangeListener(PropertyChangeListener listener)`
`void` | `clearSelection()` Clear selection in palette (i.e.
`Lookup` | `getRoot()`
`Lookup` | `getSelectedCategory()`
`Lookup` | `getSelectedItem()`
`void` | `refresh()` Refresh the list of categories and items, e.g.
`void` | `removePropertyChangeListener(PropertyChangeListener listener)`
`void` | `setSelectedItem(Lookup category, Lookup item)` Select a new item in the palette window.
`void` | `showCustomizer()` Open the default Palette Manager window to allow user to customize palette's contents, especially add/import new items to palette.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ITEM_DATA_FLAVOR

    public static final DataFlavor ITEM_DATA_FLAVOR

  `DataFlavor` of palette items dragged from palette to editor. The trasfer data returned from `Transferable` for this `DataFlavor` is the `Lookup` of the `Node` representing the palette item being dragged.

### ATTR_ITEM_WIDTH

    public static final String ATTR_ITEM_WIDTH

  The width of palette items in pixels, if this attribute is set to -1 or is missing then the item width will be calculated dynamically depending on the length of item display names and may differ for each category (therefore each category may have a different number of columns). This attribute applies to palette's root only and is read-only. Default value is "-1".

  See Also:
    Constant Field Values

### ATTR_SHOW_ITEM_NAMES

    public static final String ATTR_SHOW_ITEM_NAMES

  "true" to show item names in the palette panel, "false" to show item icons only. This attribute applies to palette's root only. Default value is "true".

  See Also:
    Constant Field Values

### ATTR_ICON_SIZE

    public static final String ATTR_ICON_SIZE

  Item icon size. This attribute applies to palette's root only. Default value is java.beans.BeanInfo.ICON_COLOR_16x16

  See Also:
    `BeanInfo`, Constant Field Values

### ATTR_IS_EXPANDED

    public static final String ATTR_IS_EXPANDED

  "true" if palette category is expanded, "false" if category is collapsed. Default value is "false".

  See Also:
    Constant Field Values

### ATTR_IS_VISIBLE

    public static final String ATTR_IS_VISIBLE

  "true" if palette category or item is visible in the palette, "false" if the category or item is visible in palette customizer only. Default value is "true".

  See Also:
    Constant Field Values

### ATTR_IS_READONLY

    public static final String ATTR_IS_READONLY

  "true" if the category or item cannot be removed, "false" otherwise. Users cannot override this attribute's value. Default value is "false".

  See Also:
    Constant Field Values

### ATTR_HELP_ID

    public static final String ATTR_HELP_ID

  Use this attribut for palette's root, category or item to specify its help id. Default value is "CommonPalette".

  See Also:
    Constant Field Values

### PROP_SELECTED_ITEM

    public static final String PROP_SELECTED_ITEM

  Palette clients should listen to changes of this property if they want to notified when the selected item in palette has changed.

  See Also:
    Constant Field Values

Method Detail

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

### getSelectedItem

    public Lookup getSelectedItem()

  Returns:
    Lookup representing the item currently selected in the palette. The lookup is empty if no item is currently selected.

### setSelectedItem

    public void setSelectedItem(Lookup category,
                                Lookup item)

  Select a new item in the palette window.

  Parameters:
    `category` - Lookup of the category that contains the item to be selected.
    `item` - Item's lookup.

### getSelectedCategory

    public Lookup getSelectedCategory()

  Returns:
    Lookup representing the category of currently selected item. The lookup is empty if no item is currently selected.

### clearSelection

    public void clearSelection()

  Clear selection in palette (i.e. no item is selected)

### refresh

    public void refresh()

  Refresh the list of categories and items, e.g. when PaletteFilter conditions have changed.

### showCustomizer

    public void showCustomizer()

  Open the default Palette Manager window to allow user to customize palette's contents, especially add/import new items to palette.

### getRoot

    public Lookup getRoot()

  Returns:
    Lookup representing palette's root folder.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.spi.palette/1 1.6.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.