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.
Modifier and Type | Field and Description |
---|---|
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_PALETTE_DEFAULT_VISIBILITY
Boolean attribute to be set on palette's root node or palette's root folder
in XML layer to make the palette visible by default.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.public static final String ATTR_ITEM_WIDTH
public static final String ATTR_SHOW_ITEM_NAMES
public static final String ATTR_ICON_SIZE
BeanInfo
,
Constant Field Valuespublic static final String ATTR_IS_EXPANDED
public static final String ATTR_IS_VISIBLE
public static final String ATTR_IS_READONLY
public static final String ATTR_HELP_ID
public static final String ATTR_PALETTE_DEFAULT_VISIBILITY
public static final String PROP_SELECTED_ITEM
public void addPropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public Lookup getSelectedItem()
public void setSelectedItem(Lookup category, Lookup item)
category
- Lookup of the category that contains the item to be selected.item
- Item's lookup.public Lookup getSelectedCategory()
public void clearSelection()
public void refresh()
public void showCustomizer()
public Lookup getRoot()