cz.cuni.jagrlib.xml
Class InputOutputXML

java.lang.Object
  extended by cz.cuni.jagrlib.xml.InputOutputXML
All Implemented Interfaces:
InputOutput

public class InputOutputXML
extends java.lang.Object
implements InputOutput

Saving and loading of XML files.

See Also:
PlugGUI.java

Field Summary
protected  org.w3c.dom.Node actualNode
          Actual node for saving or loading.
protected static java.lang.String C_INTERFACE
           
protected static java.lang.String C_MODULEFROM
           
protected static java.lang.String C_MODULETO
           
protected static java.lang.String C_PLUGFROM
           
protected static java.lang.String C_PLUGTO
           
protected  org.w3c.dom.Document doc
          XML document.
protected  java.lang.String fileName
          File name of comoposition.
protected static java.lang.String G_COMPOSITION
           
protected static java.lang.String G_REGISTRY
           
protected static java.lang.String G_SHOWMODULES
           
protected static java.lang.String KEY
           
protected static java.lang.String M_CLASS
           
protected static java.lang.String M_EDITABLE
           
protected static java.lang.String M_MAXIMIZABLE
           
protected static java.lang.String M_MINIMIZABLE
           
protected static java.lang.String M_MODESHOW
           
protected static java.lang.String M_NAME
           
protected static java.lang.String M_NEXTINFO
           
protected static java.lang.String M_PACKAGE
           
protected static java.lang.String M_PARAMS
           
protected static java.lang.String M_PLUGS
           
protected static java.lang.String M_SELECTED
           
protected static java.lang.String M_SHAPE
           
protected static java.lang.String M_TEMPLATE
           
protected static int maxBackupNumber
          Number of backup files.
protected static java.lang.String PA_NAME
           
protected static java.lang.String PA_VALUE
           
protected static java.lang.String PA_VISIBLE
           
protected static java.lang.String PL_NAME
           
protected static java.lang.String PL_ORIENTATION
           
protected static java.lang.String PL_VISIBLE
           
protected  org.w3c.dom.Node root
          Root of data.
protected static java.lang.String SHAPE_HEIGHT
           
protected static java.lang.String SHAPE_WIDTH
           
protected static java.lang.String SHAPE_X
           
protected static java.lang.String SHAPE_Y
           
 
Fields inherited from interface cz.cuni.jagrlib.reg.InputOutput
SAVE, SAVEAS
 
Constructor Summary
InputOutputXML()
           
 
Method Summary
 void backup(java.lang.String fileName, java.io.File oldFile, int order)
          Renaming of backup files.
 void load(InfoGroup _composition)
          Main method for load Composition from XML file.
 InfoGroup loadComposition(InfoGroup _composition)
          Loads composition.
 void loadFile(InfoGroup _composition, java.lang.String fileName)
          Loads composition w/o asking for its file-name.
 InfoGroup loadGroup(InfoGroup _info)
          Loads group.
 InfoChannel loadChannel(InfoChannel _info)
          Loads channel.
 InfoModule loadModule(InfoModule _info)
          Loads module.
 InfoModule loadModuleInfo(InfoModule _info)
          Loads module or group info.
 InfoParam loadParam(InfoParam _info, InfoModule _owner)
          Loads parameter.
 InfoPlug loadPlug(InfoPlug _info, InfoModule _owner)
          Loads plug.
 void loadPlugsParams(InfoModule _info)
          Loads plugs and params.
 void save(java.lang.String type, InfoGroup _composition)
          Main method for save Composition to XML file.
 void saveComposition(InfoGroup _composition)
          Saves composition.
 void saveGroup(InfoGroup _info)
          Saves one group.
 void saveChannel(InfoChannel _info)
          Saves one channel.
 void saveModule(org.w3c.dom.Element sg, InfoModule _info)
          Saves module or group info.
 void saveModule(InfoModule _info)
          Saves one module.
 org.w3c.dom.Element saveNextInfo(java.util.Map<java.lang.String,java.lang.Object> _nextInfo)
          Saves nextInfo.
 void saveParam(InfoParam _info, java.lang.String _key)
          Saves one parameter.
 void savePlug(InfoPlug _info, java.lang.String _key)
          Saves one plug.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

protected java.lang.String fileName
File name of comoposition.


doc

