IPaletteItem Interface

com.bea.ide.ui.palette
IPaletteItem Interface

public interface IPaletteItem

    extends Serializable

This interface represents a item that appears on the workshop palette and may be dragged into a document view. IPaletteItems will be automatically generated for palette actions specified in extension.xml, and may be programatically generated by calling IPaletteGroup.addItem.

The primary function of an IPaletteItem is to contain a reference to the Action to be performed on drop of a palette item. It also contains a set of DataFlavors that may be examined during drag in order to indicate whether the cursor is over an acceptable drop point. By default, an IPaletteItem has a single, generic PaletteItem data flavor. Document-specific data flavors may be specified in extension.xml or by setting the "dataflavors" property on IPaletteAction.

Two useful ways that the IPaletteItem inteface may be obtained during a drag operation initiated from the palette: 1) The drag source JComponent will be an instance of IPaletteItem. This is especially useful for examining the data flavor list during drag. 2) The drag Transferable will return an IPaletteItem from the call transferable.getTransferData(IPaletteItem.PALETTE_ITEM_DATA_FLAVOR). This is done by the PaletteTransferHandler to get the IPaletteAction on drop.

An insert menu item corresponding to each palette item will be generated by default. Use the IPaletteAction "addmenu" property to control whether the palette item should appear on the menu.

Related Topics

IPaletteAction


All Superinterfaces
Serializable

Field Summary

public static final DataFlavor
PALETTE_ITEM_DATA_FLAVOR
Default DataFlavor for all IPaletteItems.
 

Method Summary

public IPaletteAction
getAction()
Action to be performed on drop.
public DataFlavor[]
getFlavors()
Returns the data type identifiers for this palette item.
public Icon
getIcon()
Icon to be displayed for this palette item
public String
getLabel()
Label to be displayed for this palette item
public String
getTooltip()
Tooltip to be displayed for this palette item

Field Detail

PALETTE_ITEM_DATA_FLAVOR

public static final DataFlavor PALETTE_ITEM_DATA_FLAVOR
Default DataFlavor for all IPaletteItems. The palette drag Transferable will return a reference to an IPaletteItem when getTransferData with this flavor is called.

 

Method Detail

getAction() Method

public IPaletteAction getAction()
Action to be performed on drop.

Returns

IPaletteAction

getFlavors() Method

public DataFlavor[] getFlavors()
Returns the data type identifiers for this palette item. These identifiers may be used by a drop target implementation to accept or reject the drag. The palette item data flavor will always appear in this list. Additional, document-specific, data flavors may be specified in extension.xml or by setting the "dataflavors" property on the IPaletteItem's IPaletteAction.

Returns

Array of DataFlavors.

getIcon() Method

public Icon getIcon()
Icon to be displayed for this palette item


getLabel() Method

public String getLabel()
Label to be displayed for this palette item


getTooltip() Method

public String getTooltip()
Tooltip to be displayed for this palette item