lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ed...@apache.org
Subject cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/publication SiteTreeNode.java SiteTreeNodeImpl.java
Date Mon, 25 Aug 2003 17:42:08 GMT
edith       2003/08/25 10:42:08

  Modified:    src/java/org/apache/lenya/cms/publication SiteTreeNode.java
                        SiteTreeNodeImpl.java
  Log:
  method remove children
  
  Revision  Changes    Path
  1.9       +12 -4     cocoon-lenya/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java
  
  Index: SiteTreeNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/publication/SiteTreeNode.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SiteTreeNode.java	14 Aug 2003 10:45:34 -0000	1.8
  +++ SiteTreeNode.java	25 Aug 2003 17:42:08 -0000	1.9
  @@ -139,10 +139,18 @@
   
   	/**
   	 * Get the sitetreenodes, which are children of this node
  +	 * 
   	 * @return the children.
   	 */
   	SiteTreeNode[] getChildren();
  -	
  +
  +	/**
  +	 * Remove the children of the node
  +	 * 
  +	 * @return the removed node
  +	 */
  +	SiteTreeNode[] removeChildren();
  +		
   	/**
   	 * Call the visit method of the visitor, that mean
   	 * the operation that shall be perfoemed on this node
  
  
  
  1.14      +19 -3     cocoon-lenya/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java
  
  Index: SiteTreeNodeImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SiteTreeNodeImpl.java	14 Aug 2003 10:45:34 -0000	1.13
  +++ SiteTreeNodeImpl.java	25 Aug 2003 17:42:08 -0000	1.14
  @@ -344,6 +344,22 @@
   	}
   
   	/**
  +	 *  (non-Javadoc)
  +	 * @see org.apache.lenya.cms.publication.SiteTreeNode#removeChildren()
  +	 */
  +	public SiteTreeNode[] removeChildren() {
  +		List childElements = new ArrayList();
  +		NamespaceHelper helper = new NamespaceHelper(DefaultSiteTree.NAMESPACE_URI, "", node.getOwnerDocument());
  +		Element[] elements = helper.getChildren((Element)node, SiteTreeNodeImpl.NODE_NAME);
  +		for (int i = 0; i < elements.length; i++) {
  +	        node.removeChild(elements[i]);
  +			SiteTreeNode newNode = new SiteTreeNodeImpl(elements[i]); 
  +			childElements.add(newNode);
  +		}
  +		return (SiteTreeNode[]) childElements.toArray(new SiteTreeNode[childElements.size()]);
  +	}
  +
  +	/**
   	 * (non-Javadoc)
   	 * @see org.apache.lenya.cms.publication.SiteTreeNode#accept(org.apache.lenya.cms.publication.SiteTreeNodeVisitor)
   	 */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org


Mime
View raw message