/*
This file is part of the software framework JStatCom,
a library for building applications for data based analysis.
Copyright (C) 2000-2005 Markus Kraetzig
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/
package com.jstatcom.component;
import javolution37.javolution.xml.XmlElement;
import javolution37.javolution.xml.XmlFormat;
/**
* Represents a serializable module to be used with TopFrame. A
* module holds the classname of the JInternalFrame containing
* the module and the associated helpset. Each of them can be null.
*
* The XML representation of modules can be used to set up the helpsets and
* modules that are shown in a TopFrame.
*
* @author Markus Kraetzig
*/
public final class Module {
/**
* Classname of this module.
*/
public final String className;
/**
* Name of the helpset file of this module, for example
* /helpsets/myhelp/myhelp.hs.
*/
public final String helpSetName;
/**
* Name of the static method to call with no parameters.
*/
public final String methodName;
/**
* XML format field for (de)serialization.
*/
public static final XmlFormat Module_XML = new XmlFormat(
Module.class) {
public void format(Module data, XmlElement xml) {
if (data.className != null)
xml.setAttribute("class", data.className);
if (data.helpSetName != null)
xml.setAttribute("helpset", data.helpSetName);
if (data.methodName != null)
xml.setAttribute("method", data.methodName);
}
public Module parse(XmlElement xml) {
String classAtt = xml.getAttribute("class", (String) null);
String helpSetAtt = xml.getAttribute("helpset", (String) null);
String methAtt = xml.getAttribute("method", (String) null);
return new Module(classAtt, helpSetAtt, methAtt);
}
};
/**
* Creates a module instance.
*
* @param className
* the class of this module, can be null
* @param helpSetName
* the name of the helpset associated with this module, can be
* null
*/
public Module(String className, String helpSetName, String methodName) {
super();
this.className = className;
this.helpSetName = helpSetName;
this.methodName = methodName;
}
}
Ads help maintain this website.