4,14 → 4,17 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.56 $ |
* @version $Revision: 1.57 $ |
* |
* Last modification: $Date: 2003/07/28 10:09:20 $ |
* $Id: Validator.java,v 1.56 2003/07/28 10:09:20 smcsporr Exp $ |
* Last modification: $Date: 2003/07/28 11:15:02 $ |
* $Id: Validator.java,v 1.57 2003/07/28 11:15:02 smcsporr Exp $ |
*/ |
|
package src.parser; |
|
import java.awt.event.ItemEvent; |
import java.awt.event.ItemListener; |
|
import java.io.File; |
import java.io.InputStream; |
import java.io.InputStreamReader; |
53,9 → 56,9 |
* |
* @author S. McSporran |
* |
* @version $Revision: 1.56 $ Last modification: $Date: 2003/07/28 10:09:20 $ |
* @version $Revision: 1.57 $ Last modification: $Date: 2003/07/28 11:15:02 $ |
*/ |
public class Validator { |
public class Validator implements ItemListener { |
|
/** The name of the Xerces parser implementation. */ |
private final String defaultParser = "org.apache.xerces.parsers.SAXParser"; |
85,6 → 88,9 |
private Transformer myTransformer; |
private TransformerFactory transFactory; |
|
/** Indicates, if the auto validation feature is activated. */ |
private boolean autoValidationOn = true; |
|
/** |
* The class constructor creates and configures an instance of a SAX parser, registers |
* the log and status panel to enable their use and the parser's error handler. |
493,6 → 499,43 |
|
return eHandler.isValid(); |
} |
|
/** |
* Listens for item events and launches the appropriate actions. |
* |
* In this implementation, events fired by the auto validation menu item |
* are treated by this method. If selected, the auto validation feature |
* will be turned on and vice versa. |
* |
* @param ie An item event indicating a change in the button's state. |
* |
* @see java.awt.event.ItemEvent |
* @see java.awt.event.ItemListener |
*/ |
public void itemStateChanged(ItemEvent ie) { |
|
if (ie.getStateChange() == ItemEvent.SELECTED) { |
autoValidationOn = true; |
log(LogInterface.TYPE_INFO, "Auto-validation enabled."); |
} |
if (ie.getStateChange() == ItemEvent.DESELECTED) { |
autoValidationOn = false; |
log(LogInterface.TYPE_INFO, "Auto-validation disabled."); |
} |
} |
|
/** |
* Returns the status of the auto validation feature. |
* |
* The auto validation feature controls, whether the program will validate |
* automatically after loading a file and when updating the treeview. |
* |
* @return A <code>boolean</code> value indicating if the auto validation |
* feature is activated. |
*/ |
public boolean getAutoValidation() { |
return autoValidationOn; |
} |
|
/** |
* Sends a text message of a specified type (info, error, warning) to the |