protected org.w3c.dom.Document doc
XML document.


root

protected org.w3c.dom.Node root
Root of data.


actualNode

protected org.w3c.dom.Node actualNode
Actual node for saving or loading.


maxBackupNumber

protected static final int maxBackupNumber
Number of backup files.

See Also:
Constant Field Values

G_REGISTRY

protected static final java.lang.String G_REGISTRY
See Also:
Constant Field Values

G_COMPOSITION

protected static final java.lang.String G_COMPOSITION
See Also:
Constant Field Values

G_SHOWMODULES

protected static final java.lang.String G_SHOWMODULES
See Also:
Constant Field Values

KEY

protected static final java.lang.String KEY
See Also:
Constant Field Values

C_INTERFACE

protected static final java.lang.String C_INTERFACE
See Also:
Constant Field Values

C_MODULEFROM

protected static final java.lang.String C_MODULEFROM
See Also:
Constant Field Values

C_PLUGFROM

protected static final java.lang.String C_PLUGFROM
See Also:
Constant Field Values

C_MODULETO

protected static final java.lang.String C_MODULETO
See Also:
Constant Field Values

C_PLUGTO

protected static final java.lang.String C_PLUGTO
See Also:
Constant Field Values

PA_NAME

protected static final java.lang.String PA_NAME
See Also:
Constant Field Values

PA_VALUE

protected static final java.lang.String PA_VALUE
See Also:
Constant Field Values

PA_VISIBLE

protected static final java.lang.String PA_VISIBLE
See Also:
Constant Field Values

PL_NAME

protected static final java.lang.String PL_NAME
See Also:
Constant Field Values

PL_ORIENTATION

protected static final java.lang.String PL_ORIENTATION
See Also:
Constant Field Values

PL_VISIBLE

protected static final java.lang.String PL_VISIBLE
See Also:
Constant Field Values

M_CLASS

protected static final java.lang.String M_CLASS
See Also:
Constant Field Values

M_PACKAGE

protected static final java.lang.String M_PACKAGE
See Also:
Constant Field Values

M_TEMPLATE

protected static final java.lang.String M_TEMPLATE
See Also:
Constant Field Values

M_NAME

protected static final java.lang.String M_NAME
See Also:
Constant Field Values

M_SHAPE

protected static final java.lang.String M_SHAPE
See Also:
Constant Field Values

M_MODESHOW

protected static final java.lang.String M_MODESHOW
See Also:
Constant Field Values

M_EDITABLE

protected static final java.lang.String M_EDITABLE
See Also:
Constant Field Values

M_MINIMIZABLE

protected static final java.lang.String M_MINIMIZABLE
See Also:
Constant Field Values

M_MAXIMIZABLE

protected static final java.lang.String M_MAXIMIZABLE
See Also:
Constant Field Values

M_SELECTED

protected static final java.lang.String M_SELECTED
See Also:
Constant Field Values

M_PLUGS

protected static final java.lang.String M_PLUGS
See Also:
Constant Field Values

M_PARAMS

protected static final java.lang.String M_PARAMS
See Also:
Constant Field Values

M_NEXTINFO

protected static final java.lang.String M_NEXTINFO
See Also:
Constant Field Values

SHAPE_X

protected static final java.lang.String SHAPE_X
See Also:
Constant Field Values

SHAPE_Y

protected static final java.lang.String SHAPE_Y
See Also:
Constant Field Values

SHAPE_HEIGHT

protected static final java.lang.String SHAPE_HEIGHT
See Also:
Constant Field Values

SHAPE_WIDTH

protected static final java.lang.String SHAPE_WIDTH
See Also:
Constant Field Values
Constructor Detail

InputOutputXML

public InputOutputXML()
Method Detail

save

public void save(java.lang.String type,
                 InfoGroup _composition)
          throws java.lang.Exception
Main method for save Composition to XML file.

Specified by:
save in interface InputOutput
Parameters:
_composition - Composition info.
type - Save type (Save or SaveAs)
Throws:
java.lang.Exception

saveComposition

public void saveComposition(InfoGroup _composition)
Saves composition.

Specified by:
saveComposition in interface InputOutput
Parameters:
_composition - Composition info.

saveGroup

public void saveGroup(InfoGroup _info)
Saves one group.

