Module tvbrowser

Class IconTheme

  • All Implemented Interfaces:
    java.lang.Comparable<IconTheme>
    Direct Known Subclasses:
    DirectoryIconTheme, ZipIconTheme

    public abstract class IconTheme
    extends java.lang.Object
    implements java.lang.Comparable<IconTheme>
    This class implements the IconTheme-Loading Most of the Code is based on the FreeDesktop Specs http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
    • Constructor Summary

      Constructors 
      Constructor Description
      IconTheme​(java.io.File iconDir)
      Create the IconTheme The Directory must contain a index.theme-File.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(IconTheme o)  
      protected abstract boolean entryExists​(java.lang.String entry)
      Tests if an Entry exists in the Icon-Theme
      boolean equals​(java.lang.Object obj)  
      java.io.File getBase()
      Get the Icon-Base.
      java.lang.String getComment()
      Get the Comment of the Theme
      javax.swing.ImageIcon getIcon​(ThemeIcon icon)
      Get an Icon from this Theme.
      protected abstract javax.swing.ImageIcon getImageFromTheme​(java.lang.String image)
      Get an Image from the Icon-Theme
      protected abstract java.io.InputStream getInputStream​(java.lang.String entry)
      Get an InputStream from the Icon-Theme.
      java.lang.String getName()
      Get the Name of the Theme
      int hashCode()  
      boolean loadTheme()
      Load the Theme-File
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IconTheme

        public IconTheme​(java.io.File iconDir)
        Create the IconTheme The Directory must contain a index.theme-File. For Details please look into the Specs.
        Parameters:
        iconDir - Directory for this Theme
    • Method Detail

      • loadTheme

        public boolean loadTheme()
        Load the Theme-File
        Returns:
        true if successfull
      • getName

        public java.lang.String getName()
        Get the Name of the Theme
        Returns:
        Name
      • getComment

        public java.lang.String getComment()
        Get the Comment of the Theme
        Returns:
        Comment
      • getBase

        public java.io.File getBase()
        Get the Icon-Base. This can be a File or a Directory
        Returns:
        Icon-Base
      • getIcon

        public javax.swing.ImageIcon getIcon​(ThemeIcon icon)
        Get an Icon from this Theme. This Method tries to find an exact size match, if it wasn't found it tries to find another Version of the Icon and rescales it.
        Parameters:
        icon - Icon that should be loaded
        Returns:
        Icon or Null if Icon was not found
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getInputStream

        protected abstract java.io.InputStream getInputStream​(java.lang.String entry)
        Get an InputStream from the Icon-Theme.
        Parameters:
        entry - File/Entry to load
        Returns:
        InputStream of specific Entry
      • entryExists

        protected abstract boolean entryExists​(java.lang.String entry)
        Tests if an Entry exists in the Icon-Theme
        Parameters:
        entry - check for this Entry
        Returns:
        True, if the Entry exists
      • getImageFromTheme

        protected abstract javax.swing.ImageIcon getImageFromTheme​(java.lang.String image)
        Get an Image from the Icon-Theme
        Parameters:
        image - get this Image
        Returns:
        Image
      • compareTo

        public int compareTo​(IconTheme o)
        Specified by:
        compareTo in interface java.lang.Comparable<IconTheme>