|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object standup.symbol.SymbolManager
public class SymbolManager
Provides methods for retrieving literacy/AAC symbols. STANDUP currently supports the Widgit Rebus and PCS Mayer-Johnson symbol sets (note that the symbols themselves must be obtained separately).
Obtaining symbol bitmaps is typically a 2-stage process:
getSymbolFilenames(String, SymbolType[])
, which takes a 'real'
Widgit conceptcode and a symbol preference, and returns an appropriate list
of filenames.
getSymbolImage(String)
or
getSymbolImage(String, int)
to obtain a rendered bitmap.
Field Summary | |
---|---|
private static Hashtable<String,String[]> |
cachedConceptCodeImageFilenames
|
private static boolean |
enableFullPCS
|
private static Hashtable<String,BufferedImage> |
imageCache
|
private static SymbolLoader |
pcsLoader
|
private static SymbolLoader |
rebusLoader
|
private static boolean |
symbolLoadersHaveBeenInitialized
|
Constructor Summary | |
---|---|
SymbolManager()
|
Method Summary | |
---|---|
static String |
getSymbolCaption(String filename)
Returns a simple caption for the symbol with the given filename. |
private static List<String> |
getSymbolFilenames(String[] imgFiles,
SymbolType[] symbolSet)
Given a list of symbol filenames and a SymbolType[] indicating a
preference for symbol sets, returns an ordered (sub)list of the symbol
filenames according to the preference. |
static List<String> |
getSymbolFilenames(String realConceptCode,
SymbolType[] symbolSet)
Given a 'real' Widgit conceptcode, and a SymbolType[] indicating
a preference for symbol sets, returns a list of symbol filenames that are
ordered by preference. |
static BufferedImage |
getSymbolImage(String filename)
Attempts to load and render/transcode a symbol with the given filename at its default resolution. |
static BufferedImage |
getSymbolImage(String filename,
int height)
Attempts to load and render/transcode a symbol with the given filename at a resolution such that the resulting bitmap is as tall as the given height argument. |
static boolean |
isEnableFullPCS()
Returns true if the symbol loaders are set up in 'full' PCS mode,
or false if they are in 'message' PCS mode. |
static boolean |
isPCSSymbolFilename(String filename)
Returns true if the given filename points to a PCS symbol,
false otherwise. |
static boolean |
isRebusSymbolFilename(String filename)
Returns true if the given filename points to a Rebus symbol,
false otherwise. |
static void |
loadConceptCodeImageFilenames()
Loads a serialized hashtable that maps Widgit conceptcodes to symbol filenames. |
static void |
setupLoadersAndRenderers()
Sets up the required symbol loaders for the various supported symbol sets. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static transient boolean enableFullPCS
private static transient SymbolLoader rebusLoader
private static transient SymbolLoader pcsLoader
private static transient boolean symbolLoadersHaveBeenInitialized
private static transient Hashtable<String,BufferedImage> imageCache
private static Hashtable<String,String[]> cachedConceptCodeImageFilenames
Constructor Detail |
---|
public SymbolManager()
Method Detail |
---|
public static String getSymbolCaption(String filename)
filename
-
public static boolean isRebusSymbolFilename(String filename)
true
if the given filename points to a Rebus symbol,
false
otherwise.
filename
-
public static boolean isPCSSymbolFilename(String filename)
true
if the given filename points to a PCS symbol,
false
otherwise.
filename
-
public static List<String> getSymbolFilenames(String realConceptCode, SymbolType[] symbolSet) throws SymbolException
SymbolType[]
indicating
a preference for symbol sets, returns a list of symbol filenames that are
ordered by preference.
realConceptCode
- symbolSet
-
SymbolException
private static List<String> getSymbolFilenames(String[] imgFiles, SymbolType[] symbolSet) throws SymbolException
SymbolType[]
indicating a
preference for symbol sets, returns an ordered (sub)list of the symbol
filenames according to the preference. It may return a sublist due to the
fact that the given symbol set preference might not include all possible
SymbolType
s.
If no appropriate symbol filenames are found, it returns null
.
imgFiles
- symbolSet
-
SymbolException
public static void loadConceptCodeImageFilenames()
public static boolean isEnableFullPCS()
true
if the symbol loaders are set up in 'full' PCS mode,
or false
if they are in 'message' PCS mode.
public static void setupLoadersAndRenderers()
cla
- public static BufferedImage getSymbolImage(String filename) throws SymbolException
BufferedImage
. Else, it returns null
.
Additionally, it caches the resulting bitmap in a hashtable where the keys are the filenames. Thus, if this method is called with the same argument again, it doesn't have to re-load and re-render the symbol.
filename
-
SymbolException
public static BufferedImage getSymbolImage(String filename, int height) throws SymbolException
height
argument. If successful, it returns the resulting
BufferedImage
. Else, it returns null
.
Additionally, it caches the resulting bitmap in a hashtable where the keys are the filenames plus the intended height. Thus, if this method is called with the same arguments again, it doesn't have to re-load and re-render the symbol.
filename
- height
-
SymbolException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |