org.eclipse.gef.palette

## Class PaletteEntry

- java.lang.Object
- - org.eclipse.gef.palette.PaletteEntry

Direct Known Subclasses:
  PaletteContainer, PaletteSeparator, PaletteTemplateEntry, ToolEntry

    public class PaletteEntry
    extends java.lang.Object

Root class (statically) for the palette model.

### Field Summary

Fields
`protected java.beans.PropertyChangeSupport` `listeners` PropertyChangeSupport
`static java.lang.String` `PALETTE_TYPE_UNKNOWN` Type unknown
`static int` `PERMISSION_FULL_MODIFICATION` All modifications allowed.
`static int` `PERMISSION_HIDE_ONLY` Entries with this permission level can only be hidden/shown.
`static int` `PERMISSION_LIMITED_MODIFICATION` Any property of entries with this level of permission can be changed; however, they cannot be deleted from the palette.
`static int` `PERMISSION_NO_MODIFICATION` No changes can be made to a PaletteEntry with this permission level.
`static java.lang.String` `PROPERTY_DEFAULT` Property name for the entry's default staus
`static java.lang.String` `PROPERTY_DESCRIPTION` Property name for the entry's description
`static java.lang.String` `PROPERTY_LABEL` Property name for the entry's label (name)
`static java.lang.String` `PROPERTY_LARGE_ICON` Property name for the entry's large icon
`static java.lang.String` `PROPERTY_PARENT` Property name for the entry's parent
`static java.lang.String` `PROPERTY_SMALL_ICON` Property name for the entry's small icon
`static java.lang.String` `PROPERTY_TYPE` Property name for the entry's type
`static java.lang.String` `PROPERTY_VISIBLE` Property name for the entry's hidden status

### Constructor Summary

Constructors
Constructor and Description
`PaletteEntry(java.lang.String label, java.lang.String shortDescription)` Constructor Any parameter can be `null`
`PaletteEntry(java.lang.String label, java.lang.String shortDescription, ImageDescriptor iconSmall, ImageDescriptor iconLarge)` Constructor Any parameter can be `null`
`PaletteEntry(java.lang.String label, java.lang.String shortDescription, ImageDescriptor iconSmall, ImageDescriptor iconLarge, java.lang.Object type)` Constructor Any parameter can be `null`
`PaletteEntry(java.lang.String label, java.lang.String shortDescription, ImageDescriptor smallIcon, ImageDescriptor largeIcon, java.lang.Object type, java.lang.String id)` Constructor Any parameter can be `null`
`PaletteEntry(java.lang.String label, java.lang.String shortDescription, java.lang.Object type)` Constructor Any parameter can be `null`

### Method Summary

Methods
`void` `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` A listener can only be added once.
`java.lang.String` `getDescription()`
`java.lang.String` `getId()` Returns the id.
`java.lang.String` `getLabel()`
`ImageDescriptor` `getLargeIcon()`
`PaletteContainer` `getParent()`
`ImageDescriptor` `getSmallIcon()`
`java.lang.Object` `getType()`
`int` `getUserModificationPermission()` Returned values are from amongst the following: PERMISSION_NO_MODIFICATION PERMISSION_HIDE_ONLY PERMISSION_LIMITED_MODIFICATION PERMISSION_FULL_MODIFICATION
`boolean` `isVisible()`
`void` `removePropertyChangeListener(java.beans.PropertyChangeListener listener)`
`void` `setDescription(java.lang.String s)` Mutator method for description
`void` `setId(java.lang.String id)` Sets the id.
`void` `setLabel(java.lang.String s)` Mutator method for label
`void` `setLargeIcon(ImageDescriptor icon)` Mutator method for large icon
`void` `setParent(PaletteContainer newParent)` Sets the parent of this entry
`void` `setSmallIcon(ImageDescriptor icon)` Mutator method for small icon
`void` `setType(java.lang.Object newType)` Mutator method for type
`void` `setUserModificationPermission(int permission)` Permissions are not checked before making modifications.
`void` `setVisible(boolean newVal)` Makes this entry visible or invisible.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### PROPERTY_SMALL_ICON

    public static final java.lang.String PROPERTY_SMALL_ICON

