/*
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.io;
import javolution37.javolution.xml.XmlElement;
import javolution37.javolution.xml.XmlFormat;
import com.jstatcom.model.JSCSArray;
import com.jstatcom.project.SettingsElement;
/**
* Holds information for the FileSupport class about the location
* of selected files that should be stored between application runs.
*
* @author Markus Kraetzig
*/
public final class FileSupportSettings implements SettingsElement {
private JSCSArray selectedFiles = new JSCSArray("files");
/**
* XML format field for (de)serialization.
*/
public static final XmlFormat FileSupportSettings_XML = new XmlFormat(
FileSupportSettings.class) {
public void format(FileSupportSettings data , XmlElement xml) {
xml.add(data.selectedFiles);
}
public FileSupportSettings parse(XmlElement xml) {
FileSupportSettings settings = new FileSupportSettings();
if (xml.hasNext()) {
JSCSArray sel = (JSCSArray) xml.getNext();
settings.setSelectedFiles(sel);
}
return settings;
}
};
/*
* (non-Javadoc)
*
* @see com.jstatcom.project.SettingsElement#setElement()
*/
public void setElement() {
FileSupport.getInstance().setFileSupportSettings(this);
}
/**
* Gets the string array with the names of selected files and directories in
* the followins order:
*
* - selected text output directory
*
- selected data directory
*
- selected project filename (without directory)
*
- selected project directory
*
*
* @return 4x1 JSCSArray
*/
public JSCSArray getSelectedFiles() {
return selectedFiles;
}
/**
* Sets the JSCSArray with the names of selected files and
* directories.
*
* @param selectedFiles
* array with names
* @throws IllegalArgumentException
* if (selectedFiles == null)
*/
public void setSelectedFiles(JSCSArray selectedFiles) {
if (selectedFiles == null)
throw new IllegalArgumentException("Argument was null.");
this.selectedFiles = selectedFiles;
}
}
Ads help maintain this website.