Class ImageCatalog


  • public class ImageCatalog
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageCatalog​(java.lang.String rkName, java.lang.String rkDefaultDir)
      Create the image catalog, with the name of the catalog and the default directory where the images are located.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Delete memory.
      GraphicsImage Find​(java.lang.String rkImageName)
      Find an image in the catalog based on the image's name.
      static ImageCatalog GetActive()
      Get the active image catalog.
      java.lang.String GetDefaultDir()
      Get the name of the default image directory.
      java.lang.String GetName()
      Get the name of the image catalog.
      boolean Insert​(GraphicsImage pkImage)
      Add an image to the catalog, do not add if it already exists in the catalog.
      void PrintEntries()
      Prints the Entries in the Catalog.
      boolean Remove​(GraphicsImage pkImage)
      Remove the image from the catalog.
      static void SetActive​(ImageCatalog pkActive)
      Set the active image catalog.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_kName

        private java.lang.String m_kName
        Name of the ImageCatalog -- typically "Main"
      • m_kDefaultDir

        private java.lang.String m_kDefaultDir
        Default directory where images are stored.
      • m_kEntry

        private java.util.HashMap<java.lang.String,​GraphicsImage> m_kEntry
        Map for mapping an image to its name.
      • m_spkDefaultImage

        private GraphicsImage m_spkDefaultImage
        Default image when no image can be found.
      • ms_kNullString

        private static final java.lang.String ms_kNullString
        null string comparison
      • ms_kDefaultString

        public static final java.lang.String ms_kDefaultString
        default string comparison
      • ms_pkActive

        private static ImageCatalog ms_pkActive
        Active ImageCatalog.
    • Constructor Detail

      • ImageCatalog

        public ImageCatalog​(java.lang.String rkName,
                            java.lang.String rkDefaultDir)
        Create the image catalog, with the name of the catalog and the default directory where the images are located.
        Parameters:
        rkName - name of the image catalog.
        rkDefaultDir - default directory where images are located.
    • Method Detail

      • GetActive

        public static final ImageCatalog GetActive()
        Get the active image catalog.
        Returns:
        the active image catalog.
      • SetActive

        public static void SetActive​(ImageCatalog pkActive)
        Set the active image catalog.
        Parameters:
        pkActive - new active image catalog.
      • dispose

        public void dispose()
        Delete memory.
      • Find

        public GraphicsImage Find​(java.lang.String rkImageName)
        Find an image in the catalog based on the image's name. If not in the catalog, try to load from disk.
        Parameters:
        rkImageName - name of the image to fine.
        Returns:
        the desired image, or the default image.
      • GetDefaultDir

        public final java.lang.String GetDefaultDir()
        Get the name of the default image directory.
        Returns:
        the name of the image directory.
      • GetName

        public final java.lang.String GetName()
        Get the name of the image catalog.
        Returns:
        the name of the image catalog.
      • Insert

        public boolean Insert​(GraphicsImage pkImage)
        Add an image to the catalog, do not add if it already exists in the catalog.
        Parameters:
        pkImage - image to add.
        Returns:
        true if the image is added, false otherwise.
      • PrintEntries

        public void PrintEntries()
        Prints the Entries in the Catalog.
      • Remove

        public boolean Remove​(GraphicsImage pkImage)
        Remove the image from the catalog.
        Parameters:
        pkImage - image to remove.
        Returns:
        true if the image is removed, false otherwise.