Class ImageObject

java.lang.Object
java.util.AbstractMap<K,​V>
java.util.HashMap<String,​String>
edu.wisc.game.sql.ImageObject
All Implemented Interfaces:
Serializable, Cloneable, Map<String,​String>
Direct Known Subclasses:
Composite

public class ImageObject
extends HashMap<String,​String>
Describes an image-and-properties-based object. For details, see Image-and-property-based description of objects
See Also:
Serialized Form
  • Field Details

    • key

      public String key
    • file

      public final File file
      For static objects, this is the SVG file for the image. For dynamically generated ones, null.
  • Constructor Details

    • ImageObject

      protected ImageObject()
      Used by Composite
  • Method Details

    • getKey

      public String getKey()
    • getSvg

      public String getSvg()
      The SVG code for the image, if available. It is mandatory for dynamically generated ImageObjects (/composite). For static ones, it may or may not be null.
    • clearTable

      public static void clearTable()
    • enlist

      public void enlist()
      Enters this ImageObject into the master table
    • obtainImageObjectPlain

      public static ImageObject obtainImageObjectPlain​(File dir, String plainPath, boolean allowMissing)
      Retrieves the ImageObject for a specified path from the master table. If necessary, tries to add that object (and all other objects listed in the properties file in that directory) to the master table.
      Parameters:
      dir - If provided, plainPath is understood as being relative to it.
      plainPath - The image path (relative to dir, or absolute if dir==null). Must not contain wildcard. May contain an extension (e.g. ".png" or ".svg"); if it does not, ".svg" will be added.
    • obtainImageObjectPlain

      public static ImageObject obtainImageObjectPlain​(File f)
    • obtainImageObjectPlain

      public static ImageObject obtainImageObjectPlain​(File f, boolean allowMissing)
      Parameters:
      allowMissing - If true, simply return null, rather than throw exception, when the file is not listed in the prop file
    • obtainImageObjects

      public static Vector<ImageObject> obtainImageObjects​(String wildCardPath)
      Loads an image object, or a group of them, if a wildcard is given. The path may also refer to dynamically generated Composite ImageObjects.
      Returns:
      a Vector of "regular" ImageObjects (associated with the file(s) given by the wildCardPath), or a Composite ImageObject (maybe a "family" one) is the path is of that kind.
    • listProperties

      public String listProperties()
    • listProperties

      public String listProperties​(String sep)
      Produces a "key1:val1, key2:val2, ..." list, with a desired separator.
    • symbol

      public String symbol()
      For use in ASCII graphics