Specified by:
saveGroup in interface InputOutput
Parameters:
_info - Group info.

saveChannel

public void saveChannel(InfoChannel _info)
Saves one channel.

Specified by:
saveChannel in interface InputOutput
Parameters:
_info - Channel info.

saveParam

public void saveParam(InfoParam _info,
                      java.lang.String _key)
Saves one parameter.

Specified by:
saveParam in interface InputOutput
Parameters:
_info - Parameter info.
_key - Key of parameter for module or group.

saveModule

public void saveModule(InfoModule _info)
Saves one module.

Specified by:
saveModule in interface InputOutput
Parameters:
_info - Module info.

saveModule

public void saveModule(org.w3c.dom.Element sg,
                       InfoModule _info)
Saves module or group info.

Parameters:
sg - Node for saving.
_info - Module info.

savePlug

public void savePlug(InfoPlug _info,
                     java.lang.String _key)
Saves one plug.

Specified by:
savePlug in interface InputOutput
Parameters:
_info - Plug info.
_key - Key of plug for module or group.

saveNextInfo

public org.w3c.dom.Element saveNextInfo(java.util.Map<java.lang.String,java.lang.Object> _nextInfo)
Saves nextInfo.

Parameters:
_nextInfo - Next information for anything.
Returns:
Node with saved data.

loadFile

public void loadFile(InfoGroup _composition,
                     java.lang.String fileName)
              throws java.lang.Exception
Loads composition w/o asking for its file-name. File-name can be stored in _composition.fileName already (in that case fileName argument should be null).

Specified by:
loadFile in interface InputOutput
fileName - File-name to load.
Throws:
java.lang.Exception

load

public void load(InfoGroup _composition)
          throws java.lang.Exception
Main method for load Composition from XML file.

Specified by:
load in interface InputOutput
Parameters:
_composition - Composition info.
Throws:
java.lang.Exception

loadComposition

public InfoGroup loadComposition(InfoGroup _composition)
                          throws java.lang.Exception
Loads composition.

Specified by:
loadComposition in interface InputOutput
Parameters:
_composition - Composition info.
Returns:
Information about composition.
Throws:
java.lang.Exception

loadGroup

public InfoGroup loadGroup(InfoGroup _info)
                    throws java.lang.Exception
Loads group.

Specified by:
loadGroup in interface InputOutput
Parameters:
_info - Group info.
Returns:
Information about group.
Throws:
java.lang.Exception

loadChannel

public InfoChannel loadChannel(InfoChannel _info)
                        throws java.lang.Exception
Loads channel.

Specified by:
loadChannel in interface InputOutput
Parameters:
_info - Channel info.
Returns:
Information about channel.
Throws:
java.lang.Exception

loadParam

public InfoParam loadParam(InfoParam _info,
                           InfoModule _owner)
                    throws java.lang.Exception
Loads parameter.

Specified by:
loadParam in interface InputOutput
Parameters:
_info - Parameter info.
_owner - Owner of parameter.
Returns:
Information about parameter.
Throws:
java.lang.Exception

loadModuleInfo

public InfoModule loadModuleInfo(InfoModule _info)
                          throws java.lang.Exception
Loads module or group info.

Parameters:
_info - Module info.
Returns:
Information about module.
Throws:
java.lang.Exception

loadPlugsParams

public void loadPlugsParams(InfoModule _info)
                     throws java.lang.Exception
Loads plugs and params.

Parameters:
_info - Module info.
Throws:
java.lang.Exception

loadModule

public InfoModule loadModule(InfoModule _info)
                      throws java.lang.Exception
Loads module.

Specified by:
loadModule in interface InputOutput
Parameters:
_info - Module info.
Returns:
Information about module.
Throws:
java.lang.Exception

loadPlug

public InfoPlug loadPlug(InfoPlug _info,
                         InfoModule _owner)
                  throws java.lang.Exception
Loads plug.

Specified by:
loadPlug in interface InputOutput
Parameters:
_info - Plug info.
_owner - Owner of plug.
Returns:
Information about plug.
Throws:
java.lang.Exception

backup

public void backup(java.lang.String fileName,
                   java.io.File oldFile,
                   int order)
Renaming of backup files.

Parameters:
fileName - Name of new file.
oldFile - Name of old file.
order - Numerical order of backup file.