4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.54 $ |
* @version $Revision: 1.55 $ |
* |
* Last modification: $Date: 2003/07/25 11:48:51 $ |
* $Id: UpdateView.java,v 1.54 2003/07/25 11:48:51 hjokusch Exp $ |
* Last modification: $Date: 2003/07/26 10:49:32 $ |
* $Id: UpdateView.java,v 1.55 2003/07/26 10:49:32 smcsporr Exp $ |
*/ |
|
package src.gui; |
46,7 → 46,7 |
* |
* @author Christian Stollenwerk |
* |
* @version $Revision: 1.54 $ Last modification: $Date: 2003/07/25 11:48:51 $ |
* @version $Revision: 1.55 $ Last modification: $Date: 2003/07/26 10:49:32 $ |
*/ |
public class UpdateView implements ActionListener, UpdateViewInterface, |
OurEventListener, TreeModelListener, TreeExpansionListener, TreeSelectionListener { |
127,14 → 127,14 |
|
public TreePath getActualSelectedPath() { |
|
treeVisibleList = documentManagerInterface.getActualVisibleTree(); |
treeVisibleList = documentManagerInterface.getActualVisibleTree(); |
|
if(treeVisibleList.size() != 0) { |
int selectedRow=((Integer)treeVisibleList.getFirst()).intValue(); |
return newPopUpJTree.getPathForRow(selectedRow-1); // -1 because root is not visible |
}else{ |
return null; |
} |
if(treeVisibleList.size() != 0) { |
int selectedRow=((Integer)treeVisibleList.getFirst()).intValue(); |
return newPopUpJTree.getPathForRow(selectedRow-1); // -1 because root is not visible |
} else { |
return null; |
} |
} |
|
|
147,16 → 147,13 |
|
if(documentManagerInterface.getOpenDocumentList().isEmpty()) { |
gui.setTreeVisible(false); |
} |
else { |
|
} else { |
|
dividerPosition = gui.getDivider(); |
gui.setTreeVisible(true); |
if(documentManagerInterface.getExpression() != "") { |
isFiltered = true; |
} |
else { |
} else { |
isFiltered = false; |
} |
// checks if an XPath-expression is set |
185,6 → 182,7 |
|
gui.setTree(newPopUpJTree); |
} |
|
// if no XPath-expression is set create a normal tree out of the actual document |
else { |
newTreeModel = |
195,8 → 193,6 |
newPopUpJTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); |
newPopUpJTree.setShowsRootHandles(true); |
|
|
|
// set the elements visible, which have been visible before |
treeVisibleList = documentManagerInterface.getActualVisibleTree(); |
|
223,7 → 219,7 |
} |
|
newPopUpJTree.setRootVisible(false); |
//added 070703 Sascha W. |
|
TreeSelectionListener hui = pluginManagerInterface.getTreeSelectionListener(); |
newPopUpJTree.setTreeSelectionListener(hui); |
newPopUpJTree.setTreeSelectionListener(this); |
238,17 → 234,6 |
} |
|
/** |
* Method returns the actual tree. |
*/ |
/*public Document getActualTree() { |
//filter tree view (from Christian) |
ViewFilter viewFilter = new ViewFilter(); |
viewFilter.filter((DOMSource)document, expression); |
|
return Document; |
}*/ |
|
/** |
* This method sets an internal reference to the GUI. |
* |
* @param g: An object compliant to src.gui.GuiInterface. |
316,10 → 301,6 |
); |
} |
|
|
|
|
|
/* (non-Javadoc) |
* @see javax.swing.event.TreeModelListener#treeNodesChanged(javax.swing.event.TreeModelEvent) |
*/ |
398,17 → 379,28 |
|
} |
|
// TODO comments |
private void validate() { |
/* Check if the document is valid. */ |
src.parser.Validator validator = new src.parser.Validator(logInterface, gui.getStatusInterface()); |
if (validator.validateDocument(documentManagerInterface.getActualDocument(), |
documentManagerInterface.getActualDocumentFile())) { |
|
/* 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"); |
} |
} |
|
/* If not, 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."); |
} |
} |
} |