Class ContentHandlerFavorites

    • Constructor Detail

      • ContentHandlerFavorites

        public ContentHandlerFavorites()
        Initializes the favorites with immediate saving enabled.
      • ContentHandlerFavorites

        public ContentHandlerFavorites​(boolean autosave)
        Initializes the favorites.
        Parameters:
        autosave - whether to save the favorites immediately whenever modified
    • Method Detail

      • setAutoSave

        public void setAutoSave​(boolean value)
        Sets auto save to on or off.
        Parameters:
        value - if true then auto save is on
      • isAutoSave

        public boolean isAutoSave()
        Returns whether the favorites get immediately saved whenever modified.
        Returns:
        true if autosave is on
      • setModified

        public void setModified​(boolean value)
        Sets the modified state.
        Parameters:
        value - the modified state
      • isModified

        public boolean isModified()
        Returns whether the favorites are modified.
        Returns:
        true if modified
      • load

        protected void load()
        Loads the favorites.
      • clear

        public void clear()
        Removes all favorites.
      • getExtensions

        public List<String> getExtensions()
        Returns the list of extensions we have favorites for.
        Returns:
        the list
      • updateFavorite

        public boolean updateFavorite​(String ext,
                                      String name,
                                      ContentHandler handler)
        Updates the favorite.
        Parameters:
        ext - the extension this favorite is for
        name - the name of the favorite
        handler - the handler
        Returns:
        the generated favorite
      • removeFavorites

        public void removeFavorites​(String ext)
        Removes all the favorites for this extension.
        Parameters:
        ext - the extension to remove the favorites for
      • getFilename

        public String getFilename()
        Returns the filename the favorites will be saved as.
        Returns:
        the filename
      • updateFavorites

        public boolean updateFavorites()
        Updates the favorites, i.e., stores the properties on disk.
        Returns:
        true if successfully saved
      • customizeDropDownButton

        public void customizeDropDownButton​(BaseButtonWithDropDownMenu button,
                                            String ext,
                                            PreviewDisplay display)
        Adds menu items for favorites to the dropdown button.
        Parameters:
        button - the button to add the favorites to
        ext - the extension of the current file, disables the button if null
      • getSingleton

        public static ContentHandlerFavorites getSingleton()
        Returns the singleton (and initializes it, if necessary).
        Returns:
        the singleton
      • reload

        public static void reload()
        Reloads the system-wide favorites.