Gridarta Editor
net.sf.gridarta.utils.ResourceIcons Class Reference

Creates ImageIcon instances from resources. More...

+ Collaboration diagram for net.sf.gridarta.utils.ResourceIcons:

Public Member Functions

void addToCache (@NotNull final String name, @NotNull final ImageIcon imageIcon)
 Add an image to the cache. More...
 
ImageIcon getLightSquareIcon ()
 Returns the ImageIcon for highlighting map squares that are affected by nearby light emitting game objects. More...
 
ImageIcon getResourceIcon (@NotNull final String iconName) throws MissingResourceException
 Returns the image icon for the given icon name. More...
 
ImageIcon getWarningSquareIcon ()
 

Static Public Attributes

static final String APP_ICON = ICON_DIR + "app_icon.gif"
 Application icon definitions (icon-dir). More...
 
static final String AUTO_RUN_SMALL_ICON = ICON_DIR + "auto_run_small_icon.gif"
 
static final String CLOSE_TAB_SMALL_ICON = ICON_DIR + "close_tab_small_icon.gif"
 
static final String DEFAULT_ICON = SYSTEM_DIR + "default_icon.png"
 The default map icon to use if no icon can be created. More...
 
static final String DEFAULT_PREVIEW = SYSTEM_DIR + "default_preview.png"
 The default map preview to use if no icon can be created. More...
 
static final String FILTER_SMALL_ICON = ICON_DIR + "filter_small_icon.gif"
 
static final String RUN_PLUGIN_SMALL_ICON = ICON_DIR + "run_plugin_small_icon.gif"
 
static final String SQUARE_CURSOR = SYSTEM_DIR + "cursor.png"
 
static final String SQUARE_EMPTY = SYSTEM_DIR + "empty.png"
 
static final String SQUARE_NO_ARCH = SYSTEM_DIR + "no_arch.png"
 
static final String SQUARE_NO_FACE = SYSTEM_DIR + "no_face.png"
 
static final String SQUARE_PRE_SELECTED_SQUARE = SYSTEM_DIR + "pre_selected_square.png"
 
static final String SQUARE_SELECTED_SQUARE = SYSTEM_DIR + "selected_square.png"
 
static final String SQUARE_SELECTED_SQUARE_EAST = SYSTEM_DIR + "selected_square_e.png"
 
static final String SQUARE_SELECTED_SQUARE_NORTH = SYSTEM_DIR + "selected_square_n.png"
 
static final String SQUARE_SELECTED_SQUARE_SOUTH = SYSTEM_DIR + "selected_square_s.png"
 
static final String SQUARE_SELECTED_SQUARE_WEST = SYSTEM_DIR + "selected_square_w.png"
 
static final String SQUARE_UNKNOWN = SYSTEM_DIR + "unknown.png"
 
static final String SQUARE_WARNING = SYSTEM_DIR + "warning.png"
 
static final String SYSTEM_DIR = "system/"
 The directory that contains the system icons. More...
 
static final String TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"
 
static final String TREASURE_NO = SYSTEM_DIR + "treasure_no.png"
 
static final String TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"
 
static final String TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"
 

Private Attributes

final Map< String, ImageIcon > imageCache = new HashMap<>()
 Caches image icons. More...
 
ImageIcon lightSquareIcon
 
ImageIcon warningSquareIcon
 

Static Private Attributes

static final String ICON_DIR = "icons/"
 The directory that contains the common-use icons. More...
 
static final Category LOG = Logger.getLogger(ResourceIcons.class)
 The Logger for printing log messages. More...
 
static final String SQUARE_LIGHT = SYSTEM_DIR + "light.png"
 The name of the image for highlighting map squares that are affected by nearby light emitting game objects. More...
 

Detailed Description

Creates ImageIcon instances from resources.

The returned image icons are cached.

Author
Michael Toennies
Andreas Vogl
Christian Hujer
Andreas Kirschbaum

Definition at line 46 of file ResourceIcons.java.

Member Function Documentation

◆ addToCache()

void net.sf.gridarta.utils.ResourceIcons.addToCache ( @NotNull final String  name,
@NotNull final ImageIcon  imageIcon 
)

Add an image to the cache.

Parameters
namethe name
imageIconthe image icon

Definition at line 208 of file ResourceIcons.java.

◆ getLightSquareIcon()

ImageIcon net.sf.gridarta.utils.ResourceIcons.getLightSquareIcon ( )

Returns the ImageIcon for highlighting map squares that are affected by nearby light emitting game objects.

Returns
the image icon

Definition at line 234 of file ResourceIcons.java.

References net.sf.gridarta.utils.AlphaImageFilterInstance.ALPHA_FILTER, net.sf.gridarta.utils.ResourceIcons.getResourceIcon(), and net.sf.gridarta.utils.ResourceIcons.lightSquareIcon.

+ Here is the call graph for this function:

◆ getResourceIcon()

ImageIcon net.sf.gridarta.utils.ResourceIcons.getResourceIcon ( @NotNull final String  iconName) throws MissingResourceException

Returns the image icon for the given icon name.

Loads every icon only once and uses hash table to return the same instance if same icon name is given. Note: There must not be conflicting icon names from different directories.

Parameters
iconNamethe icon name
Returns
the image icon for the given icon name
Exceptions
MissingResourceExceptionif the icon cannot be loaded

Definition at line 168 of file ResourceIcons.java.

Referenced by net.sf.gridarta.model.face.FaceObjectProviders.getFace(), net.sf.gridarta.utils.ResourceIcons.getLightSquareIcon(), net.sf.gridarta.utils.ResourceIcons.getWarningSquareIcon(), net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory.newPickmapRenderer(), net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory.newPickmapRenderer(), net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory.newSimpleMapRenderer(), net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory.newSimpleMapRenderer(), net.sf.gridarta.var.crossfire.gui.map.renderer.SimpleFlatMapRenderer.paintSquare(), and net.sf.gridarta.gui.dialog.plugin.PluginView< G, A, R >.showConsoleFrame().

+ Here is the caller graph for this function:

◆ getWarningSquareIcon()

ImageIcon net.sf.gridarta.utils.ResourceIcons.getWarningSquareIcon ( )

Member Data Documentation

◆ APP_ICON

final String net.sf.gridarta.utils.ResourceIcons.APP_ICON = ICON_DIR + "app_icon.gif"
static

◆ AUTO_RUN_SMALL_ICON

final String net.sf.gridarta.utils.ResourceIcons.AUTO_RUN_SMALL_ICON = ICON_DIR + "auto_run_small_icon.gif"
static

◆ CLOSE_TAB_SMALL_ICON

◆ DEFAULT_ICON

final String net.sf.gridarta.utils.ResourceIcons.DEFAULT_ICON = SYSTEM_DIR + "default_icon.png"
static

◆ DEFAULT_PREVIEW

final String net.sf.gridarta.utils.ResourceIcons.DEFAULT_PREVIEW = SYSTEM_DIR + "default_preview.png"
static

◆ FILTER_SMALL_ICON

final String net.sf.gridarta.utils.ResourceIcons.FILTER_SMALL_ICON = ICON_DIR + "filter_small_icon.gif"
static

◆ ICON_DIR

final String net.sf.gridarta.utils.ResourceIcons.ICON_DIR = "icons/"
staticprivate

The directory that contains the common-use icons.

Definition at line 51 of file ResourceIcons.java.

◆ imageCache

final Map<String, ImageIcon> net.sf.gridarta.utils.ResourceIcons.imageCache = new HashMap<>()
private

Caches image icons.

Maps icon name to image icon.

Definition at line 150 of file ResourceIcons.java.

◆ lightSquareIcon

ImageIcon net.sf.gridarta.utils.ResourceIcons.lightSquareIcon
private

◆ LOG

final Category net.sf.gridarta.utils.ResourceIcons.LOG = Logger.getLogger(ResourceIcons.class)
staticprivate

The Logger for printing log messages.

Definition at line 144 of file ResourceIcons.java.

◆ RUN_PLUGIN_SMALL_ICON

final String net.sf.gridarta.utils.ResourceIcons.RUN_PLUGIN_SMALL_ICON = ICON_DIR + "run_plugin_small_icon.gif"
static

◆ SQUARE_CURSOR

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_CURSOR = SYSTEM_DIR + "cursor.png"
static

◆ SQUARE_EMPTY

◆ SQUARE_LIGHT

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_LIGHT = SYSTEM_DIR + "light.png"
staticprivate

The name of the image for highlighting map squares that are affected by nearby light emitting game objects.

Definition at line 91 of file ResourceIcons.java.

◆ SQUARE_NO_ARCH

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_NO_ARCH = SYSTEM_DIR + "no_arch.png"
static

◆ SQUARE_NO_FACE

◆ SQUARE_PRE_SELECTED_SQUARE

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_PRE_SELECTED_SQUARE = SYSTEM_DIR + "pre_selected_square.png"
static

◆ SQUARE_SELECTED_SQUARE

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_SELECTED_SQUARE = SYSTEM_DIR + "selected_square.png"
static

◆ SQUARE_SELECTED_SQUARE_EAST

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_SELECTED_SQUARE_EAST = SYSTEM_DIR + "selected_square_e.png"
static

◆ SQUARE_SELECTED_SQUARE_NORTH

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_SELECTED_SQUARE_NORTH = SYSTEM_DIR + "selected_square_n.png"
static

◆ SQUARE_SELECTED_SQUARE_SOUTH

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_SELECTED_SQUARE_SOUTH = SYSTEM_DIR + "selected_square_s.png"
static

◆ SQUARE_SELECTED_SQUARE_WEST

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_SELECTED_SQUARE_WEST = SYSTEM_DIR + "selected_square_w.png"
static

◆ SQUARE_UNKNOWN

◆ SQUARE_WARNING

final String net.sf.gridarta.utils.ResourceIcons.SQUARE_WARNING = SYSTEM_DIR + "warning.png"
static

Definition at line 85 of file ResourceIcons.java.

◆ SYSTEM_DIR

final String net.sf.gridarta.utils.ResourceIcons.SYSTEM_DIR = "system/"
static

The directory that contains the system icons.

Definition at line 56 of file ResourceIcons.java.

◆ TREASURE_LIST

final String net.sf.gridarta.utils.ResourceIcons.TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"
static

Definition at line 100 of file ResourceIcons.java.

◆ TREASURE_NO

final String net.sf.gridarta.utils.ResourceIcons.TREASURE_NO = SYSTEM_DIR + "treasure_no.png"
static

Definition at line 109 of file ResourceIcons.java.

◆ TREASURE_YES

final String net.sf.gridarta.utils.ResourceIcons.TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"
static

Definition at line 106 of file ResourceIcons.java.

◆ TREASUREONE_LIST

final String net.sf.gridarta.utils.ResourceIcons.TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"
static

Definition at line 103 of file ResourceIcons.java.

◆ warningSquareIcon

ImageIcon net.sf.gridarta.utils.ResourceIcons.warningSquareIcon
private

The documentation for this class was generated from the following file: