[aXSL-commit] SF.net SVN: axsl: [560] trunk/axsl/axsl-area-w/src/java/org/axsl/areaW
An API for XSL-FO.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-05-09 00:58:17
|
Revision: 560 Author: victormote Date: 2006-05-08 11:20:18 -0700 (Mon, 08 May 2006) ViewCVS: http://svn.sourceforge.net/axsl/?rev=560&view=rev Log Message: ----------- 1. Add new superinterface for OrderedTreeNodes. 2. Fix some hierarchy problems. 3. Add some useful methods. Modified Paths: -------------- trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/AreaNode.java trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageArea.java trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageCollection.java Added Paths: ----------- trunk/axsl/axsl-common/src/java/org/axsl/common/OrderedTreeNode.java Modified: trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/AreaNode.java =================================================================== --- trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/AreaNode.java 2006-05-08 17:49:55 UTC (rev 559) +++ trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/AreaNode.java 2006-05-08 18:20:18 UTC (rev 560) @@ -20,12 +20,13 @@ package org.axsl.areaW; +import org.axsl.common.OrderedTreeNode; import org.axsl.foR.FONode; import org.axsl.foR.FObj; import java.util.List; -public interface AreaNode { +public interface AreaNode extends OrderedTreeNode { public AreaNode getWritableParent() ; Modified: trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageArea.java =================================================================== --- trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageArea.java 2006-05-08 17:49:55 UTC (rev 559) +++ trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageArea.java 2006-05-08 18:20:18 UTC (rev 560) @@ -21,6 +21,7 @@ package org.axsl.areaW; import org.axsl.foR.fo.FootnoteBody; +import org.axsl.foR.fo.Marker; import org.axsl.foR.fo.PageSequence; import org.axsl.foR.fo.SimplePageMaster; @@ -54,4 +55,6 @@ public PageSequence getPageSequence() ; + public void registerMarker(Marker marker) ; + } Modified: trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageCollection.java =================================================================== --- trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageCollection.java 2006-05-08 17:49:55 UTC (rev 559) +++ trunk/axsl/axsl-area-w/src/java/org/axsl/areaW/PageCollection.java 2006-05-08 18:20:18 UTC (rev 560) @@ -28,7 +28,7 @@ * It is the immediate child of {@link AreaTree}, and the parent of one or * more Pages. */ -public interface PageCollection { +public interface PageCollection extends AreaNode { public AreaTree getWritableAreaTree() ; Added: trunk/axsl/axsl-common/src/java/org/axsl/common/OrderedTreeNode.java =================================================================== --- trunk/axsl/axsl-common/src/java/org/axsl/common/OrderedTreeNode.java (rev 0) +++ trunk/axsl/axsl-common/src/java/org/axsl/common/OrderedTreeNode.java 2006-05-08 18:20:18 UTC (rev 560) @@ -0,0 +1,153 @@ +/* + * Copyright 2006 The aXSL Project. + * http://www.axsl.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* $Id$ */ + +package org.axsl.common; + +import java.util.Enumeration; +import java.util.List; + +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; + +public interface OrderedTreeNode extends TreeNode { + + public Enumeration children() ; + + public List getChildren(); + + public boolean getAllowsChildren(); + + public TreeNode getChildAt(int childIndex) ; + + public int getChildCount() ; + + public int getIndex(TreeNode node) ; + + public TreeNode getParent() ; + + public boolean isLeaf() ; + + public List getSiblings() ; + + /** + * @return The index to "this" in the parent's children. + */ + public int siblingIndex() ; + + /** + * @return Return the sibling immediately preceding "this" in the parent's + * children, or null if this is the first child. + */ + public OrderedTreeNode getPreviousSibling() ; + + /** + * @return Return the sibling immediately following "this" in the parent's + * children, or null if this is the last child. + */ + public OrderedTreeNode getNextSibling() ; + + /** + * @return True if this AreaNode has any children, false if it has none. + */ + public boolean hasChildren() ; + + public OrderedTreeNode getFirstChild() ; + + public OrderedTreeNode getLastChild() ; + + /** + * Returns the next node in the tree relative to the current node, in + * pre-order traversal order. This is also known as breadth-first order. + * @return The next pre-order node, or null if there is none. + */ + public OrderedTreeNode nextPreOrderNode() ; + + /** + * Finds and returns the first leaf that is a descendant of this node -- + * either this node or its first child's first leaf. + * Returns this node if it is a leaf. + * (Liberated from {@link DefaultMutableTreeNode}). + * + * @see #isLeaf + * @see DefaultMutableTreeNode#isNodeDescendant + * @return the first leaf in the subtree rooted at this node + */ + public OrderedTreeNode getFirstLeaf() ; + + + /** + * Finds and returns the last leaf that is a descendant of this node -- + * either this node or its last child's last leaf. + * Returns this node if it is a leaf. + * (Liberated from {@link DefaultMutableTreeNode}). + * + * @see #isLeaf + * @see DefaultMutableTreeNode#isNodeDescendant + * @return the last leaf in the subtree rooted at this node + */ + public OrderedTreeNode getLastLeaf() ; + + + /** + * Returns the leaf after this node or null if this node is the + * last leaf in the tree. + * <p> + * In this implementation of the <code>MutableNode</code> interface, + * this operation is very inefficient. In order to determine the + * next node, this method first performs a linear search in the + * parent's child-list in order to find the current node. + * <p> + * That implementation makes the operation suitable for short + * traversals from a known position. But to traverse all of the + * leaves in the tree, you should use <code>depthFirstEnumeration</code> + * to enumerate the nodes in the tree and use <code>isLeaf</code> + * on each node to determine which are leaves. + * (Liberated from {@link DefaultMutableTreeNode}). + * + * @see DefaultMutableTreeNode#depthFirstEnumeration + * @see #isLeaf + * @return returns the next leaf past this node + */ + public OrderedTreeNode getNextLeaf() ; + + + /** + * Returns the leaf before this node or null if this node is the + * first leaf in the tree. + * <p> + * In this implementation of the <code>MutableNode</code> interface, + * this operation is very inefficient. In order to determine the + * previous node, this method first performs a linear search in the + * parent's child-list in order to find the current node. + * <p> + * That implementation makes the operation suitable for short + * traversals from a known position. But to traverse all of the + * leaves in the tree, you should use <code>depthFirstEnumeration</code> + * to enumerate the nodes in the tree and use <code>isLeaf</code> + * on each node to determine which are leaves. + * (Liberated from {@link DefaultMutableTreeNode}). + * + * @see DefaultMutableTreeNode#depthFirstEnumeration + * @see #isLeaf + * @return returns the leaf before this node + */ + public OrderedTreeNode getPreviousLeaf() ; + +} Property changes on: trunk/axsl/axsl-common/src/java/org/axsl/common/OrderedTreeNode.java ___________________________________________________________________ Name: svn:keywords + "Author Id Rev Date URL" Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |