com.dlsc.flexgantt.icons

## Class AbstractIconMap

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<IconId,Icon>
    - - com.dlsc.flexgantt.icons.AbstractIconMap

- All Implemented Interfaces:
    IIconMap, Serializable, Cloneable, Map<IconId,Icon>
  Direct Known Subclasses:
    Gif16EclipseIconMap

      public abstract class AbstractIconMap
      extends HashMap<IconId,Icon>
      implements IIconMap

  An abstract implementation of the `IIconMap` interface that provides mechanisms to store, retrieve, and load icons.
  Since:
    1.0
  Version:
    $Revision: 1.9 $
  Author:
    Dirk Lemmermann
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractIconMap(int iconWidth, int iconHeight)` Constructs a new icon map.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Icon` | `getDisabledIcon(IconId id)` Returns a disabled version of the icon for the given ID.
    `Icon` | `getIcon(IconId id)` Returns an icon for the given ID.
    `Dimension` | `getIconDimension()` Returns the size of the icons in the map.
    `List<String>` | `getLoadedFileNames()` Returns the filenames used for loading the icons.
    `protected Icon` | `loadIcon(Class<? extends AbstractIconMap> iconMap, String fileName)` Loads the image with the given name from the package where the specified class is located.
    `void` | `setIcon(IconId id, Icon icon)` Specifies a new icon for the given ID.

    - ### Methods inherited from class java.util.HashMap

      `clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

    - ### Methods inherited from class java.util.AbstractMap

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Constructor Detail

    - #### AbstractIconMap

          protected AbstractIconMap(int iconWidth,
                                    int iconHeight)

      Constructs a new icon map.
      Parameters:
        `iconWidth` - the width of icons in this map
        `iconHeight` - the height of icons in this map
      Since:
        1.0

  - ### Method Detail

    - #### getIcon

          public Icon getIcon(IconId id)

      Description copied from interface: `IIconMap`
      Returns an icon for the given ID.
      Specified by:
        `getIcon` in interface `IIconMap`
      Parameters:
        `id` - the ID for which to return an icon
      Returns:
        an icon for the given ID

    - #### getIconDimension

          public Dimension getIconDimension()

      Description copied from interface: `IIconMap`
      Returns the size of the icons in the map.
      Specified by:
        `getIconDimension` in interface `IIconMap`
      Returns:
        the icon dimensions

    - #### getDisabledIcon

          public Icon getDisabledIcon(IconId id)

      Description copied from interface: `IIconMap`
      Returns a disabled version of the icon for the given ID.
      Specified by:
        `getDisabledIcon` in interface `IIconMap`
      Parameters:
        `id` - the ID for which to return an icon
      Returns:
        an icon for the given ID

    - #### setIcon

          public void setIcon(IconId id,
                              Icon icon)

      Specifies a new icon for the given ID.
      Specified by:
        `setIcon` in interface `IIconMap`
      Parameters:
        `id` - the ID of the icon that will be replaced
        `icon` - the new icon to use for the given ID
      Since:
        1.0

    - #### loadIcon

          protected Icon loadIcon(Class<? extends AbstractIconMap> iconMap,
                                  String fileName)

      Loads the image with the given name from the package where the specified class is located. Usually the icon map class and the icons managed by it are located in the same package.
      Parameters:
        `iconMap` - the class of the icon map implementation
        `fileName` - the name of the icon file (e.g. Folder.gif)
      Returns:
        Icon the icon for the given file name
      Since:
        1.0

    - #### getLoadedFileNames

          public List<String> getLoadedFileNames()

      Returns the filenames used for loading the icons.
      Returns:
        the list of loaded files (filenames)
      Since:
        2.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.