/sun/xmleditor/trunk/src/control/Controller.java |
---|
4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.62 $ |
* @version $Revision: 1.63 $ |
* |
* Last modification: $Date: 2003/07/26 10:50:06 $ |
* $Id: Controller.java,v 1.62 2003/07/26 10:50:06 smcsporr Exp $ |
* Last modification: $Date: 2003/07/26 11:42:56 $ |
* $Id: Controller.java,v 1.63 2003/07/26 11:42:56 swalkenh Exp $ |
*/ |
package src.control; |
31,7 → 31,7 |
* |
* @author Group 5 |
* |
* @version $Revision: 1.62 $ Last modification: $Date: 2003/07/26 10:50:06 $ |
* @version $Revision: 1.63 $ Last modification: $Date: 2003/07/26 11:42:56 $ |
*/ |
public class Controller { |
53,6 → 53,9 |
/** The updateView refreshes the view of of the tree if the document is changed. */ |
private UpdateView updateView; |
/** A validator is used for document validation. */ |
private Validator vali; |
/** |
* The plugin manager is responsible for launching plugins and |
* to handle program-to-plugin and plugin-to-program actions. |
69,7 → 72,7 |
* ----------------------------------------------------------------------------- |
* DocumentFactory -> |
* DocumentManager -> GUI, LogPanel, PluginManager, StatusPanel, UpdateView |
* GUI -> DocumentManager, OtherGUIActions, PluginManager, UpdateView |
* GUI -> DocumentManager, OtherGUIActions, PluginManager, UpdateView, Validator |
* OtherGUIActions -> DocumentManager |
* Parser -> LogPanel |
* PluginManager -> DocumentManager, GUI, LogPanel, UpdateView |
91,6 → 94,8 |
parser = new Parser(); |
aDocumentFactory = new DocumentFactory(myGui.getLogPanelImpl()); |
updateView = new UpdateView(); |
vali = new Validator(myGui.getLogPanelImpl(), myGui.getStatusInterface()); |
pluginManager = new PluginManager("src/control/config.xml", myGui, updateView, myGui.getLogPanelImpl()); |
/* Give DocumentManager interface to the guiListener. */ |
115,7 → 120,7 |
updateView.setPluginManagerInterface(pluginManager); |
/* Give Interfaces to gui. */ |
myGui.setInterfaces(gUIListener,docMaster, updateView, pluginManager, docMaster,docMaster); |
myGui.setInterfaces(gUIListener,docMaster, updateView, pluginManager, docMaster,docMaster, vali); |
/* Register the log panel to the different objects. */ |
parser.setLogInterface(myGui.getLogPanelImpl()); |
/sun/xmleditor/trunk/src/control/DocumentManager.java |
---|
4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.135 $ |
* @version $Revision: 1.136 $ |
* |
* Last modification: $Date: 2003/07/28 13:25:30 $ |
* $Id: DocumentManager.java,v 1.135 2003/07/28 13:25:30 smcsporr Exp $ |
* Last modification: $Date: 2003/07/28 13:27:18 $ |
* $Id: DocumentManager.java,v 1.136 2003/07/28 13:27:18 hjokusch Exp $ |
*/ |
package src.control; |
50,7 → 50,7 |
* |
* @author Group 5 |
* |
* @version $Revision: 1.135 $ Last modification: $Date: 2003/07/28 13:25:30 $ |
* @version $Revision: 1.136 $ Last modification: $Date: 2003/07/28 13:27:18 $ |
*/ |
public class DocumentManager implements ActionListener, DocumentManagerInterface, |
ChangeListener { |
99,9 → 99,6 |
/** A parser, in this case used to parse a grammar (DTD or XML schema). */ |
private Parser grammarParser = new Parser(); |
/** Indicates, if the auto validation feature is activated. */ |
private boolean autoValidationOn = true; |
private int unNamedCounter = 0; |
/** Instance variables for used file filters. */ |
322,13 → 319,6 |
} |
} |
/**/ |
if (event.getID() == ActionEvent.ITEM_EVENT_MASK) { |
log(LogInterface.TYPE_INFO, event.getActionCommand()); |
log(LogInterface.TYPE_INFO, event.toString()); |
} |
/* Actions to perform if the user choosed to change the curent document's DTD. */ |
if (event.getActionCommand() == "Set DTD") { |
setNewDTD(); |
1458,17 → 1448,4 |
return false; |
} |
} |
/** |
* 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; |
} |
} |
/sun/xmleditor/trunk/src/gui/UpdateView.java |
---|
4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.58 $ |
* @version $Revision: 1.59 $ |
* |
* Last modification: $Date: 2003/07/28 13:23:15 $ |
* $Id: UpdateView.java,v 1.58 2003/07/28 13:23:15 cstollen Exp $ |
* Last modification: $Date: 2003/07/28 13:33:08 $ |
* $Id: UpdateView.java,v 1.59 2003/07/28 13:33:08 smcsporr Exp $ |
*/ |
package src.gui; |
47,7 → 47,7 |
* |
* @author Christian Stollenwerk |
* |
* @version $Revision: 1.58 $ Last modification: $Date: 2003/07/28 13:23:15 $ |
* @version $Revision: 1.59 $ Last modification: $Date: 2003/07/28 13:33:08 $ |
*/ |
public class UpdateView implements ActionListener, UpdateViewInterface, |
OurEventListener, TreeModelListener, TreeExpansionListener, TreeSelectionListener { |
402,25 → 402,30 |
/* Update the document with the content of the plugin */ |
pluginManagerInterface.forcePluginReport(); |
/* Check, if a grammar has been specified. */ |
if ((documentManagerInterface.getActualDocument().getDocumentElement().hasAttribute("xsi:schemaLocation")) || |
(documentManagerInterface.getActualDocument().getDoctype() != null)) { |
if (validator.getAutoValidation()) { |
logInterface.log(LogInterface.TYPE_INFO, "True !"); |
/* Check, if a grammar has been specified. */ |
if ((documentManagerInterface.getActualDocument().getDocumentElement().hasAttribute("xsi:schemaLocation")) || |
(documentManagerInterface.getActualDocument().getDoctype() != null)) { |
/* Check, if the current document is valid. */ |
if (validator.validateDocument(documentManagerInterface.getActualDocument(), |
documentManagerInterface.getActualDocumentFile())) { |
logInterface.log(LogInterface.TYPE_INFO, "The document is valid"); |
} |
/* Check, if the current document is valid. */ |
if (validator.validateDocument(documentManagerInterface.getActualDocument(), |
documentManagerInterface.getActualDocumentFile())) { |
logInterface.log(LogInterface.TYPE_INFO, "The document is valid"); |
} |
/* Not valid -> Print an error message. */ |
else { |
logInterface.log(LogInterface.TYPE_ERROR, |
"The document does not fit to the specified grammar"); |
/* Not valid -> Print an error message. */ |
else { |
logInterface.log(LogInterface.TYPE_ERROR, |
"The document does not fit to the specified grammar"); |
} |
/* No grammar -> Print an error message. */ |
} else { |
logInterface.log(LogInterface.TYPE_ERROR, "No grammar specified."); |
} |
/* No grammar -> Print an error message. */ |
} else { |
logInterface.log(LogInterface.TYPE_ERROR, "No grammar specified."); |
} |
} |
} |
/sun/xmleditor/trunk/src/gui/GUI.java |
---|
4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.88 $ |
* @version $Revision: 1.89 $ |
* |
* Last modification: $Date: 2003/07/28 11:42:20 $ |
* $Id: GUI.java,v 1.88 2003/07/28 11:42:20 swalkenh Exp $ |
* Last modification: $Date: 2003/07/28 13:21:40 $ |
* $Id: GUI.java,v 1.89 2003/07/28 13:21:40 smcsporr Exp $ |
*/ |
package src.gui; |
21,6 → 21,7 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.awt.event.ItemListener; |
import java.awt.event.KeyEvent; |
import java.awt.event.WindowEvent; |
import java.awt.event.WindowListener; |
51,7 → 52,7 |
* |
* @author group 5 |
* |
* @version $Revision: 1.88 $ Last modification: $Date: 2003/07/28 11:42:20 $ |
* @version $Revision: 1.89 $ Last modification: $Date: 2003/07/28 13:21:40 $ |
*/ |
public class GUI |
extends JFrame implements GuiInterface, WindowListener { |
112,11 → 113,12 |
/** The required event listeners. */ |
private ActionListener otherGUIListener; |
private ActionListener validatorListener; |
//private ActionListener validatorListener; |
private ActionListener docManager; |
private ActionListener updateViewListener; |
private ActionListener pluginManager; |
private ChangeListener docManagerCL; |
private ItemListener validatorListener; |
/* A reference variable to the document manager. */ |
private DocumentManagerInterface docMaster; |
325,7 → 327,7 |
/* Help text for auto validation feature. */ |
autoValidate.setToolTipText("select to enable auto validation"); |
/* Register auto validation button events with docManager. */ |
autoValidate.addActionListener(docManager); |
autoValidate.addItemListener(validatorListener); |
documentMenu.add(autoValidate); |
documentMenu.addSeparator(); |
647,11 → 649,13 |
public void setInterfaces(ActionListener otherGuiThings, |
ActionListener duocManager, ActionListener updateViewListenerParam, |
ActionListener newPluginManager, |
ChangeListener chList,DocumentManagerInterface docManInt) { |
ChangeListener chList,DocumentManagerInterface docManInt, |
ItemListener validatorInt) { |
otherGUIListener= otherGuiThings; |
docManager= duocManager; |
updateViewListener = updateViewListenerParam; |
validatorListener = validatorInt; |
pluginManager = newPluginManager; |
docManagerCL = chList; |
docMaster= docManInt; |
/sun/xmleditor/trunk/src/parser/Validator.java |
---|
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 |