Package mgui.io.domestic.maps
Class NameMapLoader
java.lang.Object
mgui.io.FileLoader
mgui.io.domestic.maps.NameMapLoader
- All Implemented Interfaces:
InterfaceIO
,IconObject
public class NameMapLoader extends FileLoader
Reads a name map from file. One of three format options are possible:
- Ascii - An Ascii file having two delimited columns, ordered as index (integer), then name (String)
- XML - An XML file comprised of entries
- Auto [default] - Searches for the leading xml tag; if found, reads as XML, otherwise as Ascii
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NameMapLoader.Format
-
Field Summary
Fields Modifier and Type Field Description protected NameMapLoader.Format
format
Fields inherited from class mgui.io.FileLoader
dataFile, dataURL, options
-
Constructor Summary
Constructors Constructor Description NameMapLoader()
NameMapLoader(java.io.File file)
NameMapLoader(java.io.File file, NameMapLoader.Format format)
-
Method Summary
Modifier and Type Method Description javax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.boolean
load(InterfaceIOOptions options, ProgressUpdater progress_bar)
Loads data from the set of files or URLs specified byoptions
.NameMap
loadNameMap()
Load data intoname_map
, with the current data format and data fileprotected NameMap
loadNameMapAscii(java.lang.String[] delim)
protected NameMap
loadNameMapXML()
Loads a name map from XML format.java.lang.Object
loadObject(ProgressUpdater progress_bar, InterfaceIOOptions options)
Loads data into an instance of the object corresponding to this loader.Methods inherited from class mgui.io.FileLoader
getComplementIOType, getFailureMessage, getFile, getIOType, getOptions, getProgressMessage, getSuccessMessage, getSupportedObjects, getTitle, getWriterComplement, load, load, loadObject, loadObject, loadObject, setFile, setOptions, setURL, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
format
-
-
Constructor Details
-
NameMapLoader
public NameMapLoader() -
NameMapLoader
public NameMapLoader(java.io.File file) -
NameMapLoader
-
-
Method Details
-
loadObject
public java.lang.Object loadObject(ProgressUpdater progress_bar, InterfaceIOOptions options) throws java.io.IOExceptionDescription copied from class:FileLoader
Loads data into an instance of the object corresponding to this loader. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object. TODO: make generic?- Overrides:
loadObject
in classFileLoader
- Parameters:
progress_bar
- An optional progress updater. Can benull
.options
- Options defining the loading process- Returns:
- Throws:
java.io.IOException
-
load
Description copied from class:FileLoader
Loads data from the set of files or URLs specified byoptions
. Loading is controlled by the specifications ofoptions
. If loaded object is of typePersistentObject
, this method should also set the file loader and reference URL for the object.This method should also set the URL reference and writer and loader attributes to match this one and its complement.
- Specified by:
load
in classFileLoader
progress_bar
- An optional progress updater. Can benull
.- Returns:
-
loadNameMap
Load data intoname_map
, with the current data format and data file- Parameters:
name_map
-- Returns:
-
loadNameMapAscii
-
loadNameMapXML
Loads a name map from XML format.- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Overrides:
getObjectIcon
in classFileLoader
- Returns:
-