|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdasher.CColourIO
public class CColourIO
Responsible for reading a given list of XML files, extracting colour scheme information, and creating a list of ColourInfo objects for each.
Further, after doing so, responsible for returning a ColourInfo object corresponding to a given alphabet name, and of giving a full list of available colour schemes.
| Nested Class Summary | |
|---|---|
static class |
CColourIO.ColourInfo
Simple struct which represents a colour scheme. |
| Field Summary | |
|---|---|
protected java.util.HashMap<java.lang.String,CColourIO.ColourInfo> |
Colours
Map from colour scheme names to their ColourInfo objects. |
protected java.util.ArrayList<java.lang.String> |
Filenames
Files which are to be parsed. |
boolean |
LoadMutable
Flag indicating whether or not the current colour scheme may be modified. |
CDasherInterfaceBase |
m_Interface
Interface which will be used for Applet style I/O. |
protected javax.xml.parsers.SAXParser |
parser
SAXParser used to read XML files. |
protected java.lang.String |
SystemLocation
The current system data location, for locating DTDs. |
protected java.lang.String |
UserLocation
The current user data location, for locating DTDs. |
| Constructor Summary | |
|---|---|
CColourIO(java.lang.String SysLoc,
java.lang.String UserLoc,
java.util.ArrayList<java.lang.String> Fnames,
CDasherInterfaceBase dib)
Sole constructor. |
|
| Method Summary | |
|---|---|
protected void |
CreateDefault()
Creates and stores a default colour scheme, named simply Default. |
void |
Delete(java.lang.String ColourID)
Removes a colour scheme by name. |
void |
GetColours(java.util.Collection<java.lang.String> ColourList)
Fills a given Collection with the names of all available colour schemes. |
CColourIO.ColourInfo |
GetInfo(java.lang.String ColourID)
Retrieves the ColourInfo object associated with a given colour scheme. |
void |
ParseFile(java.lang.String filename)
Parse a named XML file. |
void |
Save(java.lang.String name)
Stub method. |
void |
SetInfo(CColourIO.ColourInfo NewInfo)
Adds a ColourInfo object to the list of those available. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String SystemLocation
protected java.lang.String UserLocation
protected java.util.HashMap<java.lang.String,CColourIO.ColourInfo> Colours
protected java.util.ArrayList<java.lang.String> Filenames
public boolean LoadMutable
public CDasherInterfaceBase m_Interface
protected javax.xml.parsers.SAXParser parser
| Constructor Detail |
|---|
public CColourIO(java.lang.String SysLoc,
java.lang.String UserLoc,
java.util.ArrayList<java.lang.String> Fnames,
CDasherInterfaceBase dib)
SysLoc - System data location to search for DTD files.UserLoc - User data location to search for DTD files.Fnames - List of files to parse.dib - Interface against which we can perform applet-style IO. Optional; if null, applet-style IO will not be attempted.| Method Detail |
|---|
public void ParseFile(java.lang.String filename)
This method will attempt to retrieve the file first by ordinary file I/O, and then if this fails, will attempt to retrieve a resource stream, allowing it to find XML files stored in a JAR.
filename - Relative or absolute path to the file to be parsed.public void GetColours(java.util.Collection<java.lang.String> ColourList)
Colour schemes can be made available by being parsed from an XML file by way of the ParseFile method (or through the constructor), or by the manual creation of a ColourInfo object which must then be saved using SetInfo.
ColourList - Collection to be filled with available colours.public CColourIO.ColourInfo GetInfo(java.lang.String ColourID)
If the specified name cannot be found, the Default scheme will be retrieved. To avoid this happening, make sure that only schemes enumerated by GetColours are requested.
Schemes' names may consist of any Unicode character in the Basic Multilingual Plane.
ColourID - Name of the colour scheme to retrieve.
public void SetInfo(CColourIO.ColourInfo NewInfo)
NewInfo - Colour scheme to save. Must not be null.public void Delete(java.lang.String ColourID)
ColourID - Name of the scheme to remove. If the given name
does not exist the method will return without error.public void Save(java.lang.String name)
The class must already know about the scheme to be able to save it.
name - Name of the scheme to save.protected void CreateDefault()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||