Thread: [Jsxe-cvs] SF.net SVN: jsxe: [901] branches/jsxe2
Status: Inactive
Brought to you by:
ian_lewis
|
From: <ian...@us...> - 2006-06-05 23:51:26
|
Revision: 901 Author: ian_lewis Date: 2006-06-03 23:06:10 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=901&view=rev Log Message: ----------- added XMLElement to model element nodes Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-06-04 01:54:23 UTC (rev 900) +++ branches/jsxe2/Changelog 2006-06-04 06:06:10 UTC (rev 901) @@ -1,3 +1,7 @@ +06/04/2006 Ian Lewis <Ian...@me...> + + * XMLElement was added to model element nodes + 06/03/2006 Ian Lewis <Ian...@me...> * Added the XMLException class for use in handling XML errors Added: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java 2006-06-04 06:06:10 UTC (rev 901) @@ -0,0 +1,62 @@ +/* +XMLElement.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom; + +//{{{ Imports +import java.util.HashMap; +//}}} + +/** + * The XMLElement class represents an element in the XMLDocument tree. It allows + * attibute modifications which will translate to text modifications in the + * XMLDocument. + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @since jsXe 0.5 pre1 + */ +public class XMLElement extends XMLNode { + + //{{{ XMLElement constructor + /** + * Creates a new XMLElement + * @param document the document that owns this element + */ + XMLElement(XMLDocument document) { + m_attributes = new HashMap(); + }//}}} + + //{{{ getAttributes() + /** + * Returns a HashMap of attribute names to XMLAttribute objects. + */ + public HashMap getAttributes() { + return m_attributes; + }//}}} + + //{{{ Private Members + private HashMap m_attributes; + //}}} +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java ___________________________________________________________________ Name: svn:executable + * Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-04 01:54:23 UTC (rev 900) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-04 06:06:10 UTC (rev 901) @@ -43,7 +43,7 @@ /** * <p>The XMLNode class is meant to represent an XMLNode in a XMLDocument tree * but also as a section of text within that document tree. It - * allows tree and attribute modifications only, however these modifications + * allows tree modifications only, however these modifications * will correspond to text modifications to the XMLDocument. Direct text * modifications are only allowed at the XMLDocument level.</p> * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-06-06 01:31:26
|
Revision: 899 Author: ian_lewis Date: 2006-06-03 18:53:46 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=899&view=rev Log Message: ----------- Added the XMLNodeListener class for use in notifying objects concerning changes to nodes Updated the XMLNode class to have a simple implementation of an XML Node editing interface AdapterNode and AdapterNodeListener are now deprecated Updated the Changelog Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/Changelog 2006-06-04 01:53:46 UTC (rev 899) @@ -1,3 +1,8 @@ +06/03/2006 Ian Lewis <Ian...@me...> + + * Added the XMLException class for use in handling XML errors + * Updated the XMLNode class to support a simple interface for Node editing. + 06/01/2006 Ian Lewis <Ian...@me...> * Added insertUpdate and removeUpdate methods to the XMLDocumentListener Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-06-04 01:53:46 UTC (rev 899) @@ -62,6 +62,7 @@ * @version $Id$ * @see XMLDocument * @see XMLDocument#addAdapterNode(AdapterNode, String, String, short) + * @deprecated */ public class AdapterNode { Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java 2006-06-04 01:53:46 UTC (rev 899) @@ -46,6 +46,9 @@ //}}} +/** + * @deprecated + */ public interface AdapterNodeListener { //{{{ nodeAdded() Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-04 01:53:46 UTC (rev 899) @@ -31,6 +31,7 @@ import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; import net.sourceforge.jsxe.dom.completion.*; +import net.sourceforge.jsxe.gui.Messages; //}}} //{{{ Java Base Classes @@ -119,7 +120,7 @@ * <p>Adds an XMLNodeListener to be notified when this node changes</p> * @param listener the listener to add */ - public void addAdapterNodeListener(XMLNodeListener listener) { + public void addXMLNodeListener(XMLNodeListener listener) { m_listeners.add(listener); }//}}} @@ -128,7 +129,7 @@ * <p>Removes a listener from this node if it exists</p> * @param listener the listener to remove */ - public void removeAdapterNodeListener(XMLNodeListener listener) { + public void removeXMLNodeListener(XMLNodeListener listener) { m_listeners.remove(m_listeners.indexOf(listener)); }//}}} @@ -194,23 +195,24 @@ * @param type the type of the new child node * @param index the index where to add the new child node. * @return the new child that was created - * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified name + * @throws XMLException INVALID_CHARACTER_ERR: Raised if the specified name * or value contains an illegal character. - * @throws DOMException NOT_SUPPORTED_ERR: Raised if the node type is not + * @throws XMLException NOT_SUPPORTED_ERR: Raised if the node type is not * supported. - * @throws DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a + * @throws XMLException HIERARCHY_REQUEST_ERR: Raised if this node is of a * type that does not allow children of the type of the * newChild node, or if the node to append is one of this * node's ancestors or this node itself. - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly or if the previous parent of the node being * inserted is readonly. */ - public XMLNode addAdapterNode(String name, String value, short type, int index) throws DOMException { + public XMLNode addChildNode(String name, String value, short type, int index) throws XMLException { //TODO: error checking //TODO: update the XMLDocument text //TODO: create node and add it to m_children. //TODO: notify listeners that the document has changed. + return null; }//}}} //{{{ addChildNode() @@ -219,22 +221,22 @@ * is added after all child nodes that this node contains. * @param node the node to be added. * @return a reference to the node that was added. - * @throws DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a + * @throws XMLException HIERARCHY_REQUEST_ERR: Raised if this node is of a * type that does not allow children of the type of the * newChild node, or if the node to append is one of this * node's ancestors or this node itself. - * @throws DOMException WRONG_DOCUMENT_ERR: Raised if newChild was created + * @throws XMLException WRONG_DOCUMENT_ERR: Raised if newChild was created * from a different document than the one that created * this node. - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly or if the previous parent of the node being * inserted is readonly. */ - public XMLNode addXMLNode(XMLNode node) throws DOMException { + public XMLNode addChildNode(XMLNode node) throws XMLException { //TODO: error checking //TODO: updated XMLDocument text //TODO: update listeners that the doc has changed - m_children.add(node); + return addChildNodeAt(node, getChildCount()); }//}}} //{{{ addChildNodeAt() @@ -248,47 +250,47 @@ * @param node the node to add to this parent node. * @param index the index to add it at. * @return the node added. - * @throws DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a + * @throws XMLException HIERARCHY_REQUEST_ERR: Raised if this node is of a * type that does not allow children of the type of the * newChild node, or if the node to append is one of this * node's ancestors or this node itself. - * @throws DOMException WRONG_DOCUMENT_ERR: Raised if newChild was created + * @throws XMLException WRONG_DOCUMENT_ERR: Raised if newChild was created * from a different document than the one that created * this node. - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly or if the previous parent of the node being * inserted is readonly. */ - public XMLNode addChildNodeAt(XMLNode node, int index) throws DOMException { + public XMLNode addChildNodeAt(XMLNode node, int index) throws XMLException { //TODO: error checking //TODO: updated XMLDocument text //TODO: update listeners that the doc has changed - m_children.add(index, node); + if (index >= 0 && index < getChildCount()) { + m_children.add(index, node); + } else { + if (index == getChildCount()) { + m_children.add(node); + } else { + throw new XMLException(XMLException.INDEX_SIZE_ERR, Messages.getMessage("Index.Out.Of.Bounds.Error")); + } + } + return node; }//}}} //{{{ remove() /** * <p>Removes a child from this node.</p> * @param child the child node to remove from this node - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly. - * @throws DOMException NOT_FOUND_ERR: Raised if oldChild is not + * @throws XMLException NOT_FOUND_ERR: Raised if oldChild is not * a child of this node. */ - public void remove(XMLNode child) throws DOMException { - if (child != null) { - if (getNodeType() == DOCUMENT_NODE && getNodeType() == Node.ELEMENT_NODE) { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "You cannot remove the root element node."); - } - if (child.getNodeType() != Node.DOCUMENT_TYPE_NODE) { - m_domNode.removeChild(child.getNode()); - m_children.remove(child); - child.setParent(null); - fireNodeRemoved(this, child); - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes"); - } - } + public void remove(XMLNode child) throws XMLException { + //TODO: error checking + //TODO: updated XMLDocument text + //TODO: update listeners that the doc has changed + m_children.remove(child); }//}}} //{{{ getNodeName() @@ -314,14 +316,14 @@ /** * <p>Sets the local name of the node.</p> * @param newValue the new local name for this node - * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified name + * @throws XMLException INVALID_CHARACTER_ERR: Raised if the specified name * contains an illegal character. */ - public void setLocalName(String localName) throws DOMException { + public void setLocalName(String localName) throws XMLException { //checking for illegal characters etc will be done by subclasses. - m_localName = localName; //TODO: Notify listeners that the local name has changed //TODO: Update XMLDocument text with the change. + m_localName = localName; }//}}} //{{{ getNSPrefix() @@ -339,12 +341,12 @@ * Sets the namespace prefix for this node. To remove this node from a * namespace this method should be passed null. * @param prefix The new prefix for this node - * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified + * @throws XMLException INVALID_CHARACTER_ERR: Raised if the specified * prefix contains an illegal character, per the * XML 1.0 specification . - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly. - * @throws DOMException NAMESPACE_ERR: Raised if the specified prefix is + * @throws XMLException NAMESPACE_ERR: Raised if the specified prefix is * malformed per the Namespaces in XML specification, * if the namespaceURI of this node is null, if the * specified prefix is "xml" and the namespaceURI of @@ -356,11 +358,11 @@ * an attribute and the qualifiedName of this node is * "xmlns" . */ - public void setNSPrefix(String prefix) throws DOMException { + public void setNSPrefix(String prefix) throws XMLException { //TODO: Error checking - m_namespacePrefix = prefix; //TODO: Notify listeners that the namespaces has changed //TODO: Updated XMLDocument text with the change + m_namespacePrefix = prefix; }//}}} //{{{ getProperty() Added: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java 2006-06-04 01:53:46 UTC (rev 899) @@ -0,0 +1,39 @@ +/* +XMLNodeListener.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom; + +/** + * XMLNodeListener is used to notify objects of a change to a specific XMLNode. + * These changes can occur via changes to the text or document structure. Both + * are maintained by the XMLDocument class. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre1 + * @see XMLDocument + */ +public interface XMLNodeListener { + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-08 18:22:22
|
Revision: 1003 Author: ian_lewis Date: 2006-07-08 11:22:12 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1003&view=rev Log Message: ----------- Added a new XMLDocumentType class Added factory methods for XMLElements and XMLAttributes to the XMLDocument class. Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-08 15:57:53 UTC (rev 1002) +++ branches/jsxe2/Changelog 2006-07-08 18:22:12 UTC (rev 1003) @@ -5,6 +5,9 @@ * Created an new XMLDocument class. * Made use of the DOM events model to allow users to register DOM event listeners. + * Added a new XMLDocumentType class + * Added factory methods for XMLElements and XMLAttributes to the + XMLDocument class. 06/04/2006 Ian Lewis <Ian...@me...> Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 15:57:53 UTC (rev 1002) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 18:22:12 UTC (rev 1003) @@ -58,9 +58,12 @@ * provided to allow user objects to interact with the XML document as text * or as a tree structure seamlessly. * + * Properties of XMLDocuments are saved by jsXe as string values. And are loaded + * later when if the document was loaded recently. + * * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id: XMLDocument.java 999 2006-07-07 20:59:23Z ian_lewis $ - * @see AdapterNode + * @see XMLNode */ public class XMLDocument /* implements javax.swing.text.Document */ { @@ -217,7 +220,13 @@ }//}}} //{{{ putProperty() - + /** + * Add a property to the XMLDocument. + * They are saved in memory as objects however, jsXe saves properties as + * Strings when saving the Document to the recent buffers file, and when + * the document is opened later the property will be loaded as a String. + * Generally String properties are stored here. + */ public void putProperty(Object key, Object value) { m_properties.put(key, value); }//}}} @@ -261,6 +270,45 @@ //}}} + //{{{ getDocumentType() + + public XMLDocumentType getDocumentType() { + DocumentType docType = m_document.getDocType(); + if (docType != null) { + return (XMLDocumentType)docType.getUserData(USER_DATA_KEY); + } else { + return null; + } + }//}}} + + //{{{ getProperties() + + public Map getProperties() { + return m_properties; + }//}}} + + //{{{ Node Factory methods + + //{{{ newElementNode() + /** + * Create a new XMLElement node with the given name. + * @param name the qualified name of the new node. + */ + public XMLElement newElementNode(String name) throws DOMException { + return new XMLElement(m_document.createElementNS("", name)); + }//}}} + + //{{{ newAttributeNode() + /** + * Create a new XMLAttribute node with the given name. + * @param name the qualified name of the new node. + */ + public XMLAttribute newAttributeNode(String name) throws DOMException { + return new XMLAttribute(m_document.createAttributeNS("", name)); + }//}}} + + //}}} + //{{{ Private members //{{{ ContentManager class Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java 2006-07-08 18:22:12 UTC (rev 1003) @@ -0,0 +1,77 @@ +/* +XMLDocumentType.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +//{{{ Imports + +//{{{ Swing classes +import javax.swing.text.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.*; +import org.w3c.dom.events.*; +//}}} + +//}}} + +/** + * XMLDocumentType represents a Document Type node in an XML Document. + * It is generated from the DTD and contains element, attribute and entity + * delarations.. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + */ +public class XMLDocumentType extends XMLNode { + + //{{{ XMLDocumentType constructor + /** + * Creates a new Document Type node. + * @param docType the DocumentType node that this node wraps + */ + XMLDocumentType(DocumentType docType) { + super(docType); + }//}}} + + //{{{ getPublicId() + /** + * The system identifier of the external subset. + * This may be an absolute URI or not. + */ + public String getPublicId() { + return ((DocumentType)getNode()).getPublicId(); + }//}}} + + //{{{ getPublicId() + /** + * The public identifier of the external subset. + */ + public String getSystemId() { + return ((DocumentType)getNode()).getSystemId(); + }//}}} + +} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 15:57:53 UTC (rev 1002) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 18:22:12 UTC (rev 1003) @@ -60,7 +60,7 @@ */ public abstract class XMLNode /* implements javax.swing.text.Element */ { - static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; + protected static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; //{{{ Private members This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-20 21:55:22
|
Revision: 1045 Author: ian_lewis Date: 2006-07-20 14:55:13 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1045&view=rev Log Message: ----------- dom2 package can now be compiled. Xerces 2.8.0 needs to be installed in the java endorsed dir now Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/build.xml branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/Changelog 2006-07-20 21:55:13 UTC (rev 1045) @@ -1,3 +1,8 @@ +07/20/2006 Ian Lewis <Ian...@me...> + + * Xerces needs to be installed in the java endorsed directory now to make + use of DOM3 classes. + 06/08/2006 Ian Lewis <Ian...@me...> * XMLAttribute was added to the new data model. Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/build.xml 2006-07-20 21:55:13 UTC (rev 1045) @@ -59,7 +59,8 @@ <!--<property name="app_version" value="${major.version}_${minor.version}beta"/>--> <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> - <path id="classpath"> + + <path id="classpath"> <pathelement location="."/> <pathelement location="${build.dest}"/> <pathelement location="${build.src}"/> @@ -132,7 +133,7 @@ <mkdir dir="${build.dest}"/> <javac debug="${javac.debug}" deprecation="${javac.deprecation}" includeJavaRuntime="${javac.include.runtime}" optimize="${javac.optimize}" source="${javac.source}" destdir="${build.dest}" srcdir="${build.src}"> <classpath refid="classpath"/> - <include name="**/*.java"/> + <include name="**/*.java"/> </javac> <copy todir="${build.dest}"> <fileset dir="${build.src}"> Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java 2006-07-20 21:55:13 UTC (rev 1045) @@ -71,7 +71,7 @@ //{{{ isId() public boolean isId() { - return ((Attr)getNode()).getId(); + return ((Attr)getNode()).isId(); }//}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-20 21:55:13 UTC (rev 1045) @@ -41,6 +41,7 @@ import java.io.IOException; import java.io.Writer; import java.util.ArrayList; +import java.util.Map; import java.util.HashMap; //}}} @@ -273,9 +274,9 @@ //{{{ getDocumentType() public XMLDocumentType getDocumentType() { - DocumentType docType = m_document.getDocType(); + DocumentType docType = m_document.getDoctype(); if (docType != null) { - return (XMLDocumentType)docType.getUserData(USER_DATA_KEY); + return (XMLDocumentType)docType.getUserData(XMLNode.USER_DATA_KEY); } else { return null; } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-20 21:55:13 UTC (rev 1045) @@ -26,6 +26,10 @@ //{{{ Imports +//{{{ jsXe classes +import net.sourceforge.jsxe.util.MiscUtilities; +//}}} + //{{{ Swing classes import javax.swing.text.*; //}}} @@ -35,8 +39,14 @@ import org.w3c.dom.events.*; //}}} +//{{{ Java classes +import java.util.ArrayList; +import java.util.List; +import java.util.Map; //}}} +//}}} + /** * The XMLElement class represents an element in the XMLDocument tree. It allows * attibute modifications which will translate to text modifications in the @@ -103,7 +113,7 @@ * @param name the qualified name of the attribute */ public XMLAttribute getAttribute(String name) { - Element element = (org.w3c.dom.Element)getNode(); + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String localName = MiscUtilities.getLocalNameFromQualifiedName(name); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); @@ -122,7 +132,7 @@ * @param value the value of the attribute */ public XMLAttribute setAttribute(String name, String value) throws DOMException { - Element element = (org.w3c.dom.Element)getNode(); + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); Attr newAttr; @@ -139,7 +149,7 @@ String uri = lookupNamespaceURI(prefix); element.setAttributeNS(uri,name,value); - newAttr = getAttributeNodeNS(uri, name, value); + newAttr = element.getAttributeNodeNS(uri, name); } else { /* setAttribute doesn't throw an error if the first character is @@ -150,13 +160,13 @@ throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character"); } element.setAttribute(name, value); - newAttr = getAttributeNode(name, value); + newAttr = element.getAttributeNode(name); } //create an XMLAttribute node for the new attribute if (newAttr != null) { - xmlAttr = new XMLAttribute(attr); - attr.setUserData(USER_DATA_KEY, xmlAttr, null); + XMLAttribute xmlAttr = new XMLAttribute(newAttr); + newAttr.setUserData(USER_DATA_KEY, xmlAttr, null); return xmlAttr; } return null; @@ -177,12 +187,13 @@ /** * @param index the index at which to remove an attribute. */ - public removeAttributeAt(int index) throws DOMException { - Element element = (org.w3c.dom.Element)getNode(); + public XMLAttribute removeAttributeAt(int index) throws DOMException { + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); NamedNodeMap attrs = element.getAttributes(); if (attrs != null) { - removeAttribute(attrs.item(index).getNodeName()); + return removeAttribute(attrs.item(index).getNodeName()); } + return null; }//}}} //{{{ removeAttribute() @@ -190,7 +201,7 @@ * @param name The qualified name of the attribute. */ public XMLAttribute removeAttribute(String name) throws DOMException { - Element element = (org.w3c.dom.Element)getNode(); + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); String localName = MiscUtilities.getLocalNameFromQualifiedName(name); @@ -227,15 +238,22 @@ } } + XMLAttribute attr; + if (prefix != null && !prefix.equals("")) { - element.removeAttributeNS(lookupNamespaceURI(prefix),localName); + String uri = lookupNamespaceURI(prefix); + attr = (XMLAttribute)element.getAttributeNodeNS(uri, localName).getUserData(USER_DATA_KEY); + element.removeAttributeNS(uri,localName); } else { + attr = (XMLAttribute)element.getAttributeNode(localName).getUserData(USER_DATA_KEY); element.removeAttribute(localName); } + + return attr; }//}}} //{{{ getNodeType() - public int getNodeType() { + public short getNodeType() { return Node.ELEMENT_NODE; }//}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-24 20:18:29
|
Revision: 1061 Author: ian_lewis Date: 2006-07-24 13:18:20 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1061&view=rev Log Message: ----------- Added XMLText and XMLComment node types Modified Paths: -------------- branches/jsxe2/RELEASE.CHECKLIST Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java Modified: branches/jsxe2/RELEASE.CHECKLIST =================================================================== --- branches/jsxe2/RELEASE.CHECKLIST 2006-07-24 20:09:47 UTC (rev 1060) +++ branches/jsxe2/RELEASE.CHECKLIST 2006-07-24 20:18:20 UTC (rev 1061) @@ -1,7 +1,36 @@ RELEASE CHECKLIST +*********Minor release********* + +* Update the Changelog file +* Update the NEWS file +* Update the README if needed +* Update the AUTHORS if needed +* Update the INSTALL file if needed +* Update the README if needed + +* Make a new tag in SVN for the release. + +* Update the jsXe website in SVN to reference the new versions +* Update the jsXe website in SVN to have the correct help and documentation. + * Run 'ant deploy-web-doc' + +Build the project + * Make sure the major.version, minor.version, beta.version, bugfix.version, + app.version, and app_version are correct in build.xml + * Build the release files using 'ant bin src' + +* Create new release on sourceforge + * Upload binary and source distribution to Sourceforge + * Add the NEWS and Changelog entries to the release. +* Update the News on the sourceforge project page. +* Update the freshmeat project with the new version and URLs. + +*********Major release********* + * Get translations finalized * Build the Java Doc and check it for omissions and errors. +* Make sure all bugs that have a priority above 5 are resolved. * Update the Changelog file * Update the NEWS file @@ -9,8 +38,11 @@ * Update the AUTHORS if needed * Update the INSTALL file if needed * Update the README if needed -* Update the jsXe website in CVS to reference the new versions -* Update the jsXe website in CVS to have the correct help and documentation. + +* Make a new tag in SVN for the release. + +* Update the jsXe website in SVN to reference the new versions +* Update the jsXe website in SVN to have the correct help and documentation. * Run 'ant deploy-web-doc' Build the project Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java 2006-07-24 20:18:20 UTC (rev 1061) @@ -0,0 +1,36 @@ +/* +XMLComment.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +import org.w3c.dom.*; + +public class XMLComment extends XMLCharacterData { + + //{{{ XMLComment constructor + XMLComment(Comment comment) { + super(comment); + }//}}} + +} \ No newline at end of file Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java 2006-07-24 20:18:20 UTC (rev 1061) @@ -0,0 +1,36 @@ +/* +XMLText.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +import org.w3c.dom.*; + +public class XMLText extends XMLCharacterData { + + //{{{ XMLText constructor + XMLText(Text text) { + super(text); + }//}}} + +} \ No newline at end of file Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-26 19:53:45
|
Revision: 1072 Author: ian_lewis Date: 2006-07-26 12:29:32 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1072&view=rev Log Message: ----------- added support for error nodes Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/messages/messages.en branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/Changelog 2006-07-26 19:29:32 UTC (rev 1072) @@ -1,3 +1,11 @@ +07/26/2006 Ian Lewis <Ian...@me...> + + * Added support for error nodes in the new data model + +07/25/2006 Ian Lewis <Ian...@me...> + + * Added support for the read only attribute + 07/24/2006 Ian Lewis <Ian...@me...> * Added the XMLText, XMLComment, and XMLProcessingInstruction node Modified: branches/jsxe2/messages/messages.en =================================================================== --- branches/jsxe2/messages/messages.en 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/messages/messages.en 2006-07-26 19:29:32 UTC (rev 1072) @@ -21,6 +21,8 @@ common.paste=Paste common.find=Find... common.findnext=Find Next +common.error=Error +common.warning=Warning #}}} @@ -123,10 +125,15 @@ No.Xerces.Error={0} not found. jsXe requires Apache {0}. No.Xerces.Error.Title={0} not found. IO.Error.Title=I/O Error + +#{{{ XML Messages +XML.Read.Only.Node=You cannot modify this node. The node is read only. #}}} #}}} +#}}} + #{{{ Dialogs #{{{ Download resource dialog Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -24,6 +24,8 @@ package net.sourceforge.jsxe.dom2; +import net.sourceforge.jsxe.gui.Messages; + import org.w3c.dom.*; public abstract class XMLCharacterData extends XMLNode { @@ -35,16 +37,25 @@ //{{{ appendData() public void append(String data) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } ((CharacterData)getNode()).appendData(data); }//}}} //{{{ deleteData() public void deleteData(int offset, int len) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } ((CharacterData)getNode()).deleteData(offset, len); }//}}} //{{{ insertData() public void insertData(int offset, String data) { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } ((CharacterData)getNode()).insertData(offset, data); }//}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -71,7 +71,7 @@ * @version $Id: XMLDocument.java 999 2006-07-07 20:59:23Z ian_lewis $ * @see XMLNode */ -public class XMLDocument /* implements javax.swing.text.Document */ { +public class XMLDocument implements javax.swing.text.Document { //{{{ XMLDocument defined properties /** @@ -160,7 +160,7 @@ Iterator propertyNames = properties.keySet().iterator(); while (propertyNames.hasNext()) { Object key = propertyNames.next(); - setProperty(key, properties.get(key)); + putProperty(key, properties.get(key)); } } @@ -419,6 +419,26 @@ return m_document.getXmlStandalone(); }//}}} + //{{{ isReadOnly() + /** + * Returns whether this document is currently read only. + */ + public boolean isReadOnly() { + return m_readOnly; + }//}}} + + //{{{ setReadOnly() + /** + * Sets this document to read only. Any attempts + * to change any attribute of this document or + * child nodes of this document will result in + * DOMExceptions being thrown. + * @param readOnly the value of the readOnly property + */ + public void setReadOnly(boolean readOnly) { + m_readOnly = readOnly; + }//}}} + //{{{ Node Factory methods //{{{ newElementNode() @@ -439,18 +459,28 @@ return new XMLAttribute(m_document.createAttributeNS("", name)); }//}}} + //{{{ newErrorNode() + /** + * Creates a new error node. + * @param message the error message + * @param warning true if the node is a warning, false if it's an error + */ + public XMLError newErrorNode(String message, boolean warning) { + return new XMLError(this, null, message, warning); + }//}}} + //}}} //{{{ Private members //{{{ setDefaultProperties() private void setDefaultProperties() { - setProperty(FORMAT_XML, "false"); - setProperty(IS_USING_SOFT_TABS, "false"); - setProperty(WS_IN_ELEMENT_CONTENT, "true"); - setProperty(ENCODING, "UTF-8"); - setProperty(INDENT, "4"); - setProperty(IS_VALIDATING, "false"); + putProperty(FORMAT_XML, "false"); + putProperty(IS_USING_SOFT_TABS, "false"); + putProperty(WS_IN_ELEMENT_CONTENT, "true"); + putProperty(ENCODING, "UTF-8"); + putProperty(INDENT, "4"); + putProperty(IS_VALIDATING, "false"); }//}}} //{{{ ContentManager class @@ -692,6 +722,8 @@ * in this document. */ private EntityResolver m_entityResolver; + + private boolean m_readOnly; //}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -27,6 +27,7 @@ //{{{ Imports //{{{ jsXe classes +import net.sourceforge.jsxe.gui.Messages; import net.sourceforge.jsxe.util.MiscUtilities; //}}} @@ -175,6 +176,9 @@ //{{{ setAttribute() public XMLAttribute setAttribute(XMLAttribute attr) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } /* TODO: test how this works. Will I need to check for a namespace and call setAttributeNode() instead if there is none? @@ -188,6 +192,10 @@ * @param index the index at which to remove an attribute. */ public XMLAttribute removeAttributeAt(int index) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); NamedNodeMap attrs = element.getAttributes(); if (attrs != null) { @@ -201,6 +209,10 @@ * @param name The qualified name of the attribute. */ public XMLAttribute removeAttribute(String name) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -28,6 +28,7 @@ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.gui.Messages; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.dom.completion.*; //}}} @@ -41,6 +42,8 @@ import javax.swing.text.*; //}}} +import java.util.ArrayList; + //}}} /** @@ -58,10 +61,55 @@ * @see XMLDocument * @since jsXe 0.5 pre2 */ -public abstract class XMLNode /* implements javax.swing.text.Element */ { +public abstract class XMLNode implements javax.swing.text.Element { protected static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; + /** + * The node is an Attr. + */ + public static short ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE; + /** + * The node is a CDATASection. + */ + public static short CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE; + /** + * The node is a Comment. + */ + public static short COMMENT_NODE = Node.COMMENT_NODE; + /** + * The node is a DocumentType. + */ + public static short DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE; + /** + * The node is an Element. + */ + public static short ELEMENT_NODE = Node.ELEMENT_NODE; + /** + * The node is an Entity. + */ + public static short ENTITY_NODE = Node.ENTITY_NODE; + /** + * The node is an EntityReference. + */ + public static short ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE; + /** + * The node is a Notation. + */ + public static short NOTATION_NODE = Node.NOTATION_NODE; + /** + * The node is a ProcessingInstruction. + */ + public static short PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE; + /** + * The node is a Text node. + */ + public static short TEXT_NODE = Node.TEXT_NODE; + /** + * The node is an Error node. + */ + public static short ERROR_NODE = Short.MAX_VALUE; + //{{{ Private members /** @@ -70,13 +118,21 @@ */ private Node m_domNode; + /** + * Used to keep track of children and XMLError nodes and keep them + * in the correct order. + */ + private ArrayList m_children = new ArrayList(); + //}}} //{{{ XMLNode constructor XMLNode(Node node) { m_domNode = node; //TODO: add UserDataHandler - m_domNode.setUserData(USER_DATA_KEY, this, null); + if (m_domNode != null) { + m_domNode.setUserData(USER_DATA_KEY, this, null); + } }//}}} //{{{ javax.swing.text.Element methods @@ -102,15 +158,22 @@ //{{{ getElement() public javax.swing.text.Element getElement(int index) { - return (javax.swing.text.Element)m_domNode.getChildNodes().item(index).getUserData(USER_DATA_KEY); + return (javax.swing.text.Element)m_children.get(index); }//}}} //{{{ getElementCount() public int getElementCount() { - return m_domNode.getChildNodes().getLength(); + return m_children.size(); }//}}} + //{{{ getElementIndex() + + public int getElementIndex(int offset) { + //TODO: implement offsets + return 0; + }//}}} + //{{{ getEndOffset() public int getEndOffset() { @@ -133,7 +196,7 @@ public javax.swing.text.Element getParentElement() { return (javax.swing.text.Element)m_domNode.getParentNode().getUserData(USER_DATA_KEY); - }//}}} + }//}}} //{{{ getStartOffset() @@ -163,8 +226,24 @@ //{{{ appendNode() public XMLNode appendNode(XMLNode newChild) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } - m_domNode.appendChild(newChild.getNode()); + if (newChild != null) { + if (!(newChild instanceof XMLError)) { + XMLNode parent = (XMLNode)newChild.getParentElement(); + if (parent != null) { + parent.removeNode(newChild); + } + ((XMLError)newChild).setParent(this); + } + + m_children.add(newChild); + if (!(newChild instanceof XMLError)) { + m_domNode.appendChild(newChild.getNode()); + } + } return newChild; }//}}} @@ -202,7 +281,24 @@ //{{{ insertNode() public XMLNode insertNode(XMLNode node, int index) throws DOMException { - m_domNode.insertBefore(node.getNode(), m_domNode.getChildNodes().item(index)); + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + + if (node != null) { + if (!(node instanceof XMLError)) { + XMLNode parent = (XMLNode)node.getParentElement(); + if (parent != null) { + parent.removeNode(node); + } + ((XMLError)node).setParent(this); + } + + m_children.add(index, node); + if (!(node instanceof XMLError)) { + m_domNode.insertBefore(node.getNode(), m_domNode.getChildNodes().item(index)); + } + } return node; }//}}} @@ -215,21 +311,40 @@ //{{{ removeNode() public XMLNode removeNode(XMLNode child) throws DOMException { - Node childNode = child.getNode(); - m_domNode.removeChild(childNode); - childNode.setUserData(USER_DATA_KEY, null, null); + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + + if (child != null) { + m_children.remove(child); + if (!(child instanceof XMLError)) { + Node childNode = child.getNode(); + m_domNode.removeChild(childNode); + childNode.setUserData(USER_DATA_KEY, null, null); + } else { + ((XMLError)child).setParent(null); + } + } return child; }//}}} //{{{ setValue() public void setValue(String value) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + m_domNode.setNodeValue(value); }//}}} //{{{ setNSPrefix() public void setNSPrefix(String prefix) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + m_domNode.setPrefix(prefix); }//}}} @@ -238,6 +353,10 @@ * @param name the qualified name of the node. */ public void setName(String name) { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + m_domNode = m_domNode.getOwnerDocument().renameNode(m_domNode, m_domNode.getNamespaceURI(), name); }//}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-27 18:02:29
|
Revision: 1078 Author: ian_lewis Date: 2006-07-27 11:02:07 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1078&view=rev Log Message: ----------- added libraries Added Paths: ----------- branches/jsxe2/lib/ branches/jsxe2/lib/gnu-regexp-1.1.4.jar branches/jsxe2/lib/resolver.jar branches/jsxe2/lib/xercesImpl.jar branches/jsxe2/lib/xml-apis.jar Removed Paths: ------------- branches/jsxe2/src/gnu/ Added: branches/jsxe2/lib/gnu-regexp-1.1.4.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/gnu-regexp-1.1.4.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: branches/jsxe2/lib/resolver.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/resolver.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: branches/jsxe2/lib/xercesImpl.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/xercesImpl.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: branches/jsxe2/lib/xml-apis.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/xml-apis.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-29 15:52:34
|
Revision: 1093 Author: ian_lewis Date: 2006-07-29 08:52:20 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1093&view=rev Log Message: ----------- Added some more code for multi-threaded io Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/messages/messages branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java branches/jsxe2/src/net/sourceforge/jsxe/properties Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/Changelog 2006-07-29 15:52:20 UTC (rev 1093) @@ -1,3 +1,7 @@ +07/29/2006 Ian Lewis <Ian...@me...> + + * Added some more code for multi-threaded IO support. + 07/28/2006 Ian Lewis <Ian...@me...> * Added some multi-threaded support. Modified: branches/jsxe2/messages/messages =================================================================== --- branches/jsxe2/messages/messages 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/messages/messages 2006-07-29 15:52:20 UTC (rev 1093) @@ -185,6 +185,8 @@ DocumentBuffer.Loaded.Message={0} Loaded DocumentBuffer.Reloaded.Message={0} Reloaded +DocumentBuffer.Loading.Message=Loading {0} + #{0} plugin name DocumentView.Not.Found=No plugin a with name of {0} exists. @@ -229,8 +231,21 @@ #{{{ Error Messages No.Xerces.Error.message={0} not found. jsXe requires Apache {0}. No.Xerces.Error.title={0} not found. + +IO.Error.caption=The following {0} I/O operations could not be completed: +IO.Error.caption-1=The following {0} I/O operation could not be completed: + +IO.Error.Encoding.Error=Cannot load with "{0}" encoding.\n\ + ({1})\n\ + Try selecting a different encoding. +IO.Error.Read.Error=Cannot load: {0} +IO.Error.Write.Error=Cannot save: {0} + IO.Error.title=I/O Error IO.Error.message=An I/O error has occurred + +Out.Of.Memory.Error=There was insufficent Java heap memory to complete\n\ + this request. Try increasing the maximum heap size. #}}} #}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -69,6 +69,7 @@ * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id: XMLDocument.java 999 2006-07-07 20:59:23Z ian_lewis $ * @see XMLNode + * @since jsXe 0.5 pre3 */ public class XMLDocument { Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -38,7 +38,9 @@ /** * A document I/O request. * @author Slava Pestov + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ + * @since jsXe 0.5 pre3 */ public class XMLDocumentIORequest extends WorkRequest { @@ -192,14 +194,14 @@ setAbortable(true); if (!buffer.isTemporary()) { - setStatus(jEdit.getProperty("vfs.status.load",args)); + setStatus(Messages.getMessage("DocumentBuffer.Loading.Message",args)); setProgressValue(0); } path = vfs._canonPath(session,path,view); - VFS.DirectoryEntry entry = vfs._getDirectoryEntry( - session,path,view); + VFS.DirectoryEntry entry = vfs._getDirectoryEntry(session,path,view); + long length; if (entry != null) { length = entry.length; @@ -214,11 +216,13 @@ read(autodetect(in),length,false); buffer.setNewFile(false); + } catch(CharConversionException ch) { Log.log(Log.ERROR,this,ch); - Object[] pp = { buffer.getProperty(Buffer.ENCODING), - ch.toString() }; - VFSManager.error(view,path,"ioerror.encoding-error",pp); + + Object[] pp = { buffer.getProperty(Buffer.ENCODING), ch.toString() }; + + VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); @@ -226,39 +230,38 @@ Log.log(Log.ERROR,this,uu); Object[] pp = { buffer.getProperty(Buffer.ENCODING), uu.toString() }; - VFSManager.error(view,path,"ioerror.encoding-error",pp); + VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); } catch(IOException io) { Log.log(Log.ERROR,this,io); Object[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + VFSManager.error(view,path,"IO.Error.Read.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); } catch(OutOfMemoryError oom) { Log.log(Log.ERROR,this,oom); - VFSManager.error(view,path,"out-of-memory-error",null); + VFSManager.error(view,path,"Out.Of.Memory.Error",null); buffer.setBooleanProperty(ERROR_OCCURRED,true); } - if (jEdit.getBooleanProperty("persistentMarkers")) { - try { - String[] args = { vfs.getFileName(path) }; - if (!buffer.isTemporary()) { - setStatus(jEdit.getProperty("vfs.status.load-markers",args)); - } - setAbortable(true); - - in = vfs._createInputStream(session,markersPath,true,view); - if(in != null) - readMarkers(buffer,in); - } catch(IOException io) { - // ignore - } - } + // if (jEdit.getBooleanProperty("persistentMarkers")) { + // try { + // String[] args = { vfs.getFileName(path) }; + // if (!buffer.isTemporary()) { + // setStatus(jEdit.getProperty("vfs.status.load-markers",args)); + // } + // setAbortable(true); + // in = vfs._createInputStream(session,markersPath,true,view); + // if(in != null) + // readMarkers(buffer,in); + // } catch(IOException io) { + // // ignore + // } + // } } catch(WorkThread.Abort a) { if (in != null) { try { @@ -274,7 +277,7 @@ } catch(IOException io) { Log.log(Log.ERROR,this,io); String[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + VFSManager.error(view,path,"IO.Error.Read.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); } catch(WorkThread.Abort a) { @@ -338,8 +341,7 @@ { // do not reset the stream and just treat it // like a normal UTF-8 file. - buffer.setProperty(Buffer.ENCODING, - MiscUtilities.UTF_8_Y); + buffer.setProperty(XMLDocument.ENCODING, MiscUtilities.UTF_8_Y); encoding = "UTF-8"; } else { @@ -356,8 +358,8 @@ break; } - String xmlPI = new String(_xmlPI,0,offset, - "ASCII"); + String xmlPI = new String(_xmlPI,0,offset, "ASCII"); + if (xmlPI.startsWith("<?xml")) { int index = xmlPI.indexOf("encoding="); if (index != -1 && index + 9 != xmlPI.length()) { @@ -366,7 +368,7 @@ encoding = xmlPI.substring(index + 10,endIndex); if (MiscUtilities.isSupportedEncoding(encoding)) { - buffer.setProperty(Buffer.ENCODING,encoding); + buffer.setProperty(XMLDocument.ENCODING, encoding); } else { Log.log(Log.WARNING,this,"XML PI specifies unsupported encoding: " + encoding); } Added: branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -0,0 +1,117 @@ +/* +ErrorListCellRenderer.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2001 Slava Pestov +Portions Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.gui; + +//{{{ Imports +import javax.swing.*; +import javax.swing.border.*; +import java.awt.*; +//}}} + +/** + * @author Slava Pestov + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class ErrorListCellRenderer extends JComponent implements ListCellRenderer { + + //{{{ ErrorListCellRenderer constructor + ErrorListCellRenderer() { + // GTK look and feel issues + plainFont = new JLabel().getFont(); + //UIManager.getFont("Label.font"); + boldFont = new Font(plainFont.getName(),Font.BOLD,plainFont.getSize()); + plainFM = getFontMetrics(plainFont); + boldFM = getFontMetrics(boldFont); + + setBorder(new EmptyBorder(2,2,2,2)); + } //}}} + + //{{{ getListCellRendererComponent() method + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) + { + if (value instanceof ErrorListDialog.ErrorEntry) { + ErrorListDialog.ErrorEntry entry = (ErrorListDialog.ErrorEntry)value; + this.path = entry.path + ":"; + this.messages = entry.messages; + } else { + this.path = null; + this.messages = new String[] { value.toString() }; + } + + + return this; + } //}}} + + //{{{ getPreferredSize() method + public Dimension getPreferredSize() { + + int width = 0; + if (path != null) { + width = boldFM.stringWidth(path); + } + int height = boldFM.getHeight(); + for (int i = 0; i < messages.length; i++) { + width = Math.max(plainFM.stringWidth(messages[i]),width); + height += plainFM.getHeight(); + } + + Insets insets = getBorder().getBorderInsets(this); + width += insets.left + insets.right; + height += insets.top + insets.bottom; + + return new Dimension(width,height); + } //}}} + + //{{{ paintComponent() method + public void paintComponent(Graphics g) { + + Insets insets = getBorder().getBorderInsets(this); + int y = insets.top; + if (path != null) { + g.setFont(boldFont); + g.drawString(path,insets.left,insets.top + boldFM.getAscent()); + y = insets.top + boldFM.getHeight() + 2; + } + + g.setFont(plainFont); + for (int i = 0; i < messages.length; i++) { + g.drawString(messages[i],insets.left,y + plainFM.getAscent()); + y += plainFM.getHeight(); + } + } //}}} + + //{{{ Instance variables + private String path; + private String[] messages; + private Font plainFont; + private Font boldFont; + private FontMetrics plainFM; + private FontMetrics boldFM; + //}}} +} Modified: branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -44,79 +44,126 @@ */ public class ErrorListDialog extends EnhancedDialog { - //{{{ ErrorListDialog constructor - /** - * Creates a new ErrorListDialog. - * @param frame the parent component of this dialog - * @param title the title of the dialog - * @param caption the caption displayed on the dialog. - * @param messages a Vector containing objects used as error messages - * @param modal whether the dialog is modal - */ - public ErrorListDialog(Frame frame, String title, String caption, Vector messages, boolean modal) { - super(frame,title,modal); + //{{{ ErrorEntry class + public static class ErrorEntry { + + String path; + String[] messages; - JPanel content = new JPanel(new BorderLayout(12,12)); - content.setBorder(new EmptyBorder(12,12,12,12)); - setContentPane(content); + public ErrorEntry(String path, String messageProp, Object[] args) { + + this.path = path; - Box iconBox = new Box(BoxLayout.Y_AXIS); - iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon"))); - iconBox.add(Box.createGlue()); - content.add(BorderLayout.WEST,iconBox); + String message = Messages.getMessage(messageProp,args); + if (message == null) { + message = "Undefined property: " + messageProp; + } - JPanel centerPanel = new JPanel(new BorderLayout()); + Log.log(Log.ERROR,this,path + ":"); + Log.log(Log.ERROR,this,message); - JLabel label = new JLabel(caption); - label.setBorder(new EmptyBorder(0,0,6,0)); - centerPanel.add(BorderLayout.NORTH,label); + Vector tokenizedMessage = new Vector(); + int lastIndex = -1; + for (int i = 0; i < message.length(); i++) { + + if (message.charAt(i) == '\n') { + tokenizedMessage.addElement(message.substring(lastIndex + 1,i)); + lastIndex = i; + } + } - JList errors = new JList(messages); - // errors.setCellRenderer(new ErrorListCellRenderer()); - errors.setVisibleRowCount(Math.min(Math.max(messages.size(),4),10)); + if (lastIndex != message.length()) { + tokenizedMessage.addElement(message.substring( + lastIndex + 1)); + } - // need this bullshit scroll bar policy for the preferred size - // hack to work - JScrollPane scrollPane = new JScrollPane(errors, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - Dimension size = scrollPane.getPreferredSize(); - size.width = Math.max(size.width,400); - scrollPane.setPreferredSize(size); + messages = new String[tokenizedMessage.size()]; + tokenizedMessage.copyInto(messages); + } - centerPanel.add(BorderLayout.CENTER,scrollPane); + public boolean equals(Object o) { + if (o instanceof ErrorEntry) { + ErrorEntry e = (ErrorEntry)o; + return e.path.equals(path); + } else { + return false; + } + } + } //}}} + + //{{{ ErrorListDialog constructor + /** + * Creates a new ErrorListDialog. + * @param frame the parent component of this dialog + * @param title the title of the dialog + * @param caption the caption displayed on the dialog. + * @param messages a Vector containing ErrorEntry objects used as error messages + * @param modal whether the dialog is modal + */ + public ErrorListDialog(Frame frame, String title, String caption, Vector messages, boolean modal) { + super(frame,title,modal); - content.add(BorderLayout.CENTER,centerPanel); + JPanel content = new JPanel(new BorderLayout(12,12)); + content.setBorder(new EmptyBorder(12,12,12,12)); + setContentPane(content); - Box buttons = new Box(BoxLayout.X_AXIS); - buttons.add(Box.createGlue()); + Box iconBox = new Box(BoxLayout.Y_AXIS); + iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon"))); + iconBox.add(Box.createGlue()); + content.add(BorderLayout.WEST,iconBox); - ok = new JButton("OK"); - ok.addActionListener(new ActionHandler()); + JPanel centerPanel = new JPanel(new BorderLayout()); - buttons.add(ok); + JLabel label = new JLabel(caption); + label.setBorder(new EmptyBorder(0,0,6,0)); + centerPanel.add(BorderLayout.NORTH,label); - buttons.add(Box.createGlue()); - content.add(BorderLayout.SOUTH,buttons); + JList errors = new JList(messages); + errors.setCellRenderer(new ErrorListCellRenderer()); + errors.setVisibleRowCount(Math.min(Math.max(messages.size(),4),10)); - getRootPane().setDefaultButton(ok); + // need this bullshit scroll bar policy for the preferred size + // hack to work + JScrollPane scrollPane = new JScrollPane(errors, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + Dimension size = scrollPane.getPreferredSize(); + size.width = Math.max(size.width,400); + scrollPane.setPreferredSize(size); - pack(); - setLocationRelativeTo(frame); - setVisible(true); - } //}}} + centerPanel.add(BorderLayout.CENTER,scrollPane); - //{{{ ok() method - public void ok() { - dispose(); - } //}}} + content.add(BorderLayout.CENTER,centerPanel); - //{{{ cancel() method - public void cancel(){ - dispose(); - } //}}} + Box buttons = new Box(BoxLayout.X_AXIS); + buttons.add(Box.createGlue()); - //{{{ Private members + ok = new JButton("OK"); + ok.addActionListener(new ActionHandler()); + + buttons.add(ok); + + buttons.add(Box.createGlue()); + content.add(BorderLayout.SOUTH,buttons); + + getRootPane().setDefaultButton(ok); + + pack(); + setLocationRelativeTo(frame); + setVisible(true); + } //}}} + + //{{{ ok() method + public void ok() { + dispose(); + } //}}} + + //{{{ cancel() method + public void cancel(){ + dispose(); + } //}}} + + //{{{ Private members private JButton ok; //{{{ ActionHandler class Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -4,7 +4,7 @@ :folding=explicit:collapseFolds=1: Copyright (C) 2000, 2003 Slava Pestov -Portions Copyright (C) 2004 Ian Lewis (Ian...@me...) +Portions Copyright (C) 2006 Ian Lewis (Ian...@me...) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -58,6 +58,7 @@ * @author Slava Pestov * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ + * @since jsXe 0.5 pre3 */ public class VFSManager { /** @@ -69,13 +70,11 @@ /** * Do not call. */ - public static void init() - { - int count = jEdit.getIntegerProperty("ioThreadCount",4); - ioThreadPool = new WorkThreadPool("jEdit I/O",count); + public static void init() { + int count = jsXe.getIntegerProperty("ioThreadCount", 4); + ioThreadPool = new WorkThreadPool("jsXe I/O",count); JARClassLoader classLoader = new JARClassLoader(); - for(int i = 0; i < ioThreadPool.getThreadCount(); i++) - { + for (int i = 0; i < ioThreadPool.getThreadCount(); i++) { ioThreadPool.getThread(i).setContextClassLoader( classLoader); } @@ -85,8 +84,7 @@ /** * Do not call. */ - public static void start() - { + public static void start() { ioThreadPool.start(); } //}}} @@ -96,8 +94,7 @@ /** * Returns the local filesystem VFS. */ - public static VFS getFileVFS() - { + public static VFS getFileVFS() { return fileVFS; } //}}} @@ -105,8 +102,7 @@ /** * Returns the URL VFS. */ - public static VFS getUrlVFS() - { + public static VFS getUrlVFS() { return urlVFS; } //}}} @@ -269,41 +265,6 @@ //{{{ error() method /** - * @deprecated Call the other <code>error()</code> method instead. - */ - public static void error(final Component comp, final String error, final Object[] args) - { - // if we are already in the AWT thread, take a shortcut - if(SwingUtilities.isEventDispatchThread()) - { - GUIUtilities.error(comp,error,args); - return; - } - - // the 'error' chicanery ensures that stuff like: - // VFSManager.waitForRequests() - // if(VFSManager.errorOccurred()) - // ... - // will work (because the below runnable will only be - // executed in the next event) - VFSManager.error = true; - - runInAWTThread(new Runnable() - { - public void run() - { - VFSManager.error = false; - - if(comp == null || !comp.isShowing()) - GUIUtilities.error(null,error,args); - else - GUIUtilities.error(comp,error,args); - } - }); - } //}}} - - //{{{ error() method - /** * Reports an I/O error. * * @param comp The component @@ -318,31 +279,27 @@ { final Frame frame = JOptionPane.getFrameForComponent(comp); - synchronized(errorLock) - { + synchronized(errorLock) { + error = true; - errors.addElement(new ErrorListDialog.ErrorEntry( - path,messageProp,args)); + errors.addElement(new ErrorListDialog.ErrorEntry(path, messageProp, args)); - if(errors.size() == 1) - { + if (errors.size() == 1) { - VFSManager.runInAWTThread(new Runnable() - { - public void run() - { - String caption = jEdit.getProperty( - "ioerror.caption" + (errors.size() == 1 - ? "-1" : ""),new Integer[] { - new Integer(errors.size()) }); + VFSManager.runInAWTThread(new Runnable() { + public void run() { + String caption = Messages.getMessage("IO.Error.caption" + (errors.size() == 1 ? "-1" : ""), + new Integer[] { new Integer(errors.size()) }); + new ErrorListDialog( frame.isShowing() ? frame - : jEdit.getFirstView(), - jEdit.getProperty("ioerror.title"), + : jsXe.getActiveView(), + Messages.getMessage("IO.Error.title"), caption,errors,false); + errors.removeAllElements(); error = false; } Modified: branches/jsxe2/src/net/sourceforge/jsxe/properties =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/properties 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/properties 2006-07-29 15:52:20 UTC (rev 1093) @@ -13,6 +13,8 @@ # Resource Cache xml.cache=true +ioThreadCount=4 + #{{{ Plugin Manager Default Dimensions #pluginmgr.x=100 #pluginmgr.y=100 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-27 19:00:15
|
Revision: 1079 Author: ian_lewis Date: 2006-07-27 11:59:59 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1079&view=rev Log Message: ----------- Added classes for IO. Though they are ignored by the build atm Modified Paths: -------------- branches/jsxe2/build.xml Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/io/ branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/UrlVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java branches/jsxe2/src/net/sourceforge/jsxe/io/package.html Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-07-27 18:02:07 UTC (rev 1078) +++ branches/jsxe2/build.xml 2006-07-27 18:59:59 UTC (rev 1079) @@ -118,6 +118,10 @@ <!--<include name="**/*.dtd"/>--> <include name="**/*.jpg"/> <include name="**/*.png"/> + + <!-- files in the source directory to ignore --> + <exclude name="net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java"/> + <exclude name="net/sourceforge/jsxe/io/**/*"/> </fileset> </copy> <mkdir dir="${build.messages}"/> Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-27 18:59:59 UTC (rev 1079) @@ -0,0 +1,1036 @@ +/* +XMLDocumentIORequest.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000, 2003 Slava Pestov +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package org.gjt.sp.jedit.buffer; + +//{{{ Imports +import javax.swing.text.Segment; +import java.io.*; +import java.util.zip.*; +import java.util.Vector; +import org.gjt.sp.jedit.io.*; +import org.gjt.sp.jedit.*; +import org.gjt.sp.util.*; +//}}} + +/** + * A document I/O request. + * @author Slava Pestov + * @version $Id: BufferIORequest.java,v 1.28 2004/08/29 02:58:43 spestov Exp $ + */ +public class XMLDocumentIORequest extends WorkRequest { + + //{{{ Constants + /** + * Size of I/O buffers. + */ + public static final int IOBUFSIZE = 32768; + + /** + * Number of lines per progress increment. + */ + public static final int PROGRESS_INTERVAL = 300; + + public static final String LOAD_DATA = "BufferIORequest__loadData"; + public static final String END_OFFSETS = "BufferIORequest__endOffsets"; + public static final String NEW_PATH = "BufferIORequest__newPath"; + + /** + * Buffer boolean property set when an error occurs. + */ + public static final String ERROR_OCCURRED = "BufferIORequest__error"; + + /** + * A file load request. + */ + public static final int LOAD = 0; + + /** + * A file save request. + */ + public static final int SAVE = 1; + + /** + * An autosave request. Only supported for local files. + */ + public static final int AUTOSAVE = 2; + + /** + * An insert file request. + */ + public static final int INSERT = 3; + + /** + * Magic numbers used for auto-detecting Unicode and GZIP files. + */ + public static final int GZIP_MAGIC_1 = 0x1f; + public static final int GZIP_MAGIC_2 = 0x8b; + public static final int UNICODE_MAGIC_1 = 0xfe; + public static final int UNICODE_MAGIC_2 = 0xff; + public static final int UTF8_MAGIC_1 = 0xef; + public static final int UTF8_MAGIC_2 = 0xbb; + public static final int UTF8_MAGIC_3 = 0xbf; + + /** + * Length of longest XML PI used for encoding detection.<p> + * <?xml version="1.0" encoding="................"?> + */ + public static final int XML_PI_LENGTH = 50; + //}}} + + //{{{ XMLDocumentIORequest constructor + /** + * Creates a new buffer I/O request. + * @param type The request type + * @param view The view + * @param buffer The buffer + * @param session The VFS session + * @param vfs The VFS + * @param path The path + */ + public XMLDocumentIORequest(int type, View view, Buffer buffer, + Object session, VFS vfs, String path) + { + this.type = type; + this.view = view; + this.buffer = buffer; + this.session = session; + this.vfs = vfs; + this.path = path; + + markersPath = vfs.getParentOfPath(path) + + '.' + vfs.getFileName(path) + + ".marks"; + } //}}} + + //{{{ run() method + public void run() + { + switch(type) + { + case LOAD: + load(); + break; + case SAVE: + save(); + break; + case AUTOSAVE: + autosave(); + break; + case INSERT: + insert(); + break; + default: + throw new InternalError(); + } + } //}}} + + //{{{ toString() method + public String toString() + { + String typeString; + switch(type) + { + case LOAD: + typeString = "LOAD"; + break; + case SAVE: + typeString = "SAVE"; + break; + case AUTOSAVE: + typeString = "AUTOSAVE"; + break; + default: + typeString = "UNKNOWN!!!"; + } + + return getClass().getName() + "[type=" + typeString + + ",buffer=" + buffer + "]"; + } //}}} + + //{{{ Private members + + //{{{ Instance variables + private int type; + private View view; + private Buffer buffer; + private Object session; + private VFS vfs; + private String path; + private String markersPath; + //}}} + + //{{{ load() method + private void load() + { + InputStream in = null; + + try + { + try + { + String[] args = { vfs.getFileName(path) }; + setAbortable(true); + if(!buffer.isTemporary()) + { + setStatus(jEdit.getProperty("vfs.status.load",args)); + setProgressValue(0); + } + + path = vfs._canonPath(session,path,view); + + VFS.DirectoryEntry entry = vfs._getDirectoryEntry( + session,path,view); + long length; + if(entry != null) + length = entry.length; + else + length = 0L; + + in = vfs._createInputStream(session,path, + false,view); + if(in == null) + return; + + read(autodetect(in),length,false); + buffer.setNewFile(false); + } + catch(CharConversionException ch) + { + Log.log(Log.ERROR,this,ch); + Object[] pp = { buffer.getProperty(Buffer.ENCODING), + ch.toString() }; + VFSManager.error(view,path,"ioerror.encoding-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(UnsupportedEncodingException uu) + { + Log.log(Log.ERROR,this,uu); + Object[] pp = { buffer.getProperty(Buffer.ENCODING), + uu.toString() }; + VFSManager.error(view,path,"ioerror.encoding-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + Object[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.read-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(OutOfMemoryError oom) + { + Log.log(Log.ERROR,this,oom); + VFSManager.error(view,path,"out-of-memory-error",null); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + + if(jEdit.getBooleanProperty("persistentMarkers")) + { + try + { + String[] args = { vfs.getFileName(path) }; + if(!buffer.isTemporary()) + setStatus(jEdit.getProperty("vfs.status.load-markers",args)); + setAbortable(true); + + in = vfs._createInputStream(session,markersPath,true,view); + if(in != null) + readMarkers(buffer,in); + } + catch(IOException io) + { + // ignore + } + } + } + catch(WorkThread.Abort a) + { + if(in != null) + { + try + { + in.close(); + } + catch(IOException io) + { + } + } + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + finally + { + try + { + vfs._endVFSSession(session,view); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.read-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + } + } //}}} + + //{{{ autodetect() method + /** + * Tries to detect if the stream is gzipped, and if it has an encoding + * specified with an XML PI. + */ + private Reader autodetect(InputStream in) throws IOException + { + in = new BufferedInputStream(in); + + String encoding = buffer.getStringProperty(Buffer.ENCODING); + if(!in.markSupported()) + Log.log(Log.WARNING,this,"Mark not supported: " + in); + else if(buffer.getBooleanProperty(Buffer.ENCODING_AUTODETECT)) + { + in.mark(XML_PI_LENGTH); + int b1 = in.read(); + int b2 = in.read(); + int b3 = in.read(); + + if(encoding.equals(MiscUtilities.UTF_8_Y)) + { + // Java does not support this encoding so + // we have to handle it manually. + if(b1 != UTF8_MAGIC_1 || b2 != UTF8_MAGIC_2 + || b3 != UTF8_MAGIC_3) + { + // file does not begin with UTF-8-Y + // signature. reset stream, read as + // UTF-8. + in.reset(); + } + else + { + // file begins with UTF-8-Y signature. + // discard the signature, and read + // the remainder as UTF-8. + } + + encoding = "UTF-8"; + } + else if(b1 == GZIP_MAGIC_1 && b2 == GZIP_MAGIC_2) + { + in.reset(); + in = new GZIPInputStream(in); + buffer.setBooleanProperty(Buffer.GZIPPED,true); + // auto-detect encoding within the gzip stream. + return autodetect(in); + } + else if((b1 == UNICODE_MAGIC_1 + && b2 == UNICODE_MAGIC_2) + || (b1 == UNICODE_MAGIC_2 + && b2 == UNICODE_MAGIC_1)) + { + in.reset(); + encoding = "UTF-16"; + buffer.setProperty(Buffer.ENCODING,encoding); + } + else if(b1 == UTF8_MAGIC_1 && b2 == UTF8_MAGIC_2 + && b3 == UTF8_MAGIC_3) + { + // do not reset the stream and just treat it + // like a normal UTF-8 file. + buffer.setProperty(Buffer.ENCODING, + MiscUtilities.UTF_8_Y); + + encoding = "UTF-8"; + } + else + { + in.reset(); + + byte[] _xmlPI = new byte[XML_PI_LENGTH]; + int offset = 0; + int count; + while((count = in.read(_xmlPI,offset, + XML_PI_LENGTH - offset)) != -1) + { + offset += count; + if(offset == XML_PI_LENGTH) + break; + } + + String xmlPI = new String(_xmlPI,0,offset, + "ASCII"); + if(xmlPI.startsWith("<?xml")) + { + int index = xmlPI.indexOf("encoding="); + if(index != -1 + && index + 9 != xmlPI.length()) + { + char ch = xmlPI.charAt(index + + 9); + int endIndex = xmlPI.indexOf(ch, + index + 10); + encoding = xmlPI.substring( + index + 10,endIndex); + + if(MiscUtilities.isSupportedEncoding(encoding)) + { + buffer.setProperty(Buffer.ENCODING,encoding); + } + else + { + Log.log(Log.WARNING,this,"XML PI specifies unsupported encoding: " + encoding); + } + } + } + + in.reset(); + } + } + + return new InputStreamReader(in,encoding); + } //}}} + + //{{{ read() method + private SegmentBuffer read(Reader in, long length, + boolean insert) throws IOException + { + /* we guess an initial size for the array */ + IntegerArray endOffsets = new IntegerArray( + Math.max(1,(int)(length / 50))); + + // only true if the file size is known + boolean trackProgress = (!buffer.isTemporary() && length != 0); + + if(trackProgress) + { + setProgressValue(0); + setProgressMaximum((int)length); + } + + // if the file size is not known, start with a resonable + // default buffer size + if(length == 0) + length = IOBUFSIZE; + + SegmentBuffer seg = new SegmentBuffer((int)length + 1); + + char[] buf = new char[IOBUFSIZE]; + + // Number of characters in 'buf' array. + // InputStream.read() doesn't always fill the + // array (eg, the file size is not a multiple of + // IOBUFSIZE, or it is a GZipped file, etc) + int len; + + // True if a \n was read after a \r. Usually + // means this is a DOS/Windows file + boolean CRLF = false; + + // A \r was read, hence a MacOS file + boolean CROnly = false; + + // Was the previous read character a \r? + // If we read a \n and this is true, we assume + // we have a DOS/Windows file + boolean lastWasCR = false; + + // Number of lines read. Every 100 lines, we update the + // progress bar + int lineCount = 0; + + while((len = in.read(buf,0,buf.length)) != -1) + { + // Offset of previous line, relative to + // the start of the I/O buffer (NOT + // relative to the start of the document) + int lastLine = 0; + + for(int i = 0; i < len; i++) + { + // Look for line endings. + switch(buf[i]) + { + case '\r': + // If we read a \r and + // lastWasCR is also true, + // it is probably a Mac file + // (\r\r in stream) + if(lastWasCR) + { + CROnly = true; + CRLF = false; + } + // Otherwise set a flag, + // so that \n knows that last + // was a \r + else + { + lastWasCR = true; + } + + // Insert a line + seg.append(buf,lastLine,i - + lastLine); + seg.append('\n'); + endOffsets.add(seg.count); + if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) + setProgressValue(seg.count); + + // This is i+1 to take the + // trailing \n into account + lastLine = i + 1; + break; + case '\n': + // If lastWasCR is true, + // we just read a \r followed + // by a \n. We specify that + // this is a Windows file, + // but take no further + // action and just ignore + // the \r. + if(lastWasCR) + { + CROnly = false; + CRLF = true; + lastWasCR = false; + // Bump lastLine so + // that the next line + // doesn't erronously + // pick up the \r + lastLine = i + 1; + } + // Otherwise, we found a \n + // that follows some other + // character, hence we have + // a Unix file + else + { + CROnly = false; + CRLF = false; + seg.append(buf,lastLine, + i - lastLine); + seg.append('\n'); + endOffsets.add(seg.count); + if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) + setProgressValue(seg.count); + lastLine = i + 1; + } + break; + default: + // If we find some other + // character that follows + // a \r, so it is not a + // Windows file, and probably + // a Mac file + if(lastWasCR) + { + CROnly = true; + CRLF = false; + lastWasCR = false; + } + break; + } + } + + if(trackProgress) + setProgressValue(seg.count); + + // Add remaining stuff from buffer + seg.append(buf,lastLine,len - lastLine); + } + + setAbortable(false); + + String lineSeparator; + if(seg.count == 0) + { + // fix for "[ 865589 ] 0-byte files should open using + // the default line seperator" + lineSeparator = jEdit.getProperty( + "buffer.lineSeparator", + System.getProperty("line.separator")); + } + else if(CRLF) + lineSeparator = "\r\n"; + else if(CROnly) + lineSeparator = "\r"; + else + lineSeparator = "\n"; + + in.close(); + + // Chop trailing newline and/or ^Z (if any) + int bufferLength = seg.count; + if(bufferLength != 0) + { + char ch = seg.array[bufferLength - 1]; + if(ch == 0x1a /* DOS ^Z */) + seg.count--; + } + + buffer.setBooleanProperty(Buffer.TRAILING_EOL,false); + if(bufferLength != 0 && jEdit.getBooleanProperty("stripTrailingEOL")) + { + char ch = seg.array[bufferLength - 1]; + if(ch == '\n') + { + buffer.setBooleanProperty(Buffer.TRAILING_EOL,true); + seg.count--; + endOffsets.setSize(endOffsets.getSize() - 1); + } + } + + // add a line marker at the end for proper offset manager + // operation + endOffsets.add(seg.count + 1); + + // to avoid having to deal with read/write locks and such, + // we insert the loaded data into the buffer in the + // post-load cleanup runnable, which runs in the AWT thread. + if(!insert) + { + buffer.setProperty(LOAD_DATA,seg); + buffer.setProperty(END_OFFSETS,endOffsets); + buffer.setProperty(NEW_PATH,path); + if(lineSeparator != null) + buffer.setProperty(Buffer.LINESEP,lineSeparator); + } + + // used in insert() + return seg; + } //}}} + + //{{{ readMarkers() method + private void readMarkers(Buffer buffer, InputStream _in) + throws IOException + { + // For `reload' command + buffer.removeAllMarkers(); + + BufferedReader in = new BufferedReader(new InputStreamReader(_in)); + + try + { + String line; + while((line = in.readLine()) != null) + { + // compatibility kludge for jEdit 3.1 and earlier + if(!line.startsWith("!")) + continue; + + char shortcut = line.charAt(1); + int start = line.indexOf(';'); + int end = line.indexOf(';',start + 1); + int position = Integer.parseInt(line.substring(start + 1,end)); + buffer.addMarker(shortcut,position); + } + } + finally + { + in.close(); + } + } //}}} + + //{{{ save() method + private void save() + { + OutputStream out = null; + + try + { + String[] args = { vfs.getFileName(path) }; + setStatus(jEdit.getProperty("vfs.status.save",args)); + + // the entire save operation can be aborted... + setAbortable(true); + + path = vfs._canonPath(session,path,view); if(!MiscUtilities.isURL(path)) + path = MiscUtilities.resolveSymlinks(path); + + // Only backup once per session + if(buffer.getProperty(Buffer.BACKED_UP) == null + || jEdit.getBooleanProperty("backupEverySave")) + { + vfs._backup(session,path,view); + buffer.setBooleanProperty(Buffer.BACKED_UP,true); + } + + /* if the VFS supports renaming files, we first + * save to #<filename>#save#, then rename that + * to <filename>, so that if the save fails, + * data will not be lost. + * + * as of 4.1pre7 we now call vfs.getTwoStageSaveName() + * instead of constructing the path directly + * since some VFS's might not allow # in filenames. + */ + String savePath; + + boolean twoStageSave = (vfs.getCapabilities() & VFS.RENAME_CAP) != 0 + && jEdit.getBooleanProperty("twoStageSave"); + if(twoStageSave) + savePath = vfs.getTwoStageSaveName(path); + else + savePath = path; + + out = vfs._createOutputStream(session,savePath,view); + + try + { + // this must be after the stream is created or + // we deadlock with SSHTools. + buffer.readLock(); + if(out != null) + { + // Can't use buffer.getName() here because + // it is not changed until the save is + // complete + if(savePath.endsWith(".gz")) + buffer.setBooleanProperty(Buffer.GZIPPED,true); + + if(buffer.getBooleanProperty(Buffer.GZIPPED)) + out = new GZIPOutputStream(out); + + write(buffer,out); + + if(twoStageSave) + { + if(!vfs._rename(session,savePath,path,view)) + throw new IOException("Rename failed: " + savePath); + } + + // We only save markers to VFS's that support deletion. + // Otherwise, we will accumilate stale marks files. + if((vfs.getCapabilities() & VFS.DELETE_CAP) != 0) + { + if(jEdit.getBooleanProperty("persistentMarkers") + && buffer.getMarkers().size() != 0) + { + setStatus(jEdit.getProperty("vfs.status.save-markers",args)); + setProgressValue(0); + out = vfs._createOutputStream(session,markersPath,view); + if(out != null) + writeMarkers(buffer,out); + } + else + vfs._delete(session,markersPath,view); + } + } + else + buffer.setBooleanProperty(ERROR_OCCURRED,true); + + if(!twoStageSave) + VFSManager.sendVFSUpdate(vfs,path,true); + } + finally + { + buffer.readUnlock(); + } + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.write-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + if(out != null) + { + try + { + out.close(); + } + catch(IOException io) + { + } + } + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + finally + { + try + { + vfs._saveComplete(session,buffer,path,view); + vfs._endVFSSession(session,view); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.write-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + } + } //}}} + + //{{{ autosave() method + private void autosave() + { + OutputStream out = null; + + try + { + String[] args = { vfs.getFileName(path) }; + setStatus(jEdit.getProperty("vfs.status.autosave",args)); + + // the entire save operation can be aborted... + setAbortable(true); + + try + { + //buffer.readLock(); + + if(!buffer.isDirty()) + { + // buffer has been saved while we + // were waiting. + return; + } + + out = vfs._createOutputStream(session,path,view); + if(out == null) + return; + + write(buffer,out); + } + catch(Exception e) + { + } + finally + { + //buffer.readUnlock(); + } + } + catch(WorkThread.Abort a) + { + if(out != null) + { + try + { + out.close(); + } + catch(IOException io) + { + } + } + } + } //}}} + + //{{{ write() method + private void write(Buffer buffer, OutputStream _out) + throws IOException + { + BufferedWriter out = null; + + try + { + String encoding = buffer.getStringProperty(Buffer.ENCODING); + if(encoding.equals(MiscUtilities.UTF_8_Y)) + { + // not supported by Java... + _out.write(UTF8_MAGIC_1); + _out.write(UTF8_MAGIC_2); + _out.write(UTF8_MAGIC_3); + _out.flush(); + encoding = "UTF-8"; + } + + out = new BufferedWriter( + new OutputStreamWriter(_out,encoding), + IOBUFSIZE); + + Segment lineSegment = new Segment(); + String newline = buffer.getStringProp... [truncated message content] |
|
From: <ian...@us...> - 2006-07-29 04:41:20
|
Revision: 1087 Author: ian_lewis Date: 2006-07-28 21:40:06 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1087&view=rev Log Message: ----------- Merge from trunk/jsxe of revision 1086 ViewCVS Links: ------------- http://svn.sourceforge.net/jsxe/?rev=1086&view=rev Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/INSTALL branches/jsxe2/NEWS branches/jsxe2/RELEASE.CHECKLIST branches/jsxe2/build.xml branches/jsxe2/messages/messages.de branches/jsxe2/messages/messages.sv branches/jsxe2/src/net/sourceforge/jsxe/ActionPlugin.java branches/jsxe2/src/net/sourceforge/jsxe/ActionSet.java branches/jsxe2/src/net/sourceforge/jsxe/CatalogManager.java branches/jsxe2/src/net/sourceforge/jsxe/CustomFileFilter.java branches/jsxe2/src/net/sourceforge/jsxe/DocumentBuffer.java branches/jsxe2/src/net/sourceforge/jsxe/DocumentBufferListener.java branches/jsxe2/src/net/sourceforge/jsxe/JARClassLoader.java branches/jsxe2/src/net/sourceforge/jsxe/OperatingSystem.java branches/jsxe2/src/net/sourceforge/jsxe/PluginDependencyException.java branches/jsxe2/src/net/sourceforge/jsxe/PluginLoadException.java branches/jsxe2/src/net/sourceforge/jsxe/UnrecognizedPluginException.java branches/jsxe2/src/net/sourceforge/jsxe/action/ActivityLogAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileCloseAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileCloseAllAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileExitAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileNewAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileOpenAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileReloadAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileSaveAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileSaveAsAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/OpenRecentFileAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/ToolsOptionsAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/ToolsPluginManagerAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/ValidationErrorsAction.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocumentListener.java branches/jsxe2/src/net/sourceforge/jsxe/gui/ActivityLogDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/DirtyFilesDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/EnhancedDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GlobalOptionsDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/Messages.java branches/jsxe2/src/net/sourceforge/jsxe/gui/OptionsDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/OptionsPanel.java branches/jsxe2/src/net/sourceforge/jsxe/gui/PluginManagerDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/StatusBar.java branches/jsxe2/src/net/sourceforge/jsxe/gui/TabbedView.java branches/jsxe2/src/net/sourceforge/jsxe/gui/jsxeAboutDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/jsxeFileDialog.java branches/jsxe2/src/net/sourceforge/jsxe/jsXe.java branches/jsxe2/src/net/sourceforge/jsxe/options/OptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/properties branches/jsxe2/src/net/sourceforge/jsxe/util/Log.java branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java Added Paths: ----------- branches/jsxe2/buildlib/ branches/jsxe2/buildlib/jsmoothgen-ant.jar branches/jsxe2/buildlib/skeletons/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel branches/jsxe2/buildlib/skeletons/windowed-wrapper/jwrap.exe branches/jsxe2/jsXe.jsmooth branches/jsxe2/messages/messages branches/jsxe2/messages/messages.ja branches/jsxe2/src/net/sourceforge/jsxe/ActionManager.java branches/jsxe2/src/net/sourceforge/jsxe/EBListener.java branches/jsxe2/src/net/sourceforge/jsxe/EBMessage.java branches/jsxe2/src/net/sourceforge/jsxe/EditBus.java branches/jsxe2/src/net/sourceforge/jsxe/LocalizedAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/CopyAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/CutAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/DocumentOptionsAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FindAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FindNextAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/PasteAction.java branches/jsxe2/src/net/sourceforge/jsxe/gui/DocumentOptionsDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GUIUtilities.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GrabKeyDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GridPanel.java branches/jsxe2/src/net/sourceforge/jsxe/gui/KeyEventTranslator.java branches/jsxe2/src/net/sourceforge/jsxe/gui/KeyEventWorkaround.java branches/jsxe2/src/net/sourceforge/jsxe/gui/VariableGridLayout.java branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/ branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/WrappingMenu.java branches/jsxe2/src/net/sourceforge/jsxe/msg/ branches/jsxe2/src/net/sourceforge/jsxe/msg/DocumentBufferUpdate.java branches/jsxe2/src/net/sourceforge/jsxe/msg/PropertyChanged.java branches/jsxe2/src/net/sourceforge/jsxe/options/AbstractOptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/options/GeneralOptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/options/ShortcutsOptionPane.java Removed Paths: ------------- branches/jsxe2/buildlib/jsmoothgen-ant.jar branches/jsxe2/buildlib/skeletons/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel branches/jsxe2/buildlib/skeletons/windowed-wrapper/jwrap.exe branches/jsxe2/messages/messages.en branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocumentEvent.java branches/jsxe2/src/net/sourceforge/jsxe/dom/event/ branches/jsxe2/src/net/sourceforge/jsxe/gui/EnhancedMenu.java branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/WrappingMenu.java branches/jsxe2/src/net/sourceforge/jsxe/msg/DocumentBufferUpdate.java branches/jsxe2/src/net/sourceforge/jsxe/msg/PropertyChanged.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/Changelog 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,6 +1,14 @@ +07/28/2006 Ian Lewis <Ian...@me...> + + * Added some multi-threaded support. + 07/26/2006 Ian Lewis <Ian...@me...> * Added support for error nodes in the new data model + * Updated the find and findnext actions to use proper messages + labels. + * Fixed a bug where the shortcuts for Built-In commands were not being + honored. 07/25/2006 Ian Lewis <Ian...@me...> @@ -12,12 +20,90 @@ types. * Added some support for the URIs and standalone properties in XMLDocument. + * Fixed a bug with the source view for new users that caused a + NullPointerException to be thrown when opening the source view. + * Added a wrapper exe for windows users using jSmooth +07/21/2006 Ian Lewis <Ian...@me...> + + * Fixed bug 1509575. Files that are reloaded should always be loaded in a + view that can accep the reloaded file. + 07/20/2006 Ian Lewis <Ian...@me...> * Xerces needs to be installed in the java endorsed directory now to make use of DOM3 classes. + * Released 0.5pre1 + * Keyboard shortcuts are now fully supported. + * Added Japanese translation +07/12/2006 Ian Lewis <Ian...@me...> + + * Added functionality to save keyboard shortcuts. The shortcuts themselves + work but the shortcut labels for menu items are not updated when the + action is updated. This is a bug that is fixed in the beta for Java 6 + but obviously it can't wait that long. + * Renamed EnhancedMenu to WrappingMenu. I think it's more descriptive. + * Updated messages to load the messages files in UTF-8 + +07/10/2006 Ian Lewis <Ian...@me...> + + * Added the Shortcuts option pane. However, it currently it doesn't work. + It only displays the built in options and the combo box. + * Updated the shortcuts option pane so that it shows the select shortcut + dialog. + +07/06/2006 Ian Lewis <Ian...@me...> + + * Rewrote the Messages class. Now it loads messages on demand and only + loads the messages that it needs but allows the Locale to be changed at + any time. It also now supports different countries and variants. + +06/27/2006 Ian Lewis <Ian...@me...> + + * Added the GUIUtilities class for handling utility functions in jsXe. + * Added the GrabKeyDialog which will be used to assign shortcuts. + * Updated many classes for supporting shortcuts. + +06/23/2006 Ian Lewis <Ian...@me...> + + * Added back rudimentary key bindings using Swing Actions so they get + dispached by Swing and are displayed in menus. But infrastructure is + in place to allow jsXe to catch key bindings itself. + +06/21/2006 Ian Lewis <Ian...@me...> + + * Moved EnhancedMenu to it's own package. I will be creating a new menu + class that is specially designed for jsXe's LocalizedActions + * Created a new option for how many items can be in menus before they spill + over. + +06/20/2006 Ian Lewis <Ian...@me...> + + * Updated actions in jsXe so that actions can be easily localized and + so that they can be assigned shortcuts. Future actions that are registered + with jsXe will extend this class. The ActionManager now manages ActionSets + and key bindings within jsXe. + +06/15/2006 Ian Lewis <Ian...@me...> + + * Added a new Status column to the Plugin Manager dialog + * Added new plugin properties for the plugin author and release date + +06/14/2006 Ian Lewis <Ian...@me...> + + * Added the EditAction class for future actions in jsXe. + The messages, menu mnemonics, and tooltips will be able to be + localized and the shortcuts will be able to be set via the + InputManager. + +06/13/2006 Ian Lewis <Ian...@me...> + + * Added the InputManager for maintaining the key bindings for actions in + jsXe. + * Updated the param string for PropertyChanged messages. + * Moved the general options pane to it's own file. + 06/08/2006 Ian Lewis <Ian...@me...> * XMLAttribute was added to the new data model. @@ -28,7 +114,28 @@ * Added a new XMLDocumentType class * Added factory methods for XMLElements and XMLAttributes to the XMLDocument class. + * Added a PropertyChanged event for when one of jsXe's properties changes. + * Updated lots of javadoc + * jsXe's global options now implements AbstractOptionPane +06/07/2006 Ian Lewis <Ian...@me...> + + * Updated the document options to use abstract classes to lay out the + dialog. OptionsPanel is now deprecated in favor of using the OptionPane + and AbstractOptionPane classes. + * Updated dialogs to use setVisible() instead of show() + +06/06/2006 Ian Lewis <Ian...@me...> + + * Added a new Document Options Dialog which handles settings on a per + document basis. + * Updated the Global Options so that they don't include the per document + options anymore. + * Updated the DirtyFilesDialog so that it selects the first entry by + default. + * Updated EnhancedDialogs to be resizable by default. + * Updated the file dialog to use localized messages in the title + 06/04/2006 Ian Lewis <Ian...@me...> * XMLElement was added to model element nodes @@ -43,6 +150,11 @@ * Added insertUpdate and removeUpdate methods to the XMLDocumentListener * Updated XMLDocument to notify listeners on insert and remove events. +05/31/2006 Ian Lewis <Ian...@me...> + + * All plugins now implement EBListener and are added to the EditBus + * Updated the use of EditBus messages + 05/24/2006 Ian Lewis <Ian...@me...> * Updated the minimum version of xerces needed to run jsXe to 2.8. Modified: branches/jsxe2/INSTALL =================================================================== --- branches/jsxe2/INSTALL 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/INSTALL 2006-07-29 04:40:06 UTC (rev 1087) @@ -25,10 +25,12 @@ BUILDING jsXe FROM SOURCE This is pretty simple. You will need jakarta ANT and a Sun's javac compiler -(others might work, I just haven't tested them). Also, in order for jsXe to -compile properly you will need Apache Xerces installed. +(others might work, I just haven't tested them). You will need the optional +ant tasks installed as well. On some Linux distributions this may be a separate +package. Also, in order for jsXe to compile properly you will need Apache +Xerces installed. -You should have 1.4.2 or better of java and you will need version 2.8.0 of +You will need version 1.4.2 or better of java and you will need version 2.8.0 of Xerces (A Xerces 2.8.0 binary distribution is not included in the CVS source tree. You can aquire it at at http://xml.apache.org/) The jar files xercesImpl.jar, xml-apis.jar, and resolver.jar from the 2.8.0 distribution are @@ -36,7 +38,7 @@ (where you installed jsXe's source) or in the jre/lib/ext or lib/ext in your JVM. These jar files will be included with jsXe distributions for convenience. -Simply typing 'ant' or 'ant -p' in jsXe's root directory will give you the +Simply typing 'ant' in jsXe's root directory will give you the available targets to use with ant. To just simply compile jsXe and the default views to a jar file you can type 'ant compile'. To build a binary distribution you will need to run the 'bin' target in the build.xml file. I do this by simply @@ -51,23 +53,19 @@ RUNNING jsXe You should have 1.4.2 or better of java and you need 2.6.2 of Xerces. -To run jsXe you should just run the java interpreter on the jsXe.jar file. There -is a shell script or batch file included in the source tree for this purpose. - ./bin/jsXe.sh +*Windows* -or +Just run jsXe using the jsXe.exe in the install directory. The exe will +detect your version of Java and run jsXe using that version. - ./bin/jsXe.bat +*Unix* -The batch program should be run in with the jsXe root directory of as the -working directory. So you can create a shortcut to run jsXe by specifying the -batch file as the program to run and jsXe's root directory as the working -directory. +To run jsXe you should just run the java interpreter on the jsXe.jar file. There +is a shell script or batch file included in the source tree for this purpose. -Ex. -Target: "C:\Program Files\jsXe\bin\jsXe.bat" -Start in: "C:\Program Files\jsXe\" +./bin/jsXe.sh -You can also edit the JSXEDIR variable in the batch program to be the directory -where you installed jsXe and then the 'Start in' directory can be anywhere. +The shell script should be run in with the jsXe root directory of as the +working directory. You can also edit the JSXEDIR variable in the shell script +to be the directory where you installed jsXe. Modified: branches/jsxe2/NEWS =================================================================== --- branches/jsxe2/NEWS 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/NEWS 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,3 +1,24 @@ +07/24/2006 version 0.5 pre2 + + * Fixed a bug with the source view for new users that caused a + NullPointerException to be thrown when opening the source view. + * Added a wrapper exe for windows users using jSmooth + * Fixed bug 1509575. Files that are reloaded should always be loaded in a + view that can accep the reloaded file. + +07/20/2006 version 0.5 pre1 + + * Added support for keyboard shortcuts that can be set by the user via + the Global Options Dialog. + * Split the options into two dialogs. The Global Options, which are + editor-wide options, and the Document Options, which are set for each + document. + * Added a Japanese translation. + * Added a British-English translation. + * Fixed translation files so that non-ASCII characters will be displayed + properly. + * Added a status bar to display messages to the user. + 04/25/2006 version 0.4 beta * Updated to work with xerces 2.8.0 (jsXe now requires xerces 2.8.0) Modified: branches/jsxe2/RELEASE.CHECKLIST =================================================================== --- branches/jsxe2/RELEASE.CHECKLIST 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/RELEASE.CHECKLIST 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,48 +1,17 @@ RELEASE CHECKLIST -*********Minor release********* +* Make sure all bugs that are priority 5 or higher are resolved. -* Update the Changelog file -* Update the NEWS file -* Update the README if needed -* Update the AUTHORS if needed -* Update the INSTALL file if needed -* Update the README if needed - -* Make a new tag in SVN for the release. - -* Update the jsXe website in SVN to reference the new versions -* Update the jsXe website in SVN to have the correct help and documentation. - * Run 'ant deploy-web-doc' - -Build the project - * Make sure the major.version, minor.version, beta.version, bugfix.version, - app.version, and app_version are correct in build.xml - * Build the release files using 'ant bin src' - -* Create new release on sourceforge - * Upload binary and source distribution to Sourceforge - * Add the NEWS and Changelog entries to the release. -* Update the News on the sourceforge project page. -* Update the freshmeat project with the new version and URLs. - -*********Major release********* - * Get translations finalized * Build the Java Doc and check it for omissions and errors. -* Make sure all bugs that have a priority above 5 are resolved. * Update the Changelog file * Update the NEWS file * Update the README if needed * Update the AUTHORS if needed * Update the INSTALL file if needed -* Update the README if needed - -* Make a new tag in SVN for the release. - -* Update the jsXe website in SVN to reference the new versions -* Update the jsXe website in SVN to have the correct help and documentation. +* Update the jsXe website in CVS to reference the new versions +* Update the jsXe website in CVS to have the correct help and documentation. * Run 'ant deploy-web-doc' Build the project Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/build.xml 2006-07-29 04:40:06 UTC (rev 1087) @@ -9,161 +9,196 @@ You should check out jsxe to make a structure like this. This ensures that when compiling jsXe the other views will be compiled as well. - jsxe module => jsxe/ - treeview module => jsxe/jars/treeview - sourceview module => jsxe/jars/sourceview - jsxe web module => web/ + jsxe module => jsxe/ + treeview module (optional) => jsxe/jars/treeview + sourceview module (optional) => jsxe/jars/sourceview + jsxe web module (optional) => web/ + jsmooth ant task (optional) => buildlib/ + --> <project basedir="." default="usage" name="jsXe"> - + <description>jsXe - Java Simple XML Editor</description> <!-- {{{ ============ Initializes properties and variables ============= --> - <target name="init"> - <tstamp/> - <property name="app.name" value="jsXe"/> - <property name="root.dir" value="."/> + <target name="init"> + <tstamp/> + <property name="app.name" value="jsXe"/> + <property name="root.dir" value="."/> <property name="build.dir" value="${root.dir}/build"/> - <property name="src.dir" value="${root.dir}/src"/> - <property name="lib.dir" value="${root.dir}/lib"/> - <property name="bin.dir" value="${root.dir}/bin"/> - <property name="messages.dir" value="${root.dir}/messages"/> + <property name="src.dir" value="${root.dir}/src"/> + <property name="lib.dir" value="${root.dir}/lib"/> + <property name="bin.dir" value="${root.dir}/bin"/> + <property name="messages.dir" value="${root.dir}/messages"/> <property name="build.messages" value="${build.dir}/messages"/> <property name="docs.dir" value="${src.dir}/doc"/> <property name="plugin.dir" value="${root.dir}/jars"/> - <property name="build.src" value="${build.dir}/src"/> - <property name="build.dest" value="${build.dir}/classes"/> - <property name="build.docs" value="${build.dir}/doc"/> - <property name="build.lib" value="${build.dir}/lib"/> - <property name="build.bin" value="${build.dir}/bin"/> - <property name="build.bin" value="${build.dir}/bin"/> + <property name="build.plugin" value="${build.dir}/jars"/> + <property name="build.src" value="${build.dir}/src"/> + <property name="build.dest" value="${build.dir}/classes"/> + <property name="build.docs" value="${build.dir}/doc"/> + <property name="build.lib" value="${build.dir}/lib"/> + <property name="build.bin" value="${build.dir}/bin"/> <property name="date.format" value="MM.dd.yyyy HH:mm:ss z"/> - <property name="build.javadocs" value="${build.docs}/api"/> - <property name="build.help" value="${build.docs}/help"/> + <property name="build.javadocs" value="${build.docs}/api"/> + <property name="build.help" value="${build.docs}/help"/> <property name="javac.debug" value="on"/> - <property name="javac.optimize" value="off"/> - <property name="javac.deprecation" value="on"/> + <property name="javac.optimize" value="off"/> + <property name="javac.deprecation" value="on"/> <property name="javac.include.runtime" value="no"/> <property name="javac.source" value="1.3"/> - <property name="javadoc.link" value="http://java.sun.com/j2se/1.3/docs/api/"/> + <property name="java.javadoc.link" value="http://java.sun.com/j2se/1.3/docs/api/"/> + <property name="xerces.javadoc.link" value="http://xerces.apache.org/xerces2-j/javadocs/api/"/> <property name="main.class" value="net.sourceforge.jsxe.jsXe"/> - <property name="major.version" value="0"/> - <property name="minor.version" value="5"/> - <property name="beta.version" value="1"/> + <property name="major.version" value="0"/> + <property name="minor.version" value="5"/> + <property name="beta.version" value="3"/> <property name="bugfix.version" value="0"/> <!-- Human Readable --> - <property name="app.version" value="0.5 pre1"/> + <property name="app.version" value="0.5 pre3"/> <!-- Used in filenames --> - <property name="app_version" value="05_pre1"/> - <!--<property name="app.version" value="${major.version}.${minor.version} beta"/>--> - <!--<property name="app_version" value="${major.version}_${minor.version}beta"/>--> - <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> - <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> + <property name="app_version" value="05_pre3"/> + <property name="buildlib.dir" value="${root.dir}/buildlib"/> + <property name="jsmooth.project" value="${root.dir}/jsXe.jsmooth"/> + <property name="jsmooth.jar" value="${buildlib.dir}/jsmoothgen-ant.jar"/> + + <condition property="windows.build"> + <and> + <os family="windows"/> + <available file="${jsmooth.jar}" property="jsmooth.avail"/> + </and> + </condition> + + <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> + <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> <path id="classpath"> - <pathelement location="."/> - <pathelement location="${build.dest}"/> - <pathelement location="${build.src}"/> - <pathelement location="${src.dir}"/> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - </path> + <pathelement location="."/> + <pathelement location="${build.dest}"/> + <pathelement location="${build.src}"/> + <pathelement location="${src.dir}"/> + <fileset dir="${lib.dir}"> + <include name="**/*.jar"/> + </fileset> + </path> + <path id="run-classpath"> + <pathelement location="${build.dir}/${app.name}.jar"/> + <fileset dir="${lib.dir}"> + <include name="**/*.jar"/> + </fileset> + </path> + <!-- set whether we have the source for the default views --> <available file="${plugin.dir}/treeview/build.xml" property="treeview.avail"/> <available file="${plugin.dir}/sourceview/build.xml" property="sourceview.avail"/> <available file="${root.dir}/../web" property="web.avail"/> + <available file="${plugin.dir}" property="plugin.avail"/> - <echo message="${app.name} ${app.version}"/> - <echo message="----------------------------------------------------------"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prints the available targets ===================== --> - <target depends="init" name="usage" description="Prints available targets"> - <echo message=" available targets are:"/> - <echo message=""/> - <echo message=" compile --> generates the ${app.name}.jar file."/> + + <echo message="${app.name} ${app.version}"/> + <echo message="----------------------------------------------------------"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prints the available targets ===================== --> + <target depends="init" name="usage" description="Prints available targets"> + <echo message=" available targets are:"/> + <echo message=""/> + <echo message=" compile --> generates the ${app.name}.jar file."/> <echo message=" also generates the jars for the tree view"/> <echo message=" and source view plugins if available."/> - <echo message=" bin --> generates a binary distribution"/> - <echo message=" src --> generates a source distribution"/> - <echo message=" doc --> generates all documentation"/> + <echo message=" bin --> generates a binary distribution"/> + <echo message=" src --> generates a source distribution"/> + <echo message=" doc --> generates all documentation"/> <echo message=" also updates the web api if the web module"/> <echo message=" is available."/> - <echo message=" clean --> cleans everything up"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prepares for any type of build =================== --> - <target depends="init" name="prepare"> - <mkdir dir="${build.dir}"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prepares the documentation ======================= --> - <target depends="prepare" name="prepare-doc"> - <mkdir dir="${build.docs}"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prepares the source distribution ================= --> - <target depends="prepare" name="prepare-src"> - <mkdir dir="${build.src}"/> - <copy todir="${build.src}"> - <fileset dir="${src.dir}"> - <include name="**/*.java"/> - <include name="**/*.props"/> - <include name="**/*.properties"/> - <include name="**/properties"/> + <echo message=" clean --> cleans everything up"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares for any type of build =================== --> + <target depends="init" name="prepare"> + <mkdir dir="${build.dir}"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares the documentation ======================= --> + <target depends="prepare" name="prepare-doc"> + <mkdir dir="${build.docs}"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares the source distribution ================= --> + <target depends="prepare" name="prepare-src"> + <mkdir dir="${build.src}"/> + <copy todir="${build.src}"> + <fileset dir="${src.dir}"> + <include name="**/*.java"/> + <include name="**/*.props"/> + <include name="**/*.properties"/> + <include name="**/properties"/> <include name="**/*.xml"/> <!-- internal xml docs are not validated --> <!--<include name="**/*.dtd"/>--> - <include name="**/*.jpg"/> - <include name="**/*.png"/> + <include name="**/*.jpg"/> + <include name="**/*.png"/> <!-- files in the source directory to ignore --> - <exclude name="net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java"/> + <exclude name="net/sourceforge/jsxe/dom2/**/*"/> <exclude name="net/sourceforge/jsxe/io/**/*"/> - </fileset> - </copy> + </fileset> + </copy> + <mkdir dir="${build.plugin}"/> + + <antcall target="prepare-plugins"/> + <mkdir dir="${build.messages}"/> - <copy todir="${build.messages}"> + <!--<copy todir="${build.messages}"> <fileset dir="${messages.dir}"> <include name="**/messages.*"/> </fileset> + </copy>--> + + <!-- run native2ascii on these files --> + <native2ascii encoding="UTF-8" src="${messages.dir}" dest="${build.messages}" includes="messages*"/> + </target> + <target name="prepare-plugins" if="plugin.avail"> + <copy todir="${build.plugin}"> + <fileset dir="${plugin.dir}"> + <include name="**/*"/> + </fileset> </copy> - </target> - <!-- }}} --> - <!-- {{{ ============ Compiles the program ============================= --> - <target depends="prepare-src" name="compile" description="compile jsXe"> - <mkdir dir="${build.dest}"/> - <javac debug="${javac.debug}" deprecation="${javac.deprecation}" includeJavaRuntime="${javac.include.runtime}" optimize="${javac... [truncated message content] |
|
From: <ian...@us...> - 2006-08-07 19:50:59
|
Revision: 1107 Author: ian_lewis Date: 2006-08-07 12:50:51 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1107&view=rev Log Message: ----------- Removed the get and setStringProperty methods since they aren't needed Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-08-05 21:41:13 UTC (rev 1106) +++ branches/jsxe2/Changelog 2006-08-07 19:50:51 UTC (rev 1107) @@ -1,3 +1,8 @@ +08/07/2006 Ian Lewis <Ian...@me...> + + * Removed get/setStringProperty methods from XMLDocument since they aren't + needed + 08/03/2006 Ian Lewis <Ian...@me...> * More porting of jEdit's VFS classes to jsXe Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-05 21:41:13 UTC (rev 1106) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-07 19:50:51 UTC (rev 1107) @@ -375,30 +375,6 @@ } }//}}} - //{{{ getStringProperty() method - /** - * Returns the value of a string property. This method is thread-safe. - * @param name The property name - */ - public String getStringProperty(String name) { - Object obj = getProperty(name); - if (obj != null) { - return obj.toString(); - } else { - return null; - } - } //}}} - - //{{{ setStringProperty() method - /** - * Sets a string property. - * @param name The property name - * @param value The value - */ - public void setStringProperty(String name, String value) { - setProperty(name,value); - } //}}} - //{{{ getBooleanProperty() method /** * Returns the value of a boolean property. This method is thread-safe. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-08-27 20:09:22
|
Revision: 1174 Author: ian_lewis Date: 2006-08-27 13:09:13 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1174&view=rev Log Message: ----------- Added a PropertyChangeEvent class for when properties change in the XMLDocument Modified Paths: -------------- branches/jsxe2/build.xml branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-08-27 18:55:21 UTC (rev 1173) +++ branches/jsxe2/build.xml 2006-08-27 20:09:13 UTC (rev 1174) @@ -141,8 +141,8 @@ <include name="**/*.png"/> <!-- files in the source directory to ignore --> - <exclude name="net/sourceforge/jsxe/dom2/**/*"/> - <exclude name="net/sourceforge/jsxe/io/**/*"/> + <!--<exclude name="net/sourceforge/jsxe/dom2/**/*"/> + <exclude name="net/sourceforge/jsxe/io/**/*"/>--> </fileset> </copy> <mkdir dir="${build.plugin}"/> Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java 2006-08-27 20:09:13 UTC (rev 1174) @@ -0,0 +1,88 @@ +/* +PropertyChangedEvent.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version.e + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2.event; + +import net.sourceforge.jsxe.dom2.*; +import java.util.EventObject; + +/** + * PropertyChangedEvents occur when a property in the XMLDocument is changed. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @since jsXe XX.XX + */ +public class PropertyChangeEvent extends EventObject { + + private XMLDocument m_document; + private String m_oldValue; + private String m_newValue; + private String m_key; + + //{{{ PropertyChangeEvent constructor + /** + * Creates a new PropertyChangeEvent. + */ + public PropertyChangeEvent(XMLDocument doc, String name, String oldValue, String newValue) { + super(doc); + m_key = name; + m_oldValue = oldValue; + m_newValue = newValue; + }//}}} + + //{{{ getDocument() + /** + * Gets the document that was updated. + */ + public XMLDocument getDocument() { + return (XMLDocument)getSource(); + }//}}} + + //{{{ getOldValue() + /** + * Gets the old value of the property. + */ + public String getOldValue() { + return m_oldValue; + }//}}} + + //{{{ getNewValue() + /** + * Gets the new value of the property. + */ + public String getNewValue() { + return m_newValue; + }//}}} + + //{{{ getName() + /** + * Gets the name of the property that was changed. + */ + public String getName() { + return m_key; + }//}}} + +} \ No newline at end of file Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-27 18:55:21 UTC (rev 1173) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-27 20:09:13 UTC (rev 1174) @@ -34,7 +34,7 @@ * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ * @see XMLDocument - * @since jsXe 0.5 pre3 + * @since jsXe XX.XX */ public class XMLDocumentEvent extends EventObject { Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-27 18:55:21 UTC (rev 1173) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-27 20:09:13 UTC (rev 1174) @@ -27,9 +27,19 @@ import net.sourceforge.jsxe.dom2.*; import java.util.EventListener; +/** + * An XMLDocumentListener listens for changes to an XMLDocument. Components + * that need to recieve notification when the document changes should implement + * this interface. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @since jsXe XX.XX + */ public interface XMLDocumentListener extends EventListener { - public void propertyChanged(PropertyChangedEvent event); + public void propertyChanged(PropertyChangeEvent event); public void insertUpdate(XMLDocumentEvent event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-09-06 23:22:20
|
Revision: 1242
http://svn.sourceforge.net/jsxe/?rev=1242&view=rev
Author: ian_lewis
Date: 2006-09-06 16:22:12 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Made XMLDocument thread safe
Modified Paths:
--------------
branches/jsxe2/Changelog
branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java
branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java
Modified: branches/jsxe2/Changelog
===================================================================
--- branches/jsxe2/Changelog 2006-09-06 19:34:32 UTC (rev 1241)
+++ branches/jsxe2/Changelog 2006-09-06 23:22:12 UTC (rev 1242)
@@ -1,3 +1,9 @@
+09/06/2006 Ian Lewis <Ian...@me...>
+
+ * Added threading support to XMLDocument. Multi-threaded support is not
+ complete yet however. Currently jsXe only runs in the AWT thread.
+ * AdapterNode now uses the DOM3 renameNode() method to rename element nodes.
+
08/31/2006 Ian Lewis <Ian...@me...>
* Added new ContextSpecificActions to replace ViewSpecificActions. Now
Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java
===================================================================
--- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-09-06 19:34:32 UTC (rev 1241)
+++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-09-06 23:22:12 UTC (rev 1242)
@@ -33,6 +33,7 @@
import net.sourceforge.jsxe.msg.UndoEvent;
import net.sourceforge.jsxe.util.Log;
import net.sourceforge.jsxe.util.MiscUtilities;
+import net.sourceforge.jsxe.util.ReadWriteLock;
import net.sourceforge.jsxe.dom.completion.*;
import net.sourceforge.jsxe.dom.undo.*;
import net.sourceforge.jsxe.dom.ls.*;
@@ -340,54 +341,63 @@
* @return the old value of the property
*/
public String setProperty(String key, String value) {
- String oldValue = getProperty(key);
- if (oldValue == null || !oldValue.equals(value)) {
- // do this first so NullPointerExceptions are thrown
- oldValue = (String)props.setProperty(key, value);
+ synchronized(propertyLock) {
+ String oldValue = getProperty(key);
- if (key.equals(ENCODING)) {
- m_syncedWithContent = false;
- }
- if (key.equals(FORMAT_XML)) {
- m_syncedWithContent = false;
- if (Boolean.valueOf(value).booleanValue()) {
- setProperty(WS_IN_ELEMENT_CONTENT, "false");
+ if (oldValue == null || !oldValue.equals(value)) {
+ // do this first so NullPointerExceptions are thrown
+ oldValue = (String)props.setProperty(key, value);
+
+ if (key.equals(ENCODING)) {
+ m_syncedWithContent = false;
}
- }
- if (key.equals(WS_IN_ELEMENT_CONTENT)) {
- m_syncedWithContent = false;
- if (Boolean.valueOf(value).booleanValue()) {
- setProperty(FORMAT_XML, "false");
+ if (key.equals(FORMAT_XML)) {
+ m_syncedWithContent = false;
+ if (Boolean.valueOf(value).booleanValue()) {
+ setProperty(WS_IN_ELEMENT_CONTENT, "false");
+ }
}
- }
- if (key.equals(IS_USING_SOFT_TABS)) {
- m_syncedWithContent = false;
- }
- if (key.equals(IS_VALIDATING)) {
- //This is ugly. Need to rethink how this should happen.
- if (Boolean.valueOf(value).booleanValue()) {
- //syncContentWithDOM could change m_parsedMode
- syncContentWithDOM();
- } else {
- /*
- If we are turning off validation then just clear the errors list.
- No need to reparse or serialize.
- */
- m_parseErrors = new ArrayList();
- m_parseFatalErrors = new ArrayList();
+ if (key.equals(WS_IN_ELEMENT_CONTENT)) {
+ m_syncedWithContent = false;
+ if (Boolean.valueOf(value).booleanValue()) {
+ setProperty(FORMAT_XML, "false");
+ }
}
- }
- if (key.equals(INDENT)) {
- if (MiscUtilities.isTrue(getProperty(FORMAT_XML))
- && MiscUtilities.isTrue(getProperty(IS_USING_SOFT_TABS)))
- {
+ if (key.equals(IS_USING_SOFT_TABS)) {
m_syncedWithContent = false;
}
+ if (key.equals(IS_VALIDATING)) {
+ //This is ugly. Need to rethink how this should happen.
+ if (Boolean.valueOf(value).booleanValue()) {
+ //syncContentWithDOM could change m_parsedMode
+ try {
+ writeLock();
+
+ syncContentWithDOM();
+ } finally {
+ writeUnlock();
+ }
+ } else {
+ /*
+ If we are turning off validation then just clear the errors list.
+ No need to reparse or serialize.
+ */
+ m_parseErrors = new ArrayList();
+ m_parseFatalErrors = new ArrayList();
+ }
+ }
+ if (key.equals(INDENT)) {
+ if (MiscUtilities.isTrue(getProperty(FORMAT_XML))
+ && MiscUtilities.isTrue(getProperty(IS_USING_SOFT_TABS)))
+ {
+ m_syncedWithContent = false;
+ }
+ }
+ firePropertyChanged(key, oldValue);
}
- firePropertyChanged(key, oldValue);
+ return oldValue;
}
- return oldValue;
}//}}}
//{{{ getBooleanProperty() method
@@ -461,14 +471,21 @@
*/
public String getText(int start, int length) throws IOException {
- if (start < 0 || length < 0 || start + length > m_content.getLength()) {
- throw new ArrayIndexOutOfBoundsException(start + ":" + length);
+ try {
+
+ writeLock();
+
+ if (start < 0 || length < 0 || start + length > m_content.getLength()) {
+ throw new ArrayIndexOutOfBoundsException(start + ":" + length);
+ }
+
+ //if the document is well formed we go by the DOM
+ //if it's not we go by the source text.
+ syncContentWithDOM();
+ return m_content.getText(start,length);
+ } finally {
+ writeUnlock();
}
-
- //if the document is well formed we go by the DOM
- //if it's not we go by the source text.
- syncContentWithDOM();
- return m_content.getText(start,length);
}//}}}
//{{{ getSegment()
@@ -482,19 +499,25 @@
* @return the segment representing the text requested
*/
public Segment getSegment(int start, int length) throws IOException {
-
- if (start < 0 || length < 0 || start + length > m_content.getLength()) {
- throw new ArrayIndexOutOfBoundsException(start + ":" + length);
+ try {
+
+ writeLock();
+
+ if (start < 0 || length < 0 || start + length > m_content.getLength()) {
+ throw new ArrayIndexOutOfBoundsException(start + ":" + length);
+ }
+
+ //if the document is well formed we go by the DOM
+ //if it's not we go by the source text.
+ if (m_parsedMode) {
+ syncContentWithDOM();
+ }
+ Segment seg = new Segment();
+ m_content.getText(start, length, seg);
+ return seg;
+ } finally {
+ writeUnlock();
}
-
- //if the document is well formed we go by the DOM
- //if it's not we go by the source text.
- if (m_parsedMode) {
- syncContentWithDOM();
- }
- Segment seg = new Segment();
- m_content.getText(start, length, seg);
- return seg;
}//}}}
//{{{ getLength()
@@ -503,10 +526,17 @@
* @return the length of the document
*/
public int getLength() {
-
- syncContentWithDOM();
-
- return m_content.getLength();
+ try {
+ writeLock();
+
+ syncContentWithDOM();
+
+ // no need to lock since this just returns a value and that's it
+ return m_content.getLength();
+ } finally {
+ Log.log(Log.DEBUG, this, "writeUnlock()");
+ writeUnlock();
+ }
}//}}}
//{{{ insertText()
@@ -517,16 +547,27 @@
* @throws IOException if the text could not be inserted
*/
public void insertText(int offset, String text) throws IOException {
- if (text.length() > 0) {
- Log.log(Log.DEBUG, this, "insertText: "+offset+": "+text);
- syncContentWithDOM();
- m_content.insert(offset, text);
- m_parsedMode = false;
- m_adapterNode = null;
- if (!getFlag(UNDO_IN_PROGRESS)) {
- addUndoableEdit(new InsertEdit(this, offset, text));
+
+ try {
+ writeLock();
+
+ if (offset < 0 || offset > m_content.getLength()) {
+ throw new ArrayIndexOutOfBoundsException(offset);
}
- fireStructureChanged(null);
+
+ if (text.length() > 0) {
+ // Log.log(Log.DEBUG, this, "insertText: "+offset+": "+text);
+ syncContentWithDOM();
+ m_content.insert(offset, text);
+ m_parsedMode = false;
+ m_adapterNode = null;
+ if (!getFlag(UNDO_IN_PROGRESS)) {
+ addUndoableEdit(new InsertEdit(this, offset, text));
+ }
+ fireStructureChanged(null);
+ }
+ } finally {
+ writeUnlock();
}
}//}}}
@@ -538,21 +579,35 @@
* @throws IOException if the text could not be removed
*/
public void removeText(int offset, int length) throws IOException {
- if (length > 0) {
- String text = getText(offset,length);
- Log.log(Log.DEBUG, this, "removeText: "+offset+": "+text);
- m_content.remove(offset, length);
- m_parsedMode = false;
- m_adapterNode = null;
- if (!getFlag(UNDO_IN_PROGRESS)) {
- addUndoableEdit(new RemoveEdit(this, offset, text));
+
+ try {
+
+ writeLock();
+
+ if (offset < 0 || length < 0 || offset + length > m_content.getLength()) {
+ throw new ArrayIndexOutOfBoundsException(offset + ":" + length);
}
- fireStructureChanged(null);
+
+ if (length > 0) {
+ String text = getText(offset,length);
+ Log.log(Log.DEBUG, this, "removeText: "+offset+": "+text);
+ m_content.remove(offset, length);
+ m_parsedMode = false;
+ m_adapterNode = null;
+ if (!getFlag(UNDO_IN_PROGRESS)) {
+ addUndoableEdit(new RemoveEdit(this, offset, text));
+ }
+ fireStructureChanged(null);
+ }
+ } finally {
+ writeUnlock();
}
}//}}}
//}}}
+ //{{{ XML Document Methods
+
//{{{ checkWellFormedness()
/**
* Checks the wellformedness of the document and throws appropriate
@@ -564,14 +619,18 @@
* @throws IOException if there was a problem reading the document
*/
public boolean checkWellFormedness() throws SAXParseException, SAXException, ParserConfigurationException, IOException {
- if (!m_parsedMode) {
- parseDocument();
- m_adapterNode = new AdapterNode(this, m_document);
- // m_adapterNode.addAdapterNodeListener(docAdapterListener);
- // m_syncedWithContent = true;
- m_parsedMode=true;
+ try {
+ readLock();
+
+ if (!m_parsedMode) {
+ parseDocument();
+ m_adapterNode = new AdapterNode(this, m_document);
+ m_parsedMode=true;
+ }
+ return m_parsedMode;
+ } finally {
+ readUnlock();
}
- return m_parsedMode;
}//}}}
//{{{ getDocType()
@@ -700,9 +759,14 @@
* @since jsXe 0.4 pre3
*/
public List getErrors() {
- syncContentWithDOM();
- parseWithoutUpdate();
- return m_parseErrors;
+ try {
+ writeLock();
+ syncContentWithDOM();
+ parseWithoutUpdate();
+ return m_parseErrors;
+ } finally {
+ writeUnlock();
+ }
}//}}}
//{{{ isWellFormed()
@@ -735,16 +799,21 @@
*/
public boolean isValid() throws IOException {
if (Boolean.valueOf(getProperty(IS_VALIDATING)).booleanValue()) {
- /*
- This needs to be done every time we check for validity even
- if this document hasn't changed since the DTD or Schema document
- we are validating against may have changed in the meantime.
- */
-
- syncContentWithDOM();
- parseWithoutUpdate();
-
- return (m_parseErrors.size() == 0 && m_parseFatalErrors.size() == 0);
+ try {
+ writeLock();
+ /*
+ This needs to be done every time we check for validity even
+ if this document hasn't changed since the DTD or Schema document
+ we are validating against may have changed in the meantime.
+ */
+
+ syncContentWithDOM();
+ parseWithoutUpdate();
+
+ return (m_parseErrors.size() == 0 && m_parseFatalErrors.size() == 0);
+ } finally {
+ writeUnlock();
+ }
} else {
return false;
}
@@ -813,6 +882,20 @@
return getNoNamespaceCompletionInfo().getEntities();
}//}}}
+ //{{{ setEntityResolver()
+ /**
+ * Sets the EntityResolver object that is used when resolving external
+ * entities.
+ * @param resolver the entity resolver
+ */
+ public void setEntityResolver(EntityResolver resolver) {
+ m_entityResolver = resolver;
+ }//}}}
+
+ //}}}
+
+ //{{{ I/O Methods
+
//{{{ serialize()
/**
* Writes the XML document to the output stream specified.
@@ -823,79 +906,86 @@
*/
public void serialize(OutputStream out) throws IOException, UnsupportedEncodingException {
- boolean parsedBeforeSerialization = m_parsedMode;
-
- String newLine = getProperty(LINE_SEPARATOR);
-
- syncContentWithDOM();
-
- String encoding = getProperty(ENCODING);
- if (encoding.equals(MiscUtilities.UTF_8_Y)) {
- // not supported by Java...
- out.write(UTF8_MAGIC_1);
- out.write(UTF8_MAGIC_2);
- out.write(UTF8_MAGIC_3);
- out.flush();
- encoding = "UTF-8";
- }
-
- //now just write out the text.
- int length = m_content.getLength();
- int index = 0;
- BufferedWriter outbuf = new BufferedWriter(new OutputStreamWriter(out, encoding), IO_BUFFER_SIZE);
- Segment seg = new Segment();
-
- while (index < length) {
- int size = WRITE_SIZE;
- try {
- size = Math.min(length - index, WRITE_SIZE);
- } catch(NumberFormatException nf) {
- Log.log(Log.ERROR, this, nf);
+ try {
+
+ writeLock();
+
+ boolean parsedBeforeSerialization = m_parsedMode;
+
+ String newLine = getProperty(LINE_SEPARATOR);
+
+ syncContentWithDOM();
+
+ String encoding = getProperty(ENCODING);
+ if (encoding.equals(MiscUtilities.UTF_8_Y)) {
+ // not supported by Java...
+ out.write(UTF8_MAGIC_1);
+ out.write(UTF8_MAGIC_2);
+ out.write(UTF8_MAGIC_3);
+ out.flush();
+ encoding = "UTF-8";
}
- // out.write(m_content.getText(index, size).getBytes(getProperty(ENCODING)), index, size);
- m_content.getText(index, size, seg);
+ //now just write out the text.
+ int length = m_content.getLength();
+ int index = 0;
+ BufferedWriter outbuf = new BufferedWriter(new OutputStreamWriter(out, encoding), IO_BUFFER_SIZE);
+ Segment seg = new Segment();
- int startOffset = seg.offset;
- int endOffset = size + seg.offset;
-
- for (int i=startOffset; i<endOffset; i++) {
- if (seg.array[i]=='\n') {
- outbuf.write(seg.array, seg.offset, i - seg.offset);
- outbuf.write(newLine.toCharArray(), 0, newLine.length());
-
- //add 1 because of \n character,
- seg.count -= i-seg.offset+1;
- seg.offset += i-seg.offset+1;
+ while (index < length) {
+ int size = WRITE_SIZE;
+ try {
+ size = Math.min(length - index, WRITE_SIZE);
+ } catch(NumberFormatException nf) {
+ Log.log(Log.ERROR, this, nf);
}
+
+ // out.write(m_content.getText(index, size).getBytes(getProperty(ENCODING)), index, size);
+ m_content.getText(index, size, seg);
+
+ int startOffset = seg.offset;
+ int endOffset = size + seg.offset;
+
+ for (int i=startOffset; i<endOffset; i++) {
+ if (seg.array[i]=='\n') {
+ outbuf.write(seg.array, seg.offset, i - seg.offset);
+ outbuf.write(newLine.toCharArray(), 0, newLine.length());
+
+ //add 1 because of \n character,
+ seg.count -= i-seg.offset+1;
+ seg.offset += i-seg.offset+1;
+ }
+ }
+
+ //write the rest
+ outbuf.write(seg.array, seg.offset, seg.count);
+ index += size;
}
- //write the rest
- outbuf.write(seg.array, seg.offset, seg.count);
- index += size;
- }
-
- outbuf.close();
-
- //if something changed in the structure while serializing
- //basically we don't want serialize() to cause the XMLDocument
- //to go from parsed mode to non-parsed mode
- if (!m_parsedMode && parsedBeforeSerialization) {
- try {
- checkWellFormedness();
- } catch (SAXException saxe) {
- throw new IOException(saxe.getMessage());
- } catch (ParserConfigurationException pce) {
- throw new IOException(pce.getMessage());
- } finally {
- /*
- if there is an error parsing we want to be in parsed mode
- using the old DOM before serializing.
- if there is no error, we want to be in parsed mode with the
- new DOM.
- */
- m_parsedMode = true;
+ outbuf.close();
+
+ //if something changed in the structure while serializing
+ //basically we don't want serialize() to cause the XMLDocument
+ //to go from parsed mode to non-parsed mode
+ if (!m_parsedMode && parsedBeforeSerialization) {
+ try {
+ checkWellFormedness();
+ } catch (SAXException saxe) {
+ throw new IOException(saxe.getMessage());
+ } catch (ParserConfigurationException pce) {
+ throw new IOException(pce.getMessage());
+ } finally {
+ /*
+ if there is an error parsing we want to be in parsed mode
+ using the old DOM before serializing.
+ if there is no error, we want to be in parsed mode with the
+ new DOM.
+ */
+ m_parsedMode = true;
+ }
}
+ } finally {
+ writeUnlock();
}
}//}}}
@@ -916,36 +1006,6 @@
return value;
}//}}}
- //{{{ setEntityResolver()
- /**
- * Sets the EntityResolver object that is used when resolving external
- * entities.
- * @param resolver the entity resolver
- */
- public void setEntityResolver(EntityResolver resolver) {
- m_entityResolver = resolver;
- }//}}}
-
- //{{{ setURI()
- /**
- * Sets the URI for the location of this document.
- * @param uri the uri specifying the location of this document. Can be null.
- * @since jsXe 0.4 pre4
- */
- public void setURI(URI uri) {
- m_uri = uri;
- }//}}}
-
- //{{{ getURI()
- /**
- * Gets the URI for the location of this document.
- * @return the uri specifying the location of this document. Can be null.
- * @since jsXe 0.4 pre4
- */
- public URI getURI() {
- return m_uri;
- }//}}}
-
//{{{ setModel()
/**
* Sets up the XMLDocument given a Reader. The existing content is
@@ -1115,6 +1175,68 @@
// }
}//}}}
+ //}}}
+
+ //{{{ Thread safety
+
+ //{{{ readLock() method
+ /**
+ * The buffer is guaranteed not to change between calls to
+ * {@link #readLock()} and {@link #readUnlock()}.
+ */
+ public void readLock() {
+ lock.readLock();
+ } //}}}
+
+ //{{{ readUnlock() method
+ /**
+ * The buffer is guaranteed not to change between calls to
+ * {@link #readLock()} and {@link #readUnlock()}.
+ */
+ public void readUnlock() {
+ lock.readUnlock();
+ } //}}}
+
+ //{{{ writeLock() method
+ /**
+ * Attempting to obtain read lock will block between calls to
+ * {@link #writeLock()} and {@link #writeUnlock()}.
+ */
+ public void writeLock() {
+ lock.writeLock();
+ } //}}}
+
+ //{{{ writeUnlock() method
+ /**
+ * Attempting to obtain read lock will block between calls to
+ * {@link #writeLock()} and {@link #writeUnlock()}.
+ */
+ public void writeUnlock() {
+ lock.writeUnlock();
+ } //}}}
+
+ //}}}
+
+ //{{{ setURI()
+ /**
+ * Sets the URI for the location of this document.
+ * @param uri the uri specifying the location of this document. Can be null.
+ * @since jsXe 0.4 pre4
+ */
+ public void setURI(URI uri) {
+ m_uri = uri;
+ }//}}}
+
+ //{{{ getURI()
+ /**
+ * Gets the URI for the location of this document.
+ * @return the uri specifying the location of this document. Can be null.
+ * @since jsXe 0.4 pre4
+ */
+ public URI getURI() {
+ return m_uri;
+ }//}}}
+
//{{{ addXMLDocumentListener()
/**
* Registers a change listener with the XMLDocument
@@ -1222,11 +1344,13 @@
//{{{ syncContentWithDOM()
/**
* Write the DOM to the content manager given the current serialization and
- * formatting options.
+ * formatting options. This method is not thread safe. You should call
+ * writeLock() before and writeUnlock() after calling this method.
*/
private void syncContentWithDOM() {
if (m_parsedMode) {
if (!m_syncedWithContent) {
+
try {
Log.log(Log.MESSAGE, this, "Serializing document");
//since we are in parsed mode let's serialize to the content
@@ -1256,6 +1380,9 @@
m_parsedMode = false;
try {
+
+ readLock();
+
parseDocument();
//Why was this set to false? why would we want to
//serialize the document again since nothing's changed?
@@ -1267,6 +1394,8 @@
} catch (Exception e) {
//If an error occurs then we're in trouble
jsXe.exiterror(this, e, 1);
+ } finally {
+ readUnlock();
}
fireStructureChanged(null);
}
@@ -1302,7 +1431,8 @@
//{{{ parseDocument()
/**
* Parses the document with the current options. After this is called
- * m_adapterNode and m_parsedMode must be updated.
+ * m_adapterNode and m_parsedMode must be updated. The document text content
+ * should be up to date compared to the document structure.
* @since jsXe 0.4 pre1
*/
public void parseDocument() throws SAXParseException, SAXException, ParserConfigurationException, IOException {
@@ -1330,9 +1460,7 @@
builder.setEntityResolver(m_entityResolver);
}
- //Temporary fix to allow parsing of documnts with multi-byte characters
- // Document doc = builder.parse(new ContentManagerInputStream(m_content));
- String text = getText(0, getLength());
+ String text = m_content.getText(0,m_content.getLength());
Document doc = builder.parse(new InputSource(new StringReader(text)));
doc.getDocumentElement().normalize();
//}}}
@@ -1352,7 +1480,8 @@
//{{{ parseWithoutUpdate()
/**
* Parses the document without updating the DOM. This method does, however,
- * update completion info and parse errors.
+ * update completion info and parse errors. The document text content should
+ * be up to date compared to the document structure.
*/
public void parseWithoutUpdate() {
Log.log(Log.MESSAGE, this, (m_uri != null ? "Validating Document: "+m_uri.toString() : "Validating Document"));
@@ -1387,7 +1516,7 @@
try {
//Temporary fix to allow parsing of documnts with multi-byte characters
// reader.parse(new InputSource(new ContentManagerInputStream(m_content)));
- String text = getText(0, getLength());
+ String text = m_content.getText(0,m_content.getLength());
reader.parse(new InputSource(new StringReader(text)));
} catch(SAXException se) {
//validation errors
@@ -2092,6 +2221,12 @@
private boolean m_addedToCompoundEdits = false;
private int m_compoundEditCount = 0;
+ /**
+ * I/O lock.
+ */
+ private ReadWriteLock lock = new ReadWriteLock();
+ private Object propertyLock = new Object();
+
// private XMLDocAdapterListener docAdapterListener = new XMLDocAdapterListener();
//}}}
Modified: branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java
===================================================================
--- branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java 2006-09-06 19:34:32 UTC (rev 1241)
+++ branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java 2006-09-06 23:22:12 UTC (rev 1242)
@@ -56,28 +56,22 @@
* write unlock
* write unlock
*/
-public class ReadWriteLock
-{
+public class ReadWriteLock {
+
//{{{ readLock() method
- public synchronized void readLock()
- {
+ public synchronized void readLock() {
// this seems to make nested readLock() calls work okay.
// but I have no idea if it actually fixes things or not.
- if (activeReaders != 0 || allowRead())
- {
- ++activeReaders;
- //readers.addElement(Thread.currentThread());
- return;
+ if (activeReaders != 0 || allowRead()) {
+ // ++activeReaders;
+ // //readers.addElement(Thread.currentThread());
+ // return;
}
++waitingReaders;
- while (!allowRead())
- {
- try
- {
+ while (!allowRead()) {
+ try {
wait();
- }
- catch (InterruptedException e)
- {
+ } catch (InterruptedException e) {
--waitingReaders; // Roll back state.
Log.log(Log.ERROR,this,e);
return;
@@ -89,10 +83,11 @@
} //}}}
//{{{ readUnlock() method
- public synchronized void readUnlock()
- {
- if(activeReaders == 0)
+ public synchronized void readUnlock() {
+
+ if (activeReaders == 0) {
throw new InternalError("Unbalanced readLock()/readUnlock() calls");
+ }
--activeReaders;
//readers.removeElement(Thread.currentThread());
@@ -100,33 +95,27 @@
} //}}}
//{{{ writeLock() method
- public synchronized void writeLock()
- {
- if (writerThread != null)
- {
+ public synchronized void writeLock() {
+
+ if (writerThread != null) {
// Write in progress.
- if (Thread.currentThread() == writerThread)
- {
- // Same thread.
- ++lockCount;
- return;
- }
+ // if (Thread.currentThread() == writerThread)
+ // {
+ // // Same thread.
+ // ++lockCount;
+ // return;
+ // }
}
- if (allowWrite())
- {
+ if (allowWrite()) {
claimWriteLock();
return;
}
++waitingWriters;
- while (!allowWrite())
- {
- try
- {
+ while (!allowWrite()) {
+ try {
wait();
- }
- catch (InterruptedException e)
- {
+ } catch (Interrup...
[truncated message content] |
|
From: <ian...@us...> - 2006-07-08 15:58:02
|
Revision: 1002 Author: ian_lewis Date: 2006-07-08 08:57:53 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1002&view=rev Log Message: ----------- Updated the new data model. Added the new XMLAttribute class Added support for editing attributes to the XMLElement class. Added new DOM support to XMLNode Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/Changelog 2006-07-08 15:57:53 UTC (rev 1002) @@ -1,3 +1,11 @@ +06/08/2006 Ian Lewis <Ian...@me...> + + * XMLAttribute was added to the new data model. + * Added support for editing attributes to the XMLElement class. + * Created an new XMLDocument class. + * Made use of the DOM events model to allow users to register DOM event + listeners. + 06/04/2006 Ian Lewis <Ian...@me...> * XMLElement was added to model element nodes Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -0,0 +1,77 @@ +/* +XMLAttribute.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +//{{{ Imports + +//{{{ Swing classes +import javax.swing.text.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.*; +import org.w3c.dom.events.*; +//}}} + +//}}} + +/** + * The XMLAttribute class represents an attribute in the XMLDocument tree. It + * does not allow modifications to the attribute itself. This is done through + * the <code>XMLElement</code> class. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @see XMLElement + * @since jsXe 0.5 pre2 + */ +public class XMLAttribute extends XMLNode { + + //{{{ XMLAttribute constructor + + public XMLAttribute(Attr attribute) { + super(attribute); + }//}}} + + //{{{ getOwnerElement() + + public XMLElement getOwnerElement() { + return (XMLElement)getNode().getUserData(USER_DATA_KEY); + }//}}} + + //{{{ isSpecified() + + public boolean isSpecified() { + return ((Attr)getNode()).getSpecified(); + }//}}} + + //{{{ isId() + + public boolean isId() { + return ((Attr)getNode()).getId(); + }//}}} + +} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -54,7 +54,7 @@ /** * The XMLDocument class represents an XML document as a tree structure - * that has nodes, implemented as AdapterNodes, as well as text. Methods are + * that has nodes, implemented as XMLNodes, as well as text. Methods are * provided to allow user objects to interact with the XML document as text * or as a tree structure seamlessly. * Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -58,12 +58,182 @@ }//}}} //{{{ getAttributes() + /** + * Returns a read only set of attributes in this node. The AttributeSet + * maps the attribute name to the attribute's value. + */ + public AttributeSet getAttributes() { + //TODO: create resolving parent for the attributes for default node + // values from a DTD or schema? + + SimpleAttributeSet attrSet = new SimpleAttributeSet(); + NamedNodeMap attributes = getNode().getAttributes(); + + int len = attributes.getLength(); + for (int i=0; i<len; i++) { + Node attr = attributes.item(i); + XMLAttribute xmlAttr = (XMLAttribute)attr.getUserData(USER_DATA_KEY); + attrSet.addAttribute(xmlAttr.getName(), xmlAttr.getValue()); + } + return attrSet; + }//}}} - public AttributeSet getAttributes() { - //TODO: implement attributes + //{{{ getAttributeNodes() + /** + * Returns a read only set of attributes in this node. This List + * contains all the XMLAttributeNode objects for this element. + */ + public List getAttributeNodes() { + ArrayList attrSet = new ArrayList(); + + NamedNodeMap attributes = getNode().getAttributes(); + + int len = attributes.getLength(); + for (int i=0; i<len; i++) { + Node attr = attributes.item(i); + XMLAttribute xmlAttr = (XMLAttribute)attr.getUserData(USER_DATA_KEY); + attrSet.add(xmlAttr); + } + + return attrSet; + }//}}} + + //{{{ getAttribute() + /** + * @param name the qualified name of the attribute + */ + public XMLAttribute getAttribute(String name) { + Element element = (org.w3c.dom.Element)getNode(); + String localName = MiscUtilities.getLocalNameFromQualifiedName(name); + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + + if (prefix != null && !prefix.equals("")) { + Attr attr = element.getAttributeNodeNS(lookupNamespaceURI(prefix),localName); + return (XMLAttribute)attr.getUserData(USER_DATA_KEY); + } else { + Attr attr = element.getAttributeNode(name); + return (XMLAttribute)attr.getUserData(USER_DATA_KEY); + } + }//}}} + + //{{{ setAttribute() + /** + * @param name the qualified name of the attribute + * @param value the value of the attribute + */ + public XMLAttribute setAttribute(String name, String value) throws DOMException { + Element element = (org.w3c.dom.Element)getNode(); + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + Attr newAttr; + + //check if we are setting a namespace declaration + if ("xmlns".equals(prefix)) { + //if so then make sure the value is valid + if (value != null && value.equals("")) { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to create an empty namespace declaration"); + } + } + + if (prefix != null && !prefix.equals("")) { + String uri = lookupNamespaceURI(prefix); + + element.setAttributeNS(uri,name,value); + newAttr = getAttributeNodeNS(uri, name, value); + } else { + /* + setAttribute doesn't throw an error if the first character is + a ":" + */ + if (name != null && !name.equals("") && name.charAt(0)==':') { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character"); + } + element.setAttribute(name, value); + newAttr = getAttributeNode(name, value); + } + + //create an XMLAttribute node for the new attribute + if (newAttr != null) { + xmlAttr = new XMLAttribute(attr); + attr.setUserData(USER_DATA_KEY, xmlAttr, null); + return xmlAttr; + } return null; }//}}} + //{{{ setAttribute() + + public XMLAttribute setAttribute(XMLAttribute attr) throws DOMException { + /* + TODO: test how this works. Will I need to check for a namespace and + call setAttributeNode() instead if there is none? + */ + ((org.w3c.dom.Element)getNode()).setAttributeNodeNS((Attr)attr.getNode()); + return attr; + }//}}} + + //{{{ removeAttributeAt() + /** + * @param index the index at which to remove an attribute. + */ + public removeAttributeAt(int index) throws DOMException { + Element element = (org.w3c.dom.Element)getNode(); + NamedNodeMap attrs = element.getAttributes(); + if (attrs != null) { + removeAttribute(attrs.item(index).getNodeName()); + } + }//}}} + + //{{{ removeAttribute() + /** + * @param name The qualified name of the attribute. + */ + public XMLAttribute removeAttribute(String name) throws DOMException { + Element element = (org.w3c.dom.Element)getNode(); + + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + String localName = MiscUtilities.getLocalNameFromQualifiedName(name); + + //Check if we are removing a namespace declaration + //This is a somewhat expensive operation, may need to + //optimize somehow in the future + if ("xmlns".equals(prefix)) { + //check if there are nodes using the namespace + String uri = lookupNamespaceURI(localName); + //check this element's namespace + if (!uri.equals(element.getNamespaceURI())) { + //check for decendent elements with this namespace + NodeList list = element.getElementsByTagName("*"); + //check if an attribute with this NS is used + for (int i=0; i<list.getLength(); i++) { + Node ele = list.item(i); + if (uri.equals(ele.getNamespaceURI())) { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + //now check the attributes + NamedNodeMap attrs = ele.getAttributes(); + for (int j=0; j<attrs.getLength(); j++) { + Node foundAttr = attrs.item(i); + if (uri.equals(foundAttr.getNamespaceURI())) { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + } + } + } else { + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + } + + if (prefix != null && !prefix.equals("")) { + element.removeAttributeNS(lookupNamespaceURI(prefix),localName); + } else { + element.removeAttribute(localName); + } + }//}}} + //{{{ getNodeType() public int getNodeType() { return Node.ELEMENT_NODE; Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -60,7 +60,7 @@ */ public abstract class XMLNode /* implements javax.swing.text.Element */ { - private static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; + static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; //{{{ Private members @@ -120,7 +120,11 @@ }//}}} //{{{ getName() - + /** + * Gets the qualified name of the node. This will be the namespace + * prefix + ":" + the locale name. + * @return the qualified name + */ public String getName() { return m_domNode.getNodeName(); }//}}} @@ -158,13 +162,85 @@ }//}}} //{{{ appendNode() - public XMLNode appendChild(XMLNode newChild) { + public XMLNode appendNode(XMLNode newChild) throws DOMException { m_domNode.appendChild(newChild.getNode()); return newChild; }//}}} + //{{{ getBaseURI() + + public String getBaseURI() { + return m_domNode.getBaseURI(); + }//}}} + + //{{{ getNamespaceURI() + + public String getNamespaceURI() { + return m_domNode.getNamespaceURI(); + }//}}} + + //{{{ getNodeType() + + public short getNodeType() { + return m_domNode.getNodeType(); + }//}}} + + //{{{ getValue() + + public String getValue() { + return m_domNode.getNodeValue(); + }//}}} + + //{{{ getNSPrefix() + + public String getNSPrefix() { + return m_domNode.getPrefix(); + }//}}} + + //{{{ insertNode() + + public XMLNode insertNode(XMLNode node, int index) throws DOMException { + m_domNode.insertBefore(node.getNode(), m_domNode.getChildNodes().item(index)); + return node; + }//}}} + + //{{{ lookupNamespaceURI() + + public String lookupNamespaceURI(String prefix) { + return m_domNode.lookupNamespaceURI(prefix); + }//}}} + + //{{{ removeNode() + + public XMLNode removeNode(XMLNode child) throws DOMException { + Node childNode = child.getNode(); + m_domNode.removeChild(childNode); + childNode.setUserData(USER_DATA_KEY, null, null); + return child; + }//}}} + + //{{{ setValue() + + public void setValue(String value) throws DOMException { + m_domNode.setNodeValue(value); + }//}}} + + //{{{ setNSPrefix() + + public void setNSPrefix(String prefix) throws DOMException { + m_domNode.setPrefix(prefix); + }//}}} + + //{{{ setName() + /** + * @param name the qualified name of the node. + */ + public void setName(String name) { + m_domNode = m_domNode.getOwnerDocument().renameNode(m_domNode, m_domNode.getNamespaceURI(), name); + }//}}} + //{{{ Protected Members //{{{ getNode() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-07-24 21:24:34
|
Revision: 1063 Author: ian_lewis Date: 2006-07-24 14:24:27 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1063&view=rev Log Message: ----------- Added support for the URI and standalone properties in the XMLDocument Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-24 20:26:42 UTC (rev 1062) +++ branches/jsxe2/Changelog 2006-07-24 21:24:27 UTC (rev 1063) @@ -1,3 +1,10 @@ +07/24/2006 Ian Lewis <Ian...@me...> + + * Added the XMLText, XMLComment, and XMLProcessingInstruction node + types. + * Added some support for the URIs and standalone properties in + XMLDocument. + 07/20/2006 Ian Lewis <Ian...@me...> * Xerces needs to be installed in the java endorsed directory now to make Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-24 20:26:42 UTC (rev 1062) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-24 21:24:27 UTC (rev 1063) @@ -28,6 +28,7 @@ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.dom2.ls.*; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; //}}} @@ -35,14 +36,18 @@ //{{{ DOM classes import org.w3c.dom.*; import org.w3c.dom.events.*; +import org.xml.sax.EntityResolver; //}}} //{{{ Java base classes import java.io.IOException; +import java.io.InputStream; import java.io.Writer; import java.util.ArrayList; +import java.util.Iterator; import java.util.Map; import java.util.HashMap; +import java.net.URI; //}}} //{{{ Swing classes @@ -68,9 +73,99 @@ */ public class XMLDocument /* implements javax.swing.text.Document */ { + //{{{ XMLDocument defined properties + /** + * The property key for the encoding of this XML document + */ + public static final String ENCODING = DOMSerializerConfiguration.XML_ENCODING; + /** + * The property key for the boolean property specifying if whitespace + * is allowed in element content. + */ + public static final String WS_IN_ELEMENT_CONTENT = DOMSerializerConfiguration.WS_IN_ELEMENT_CONTENT; + /** + * The property key for the boolean property specifying that the XML text + * should be formatted to look pleasing to the eye. + */ + public static final String FORMAT_XML = DOMSerializerConfiguration.FORMAT_XML; + /** + * The property key for the property defining the size of a tab when the + * document is displayed as text or otherwise. Used when serializing the + * document using soft-tabs. + */ + public static final String INDENT = DOMSerializerConfiguration.INDENT; + /** + * The property key for the property defining whether to serialize + * using soft tabs (tabs replaced by the number of spaces specified in the + * INDENT property). Has a value of "true" if using soft tabs. + */ + public static final String IS_USING_SOFT_TABS = DOMSerializerConfiguration.SOFT_TABS; + /** + * The property key for the property defining whether to validate the + * document with a DTD or Schema + */ + public static final String IS_VALIDATING = "validating"; + /** + * The property key for the property defining what line separator + * to use when serializing a document. \n is always used for the internal + * text but this line separator is used when serializing using the + * serialize method. + */ + public static final String LINE_SEPARATOR = "line-separator"; + //}}} + //{{{ XMLDocument constructor - XMLDocument() { + /** + * Creates a new XMLDocument for a document that can be read by the given + * Reader. + * @param uri the uri for the location of this document. Can be null. + * @param reader the Reader object to read the XML document from. + * @throws IOException if there was a problem reading the document + */ + public XMLDocument(String uri, InputStream reader) throws IOException { + this(uri, reader, null); + }//}}} + + //{{{ XMLDocument constructor + /** + * Creates a new XMLDocument for a document that can be read by the given + * Reader. + * @param reader the Reader object to read the XML document from. + * @param resolver the EntityResolver to use when resolving external + * entities. + * @throws IOException if there was a problem reading the document + */ + public XMLDocument(String uri, InputStream reader, EntityResolver resolver) throws IOException { + this(uri, reader, resolver, null); + }//}}} + + //{{{ XMLDocument constructor + /** + * Creates a new XMLDocument for a document that can be read by the given + * Reader. + * @param uri the document uri + * @param reader the Reader object to read the XML document from. + * @param resolver the EntityResolver to use when resolving external + * entities. + * @param properties the properties to assign this XMLDocument on creation. + * @throws IOException if there was a problem reading the document + */ + public XMLDocument(String uri, InputStream reader, EntityResolver resolver, Map properties) throws IOException { + m_entityResolver = resolver; + setDefaultProperties(); + setURI(uri); + //add properties one by one + if (properties != null) { + Iterator propertyNames = properties.keySet().iterator(); + while (propertyNames.hasNext()) { + Object key = propertyNames.next(); + setProperty(key, properties.get(key)); + } + } + + //TODO: Read the document from the input stream + reader.close(); }//}}} //{{{ swing.text.Document methods @@ -288,6 +383,42 @@ return m_properties; }//}}} + //{{{ setURI() + /** + * Sets the URI for the location of this document. + * @param uri the uri specifying the location of this document. Can be null. + */ + public void setURI(String uri) { + m_document.setDocumentURI(uri); + }//}}} + + //{{{ getURI() + /** + * Gets the URI for the location of this document. + * @return the uri specifying the location of this document. Can be null. + */ + public String getURI() { + return m_document.getDocumentURI(); + }//}}} + + //{{{ setStandalone() + /** + * An attribute specifying, as part of the XML declaration, whether this + * document is standalone. This is false when unspecified. + */ + public void setStandalone(boolean standalone) throws DOMException { + m_document.setXmlStandalone(standalone); + }//}}} + + //{{{ isStandalone() + /** + * An attribute specifying, as part of the XML declaration, whether this + * document is standalone. This is false when unspecified. + */ + public boolean isStandalone() { + return m_document.getXmlStandalone(); + }//}}} + //{{{ Node Factory methods //{{{ newElementNode() @@ -312,6 +443,16 @@ //{{{ Private members + //{{{ setDefaultProperties() + private void setDefaultProperties() { + setProperty(FORMAT_XML, "false"); + setProperty(IS_USING_SOFT_TABS, "false"); + setProperty(WS_IN_ELEMENT_CONTENT, "true"); + setProperty(ENCODING, "UTF-8"); + setProperty(INDENT, "4"); + setProperty(IS_VALIDATING, "false"); + }//}}} + //{{{ ContentManager class /** * Text content manager based off of jEdit's ContentManager class. @@ -546,6 +687,11 @@ private ArrayList m_docListeners = new ArrayList(); private ArrayList m_undoListeners = new ArrayList(); + /** + * The entity resolver to use when resolving external entities + * in this document. + */ + private EntityResolver m_entityResolver; //}}} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ian...@us...> - 2006-08-04 19:17:55
|
Revision: 1104 Author: ian_lewis Date: 2006-08-04 12:17:41 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1104&view=rev Log Message: ----------- More porting of jEdit's VFS to jsXe Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/messages/messages branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java branches/jsxe2/src/net/sourceforge/jsxe/properties branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/Changelog 2006-08-04 19:17:41 UTC (rev 1104) @@ -1,3 +1,7 @@ +08/03/2006 Ian Lewis <Ian...@me...> + + * More porting of jEdit's VFS classes to jsXe + 07/29/2006 Ian Lewis <Ian...@me...> * Added some more code for multi-threaded IO support. Modified: branches/jsxe2/messages/messages =================================================================== --- branches/jsxe2/messages/messages 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/messages/messages 2006-08-04 19:17:41 UTC (rev 1104) @@ -179,6 +179,15 @@ DocumentBuffer.Close.Message={0} unsaved! Save it now? DocumentBuffer.Close.Message.Title=Unsaved Changes +#{{{ I/O status messages +vfs.status.load=Loading {0} +vfs.status.save=Saving {0} +vfs.status.autosave=Autosaving {0} +vfs.status.listing-directory=Listing {0} +vfs.status.deleting=Deleting {0} +vfs.status.renaming=Renaming {0} to {1} +#}}} + #{0} file name DocumentBuffer.Saved.Message={0} Saved DocumentBuffer.Closed.Message={0} Closed @@ -250,6 +259,21 @@ #}}} +#{{{ VFS +vfs.browser.name=Name +vfs.browser.type=Type +vfs.browser.type.file=File +vfs.browser.type.directory=Directory +vfs.browser.type.filesystem=File system +vfs.browser.status=Status +vfs.browser.status.no=No access +vfs.browser.status.ro=Read only +vfs.browser.status.append=Append only +vfs.browser.status.rw=Read/write +vfs.browser.size=Size +vfs.browser.modified=Last modified +#}}} + #{{{ Dialogs #{{{ Download resource dialog Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -32,8 +32,13 @@ import net.sourceforge.jsxe.dom2.event.*; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; +import net.sourceforge.jsxe.util.ReadWriteLock; //}}} +//{{{ Swing classes +import javax.swing.text.Segment; +//}}} + //{{{ DOM classes import org.w3c.dom.*; import org.w3c.dom.events.*; @@ -44,10 +49,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; +import java.util.*; import java.net.URI; //}}} @@ -112,6 +114,8 @@ * serialize method. */ public static final String LINE_SEPARATOR = "line-separator"; + + public static final String ENCODING_AUTODETECT = "encoding.autodetect"; //}}} //{{{ XMLDocument constructor @@ -361,7 +365,7 @@ }//}}} //{{{ setProperty() - public void settProperty(String key, String value) { + public void setProperty(String key, String value) { synchronized(propertyLock) { if (value == null) { m_properties.remove(key); Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -25,6 +25,7 @@ package net.sourceforge.jsxe.dom2.event; import net.sourceforge.jsxe.dom2.*; +import java.util.EventObject; /** * XMLDocumentEvents are modifications to the structure of the XMLDocument. @@ -35,9 +36,8 @@ * @see XMLDocument * @since jsXe 0.5 pre3 */ -public interface XMLDocumentEvent extends EventListener { +public class XMLDocumentEvent extends EventObject { - private XMLDocument m_document; private int m_offset; private int m_length; private short m_type; @@ -51,7 +51,7 @@ * */ public XMLDocumentEvent(XMLDocument doc, int offset, String text, short type) { - m_document = doc; + super(doc); m_type = type; m_length = text.length(); m_offset = offset; @@ -62,7 +62,7 @@ * Gets the document that was updated. */ public XMLDocument getDocument() { - return m_document; + return (XMLDocument)getSource(); }//}}} //{{{ getOffset() Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -25,10 +25,11 @@ package net.sourceforge.jsxe.dom2.event; import net.sourceforge.jsxe.dom2.*; +import java.util.EventListener; public interface XMLDocumentListener extends EventListener { - public void propertyChanged(PropertyChangeEvent event); + public void propertyChanged(PropertyChangedEvent event); public void insertUpdate(XMLDocumentEvent event); Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -32,6 +32,8 @@ import java.util.Vector; import net.sourceforge.jsxe.io.*; import net.sourceforge.jsxe.*; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.dom2.XMLDocument; import net.sourceforge.jsxe.util.*; //}}} @@ -82,7 +84,7 @@ /** * An insert file request. */ - public static final int INSERT = 3; + // public static final int INSERT = 3; /** * Magic numbers used for auto-detecting Unicode and GZIP files. @@ -136,14 +138,22 @@ case AUTOSAVE: autosave(); break; - case INSERT: - insert(); - break; + // case INSERT: + // insert(); + // break; default: throw new InternalError(); } } //}}} - + + //{{{ getLoadData() + /** + * Gets the data loaded from a load request. + */ + public SegmentBuffer getLoadData() { + return m_loadData; + }//}}} + //{{{ toString() method public String toString() { @@ -175,6 +185,7 @@ private Object session; private VFS vfs; private String path; + private SegmentBuffer m_loadData; //}}} //{{{ load() method @@ -215,7 +226,7 @@ } catch(CharConversionException ch) { Log.log(Log.ERROR,this,ch); - Object[] pp = { buffer.getProperty(Buffer.ENCODING), ch.toString() }; + Object[] pp = { buffer.getProperty(XMLDocument.ENCODING), ch.toString() }; VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); @@ -223,7 +234,7 @@ } catch(UnsupportedEncodingException uu) { Log.log(Log.ERROR,this,uu); - Object[] pp = { buffer.getProperty(Buffer.ENCODING), + Object[] pp = { buffer.getProperty(XMLDocument.ENCODING), uu.toString() }; VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); @@ -274,11 +285,11 @@ private Reader autodetect(InputStream in) throws IOException { in = new BufferedInputStream(in); - String encoding = buffer.getStringProperty(Buffer.ENCODING); + String encoding = buffer.getStringProperty(XMLDocument.ENCODING); if (!in.markSupported()) { Log.log(Log.WARNING,this,"Mark not supported: " + in); } else { - if(buffer.getBooleanProperty(Buffer.ENCODING_AUTODETECT)) { + if(buffer.getBooleanProperty(XMLDocument.ENCODING_AUTODETECT)) { in.mark(XML_PI_LENGTH); int b1 = in.read(); int b2 = in.read(); @@ -300,13 +311,13 @@ encoding = "UTF-8"; } else { - if (b1 == GZIP_MAGIC_1 && b2 == GZIP_MAGIC_2) { - in.reset(); - in = new GZIPInputStream(in); - buffer.setBooleanProperty(Buffer.GZIPPED,true); - // auto-detect encoding within the gzip stream. - return autodetect(in); - } else { + // if (b1 == GZIP_MAGIC_1 && b2 == GZIP_MAGIC_2) { + // in.reset(); + // in = new GZIPInputStream(in); + // buffer.setBooleanProperty(Buffer.GZIPPED,true); + // // auto-detect encoding within the gzip stream. + // return autodetect(in); + // } else { if ((b1 == UNICODE_MAGIC_1 && b2 == UNICODE_MAGIC_2) || (b1 == UNICODE_MAGIC_2 @@ -314,7 +325,7 @@ { in.reset(); encoding = "UTF-16"; - buffer.setProperty(Buffer.ENCODING,encoding); + buffer.setProperty(XMLDocument.ENCODING,encoding); } else { if (b1 == UTF8_MAGIC_1 && b2 == UTF8_MAGIC_2 && b3 == UTF8_MAGIC_3) @@ -358,7 +369,7 @@ in.reset(); } } - } + // } } } } @@ -367,15 +378,14 @@ } //}}} //{{{ read() method - private SegmentBuffer read(Reader in, long length, - boolean insert) throws IOException - { + private SegmentBuffer read(Reader in, long length, boolean insert) throws IOException { + /* we guess an initial size for the array */ - IntegerArray endOffsets = new IntegerArray( - Math.max(1,(int)(length / 50))); + // IntegerArray endOffsets = new IntegerArray( + // Math.max(1,(int)(length / 50))); // only true if the file size is known - boolean trackProgress = (!buffer.isTemporary() && length != 0); + boolean trackProgress = (length != 0); if (trackProgress) { setProgressValue(0); @@ -447,7 +457,7 @@ seg.append(buf,lastLine,i - lastLine); seg.append('\n'); - endOffsets.add(seg.count); + // endOffsets.add(seg.count); if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) setProgressValue(seg.count); @@ -485,7 +495,7 @@ seg.append(buf,lastLine, i - lastLine); seg.append('\n'); - endOffsets.add(seg.count); + // endOffsets.add(seg.count); if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) setProgressValue(seg.count); lastLine = i + 1; @@ -539,39 +549,36 @@ // Chop trailing newline and/or ^Z (if any) int bufferLength = seg.count; - if(bufferLength != 0) - { + if (bufferLength != 0) { char ch = seg.array[bufferLength - 1]; if(ch == 0x1a /* DOS ^Z */) seg.count--; } - buffer.setBooleanProperty(Buffer.TRAILING_EOL,false); - if(bufferLength != 0 && jEdit.getBooleanProperty("stripTrailingEOL")) - { - char ch = seg.array[bufferLength - 1]; - if(ch == '\n') - { - buffer.setBooleanProperty(Buffer.TRAILING_EOL,true); - seg.count--; - endOffsets.setSize(endOffsets.getSize() - 1); - } - } + // buffer.setBooleanProperty(Buffer.TRAILING_EOL,false); + // if (bufferLength != 0 && jEdit.getBooleanProperty("stripTrailingEOL")) { + // char ch = seg.array[bufferLength - 1]; + // if (ch == '\n') { + // buffer.setBooleanProperty(Buffer.TRAILING_EOL,true); + // seg.count--; + // // endOffsets.setSize(endOffsets.getSize() - 1); + // } + // } // add a line marker at the end for proper offset manager // operation - endOffsets.add(seg.count + 1); + // endOffsets.add(seg.count + 1); // to avoid having to deal with read/write locks and such, // we insert the loaded data into the buffer in the // post-load cleanup runnable, which runs in the AWT thread. - if(!insert) - { - buffer.setProperty(LOAD_DATA,seg); - buffer.setProperty(END_OFFSETS,endOffsets); - buffer.setProperty(NEW_PATH,path); - if(lineSeparator != null) - buffer.setProperty(Buffer.LINESEP,lineSeparator); + if (!insert) { + m_loadData = seg; + // buffer.setProperty(END_OFFSETS,endOffsets); + // buffer.setProperty(NEW_PATH,path); + if (lineSeparator != null) { + buffer.setProperty(XMLDocument.LINE_SEPARATOR, lineSeparator); + } } // used in insert() @@ -586,7 +593,7 @@ try { String[] args = { vfs.getFileName(path) }; - setStatus(jEdit.getProperty("vfs.status.save",args)); + setStatus(Messages.getMessage("vfs.status.save",args)); // the entire save operation can be aborted... setAbortable(true); @@ -595,12 +602,12 @@ path = MiscUtilities.resolveSymlinks(path); // Only backup once per session - if(buffer.getProperty(Buffer.BACKED_UP) == null - || jEdit.getBooleanProperty("backupEverySave")) - { - vfs._backup(session,path,view); - buffer.setBooleanProperty(Buffer.BACKED_UP,true); - } + // if(buffer.getProperty(Buffer.BACKED_UP) == null + // || jEdit.getBooleanProperty("backupEverySave")) + // { + // vfs._backup(session,path,view); + // buffer.setBooleanProperty(Buffer.BACKED_UP,true); + // } /* if the VFS supports renaming files, we first * save to #<filename>#save#, then rename that @@ -614,7 +621,7 @@ String savePath; boolean twoStageSave = (vfs.getCapabilities() & VFS.RENAME_CAP) != 0 - && jEdit.getBooleanProperty("twoStageSave"); + && jsXe.getBooleanProperty("twoStageSave"); if(twoStageSave) savePath = vfs.getTwoStageSaveName(path); else @@ -632,11 +639,11 @@ // Can't use buffer.getName() here because // it is not changed until the save is // complete - if(savePath.endsWith(".gz")) - buffer.setBooleanProperty(Buffer.GZIPPED,true); + // if(savePath.endsWith(".gz")) + // buffer.setBooleanProperty(Buffer.GZIPPED,true); - if(buffer.getBooleanProperty(Buffer.GZIPPED)) - out = new GZIPOutputStream(out); + // if(buffer.getBooleanProperty(Buffer.GZIPPED)) + // out = new GZIPOutputStream(out); write(buffer,out); @@ -710,7 +717,7 @@ try { String[] args = { vfs.getFileName(path) }; - setStatus(jEdit.getProperty("vfs.status.autosave",args)); + setStatus(Messages.getMessage("vfs.status.autosave",args)); // the entire save operation can be aborted... setAbortable(true); @@ -756,152 +763,204 @@ } //}}} //{{{ write() method - private void write(Buffer buffer, OutputStream _out) - throws IOException - { - BufferedWriter out = null; + // private void write(XMLDocument buffer, OutputStream _out) throws IOException { + // BufferedWriter out = null; - try - { - String encoding = buffer.getStringProperty(Buffer.ENCODING); - if(encoding.equals(MiscUtilities.UTF_8_Y)) - { - // not supported by Java... - _out.write(UTF8_MAGIC_1); - _out.write(UTF8_MAGIC_2); - _out.write(UTF8_MAGIC_3); - _out.flush(); - encoding = "UTF-8"; - } + // try { + // String encoding = buffer.getStringProperty(Buffer.ENCODING); + // if (encoding.equals(MiscUtilities.UTF_8_Y)) { + // // not supported by Java... + // _out.write(UTF8_MAGIC_1); + // _out.write(UTF8_MAGIC_2); + // _out.write(UTF8_MAGIC_3); + // _out.flush(); + // encoding = "UTF-8"; + // } - out = new BufferedWriter( - new OutputStreamWriter(_out,encoding), - IOBUFSIZE); + // out = new BufferedWriter(new OutputStreamWriter(_out,encoding), IOBUFSIZE); - Segment lineSegment = new Segment(); - String newline = buffer.getStringProperty(Buffer.LINESEP); - if(newline == null) - newline = System.getProperty("line.separator"); + // Segment lineSegment = new Segment(); + // String newline = buffer.getStringProperty(Buffer.LINESEP); + // if (newline == null) { + // newline = System.getProperty("line.separator"); + // } - setProgressMaximum(buffer.getLineCount() / PROGRESS_INTERVAL); - setProgressValue(0); + // setProgressMaximum(buffer.getLineCount() / PROGRESS_INTERVAL); + // setProgressValue(0); - int i = 0; - while(i < buffer.getLineCount()) - { - buffer.getLineText(i,lineSegment); - out.write(lineSegment.array,lineSegment.offset, - lineSegment.count); + // int i = 0; + // while (i < buffer.getLineCount()) { + // buffer.getLineText(i,lineSegment); + // out.write(lineSegment.array, lineSegment.offset, lineSegment.count); - if(i != buffer.getLineCount() - 1) - { - out.write(newline); - } + // if (i != buffer.getLineCount() - 1) { + // out.write(newline); + // } - if(++i % PROGRESS_INTERVAL == 0) - setProgressValue(i / PROGRESS_INTERVAL); - } + // if (++i % PROGRESS_INTERVAL == 0) { + // setProgressValue(i / PROGRESS_INTERVAL); + // } + // } - if(jEdit.getBooleanProperty("stripTrailingEOL") - && buffer.getBooleanProperty(Buffer.TRAILING_EOL)) - { - out.write(newline); + // // if(jEdit.getBooleanProperty("stripTrailingEOL") + // // && buffer.getBooleanProperty(Buffer.TRAILING_EOL)) + // // { + // // out.write(newline); + // // } + // } finally { + // if (out != null) { + // out.close(); + // } else { + // _out.close(); + // } + // } + // } //}}} + + //{{{ write() + private void write(XMLDocument buffer, OutputStream out) throws IOException { + + String newLine = getProperty(XMLDocument.LINE_SEPARATOR); + + String encoding = getProperty(XMLDocument.ENCODING); + if (encoding.equals(MiscUtilities.UTF_8_Y)) { + // not supported by Java... + out.write(UTF8_MAGIC_1); + out.write(UTF8_MAGIC_2); + out.write(UTF8_MAGIC_3); + out.flush(); + encoding = "UTF-8"; + } + + //now just write out the text. + int length = buffer.getLength(); + int index = 0; + BufferedWriter outbuf = new BufferedWriter(new OutputStreamWriter(out, encoding), IO_BUFFER_SIZE); + Segment seg = new Segment(); + + while (index < length) { + int size = WRITE_SIZE; + try { + size = Math.min(length - index, WRITE_SIZE); + } catch(NumberFormatException nf) { + Log.log(Log.ERROR, this, nf); } + + // out.write(m_content.getText(index, size).getBytes(getProperty(ENCODING)), index, size); + buffer.getText(index, size, seg); + + int startOffset = seg.offset; + int endOffset = size + seg.offset; + + for (int i=startOffset; i<endOffset; i++) { + if (seg.array[i]=='\n') { + outbuf.write(seg.array, seg.offset, i - seg.offset); + outbuf.write(newLine.toCharArray(), 0, newLine.length()); + + //add 1 because of \n character, + seg.count -= i-seg.offset+1; + seg.offset += i-seg.offset+1; + } + } + + //write the rest + outbuf.write(seg.array, seg.offset, seg.count); + index += size; } - finally - { - if(out != null) - out.close(); - else - _out.close(); - } - } //}}} + + outbuf.close(); + }//}}} + + // //{{{ insert() method + // private void insert() + // { + // InputStream in = null; - //{{{ insert() method - private void insert() - { - InputStream in = null; + // try + // { + // try + // { + // String[] args = { vfs.getFileName(path) }; + // setStatus(jEdit.getProperty("vfs.status.load",args)); + // setAbortable(true); - try - { - try - { - String[] args = { vfs.getFileName(path) }; - setStatus(jEdit.getProperty("vfs.status.load",args)); - setAbortable(true); + // path = vfs._canonPath(session,path,view); - path = vfs._canonPath(session,path,view); + // VFS.DirectoryEntry entry = vfs._getDirectoryEntry( + // session,path,view); + // long length; + // if(entry != null) + // length = entry.length; + // else + // length = 0L; - VFS.DirectoryEntry entry = vfs._getDirectoryEntry( - session,path,view); - long length; - if(entry != null) - length = entry.length; - else - length = 0L; + // in = vfs._createInputStream(session,path,false,view); + // if(in == null) + // return; - in = vfs._createInputStream(session,path,false,view); - if(in == null) - return; + // final SegmentBuffer seg = read( + // autodetect(in),length,true); - final SegmentBuffer seg = read( - autodetect(in),length,true); + // /* we don't do this in Buffer.insert() so that + // we can insert multiple files at once */ + // VFSManager.runInAWTThread(new Runnable() + // { + // public void run() + // { + // view.getTextArea().setSelectedText( + // seg.toString()); + // } + // }); + // } + // catch(IOException io) + // { + // Log.log(Log.ERROR,this,io); + // String[] pp = { io.toString() }; + // VFSManager.error(view,path,"ioerror.read-error",pp); - /* we don't do this in Buffer.insert() so that - we can insert multiple files at once */ - VFSManager.runInAWTThread(new Runnable() - { - public void run() - { - view.getTextArea().setSelectedText( - seg.toString()); - } - }); - } - catch(IOException io) - { - Log.log(Log.ERROR,this,io); - String[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // } + // catch(WorkThread.Abort a) + // { + // if(in != null) + // { + // try + // { + // in.close(); + // } + // catch(IOException io) + // { + // } + // } - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - } - catch(WorkThread.Abort a) - { - if(in != null) - { - try - { - in.close(); - } - catch(IOException io) - { - } - } + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // finally + // { + // try + // { + // vfs._endVFSSession(session,view); + // } + // catch(IOException io) + // { + // Log.log(Log.ERROR,this,io); + // String[] pp = { io.toString() }; + // VFSManager.error(view,path,"ioerror.read-error",pp); - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - finally - { - try - { - vfs._endVFSSession(session,view); - } - catch(IOException io) - { - Log.log(Log.ERROR,this,io); - String[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // catch(WorkThread.Abort a) + // { + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // } + // } //}}} - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - catch(WorkThread.Abort a) - { - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - } - } //}}} - + //{{{ Private static members + private static final int READ_SIZE = 5120; + private static final int WRITE_SIZE = 5120; + private static final int IO_BUFFER_SIZE = 32768; //}}} + + //}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -1,5 +1,5 @@ /* -FileVFS.java +FileRootsVFS.java :tabSize=4:indentSize=4:noTabs=true: :folding=explicit:collapseFolds=1: @@ -25,7 +25,7 @@ from http://www.fsf.org/copyleft/gpl.txt */ -package org.gjt.sp.jedit.io; +package net.sourceforge.jsxe.io; //{{{ Imports import javax.swing.filechooser.FileSystemView; Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -30,6 +30,7 @@ import java.io.*; import java.text.*; import java.util.Date; +import net.sourceforge.jsxe.OperatingSystem; import net.sourceforge.jsxe.util.Log; //}}} @@ -89,10 +90,8 @@ } //}}} //{{{ save() method - public boolean save(View view, Buffer buffer, String path) - { - if(OperatingSystem.isUnix()) - { + public boolean save(TabbedView view, XMLDocument buffer, String path) { + if (OperatingSystem.isUnix()) { int permissions = getPermissions(buffer.getPath()... [truncated message content] |
|
From: <ian...@us...> - 2006-09-05 15:51:36
|
Revision: 1235
http://svn.sourceforge.net/jsxe/?rev=1235&view=rev
Author: ian_lewis
Date: 2006-09-05 08:47:51 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Merge from trunk/jsxe of rev. 1232
Modified Paths:
--------------
branches/jsxe2/AUTHORS
branches/jsxe2/Changelog
branches/jsxe2/INSTALL
branches/jsxe2/README
branches/jsxe2/bin/jsXe.bat
branches/jsxe2/bin/jsXe.sh
branches/jsxe2/build.xml
branches/jsxe2/src/net/sourceforge/jsxe/ActionManager.java
branches/jsxe2/src/net/sourceforge/jsxe/BufferHistory.java
branches/jsxe2/src/net/sourceforge/jsxe/CatalogManager.java
branches/jsxe2/src/net/sourceforge/jsxe/CustomFileFilter.java
branches/jsxe2/src/net/sourceforge/jsxe/DocumentBuffer.java
branches/jsxe2/src/net/sourceforge/jsxe/LocalizedAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/CopyAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/CutAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/FindAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/FindNextAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/OpenRecentFileAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/PasteAction.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java
branches/jsxe2/src/net/sourceforge/jsxe/gui/GUIUtilities.java
branches/jsxe2/src/net/sourceforge/jsxe/gui/Messages.java
branches/jsxe2/src/net/sourceforge/jsxe/gui/TabbedView.java
branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/WrappingMenu.java
branches/jsxe2/src/net/sourceforge/jsxe/jsXe.java
branches/jsxe2/src/net/sourceforge/jsxe/msg/PropertyChanged.java
branches/jsxe2/src/net/sourceforge/jsxe/options/GeneralOptionPane.java
branches/jsxe2/src/net/sourceforge/jsxe/options/ShortcutsOptionPane.java
branches/jsxe2/src/net/sourceforge/jsxe/properties
Added Paths:
-----------
branches/jsxe2/buildlib/avalon.jar
branches/jsxe2/buildlib/batik.jar
branches/jsxe2/buildlib/bsf.jar
branches/jsxe2/buildlib/docbook/
branches/jsxe2/buildlib/docbook/VERSION
branches/jsxe2/buildlib/docbook/catalog.xml
branches/jsxe2/buildlib/docbook/common/
branches/jsxe2/buildlib/docbook/common/ChangeLog
branches/jsxe2/buildlib/docbook/common/af.xml
branches/jsxe2/buildlib/docbook/common/ar.xml
branches/jsxe2/buildlib/docbook/common/autoidx-ng.xsl
branches/jsxe2/buildlib/docbook/common/bg.xml
branches/jsxe2/buildlib/docbook/common/bn.xml
branches/jsxe2/buildlib/docbook/common/bs.xml
branches/jsxe2/buildlib/docbook/common/ca.xml
branches/jsxe2/buildlib/docbook/common/common.xsl
branches/jsxe2/buildlib/docbook/common/cs.xml
branches/jsxe2/buildlib/docbook/common/da.xml
branches/jsxe2/buildlib/docbook/common/de.xml
branches/jsxe2/buildlib/docbook/common/el.xml
branches/jsxe2/buildlib/docbook/common/en.xml
branches/jsxe2/buildlib/docbook/common/es.xml
branches/jsxe2/buildlib/docbook/common/et.xml
branches/jsxe2/buildlib/docbook/common/eu.xml
branches/jsxe2/buildlib/docbook/common/fa.xml
branches/jsxe2/buildlib/docbook/common/fi.xml
branches/jsxe2/buildlib/docbook/common/fr.xml
branches/jsxe2/buildlib/docbook/common/gentext.xsl
branches/jsxe2/buildlib/docbook/common/he.xml
branches/jsxe2/buildlib/docbook/common/hr.xml
branches/jsxe2/buildlib/docbook/common/hu.xml
branches/jsxe2/buildlib/docbook/common/id.xml
branches/jsxe2/buildlib/docbook/common/it.xml
branches/jsxe2/buildlib/docbook/common/ja.xml
branches/jsxe2/buildlib/docbook/common/ko.xml
branches/jsxe2/buildlib/docbook/common/l10n.dtd
branches/jsxe2/buildlib/docbook/common/l10n.xml
branches/jsxe2/buildlib/docbook/common/l10n.xsl
branches/jsxe2/buildlib/docbook/common/la.xml
branches/jsxe2/buildlib/docbook/common/labels.xsl
branches/jsxe2/buildlib/docbook/common/lt.xml
branches/jsxe2/buildlib/docbook/common/nl.xml
branches/jsxe2/buildlib/docbook/common/nn.xml
branches/jsxe2/buildlib/docbook/common/no.xml
branches/jsxe2/buildlib/docbook/common/olink.xsl
branches/jsxe2/buildlib/docbook/common/pi.xsl
branches/jsxe2/buildlib/docbook/common/pl.xml
branches/jsxe2/buildlib/docbook/common/pt.xml
branches/jsxe2/buildlib/docbook/common/pt_br.xml
branches/jsxe2/buildlib/docbook/common/ro.xml
branches/jsxe2/buildlib/docbook/common/ru.xml
branches/jsxe2/buildlib/docbook/common/sk.xml
branches/jsxe2/buildlib/docbook/common/sl.xml
branches/jsxe2/buildlib/docbook/common/sr.xml
branches/jsxe2/buildlib/docbook/common/sr_Latn.xml
branches/jsxe2/buildlib/docbook/common/subtitles.xsl
branches/jsxe2/buildlib/docbook/common/sv.xml
branches/jsxe2/buildlib/docbook/common/table.xsl
branches/jsxe2/buildlib/docbook/common/targetdatabase.dtd
branches/jsxe2/buildlib/docbook/common/targets.xsl
branches/jsxe2/buildlib/docbook/common/th.xml
branches/jsxe2/buildlib/docbook/common/titles.xsl
branches/jsxe2/buildlib/docbook/common/tr.xml
branches/jsxe2/buildlib/docbook/common/uk.xml
branches/jsxe2/buildlib/docbook/common/vi.xml
branches/jsxe2/buildlib/docbook/common/xh.xml
branches/jsxe2/buildlib/docbook/common/zh_cn.xml
branches/jsxe2/buildlib/docbook/common/zh_tw.xml
branches/jsxe2/buildlib/docbook/dtd/
branches/jsxe2/buildlib/docbook/dtd/calstblx.dtd
branches/jsxe2/buildlib/docbook/dtd/catalog
branches/jsxe2/buildlib/docbook/dtd/catalog.xml
branches/jsxe2/buildlib/docbook/dtd/dbcentx.mod
branches/jsxe2/buildlib/docbook/dtd/dbgenent.mod
branches/jsxe2/buildlib/docbook/dtd/dbhierx.mod
branches/jsxe2/buildlib/docbook/dtd/dbnotnx.mod
branches/jsxe2/buildlib/docbook/dtd/dbpoolx.mod
branches/jsxe2/buildlib/docbook/dtd/docbookx.dtd
branches/jsxe2/buildlib/docbook/dtd/ent/
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsa.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsb.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsc.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsn.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamso.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsr.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISObox.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr1.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr2.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOdia.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk1.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk2.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk3.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk4.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat1.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat2.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOnum.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOpub.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOtech.ent
branches/jsxe2/buildlib/docbook/dtd/ent/catalog
branches/jsxe2/buildlib/docbook/dtd/ent/catalog.xml
branches/jsxe2/buildlib/docbook/dtd/htmltblx.mod
branches/jsxe2/buildlib/docbook/dtd/soextblx.dtd
branches/jsxe2/buildlib/docbook/fo/
branches/jsxe2/buildlib/docbook/fo/ChangeLog
branches/jsxe2/buildlib/docbook/fo/admon.xsl
branches/jsxe2/buildlib/docbook/fo/autoidx-ng.xsl
branches/jsxe2/buildlib/docbook/fo/autoidx.xsl
branches/jsxe2/buildlib/docbook/fo/autotoc.xsl
branches/jsxe2/buildlib/docbook/fo/axf.xsl
branches/jsxe2/buildlib/docbook/fo/biblio.xsl
branches/jsxe2/buildlib/docbook/fo/block.xsl
branches/jsxe2/buildlib/docbook/fo/callout.xsl
branches/jsxe2/buildlib/docbook/fo/component.xsl
branches/jsxe2/buildlib/docbook/fo/division.xsl
branches/jsxe2/buildlib/docbook/fo/docbook.xsl
branches/jsxe2/buildlib/docbook/fo/docbookng.xsl
branches/jsxe2/buildlib/docbook/fo/ebnf.xsl
branches/jsxe2/buildlib/docbook/fo/fo-patch-for-fop.xsl
branches/jsxe2/buildlib/docbook/fo/fo-rtf.xsl
branches/jsxe2/buildlib/docbook/fo/fo.xsl
branches/jsxe2/buildlib/docbook/fo/footnote.xsl
branches/jsxe2/buildlib/docbook/fo/fop.xsl
branches/jsxe2/buildlib/docbook/fo/formal.xsl
branches/jsxe2/buildlib/docbook/fo/glossary.xsl
branches/jsxe2/buildlib/docbook/fo/graphics.xsl
branches/jsxe2/buildlib/docbook/fo/htmltbl.xsl
branches/jsxe2/buildlib/docbook/fo/index.xsl
branches/jsxe2/buildlib/docbook/fo/info.xsl
branches/jsxe2/buildlib/docbook/fo/inline.xsl
branches/jsxe2/buildlib/docbook/fo/keywords.xsl
branches/jsxe2/buildlib/docbook/fo/lists.xsl
branches/jsxe2/buildlib/docbook/fo/math.xsl
branches/jsxe2/buildlib/docbook/fo/pagesetup.xsl
branches/jsxe2/buildlib/docbook/fo/param.ent
branches/jsxe2/buildlib/docbook/fo/param.xml
branches/jsxe2/buildlib/docbook/fo/param.xsl
branches/jsxe2/buildlib/docbook/fo/param.xweb
branches/jsxe2/buildlib/docbook/fo/passivetex.xsl
branches/jsxe2/buildlib/docbook/fo/pdf2index
branches/jsxe2/buildlib/docbook/fo/pi.xsl
branches/jsxe2/buildlib/docbook/fo/profile-docbook.xsl
branches/jsxe2/buildlib/docbook/fo/qandaset.xsl
branches/jsxe2/buildlib/docbook/fo/refentry.xsl
branches/jsxe2/buildlib/docbook/fo/sections.xsl
branches/jsxe2/buildlib/docbook/fo/synop.xsl
branches/jsxe2/buildlib/docbook/fo/table.xsl
branches/jsxe2/buildlib/docbook/fo/task.xsl
branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xml
branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xsl
branches/jsxe2/buildlib/docbook/fo/titlepage.xsl
branches/jsxe2/buildlib/docbook/fo/toc.xsl
branches/jsxe2/buildlib/docbook/fo/verbatim.xsl
branches/jsxe2/buildlib/docbook/fo/xep.xsl
branches/jsxe2/buildlib/docbook/fo/xref.xsl
branches/jsxe2/buildlib/docbook/html/
branches/jsxe2/buildlib/docbook/html/ChangeLog
branches/jsxe2/buildlib/docbook/html/admon.xsl
branches/jsxe2/buildlib/docbook/html/autoidx-ng.xsl
branches/jsxe2/buildlib/docbook/html/autoidx.xsl
branches/jsxe2/buildlib/docbook/html/autotoc.xsl
branches/jsxe2/buildlib/docbook/html/biblio.xsl
branches/jsxe2/buildlib/docbook/html/block.xsl
branches/jsxe2/buildlib/docbook/html/callout.xsl
branches/jsxe2/buildlib/docbook/html/changebars.xsl
branches/jsxe2/buildlib/docbook/html/chunk-code.xsl
branches/jsxe2/buildlib/docbook/html/chunk-common.xsl
branches/jsxe2/buildlib/docbook/html/chunk.xsl
branches/jsxe2/buildlib/docbook/html/chunker.xsl
branches/jsxe2/buildlib/docbook/html/chunkfast.xsl
branches/jsxe2/buildlib/docbook/html/chunktoc.xsl
branches/jsxe2/buildlib/docbook/html/component.xsl
branches/jsxe2/buildlib/docbook/html/division.xsl
branches/jsxe2/buildlib/docbook/html/docbook.xsl
branches/jsxe2/buildlib/docbook/html/docbookng.xsl
branches/jsxe2/buildlib/docbook/html/ebnf.xsl
branches/jsxe2/buildlib/docbook/html/footnote.xsl
branches/jsxe2/buildlib/docbook/html/formal.xsl
branches/jsxe2/buildlib/docbook/html/glossary.xsl
branches/jsxe2/buildlib/docbook/html/graphics.xsl
branches/jsxe2/buildlib/docbook/html/html-rtf.xsl
branches/jsxe2/buildlib/docbook/html/html.xsl
branches/jsxe2/buildlib/docbook/html/htmltbl.xsl
branches/jsxe2/buildlib/docbook/html/index.xsl
branches/jsxe2/buildlib/docbook/html/info.xsl
branches/jsxe2/buildlib/docbook/html/inline.xsl
branches/jsxe2/buildlib/docbook/html/keywords.xsl
branches/jsxe2/buildlib/docbook/html/lists.xsl
branches/jsxe2/buildlib/docbook/html/maketoc.xsl
branches/jsxe2/buildlib/docbook/html/manifest.xsl
branches/jsxe2/buildlib/docbook/html/math.xsl
branches/jsxe2/buildlib/docbook/html/oldchunker.xsl
branches/jsxe2/buildlib/docbook/html/onechunk.xsl
branches/jsxe2/buildlib/docbook/html/param.ent
branches/jsxe2/buildlib/docbook/html/param.xml
branches/jsxe2/buildlib/docbook/html/param.xsl
branches/jsxe2/buildlib/docbook/html/param.xweb
branches/jsxe2/buildlib/docbook/html/pi.xsl
branches/jsxe2/buildlib/docbook/html/profile-chunk-code.xsl
branches/jsxe2/buildlib/docbook/html/profile-chunk.xsl
branches/jsxe2/buildlib/docbook/html/profile-docbook.xsl
branches/jsxe2/buildlib/docbook/html/profile-onechunk.xsl
branches/jsxe2/buildlib/docbook/html/qandaset.xsl
branches/jsxe2/buildlib/docbook/html/refentry.xsl
branches/jsxe2/buildlib/docbook/html/sections.xsl
branches/jsxe2/buildlib/docbook/html/synop.xsl
branches/jsxe2/buildlib/docbook/html/table.xsl
branches/jsxe2/buildlib/docbook/html/task.xsl
branches/jsxe2/buildlib/docbook/html/titlepage.templates.xml
branches/jsxe2/buildlib/docbook/html/titlepage.templates.xsl
branches/jsxe2/buildlib/docbook/html/titlepage.xsl
branches/jsxe2/buildlib/docbook/html/toc.xsl
branches/jsxe2/buildlib/docbook/html/verbatim.xsl
branches/jsxe2/buildlib/docbook/html/xref.xsl
branches/jsxe2/buildlib/docbook/lib/
branches/jsxe2/buildlib/docbook/lib/ChangeLog
branches/jsxe2/buildlib/docbook/lib/lib.xml
branches/jsxe2/buildlib/docbook/lib/lib.xsl
branches/jsxe2/buildlib/docbook/lib/lib.xweb
branches/jsxe2/buildlib/fop.jar
branches/jsxe2/buildlib/js.jar
branches/jsxe2/doc/
branches/jsxe2/doc/manual/
branches/jsxe2/doc/manual/manual.xml
branches/jsxe2/installer/
branches/jsxe2/installer/done-HalfAnOS.html
branches/jsxe2/installer/done-MacOS.html
branches/jsxe2/installer/done-Unix.html
branches/jsxe2/installer/done-VMS.html
branches/jsxe2/installer/done-Windows.html
branches/jsxe2/installer/gpl.html
branches/jsxe2/installer/jsxe-installer.ico
branches/jsxe2/installer/jsxe.desktop
branches/jsxe2/installer/jsxe.png
branches/jsxe2/installer/launch4j.xml
branches/jsxe2/installer/readme.html
branches/jsxe2/installer/src/
branches/jsxe2/installer/src/installer/
branches/jsxe2/installer/src/installer/BZip2Constants.java
branches/jsxe2/installer/src/installer/CBZip2InputStream.java
branches/jsxe2/installer/src/installer/CBZip2OutputStream.java
branches/jsxe2/installer/src/installer/CRC.java
branches/jsxe2/installer/src/installer/ConsoleInstall.java
branches/jsxe2/installer/src/installer/ConsoleProgress.java
branches/jsxe2/installer/src/installer/Install.java
branches/jsxe2/installer/src/installer/InstallThread.java
branches/jsxe2/installer/src/installer/InvalidHeaderException.java
branches/jsxe2/installer/src/installer/NonInteractiveInstall.java
branches/jsxe2/installer/src/installer/OperatingSystem.java
branches/jsxe2/installer/src/installer/Progress.java
branches/jsxe2/installer/src/installer/SwingInstall.java
branches/jsxe2/installer/src/installer/TarBuffer.java
branches/jsxe2/installer/src/installer/TarEntry.java
branches/jsxe2/installer/src/installer/TarHeader.java
branches/jsxe2/installer/src/installer/TarInputStream.java
branches/jsxe2/installer/src/installer/TarOutputStream.java
branches/jsxe2/installer/src/installer/VariableGridLayout.java
branches/jsxe2/jsxe.ico
branches/jsxe2/launch4j.xml
branches/jsxe2/messages/messages.properties
branches/jsxe2/messages/messages_de.properties
branches/jsxe2/messages/messages_ja.properties
branches/jsxe2/messages/messages_ru.properties
branches/jsxe2/messages/messages_sv.properties
branches/jsxe2/src/net/sourceforge/jsxe/action/ContextSpecificAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/RedoAction.java
branches/jsxe2/src/net/sourceforge/jsxe/action/UndoAction.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/AddNodeChange.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/AttributeChange.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/RemoveNodeChange.java
branches/jsxe2/src/net/sourceforge/jsxe/gui/RolloverButton.java
branches/jsxe2/src/net/sourceforge/jsxe/help/
branches/jsxe2/src/net/sourceforge/jsxe/help/HelpIndex.java
branches/jsxe2/src/net/sourceforge/jsxe/help/HelpSearchPanel.java
branches/jsxe2/src/net/sourceforge/jsxe/help/HelpTOCPanel.java
branches/jsxe2/src/net/sourceforge/jsxe/help/HelpViewer.java
branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowD.png
branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowL.png
branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowR.png
branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowU.png
branches/jsxe2/src/net/sourceforge/jsxe/msg/RedoEvent.java
branches/jsxe2/src/net/sourceforge/jsxe/msg/UndoEvent.java
Removed Paths:
-------------
branches/jsxe2/buildlib/docbook/VERSION
branches/jsxe2/buildlib/docbook/catalog.xml
branches/jsxe2/buildlib/docbook/common/
branches/jsxe2/buildlib/docbook/common/ChangeLog
branches/jsxe2/buildlib/docbook/common/af.xml
branches/jsxe2/buildlib/docbook/common/ar.xml
branches/jsxe2/buildlib/docbook/common/autoidx-ng.xsl
branches/jsxe2/buildlib/docbook/common/bg.xml
branches/jsxe2/buildlib/docbook/common/bn.xml
branches/jsxe2/buildlib/docbook/common/bs.xml
branches/jsxe2/buildlib/docbook/common/ca.xml
branches/jsxe2/buildlib/docbook/common/common.xsl
branches/jsxe2/buildlib/docbook/common/cs.xml
branches/jsxe2/buildlib/docbook/common/da.xml
branches/jsxe2/buildlib/docbook/common/de.xml
branches/jsxe2/buildlib/docbook/common/el.xml
branches/jsxe2/buildlib/docbook/common/en.xml
branches/jsxe2/buildlib/docbook/common/es.xml
branches/jsxe2/buildlib/docbook/common/et.xml
branches/jsxe2/buildlib/docbook/common/eu.xml
branches/jsxe2/buildlib/docbook/common/fa.xml
branches/jsxe2/buildlib/docbook/common/fi.xml
branches/jsxe2/buildlib/docbook/common/fr.xml
branches/jsxe2/buildlib/docbook/common/gentext.xsl
branches/jsxe2/buildlib/docbook/common/he.xml
branches/jsxe2/buildlib/docbook/common/hr.xml
branches/jsxe2/buildlib/docbook/common/hu.xml
branches/jsxe2/buildlib/docbook/common/id.xml
branches/jsxe2/buildlib/docbook/common/it.xml
branches/jsxe2/buildlib/docbook/common/ja.xml
branches/jsxe2/buildlib/docbook/common/ko.xml
branches/jsxe2/buildlib/docbook/common/l10n.dtd
branches/jsxe2/buildlib/docbook/common/l10n.xml
branches/jsxe2/buildlib/docbook/common/l10n.xsl
branches/jsxe2/buildlib/docbook/common/la.xml
branches/jsxe2/buildlib/docbook/common/labels.xsl
branches/jsxe2/buildlib/docbook/common/lt.xml
branches/jsxe2/buildlib/docbook/common/nl.xml
branches/jsxe2/buildlib/docbook/common/nn.xml
branches/jsxe2/buildlib/docbook/common/no.xml
branches/jsxe2/buildlib/docbook/common/olink.xsl
branches/jsxe2/buildlib/docbook/common/pi.xsl
branches/jsxe2/buildlib/docbook/common/pl.xml
branches/jsxe2/buildlib/docbook/common/pt.xml
branches/jsxe2/buildlib/docbook/common/pt_br.xml
branches/jsxe2/buildlib/docbook/common/ro.xml
branches/jsxe2/buildlib/docbook/common/ru.xml
branches/jsxe2/buildlib/docbook/common/sk.xml
branches/jsxe2/buildlib/docbook/common/sl.xml
branches/jsxe2/buildlib/docbook/common/sr.xml
branches/jsxe2/buildlib/docbook/common/sr_Latn.xml
branches/jsxe2/buildlib/docbook/common/subtitles.xsl
branches/jsxe2/buildlib/docbook/common/sv.xml
branches/jsxe2/buildlib/docbook/common/table.xsl
branches/jsxe2/buildlib/docbook/common/targetdatabase.dtd
branches/jsxe2/buildlib/docbook/common/targets.xsl
branches/jsxe2/buildlib/docbook/common/th.xml
branches/jsxe2/buildlib/docbook/common/titles.xsl
branches/jsxe2/buildlib/docbook/common/tr.xml
branches/jsxe2/buildlib/docbook/common/uk.xml
branches/jsxe2/buildlib/docbook/common/vi.xml
branches/jsxe2/buildlib/docbook/common/xh.xml
branches/jsxe2/buildlib/docbook/common/zh_cn.xml
branches/jsxe2/buildlib/docbook/common/zh_tw.xml
branches/jsxe2/buildlib/docbook/dtd/
branches/jsxe2/buildlib/docbook/dtd/calstblx.dtd
branches/jsxe2/buildlib/docbook/dtd/catalog
branches/jsxe2/buildlib/docbook/dtd/catalog.xml
branches/jsxe2/buildlib/docbook/dtd/dbcentx.mod
branches/jsxe2/buildlib/docbook/dtd/dbgenent.mod
branches/jsxe2/buildlib/docbook/dtd/dbhierx.mod
branches/jsxe2/buildlib/docbook/dtd/dbnotnx.mod
branches/jsxe2/buildlib/docbook/dtd/dbpoolx.mod
branches/jsxe2/buildlib/docbook/dtd/docbookx.dtd
branches/jsxe2/buildlib/docbook/dtd/ent/
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsa.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsb.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsc.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsn.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamso.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsr.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISObox.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr1.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr2.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOdia.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk1.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk2.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk3.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk4.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat1.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat2.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOnum.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOpub.ent
branches/jsxe2/buildlib/docbook/dtd/ent/ISOtech.ent
branches/jsxe2/buildlib/docbook/dtd/ent/catalog
branches/jsxe2/buildlib/docbook/dtd/ent/catalog.xml
branches/jsxe2/buildlib/docbook/dtd/htmltblx.mod
branches/jsxe2/buildlib/docbook/dtd/soextblx.dtd
branches/jsxe2/buildlib/docbook/fo/
branches/jsxe2/buildlib/docbook/fo/ChangeLog
branches/jsxe2/buildlib/docbook/fo/admon.xsl
branches/jsxe2/buildlib/docbook/fo/autoidx-ng.xsl
branches/jsxe2/buildlib/docbook/fo/autoidx.xsl
branches/jsxe2/buildlib/docbook/fo/autotoc.xsl
branches/jsxe2/buildlib/docbook/fo/axf.xsl
branches/jsxe2/buildlib/docbook/fo/biblio.xsl
branches/jsxe2/buildlib/docbook/fo/block.xsl
branches/jsxe2/buildlib/docbook/fo/callout.xsl
branches/jsxe2/buildlib/docbook/fo/component.xsl
branches/jsxe2/buildlib/docbook/fo/division.xsl
branches/jsxe2/buildlib/docbook/fo/docbook.xsl
branches/jsxe2/buildlib/docbook/fo/docbookng.xsl
branches/jsxe2/buildlib/docbook/fo/ebnf.xsl
branches/jsxe2/buildlib/docbook/fo/fo-patch-for-fop.xsl
branches/jsxe2/buildlib/docbook/fo/fo-rtf.xsl
branches/jsxe2/buildlib/docbook/fo/fo.xsl
branches/jsxe2/buildlib/docbook/fo/footnote.xsl
branches/jsxe2/buildlib/docbook/fo/fop.xsl
branches/jsxe2/buildlib/docbook/fo/formal.xsl
branches/jsxe2/buildlib/docbook/fo/glossary.xsl
branches/jsxe2/buildlib/docbook/fo/graphics.xsl
branches/jsxe2/buildlib/docbook/fo/htmltbl.xsl
branches/jsxe2/buildlib/docbook/fo/index.xsl
branches/jsxe2/buildlib/docbook/fo/info.xsl
branches/jsxe2/buildlib/docbook/fo/inline.xsl
branches/jsxe2/buildlib/docbook/fo/keywords.xsl
branches/jsxe2/buildlib/docbook/fo/lists.xsl
branches/jsxe2/buildlib/docbook/fo/math.xsl
branches/jsxe2/buildlib/docbook/fo/pagesetup.xsl
branches/jsxe2/buildlib/docbook/fo/param.ent
branches/jsxe2/buildlib/docbook/fo/param.xml
branches/jsxe2/buildlib/docbook/fo/param.xsl
branches/jsxe2/buildlib/docbook/fo/param.xweb
branches/jsxe2/buildlib/docbook/fo/passivetex.xsl
branches/jsxe2/buildlib/docbook/fo/pdf2index
branches/jsxe2/buildlib/docbook/fo/pi.xsl
branches/jsxe2/buildlib/docbook/fo/profile-docbook.xsl
branches/jsxe2/buildlib/docbook/fo/qandaset.xsl
branches/jsxe2/buildlib/docbook/fo/refentry.xsl
branches/jsxe2/buildlib/docbook/fo/sections.xsl
branches/jsxe2/buildlib/docbook/fo/synop.xsl
branches/jsxe2/buildlib/docbook/fo/table.xsl
branches/jsxe2/buildlib/docbook/fo/task.xsl
branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xml
branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xsl
branches/jsxe2/buildlib/docbook/fo/titlepage.xsl
branches/jsxe2/buildlib/docbook/fo/toc.xsl
branches/jsxe2/buildlib/docbook/fo/verbatim.xsl
branches/jsxe2/buildlib/docbook/fo/xep.xsl
branches/jsxe2/buildlib/docbook/fo/xref.xsl
branches/jsxe2/buildlib/docbook/html/
branches/jsxe2/buildlib/docbook/html/ChangeLog
branches/jsxe2/buildlib/docbook/html/admon.xsl
branches/jsxe2/buildlib/docbook/html/autoidx-ng.xsl
branches/jsxe2/buildlib/docbook/html/autoidx.xsl
branches/jsxe2/buildlib/docbook/html/autotoc.xsl
branches/jsxe2/buildlib/docbook/html/biblio.xsl
branches/jsxe2/buildlib/docbook/html/block.xsl
branches/jsxe2/buildlib/docbook/html/callout.xsl
branches/jsxe2/buildlib/docbook/html/changebars.xsl
branches/jsxe2/buildlib/docbook/html/chunk-code.xsl
branches/jsxe2/buildlib/docbook/html/chunk-common.xsl
branches/jsxe2/buildlib/docbook/html/chunk.xsl
branches/jsxe2/buildlib/docbook/html/chunker.xsl
branches/jsxe2/buildlib/docbook/html/chunkfast.xsl
branches/jsxe2/buildlib/docbook/html/chunktoc.xsl
branches/jsxe2/buildlib/docbook/html/component.xsl
branches/jsxe2/buildlib/docbook/html/division.xsl
branches/jsxe2/buildlib/docbook/html/docbook.xsl
branches/jsxe2/buildlib/docbook/html/docbookng.xsl
branches/jsxe2/buildlib/docbook/html/ebnf.xsl
branches/jsxe2/buildlib/docbook/html/footnote.xsl
branches/jsxe2/buildlib/docbook/html/formal.xsl
branches/jsxe2/buildlib/docbook/html/glossary.xsl
branches/jsxe2/buildlib/docbook/html/graphics.xsl
branches/jsxe2/buildlib/docbook/html/html-rtf.xsl
branches/jsxe2/buildlib/docbook/html/html.xsl
branches/jsxe2/buildlib/docbook/html/htmltbl.xsl
branches/jsxe2/buildlib/docbook/html/index.xsl
branches/jsxe2/buildlib/docbook/html/info.xsl
branches/jsxe2/buildlib/docbook/html/inline.xsl
branches/jsxe2/buildlib/docbook/html/keywords.xsl
branches/jsxe2/buildlib/docbook/html/lists.xsl
branches/jsxe2/buildlib/docbook/html/maketoc.xsl
branches/jsxe2/buildlib/docbook/html/manifest.xsl
branches/jsxe2/buildlib/docbook/html/math.xsl
branches/jsxe2/buildlib/docbook/html/oldchunker.xsl
branches/jsxe2/buildlib/docbook/html/onechunk.xsl
branches/jsxe2/buildlib/docbook/html/param.ent
branches/jsxe2/buildlib/docbook/html/param.xml
branches/jsxe2/buildlib/docbook/html/param.xsl
branches/jsxe2/buildlib/docbook/html/param.xweb
branches/jsxe2/buildlib/docbook/html/pi.xsl
branches/jsxe2/buildlib/docbook/html/profile-chunk-code.xsl
branches/jsxe2/buildlib/docbook/html/profile-chunk.xsl
branches/jsxe2/buildlib/docbook/html/profile-docbook.xsl
branches/jsxe2/buildlib/docbook/html/profile-onechunk.xsl
branches/jsxe2/buildlib/docbook/html/qandaset.xsl
branches/jsxe2/buildlib/docbook/html/refentry.xsl
branches/jsxe2/buildlib/docbook/html/sections.xsl
branches/jsxe2/buildlib/docbook/html/synop.xsl
branches/jsxe2/buildlib/docbook/html/table.xsl
branches/jsxe2/buildlib/docbook/html/task.xsl
branches/jsxe2/buildlib/docbook/html/titlepage.templates.xml
branches/jsxe2/buildlib/docbook/html/titlepage.templates.xsl
branches/jsxe2/buildlib/docbook/html/titlepage.xsl
branches/jsxe2/buildlib/docbook/html/toc.xsl
branches/jsxe2/buildlib/docbook/html/verbatim.xsl
branches/jsxe2/buildlib/docbook/html/xref.xsl
branches/jsxe2/buildlib/docbook/lib/
branches/jsxe2/buildlib/docbook/lib/ChangeLog
branches/jsxe2/buildlib/docbook/lib/lib.xml
branches/jsxe2/buildlib/docbook/lib/lib.xsl
branches/jsxe2/buildlib/docbook/lib/lib.xweb
branches/jsxe2/buildlib/jsmoothgen-ant.jar
branches/jsxe2/buildlib/skeletons/
branches/jsxe2/doc/manual/
branches/jsxe2/doc/manual/manual.xml
branches/jsxe2/installer/done-HalfAnOS.html
branches/jsxe2/installer/done-MacOS.html
branches/jsxe2/installer/done-Unix.html
branches/jsxe2/installer/done-VMS.html
branches/jsxe2/installer/done-Windows.html
branches/jsxe2/installer/gpl.html
branches/jsxe2/installer/jsxe-installer.ico
branches/jsxe2/installer/jsxe.desktop
branches/jsxe2/installer/jsxe.png
branches/jsxe2/installer/launch4j.xml
branches/jsxe2/installer/readme.html
branches/jsxe2/installer/src/
branches/jsxe2/installer/src/installer/
branches/jsxe2/installer/src/installer/BZip2Constants.java
branches/jsxe2/installer/src/installer/CBZip2InputStream.java
branches/jsxe2/installer/src/installer/CBZip2OutputStream.java
branches/jsxe2/installer/src/installer/CRC.java
branches/jsxe2/installer/src/installer/ConsoleInstall.java
branches/jsxe2/installer/src/installer/ConsoleProgress.java
branches/jsxe2/installer/src/installer/Install.java
branches/jsxe2/installer/src/installer/InstallThread.java
branches/jsxe2/installer/src/installer/InvalidHeaderException.java
branches/jsxe2/installer/src/installer/NonInteractiveInstall.java
branches/jsxe2/installer/src/installer/OperatingSystem.java
branches/jsxe2/installer/src/installer/Progress.java
branches/jsxe2/installer/src/installer/SwingInstall.java
branches/jsxe2/installer/src/installer/TarBuffer.java
branches/jsxe2/installer/src/installer/TarEntry.java
branches/jsxe2/installer/src/installer/TarHeader.java
branches/jsxe2/installer/src/installer/TarInputStream.java
branches/jsxe2/installer/src/installer/TarOutputStream.java
branches/jsxe2/installer/src/installer/VariableGridLayout.java
branches/jsxe2/jsXe.jsmooth
branches/jsxe2/messages/messages
branches/jsxe2/messages/messages.de
branches/jsxe2/messages/messages.ja
branches/jsxe2/messages/messages.sv
bran...
[truncated message content] |
|
From: <ian...@us...> - 2006-09-07 02:33:22
|
Revision: 1250
http://svn.sourceforge.net/jsxe/?rev=1250&view=rev
Author: ian_lewis
Date: 2006-09-06 19:33:14 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Added more synchronization support to AdapterNode
Modified Paths:
--------------
branches/jsxe2/Changelog
branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java
branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java
Modified: branches/jsxe2/Changelog
===================================================================
--- branches/jsxe2/Changelog 2006-09-07 00:14:29 UTC (rev 1249)
+++ branches/jsxe2/Changelog 2006-09-07 02:33:14 UTC (rev 1250)
@@ -5,6 +5,7 @@
* AdapterNode now uses the DOM3 renameNode() method to rename element nodes.
* Made property methods on AdapterNodes thread safe.
* Updated property methods on XMLDocuments
+ * Made AdapterNode thread safe
08/31/2006 Ian Lewis <Ian...@me...>
Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java
===================================================================
--- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-09-07 00:14:29 UTC (rev 1249)
+++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-09-07 02:33:14 UTC (rev 1250)
@@ -225,7 +225,7 @@
//{{{ child()
/**
- * <p>Gets the child node at the given index.</p>
+ * <p>Gets the child node at the given index. This method is thread safe.</p>
* @param index the index of the requested node
* @return an AdapterNode representing the node at the given index,
* null if the index is out of bounds
@@ -238,40 +238,54 @@
*/
XMLDocument rootDocument = getOwnerDocument();
AdapterNode child = null;
- if (index < m_domNode.getChildNodes().getLength()) {
- if (index < m_children.size()) {
- try {
- child = (AdapterNode)m_children.get(index);
- if (child == null) {
- //the size was ok but no AdapterNode was at this index
- child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index));
- m_children.set(index, child);
- }
- } catch (IndexOutOfBoundsException ioobe) {}
- } else {
- /*
- Populate the other elements with null until we
- have the correct size.
- */
- ensureChildrenSize(index+1);
- child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index));
- m_children.set(index, child);
+
+ synchronized(childrenLock) {
+
+
+ if (index < childCount()) {
+ if (index < m_children.size()) {
+ try {
+ child = (AdapterNode)m_children.get(index);
+ if (child == null) {
+ //the size was ok but no AdapterNode was at this index
+ child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index));
+ m_children.set(index, child);
+ }
+ } catch (IndexOutOfBoundsException ioobe) {}
+ } else {
+ /*
+ Populate the other elements with null until we
+ have the correct size.
+ */
+ ensureChildrenSize(index+1);
+ child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index));
+ m_children.set(index, child);
+ }
}
+ return child;
}
- return child;
}//}}}
//{{{ childCount()
/**
- * <p>Gets the number of children that this node has.</p>
+ * <p>Gets the number of children that this node has. This method is thread
+ * safe.</p>
* @return the number of children of this node
*/
public int childCount() {
- NodeList childNodes = m_domNode.getChildNodes();
- if (childNodes != null) {
- return childNodes.getLength();
- } else {
- return 0;
+ Object lock = getLock();
+
+ /*
+ Accesses to the underlying DOM should be synchronized on
+ the root XMLDocument
+ */
+ synchronized (lock) {
+ NodeList childNodes = m_domNode.getChildNodes();
+ if (childNodes != null) {
+ return childNodes.getLength();
+ } else {
+ return 0;
+ }
}
}//}}}
@@ -282,7 +296,14 @@
* @return the namespace prefix for this node. null if no namespace
*/
public String getNSPrefix() {
- return m_domNode.getPrefix();
+ Object lock = getLock();
+ /*
+ Accesses to the underlying DOM should be synchronized on
+ the root XMLDocument
+ */
+ synchronized (lock) {
+ return m_domNode.getPrefix();
+ }
}//}}}
//{{{ setNSPrefix()
@@ -296,23 +317,25 @@
* NAMESPACE_ERR: Raised if the specified prefix is malformed per the Namespaces in XML specification, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from " http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" .
*/
public void setNSPrefix(String prefix) throws DOMException {
- XMLDocument doc = getOwnerDocument();
- try {
- doc.beginCompoundEdit();
- String oldPrefix = getNSPrefix();
- /*
- for whatever reason if I set a prefix on an node with no prefix
- you get DOMException.NAMESPACE_ERRs. If we are adding a NS then
- just rename the node.
- */
- if (oldPrefix != null && !oldPrefix.equals("")) {
- m_domNode.setPrefix(prefix);
- } else {
- renameElementNode(prefix, getLocalName());
+ Object lock = getLock();
+ synchronized(lock) {
+ try {
+ beginCompoundEdit();
+ String oldPrefix = getNSPrefix();
+ /*
+ for whatever reason if I set a prefix on an node with no prefix
+ you get DOMException.NAMESPACE_ERRs. If we are adding a NS then
+ just rename the node.
+ */
+ if (oldPrefix != null && !oldPrefix.equals("")) {
+ m_domNode.setPrefix(prefix);
+ } else {
+ renameElementNode(prefix, getLocalName());
+ }
+ fireNamespaceChanged(this, oldPrefix, prefix);
+ } finally {
+ endCompoundEdit();
}
- fireNamespaceChanged(this, oldPrefix, prefix);
- } finally {
- doc.endCompoundEdit();
}
}//}}}
@@ -323,7 +346,10 @@
* @return the full qualified name of this node
*/
public String getNodeName() {
- return m_domNode.getNodeName();
+ Object lock = getLock();
+ synchronized(lock) {
+ return m_domNode.getNodeName();
+ }
}//}}}
//{{{ setNodeName()
@@ -332,29 +358,37 @@
* @param qualifiedName the new qualified name
*/
public void setNodeName(String qualifiedName) throws DOMException {
- String oldPrefix = getNSPrefix();
- String oldLocalName = getLocalName();
+ Object lock = getLock();
- String prefix = MiscUtilities.getNSPrefixFromQualifiedName(qualifiedName);
- String localName = MiscUtilities.getLocalNameFromQualifiedName(qualifiedName);
- if (getNodeType() == ELEMENT_NODE) {
- renameElementNode(prefix, localName);
- } else {
- if (getNodeType() == PROCESSING_INSTRUCTION_NODE) {
- renamePINode(localName);
+ synchronized(lock) {
+
+ String oldPrefix = getNSPrefix();
+ String oldLocalName = getLocalName();
+
+ String prefix = MiscUtilities.getNSPrefixFromQualifiedName(qualifiedName);
+ String localName = MiscUtilities.getLocalNameFromQualifiedName(qualifiedName);
+
+ beginCompoundEdit();
+
+ if (getNodeType() == ELEMENT_NODE) {
+ renameElementNode(prefix, localName);
} else {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "An attempt was made to rename a node that is not supported.");
+ if (getNodeType() == PROCESSING_INSTRUCTION_NODE) {
+ renamePINode(localName);
+ } else {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "An attempt was made to rename a node that is not supported.");
+ }
}
+
+ if (!MiscUtilities.equals(oldPrefix, prefix)) {
+ fireNamespaceChanged(this, oldPrefix, prefix);
+ }
+ if (!MiscUtilities.equals(oldLocalName, localName)) {
+ fireLocalNameChanged(this, oldLocalName, localName);
+ }
+
+ endCompoundEdit();
}
- XMLDocument doc = getOwnerDocument();
- doc.beginCompoundEdit();
- if (!MiscUtilities.equals(oldPrefix, prefix)) {
- fireNamespaceChanged(this, oldPrefix, prefix);
- }
- if (!MiscUtilities.equals(oldLocalName, localName)) {
- fireLocalNameChanged(this, oldLocalName, localName);
- }
- doc.endCompoundEdit();
}//}}}
//{{{ getLocalName()
@@ -363,7 +397,10 @@
* @return the local name of the node
*/
public String getLocalName() {
- return m_domNode.getLocalName();
+ Object lock = getLock();
+ synchronized(lock) {
+ return m_domNode.getLocalName();
+ }
}//}}}
//{{{ setLocalName()
@@ -374,36 +411,41 @@
* contains an illegal character.
*/
public void setLocalName(String localName) throws DOMException {
+ Object lock = getLock();
- if (m_domNode.getNodeType() == Node.ELEMENT_NODE) {
- //Verify that this really is a change
- String oldLocalName = m_domNode.getLocalName();
- if (!oldLocalName.equals(localName)) {
-
- renameElementNode(getNSPrefix(), localName);
-
- fireLocalNameChanged(this, oldLocalName, localName);
- }
- } else {
- if (m_domNode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
- if (m_domNode.getNodeName() != localName) {
- Node newNode = m_domNode.getOwnerDocument().createProcessingInstruction(localName, m_domNode.getNodeValue());
- m_domNode.getParentNode().replaceChild(newNode, m_domNode);
- m_domNode = newNode;
+ synchronized(lock) {
+
+ if (m_domNode.getNodeType() == Node.ELEMENT_NODE) {
+ //Verify that this really is a change
+ String oldLocalName = m_domNode.getLocalName();
+ if (!oldLocalName.equals(localName)) {
+
+ renameElementNode(getNSPrefix(), localName);
+
+ fireLocalNameChanged(this, oldLocalName, localName);
}
} else {
- if (m_domNode.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
+ if (m_domNode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
if (m_domNode.getNodeName() != localName) {
- if (getOwnerDocument().entityDeclared(localName)) {
- Node newNode = m_domNode.getOwnerDocument().createEntityReference(localName);
- m_domNode.getParentNode().replaceChild(newNode, m_domNode);
- m_domNode = newNode;
- } else {
- throw new DOMException(DOMException.SYNTAX_ERR, "Entity "+"\""+localName+"\""+" is not declared in the Schema");
+ Node newNode = m_domNode.getOwnerDocument().createProcessingInstruction(localName, m_domNode.getNodeValue());
+ m_domNode.getParentNode().replaceChild(newNode, m_domNode);
+ m_domNode = newNode;
+ }
+ } else {
+ if (m_domNode.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
+ if (m_domNode.getNodeName() != localName) {
+ XMLDocument doc = getOwnerDocument();
+ if (doc != null && doc.entityDeclared(localName)) {
+ Node newNode = m_domNode.getOwnerDocument().createEntityReference(localName);
+ m_domNode.getParentNode().replaceChild(newNode, m_domNode);
+ m_domNode = newNode;
+ } else {
+ throw new DOMException(DOMException.SYNTAX_ERR, "Entity "+"\""+localName+"\""+" is not declared in the Schema");
+ }
}
+ } else {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Renaming this node type is not supported.");
}
- } else {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Renaming this node type is not supported.");
}
}
}
@@ -415,7 +457,10 @@
* @return the current value associated with this node
*/
public String getNodeValue() {
- return m_domNode.getNodeValue();
+ Object lock = getLock();
+ synchronized(lock) {
+ return m_domNode.getNodeValue();
+ }
}//}}}
//{{{ setNodeValue()
@@ -429,11 +474,15 @@
* the implementation platform.
*/
public void setNodeValue(String str) throws DOMException {
- // Make sure there is a change.
- if (!MiscUtilities.equals(str, m_domNode.getNodeValue())) {
- String oldValue = getNodeValue();
- m_domNode.setNodeValue(str);
- fireNodeValueChanged(this, oldValue, str);
+ Object lock = getLock();
+
+ synchronized(lock) {
+ // Make sure there is a change.
+ if (!MiscUtilities.equals(str, m_domNode.getNodeValue())) {
+ String oldValue = getNodeValue();
+ m_domNode.setNodeValue(str);
+ fireNodeValueChanged(this, oldValue, str);
+ }
}
}//}}}
@@ -443,7 +492,11 @@
* @return the node type
*/
public short getNodeType() {
- return m_domNode.getNodeType();
+ Object lock = getLock();
+
+ synchronized(lock) {
+ return m_domNode.getNodeType();
+ }
}//}}}
//{{{ getParentNode()
@@ -462,7 +515,11 @@
* <code>null</code> if this is not an element node
*/
public NamedNodeMap getAttributes() {
- return m_domNode.getAttributes();
+ Object lock = getLock();
+
+ synchronized(lock) {
+ return m_domNode.getAttributes();
+ }
}//}}}
//{{{ addAdapterNode()
@@ -529,63 +586,68 @@
* location is invalid.
*/
public AdapterNode addAdapterNodeAt(AdapterNode node, int location) throws DOMException {
- if (node != null) {
- if (location >= 0 && location <= childCount()) {
- if (m_children.indexOf(node) == location) {
- //node is already in the location specified
- return node;
- }
-
- XMLDocument doc = getOwnerDocument();
- try {
+
+ synchronized(childrenLock) {
+ if (node != null) {
+ if (location >= 0 && location <= childCount()) {
+ if (m_children.indexOf(node) == location) {
+ //node is already in the location specified
+ return node;
+ }
- doc.beginCompoundEdit();
- //add to this AdapterNode and the DOM.
- if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {
- //Add all children of the document fragment
- for (int i=0; i<node.childCount(); i++) {
- addAdapterNodeAt(node.child(i), location+i);
- }
- } else {
+ Object lock = getLock();
+ synchronized(lock) {
- /*
- if the node is already contained in this node
- then we are effectively moving the node.
- */
- if (m_children.contains(node)) {
- if (location > m_children.indexOf(node)) {
- location -= 1;
- }
- int index = index(node);
- m_children.remove(node);
- addUndoableEdit(new RemoveNodeChange(this, node, index));
- } else {
- //Remove from previous parent
- AdapterNode previousParent = node.getParentNode();
- if (previousParent != this) {
- if (previousParent != null) {
- previousParent.removeChild(node);
+ try {
+ beginCompoundEdit();
+ //add to this AdapterNode and the DOM.
+ if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {
+ //Add all children of the document fragment
+ for (int i=0; i<node.childCount(); i++) {
+ addAdapterNodeAt(node.child(i), location+i);
}
+ } else {
+
+ /*
+ if the node is already contained in this node
+ then we are effectively moving the node.
+ */
+ if (m_children.contains(node)) {
+ if (location > m_children.indexOf(node)) {
+ location -= 1;
+ }
+ int index = index(node);
+ m_children.remove(node);
+ addUndoableEdit(new RemoveNodeChange(this, node, index));
+ } else {
+ //Remove from previous parent
+ AdapterNode previousParent = node.getParentNode();
+ if (previousParent != this) {
+ if (previousParent != null) {
+ previousParent.removeChild(node);
+ }
+ }
+ }
+ if (location >= m_children.size()) {
+ m_domNode.appendChild(node.getNode());
+ ensureChildrenSize(location);
+ m_children.add(node);
+ } else {
+ m_domNode.insertBefore(node.getNode(), child(location).getNode());
+ m_children.add(location, node);
+ }
+
+ node.setParent(this);
+ fireNodeAdded(this, node, location);
}
+ } finally {
+ endCompoundEdit();
}
- if (location >= m_children.size()) {
- m_domNode.appendChild(node.getNode());
- ensureChildrenSize(location);
- m_children.add(node);
- } else {
- m_domNode.insertBefore(node.getNode(), child(location).getNode());
- m_children.add(location, node);
- }
-
- node.setParent(this);
- fireNodeAdded(this, node, location);
}
- } finally {
- doc.endCompoundEdit();
+ } else {
+ throw new DOMException(DOMException.INDEX_SIZE_ERR, "The location to insert this node is invalid.");
}
- } else {
- throw new DOMException(DOMException.INDEX_SIZE_ERR, "The location to insert this node is invalid.");
}
}
return node;
@@ -601,19 +663,26 @@
* a child of this node.
*/
public void remove(AdapterNode child) throws DOMException {
- if (child != null) {
- if (getNodeType() == Node.DOCUMENT_NODE && child.getNodeType() == Node.ELEMENT_NODE) {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "You cannot remove the root element node.");
+
+ synchronized(childrenLock) {
+ Object lock = getLock();
+ synchronized(lock) {
+
+ if (child != null) {
+ if (getNodeType() == Node.DOCUMENT_NODE && child.getNodeType() == Node.ELEMENT_NODE) {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "You cannot remove the root element node.");
+ }
+ if (child.getNodeType() != Node.DOCUMENT_TYPE_NODE) {
+ int index = index(child);
+ m_domNode.removeChild(child.getNode());
+ m_children.remove(child);
+ child.setParent(null);
+ fireNodeRemoved(this, child, index);
+ } else {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes");
+ }
+ }
}
- if (child.getNodeType() != Node.DOCUMENT_TYPE_NODE) {
- int index = index(child);
- m_domNode.removeChild(child.getNode());
- m_children.remove(child);
- child.setParent(null);
- fireNodeRemoved(this, child, index);
- } else {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes");
- }
}
}//}}}
@@ -631,43 +700,48 @@
* readonly
*/
public void setAttribute(String name, String value) throws DOMException {
- if (m_domNode.getNodeType() == Node.ELEMENT_NODE) {
-
- Element element = (Element)m_domNode;
- String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name);
-
- String oldValue = getAttribute(name);
-
- if (!MiscUtilities.equals(oldValue, value)) {
- //check if we are setting a namespace declaration
- if ("xmlns".equals(prefix)) {
- //if so then make sure the value is valid
- if (value != null && value.equals("")) {
- throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to create an empty namespace declaration");
+ Object lock = getLock();
+
+ synchronized(lock) {
+
+ if (m_domNode.getNodeType() == Node.ELEMENT_NODE) {
+
+ Element element = (Element)m_domNode;
+ String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name);
+
+ String oldValue = getAttribute(name);
+
+ if (!MiscUtilities.equals(oldValue, value)) {
+ //check if we are setting a namespace declaration
+ if ("xmlns".equals(prefix)) {
+ //if so then make sure the value is valid
+ if (value != null && value.equals("")) {
+ throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to create an empty namespace declaration");
+ }
}
- }
-
- /*
- If the attribute did not have a prefix to begin with then
- using setAttributeNS may add a new attribute node to the element
- even though the attribute already exists.
- */
- if (prefix != null && !prefix.equals("")) {
- element.setAttributeNS(lookupNamespaceURI(prefix),name,value);
- } else {
+
/*
- setAttribute doesn't throw an error if the first character
- is a ":"
+ If the attribute did not have a prefix to begin with then
+ using setAttributeNS may add a new attribute node to the element
+ even though the attribute already exists.
*/
- if (name != null && !name.equals("") && name.charAt(0)==':') {
- throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character");
+ if (prefix != null && !prefix.equals("")) {
+ element.setAttributeNS(lookupNamespaceURI(prefix),name,value);
+ } else {
+ /*
+ setAttribute doesn't throw an error if the first character
+ is a ":"
+ */
+ if (name != null && !name.equals("") && name.charAt(0)==':') {
+ throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character");
+ }
+ element.setAttribute(name, value);
}
- element.setAttribute(name, value);
+ fireAttributeChanged(this, name, oldValue, value);
}
- fireAttributeChanged(this, name, oldValue, value);
+ } else {
+ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes");
}
- } else {
- throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes");
}
}//}}}
@@ -678,28 +752,33 @@
* @throws DOMException NOT_SUPPORTED_ERR: if this is not an element node
*/
public String getAttribute(String name) throws DOMException {
- if (m_domNode.getNodeType() == Node.ELEMENT_NODE) {
- String localName = MiscUtilities.getLocalNameFromQualifiedName(name);
- String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name);
-
- Element element = (Element)m_domNode;
- if (prefix != null && !prefix.equals("")) {
- //getAttributeNS returns "" even if the attribute isn't in the
- //element.
- if (element.getAttributeNodeNS(lookupNamespaceURI(prefix),localName) == null) {
- return null;
+
+ Object lock = getLock();
+
+ synchronized(lock) {
+ if (m_domNode.getNodeType() == Node.ELEMENT_NODE) {
+ String localName = MiscUtilities.getLocalNameFromQualifiedName(name);
+ String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name);
+
+ Element element = (Element)m_domNode;
+ if (prefix != null && !prefix.equals("")) {
+ //getAttributeNS returns "" even if the attribute isn't in the
+ //element.
+ if (element.getAttributeNodeNS(lookupNamespaceURI(prefix),localName) == null) {
+ return null;
+ }
+ return element.getAttributeNS(lookupNamespaceURI(prefix),localName);
+ } else {
+ //getAttribute returns "" even if the attribute isn't in the
+ //element.
+ if (element.getAttributeNode(name) == null) {
+ return null;
+ }
+ return element.getAttribute(name);
}
- return element.getAttributeNS(lookupNamespaceURI(prefix),localName);
} else {
- //getAttribute returns "" even if the attribute isn't in the
- //element.
- if (element.getAttributeNode(name) == null) {
- return null;
- }
- return element.getAttribute(name);
+ thro...
[truncated message content] |