Class PaletteCustomizer


  • public abstract class PaletteCustomizer
    extends java.lang.Object
    PaletteCustomizer is the PaletteCustomizerDialog's interface to the model. This class is responsible for propogating to the model changes made in the dialog.
    • Constructor Detail

      • PaletteCustomizer

        public PaletteCustomizer()
    • Method Detail

      • canAdd

        protected boolean canAdd​(PaletteContainer container,
                                 PaletteEntry entry)
        Return true if this container can accept this entry as a new child. By default, this method checks to see first if the container has full permissions, then checks to see if this container can accept the type of the entry.
        Parameters:
        container - the container that will be the parent of this entry
        entry - the entry to add to the container
        Returns:
        true if this container can hold this entry
      • canDelete

        public boolean canDelete​(PaletteEntry entry)
        Indicates whether the given entry can be deleted from the model or not. Whether or not an entry can be deleted depends on its permsission ( PaletteEntry.getUserModificationPermission()).

        This method will be invoked by PaletteCustomizerDialog to determine whether or not to enable the "Delete" action.

        Parameters:
        entry - The selected palette entry. It'll never be null.
        Returns:
        true if the given entry can be deleted
        See Also:
        performDelete(PaletteEntry)
      • canMoveDown

        public boolean canMoveDown​(PaletteEntry entry)
        Indicates whether the given entry can be moved down or not. Whether or not an entry can be moved down or not is determined by its parent's user modification permission ( PaletteEntry.getUserModificationPermission()).

        Will be called by PaletteCustomizerDialog to determine whether or not to enable the "Move Down" action.

        Parameters:
        entry - The selected palette entry (it'll never be null)
        Returns:
        true if the given entry can be moved down
        See Also:
        performMoveDown(PaletteEntry)
      • canMoveUp

        public boolean canMoveUp​(PaletteEntry entry)
        Indicates whether the given entry can be moved up or not. Whether or not an entry can be moved up or not is determined by its parent's user modification permission ( PaletteEntry.getUserModificationPermission()).

        Will be called by PaletteCustomizerDialog to determine whether or not to enable the "Move Up" action.

        Parameters:
        entry - The selected palette entry (it'll never be null)
        Returns:
        true if the given entry can be moved up
        See Also:
        performMoveUp(PaletteEntry)
      • getNewEntryFactories

        public java.util.List getNewEntryFactories()
        Returns the list of PaletteEntryFactories that can be used to create new palette entries. The String returned by the getText() method of each PaletteEntryFactory will be used to populate the "New" drop-down. getImageDescriptor() will be used to set the icons on the drop down. This method can return null if there are no PaletteEntryFactories available.
        Returns:
        The List of PaletteEntryFactories
      • getPropertiesPage

        public EntryPage getPropertiesPage​(PaletteEntry entry)
        Returns an EntryPage that will display the custom properties of the given entry. Can return null if there are no custom properties.
        Parameters:
        entry - The PaletteEntry whose properties page needs to be displayed (it'll never be null)
        Returns:
        The EntryPage to represent the given entry
      • performDelete

        public void performDelete​(PaletteEntry entry)
        Updates the model by deleting the given entry from it.
        Called when the "Delete" action in the PaletteCustomizerDialog is executed.
        Parameters:
        entry - The selected palette entry (it'll never be null)
        See Also:
        canDelete(PaletteEntry)
      • performMoveDown

        public void performMoveDown​(PaletteEntry entry)
        Updates the model by moving the entry down.
        Called when the "Move Down" action in the PaletteCustomizerDialog is invoked.
        Parameters:
        entry - The selected palette entry (it'll never be null)
        See Also:
        canMoveDown(PaletteEntry)
      • performMoveUp

        public void performMoveUp​(PaletteEntry entry)
        Updates the model by moving the entry up.
        Called when the "Move Up" action in the PaletteCustomizerDialog is invoked.
        Parameters:
        entry - The selected palette entry (it'll never be null)
        See Also:
        canMoveUp(PaletteEntry)
      • revertToSaved

        public abstract void revertToSaved()
        Undoes the changes made to the model since the last save.

        This method is invoked when the "Cancel" is selected in the PaletteCustomizerDialog.

      • save

        public abstract void save()
        Persists the changes made to the model.

        Called when "OK" or "Apply" are selected in the PaletteCustomizerDialog.