Property name for the entry's small icon

See Also:
  Constant Field Values

#### PROPERTY_TYPE

    public static final java.lang.String PROPERTY_TYPE

Property name for the entry's type

See Also:
  Constant Field Values

#### PROPERTY_LARGE_ICON

    public static final java.lang.String PROPERTY_LARGE_ICON

Property name for the entry's large icon

See Also:
  Constant Field Values

#### PROPERTY_LABEL

    public static final java.lang.String PROPERTY_LABEL

Property name for the entry's label (name)

See Also:
  Constant Field Values

#### PROPERTY_DESCRIPTION

    public static final java.lang.String PROPERTY_DESCRIPTION

Property name for the entry's description

See Also:
  Constant Field Values

#### PROPERTY_VISIBLE

    public static final java.lang.String PROPERTY_VISIBLE

Property name for the entry's hidden status

See Also:
  Constant Field Values

#### PROPERTY_DEFAULT

    public static final java.lang.String PROPERTY_DEFAULT

Property name for the entry's default staus

See Also:
  Constant Field Values

#### PROPERTY_PARENT

    public static final java.lang.String PROPERTY_PARENT

Property name for the entry's parent

See Also:
  Constant Field Values

#### PALETTE_TYPE_UNKNOWN

    public static final java.lang.String PALETTE_TYPE_UNKNOWN

Type unknown

See Also:
  Constant Field Values

#### PERMISSION_NO_MODIFICATION

    public static final int PERMISSION_NO_MODIFICATION

No changes can be made to a PaletteEntry with this permission level.

See Also:
  Constant Field Values

#### PERMISSION_HIDE_ONLY

    public static final int PERMISSION_HIDE_ONLY

Entries with this permission level can only be hidden/shown.

See Also:
  Constant Field Values

#### PERMISSION_LIMITED_MODIFICATION

    public static final int PERMISSION_LIMITED_MODIFICATION

Any property of entries with this level of permission can be changed; however, they cannot be deleted from the palette. The children PaletteContainers with this permission level can be reordered within that container (however, cross-container moving is not allowed).

See Also:
  Constant Field Values

#### PERMISSION_FULL_MODIFICATION

    public static final int PERMISSION_FULL_MODIFICATION

All modifications allowed.

See Also:
  Constant Field Values

#### listeners

    protected java.beans.PropertyChangeSupport listeners

PropertyChangeSupport

### Constructor Detail

#### PaletteEntry

    public PaletteEntry(java.lang.String label,
                java.lang.String shortDescription)

Constructor

Any parameter can be `null`

Parameters:
  `label` - The entry's name
  `shortDescription` - The entry's description

#### PaletteEntry

    public PaletteEntry(java.lang.String label,
                java.lang.String shortDescription,
                java.lang.Object type)

Constructor

Any parameter can be `null`

Parameters:
  `label` - The entry's name
  `shortDescription` - The entry's description
  `type` - The entry's type

#### PaletteEntry

    public PaletteEntry(java.lang.String label,
                java.lang.String shortDescription,
                ImageDescriptor iconSmall,
                ImageDescriptor iconLarge)

Constructor

Any parameter can be `null`

Parameters:
  `label` - The entry's name
  `shortDescription` - The entry's description
  `iconSmall` - The small icon to represent this entry
  `iconLarge` - The large icon to represent this entry

#### PaletteEntry

    public PaletteEntry(java.lang.String label,
                java.lang.String shortDescription,
                ImageDescriptor iconSmall,
                ImageDescriptor iconLarge,
                java.lang.Object type)

Constructor

Any parameter can be `null`

Parameters:
  `label` - The entry's name
  `shortDescription` - The entry's description
  `iconSmall` - The small icon to represent this entry
  `iconLarge` - The large icon to represent this entry
  `type` - The entry's type

#### PaletteEntry

    public PaletteEntry(java.lang.String label,
                java.lang.String shortDescription,
                ImageDescriptor smallIcon,
                ImageDescriptor largeIcon,
                java.lang.Object type,
                java.lang.String id)

Constructor

Any parameter can be `null`

Parameters:
  `label` - The entry's name
  `shortDescription` - The entry's description
  `smallIcon` - The small icon to represent this entry
  `largeIcon` - The large icon to represent this entry
  `type` - The entry's type
  `id` - The entry's id (preferrably unique)

### Method Detail

#### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

A listener can only be added once. Adding it more than once will do nothing.

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

#### getDescription

    public java.lang.String getDescription()

Returns:
  a short desecription describing this entry.

#### getId

    public java.lang.String getId()

Returns the id. If no ID has been set (or it is `null`), an empty String will be returned.

Returns:
  String id

#### getLabel

    public java.lang.String getLabel()

Returns:
  the label for this entry.

#### getLargeIcon

    public ImageDescriptor getLargeIcon()

Returns:
  a large icon representing this entry.

#### getParent

    public PaletteContainer getParent()

Returns:
  the parent container of this entry

#### getSmallIcon

    public ImageDescriptor getSmallIcon()

Returns:
  a small icon representing the entry.

#### getType

    public java.lang.Object getType()

Returns:
  the type of this entry. Useful for different interpretations of the palette model.

#### getUserModificationPermission

    public int getUserModificationPermission()

Returned values are from amongst the following:

- PERMISSION_NO_MODIFICATION
- PERMISSION_HIDE_ONLY
- PERMISSION_LIMITED_MODIFICATION
- PERMISSION_FULL_MODIFICATION

Returns:
  the permission level for this entry.
See Also:
  `setUserModificationPermission(int)`

#### isVisible

    public boolean isVisible()

Returns:
  whether or not this entry is visible. An entry that is not visible is not shown on the palette.

#### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

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

#### setDescription

    public void setDescription(java.lang.String s)

Mutator method for description

Parameters:
  `s` - The new description

#### setId

    public void setId(java.lang.String id)

Sets the id. Can be `null`.

Parameters:
  `id` - The new id to be set

#### setLabel

    public void setLabel(java.lang.String s)

Mutator method for label

Parameters:
  `s` - The new name

#### setLargeIcon

    public void setLargeIcon(ImageDescriptor icon)

Mutator method for large icon

Parameters:
  `icon` - The large icon to represent this entry

#### setParent

    public void setParent(PaletteContainer newParent)

Sets the parent of this entry

Parameters:
  `newParent` - The parent PaletteContainer

#### setSmallIcon

    public void setSmallIcon(ImageDescriptor icon)

Mutator method for small icon

Parameters:
  `icon` - The new small icon to represent this entry

#### setType

    public void setType(java.lang.Object newType)

Mutator method for type

Parameters:
  `newType` - The new type

#### setUserModificationPermission

    public void setUserModificationPermission(int permission)

Permissions are not checked before making modifications. Clients should check the permission before invoking a modification. Sub-classes may extend the set of permissions. Current set has:

- PERMISSION_NO_MODIFICATION
- PERMISSION_HIDE_ONLY
- PERMISSION_LIMITED_MODIFICATION
- PERMISSION_FULL_MODIFICATION

Default is `PERMISSION_FULL_MODIFICATION`

Parameters:
  `permission` - One of the above-specified permission levels

#### setVisible

    public void setVisible(boolean newVal)

Makes this entry visible or invisible. An invisible entry does not show up on the palette.

Parameters:
  `newVal` - The new boolean indicating whether the entry is visible or not

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`
See Also:
  `Object.toString()`