
org.enhydra.xml.lazydom.LazyNode Maven / Gradle / Ivy
The newest version!
/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Enhydra Application Server is Lutris
* Technologies, Inc. The Enhydra Application Server and portions created
* by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
* All Rights Reserved.
*
* Contributor(s):
*
* $Id: LazyNode.java,v 1.3 2005/01/26 08:29:24 jkjome Exp $
*/
package org.enhydra.xml.lazydom;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
// FIXME: A lot of the assumptions of LazyNode vs LazyParent described
// below might be better encoded as method calls.
/**
* Interface use to define Lazy DOM methods that apply to every node.
* In addition to these methods, each node must:
*
* - Supply a getTemplateXXX for the specific node type.
*
*
* There are two basic interfaces for implementing LazyDOM nodes:
* LazyNode and LazyParent, with LazyParent extended LazyNode.
* They have the following properties:
*
* - Only LazyParent nodes can contain other nodes.
*
- Only LazyParent nodes can exist with out their parent being
* expanded.
*
- All children of a LazyParent are expanded if one of the children
* is expanded.
*
- If a LazyNode that is not a LazyParent is expanded, its siblings
* are expanded.
*
- If a LazyParent's parent is expanded, its siblings are expanded.
*
- If a LazyParent's parent is not expanded, its siblings may or may not
* be expanded.
*
*/
public interface LazyNode extends Node {
/**
* Constant to indicate an node does not have an id.
*/
public static final int NULL_NODE_ID = -1;
/**
* Node id returned for the Document node.
*/
public static final int DOCUMENT_NODE_ID = 0;
/*
* Mark this node into a template node. This assigns the node id, and
* flags the node as template.
* @param nodeId The node id to associate with the node.
*/
public void makeTemplateNode(int nodeId);
/**
* Get the node numeric id number.
*
* @return The node id number, unique to this document, or NULL_NODE_ID
* if the node does not have an id assocaited with it.
*/
public int getNodeId();
/**
* Check if this node is a template node.
*/
public boolean isTemplateNode();
/**
* Get the template node as a LazyNode.
*/
public LazyNode getTemplateNode();
/**
* Create a new node, using this node as the template.
*/
public LazyNode templateClone(Document ownerDocument);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy