Gridarta Editor
net.sf.gridarta.model.face.AbstractFaceProvider Class Referenceabstract

Abstract Base class for FaceProviders which implements a memory sensitive cache. More...

+ Inheritance diagram for net.sf.gridarta.model.face.AbstractFaceProvider:
+ Collaboration diagram for net.sf.gridarta.model.face.AbstractFaceProvider:

Public Member Functions

ImageIcon getImageIconForFacename (@NotNull final String faceName, final long stretch)
 Get an image from this FaceProvider. More...
 
void reload ()
 Reload faces. More...
 

Protected Member Functions

abstract ImageIcon createImage (@NotNull String faceName, long stretch)
 Create an image not found in the cache. More...
 

Private Attributes

final Map< String, SoftReference< ImageIcon > > cache = new HashMap<>()
 The HashMap to provide the icons from. More...
 

Static Private Attributes

static final Category LOG = Logger.getLogger(AbstractFaceProvider.class)
 The Logger for printing log messages. More...
 

Detailed Description

Abstract Base class for FaceProviders which implements a memory sensitive cache.

Author
Christian Hujer

Definition at line 36 of file AbstractFaceProvider.java.

Member Function Documentation

◆ createImage()

abstract ImageIcon net.sf.gridarta.model.face.AbstractFaceProvider.createImage ( @NotNull String  faceName,
long  stretch 
)
abstractprotected

Create an image not found in the cache.

Parameters
faceNameface name to get image for, excluding path and ending
stretchstretch factor
Returns
icon for faceName

Referenced by net.sf.gridarta.model.face.AbstractFaceProvider.getImageIconForFacename(), and net.sf.gridarta.model.face.AbstractFaceProvider.reload().

+ Here is the caller graph for this function:

◆ getImageIconForFacename()

ImageIcon net.sf.gridarta.model.face.AbstractFaceProvider.getImageIconForFacename ( @NotNull final String  faceName,
final long  stretch 
)

Get an image from this FaceProvider.

Parameters
faceNameface name to get image for, excluding path and ending
Returns
icon for faceName

Implements net.sf.gridarta.model.face.FaceProvider.

Definition at line 53 of file AbstractFaceProvider.java.

References net.sf.gridarta.model.face.AbstractFaceProvider.createImage().

+ Here is the call graph for this function:

◆ reload()

void net.sf.gridarta.model.face.AbstractFaceProvider.reload ( )

Reload faces.

This method does not really immediately reload all faces, lazy loading is allowed. But all old face information definitely is flushed, so in case the files on hard disk have changed, they will be freshly loaded from hard disk.

Implements net.sf.gridarta.model.face.FaceProvider.

Definition at line 70 of file AbstractFaceProvider.java.

References net.sf.gridarta.model.face.AbstractFaceProvider.createImage().

+ Here is the call graph for this function:

Member Data Documentation

◆ cache

final Map<String, SoftReference<ImageIcon> > net.sf.gridarta.model.face.AbstractFaceProvider.cache = new HashMap<>()
private

The HashMap to provide the icons from.

Note: Weak hashing does not differ because the keys are definitely referenced elsewhere.

Definition at line 49 of file AbstractFaceProvider.java.

◆ LOG

final Category net.sf.gridarta.model.face.AbstractFaceProvider.LOG = Logger.getLogger(AbstractFaceProvider.class)
staticprivate

The Logger for printing log messages.

Definition at line 42 of file AbstractFaceProvider.java.


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