📄 abstractadapternode.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: AbstractAdapterNode.java
package org.apache.struts2.views.xslt;
import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.StrutsException;
import org.w3c.dom.*;
// Referenced classes of package org.apache.struts2.views.xslt:
// SimpleNodeList, AdapterNode, AdapterFactory
public abstract class AbstractAdapterNode
implements AdapterNode
{
private static final NamedNodeMap EMPTY_NAMEDNODEMAP = new NamedNodeMap() {
public int getLength()
{
return 0;
}
public Node item(int index)
{
return null;
}
public Node getNamedItem(String name)
{
return null;
}
public Node removeNamedItem(String name)
throws DOMException
{
return null;
}
public Node setNamedItem(Node arg)
throws DOMException
{
return null;
}
public Node setNamedItemNS(Node arg)
throws DOMException
{
return null;
}
public Node getNamedItemNS(String namespaceURI, String localName)
{
return null;
}
public Node removeNamedItemNS(String namespaceURI, String localName)
throws DOMException
{
return null;
}
};
private List childAdapters;
private Log log;
private Object propertyValue;
private String propertyName;
private AdapterNode parent;
private AdapterFactory adapterFactory;
public AbstractAdapterNode()
{
log = LogFactory.getLog(getClass());
if (LogFactory.getLog(getClass()).isDebugEnabled())
LogFactory.getLog(getClass()).debug((new StringBuilder()).append("Creating ").append(this).toString());
}
protected void setContext(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value)
{
setAdapterFactory(adapterFactory);
setParent(parent);
setPropertyName(propertyName);
setPropertyValue(value);
}
protected List buildChildAdapters()
{
return new ArrayList();
}
protected List getChildAdapters()
{
if (childAdapters == null)
childAdapters = buildChildAdapters();
return childAdapters;
}
public Node getChildBeforeOrAfter(Node child, boolean before)
{
log.debug("getChildBeforeOrAfter: ");
List adapters = getChildAdapters();
if (log.isDebugEnabled())
{
log.debug((new StringBuilder()).append("childAdapters = ").append(adapters).toString());
log.debug((new StringBuilder()).append("child = ").append(child).toString());
}
int index = adapters.indexOf(child);
if (index < 0)
{
throw new StrutsException((new StringBuilder()).append(child).append(" is no child of ").append(this).toString());
} else
{
int siblingIndex = before ? index - 1 : index + 1;
return 0 >= siblingIndex || siblingIndex >= adapters.size() ? null : (Node)adapters.get(siblingIndex);
}
}
public Node getChildAfter(Node child)
{
log.trace("getChildafter");
return getChildBeforeOrAfter(child, false);
}
public Node getChildBefore(Node child)
{
log.trace("getchildbefore");
return getChildBeforeOrAfter(child, true);
}
public NodeList getElementsByTagName(String tagName)
{
if (tagName.equals("*"))
return getChildNodes();
LinkedList filteredChildren = new LinkedList();
Iterator i$ = getChildAdapters().iterator();
do
{
if (!i$.hasNext())
break;
Node adapterNode = (Node)i$.next();
if (adapterNode.getNodeName().equals(tagName))
filteredChildren.add(adapterNode);
} while (true);
return new SimpleNodeList(filteredChildren);
}
public NodeList getElementsByTagNameNS(String string, String string1)
{
return null;
}
public NamedNodeMap getAttributes()
{
return EMPTY_NAMEDNODEMAP;
}
public NodeList getChildNodes()
{
NodeList nl = new SimpleNodeList(getChildAdapters());
if (log.isDebugEnabled())
log.debug((new StringBuilder()).append("getChildNodes for tag: ").append(getNodeName()).append(" num children: ").append(nl.getLength()).toString());
return nl;
}
public Node getFirstChild()
{
return getChildNodes().getLength() <= 0 ? null : getChildNodes().item(0);
}
public Node getLastChild()
{
return getChildNodes().getLength() <= 0 ? null : getChildNodes().item(getChildNodes().getLength() - 1);
}
public String getLocalName()
{
return null;
}
public String getNamespaceURI()
{
return null;
}
public void setNodeValue(String string)
throws DOMException
{
throw operationNotSupported();
}
public String getNodeValue()
throws DOMException
{
throw operationNotSupported();
}
public Document getOwnerDocument()
{
return null;
}
public Node getParentNode()
{
log.trace("getParentNode");
return getParent();
}
public AdapterNode getParent()
{
return parent;
}
public void setParent(AdapterNode parent)
{
this.parent = parent;
}
public Object getPropertyValue()
{
return propertyValue;
}
public void setPropertyValue(Object prop)
{
propertyValue = prop;
}
public void setPrefix(String string)
throws DOMException
{
throw operationNotSupported();
}
public String getPrefix()
{
return null;
}
public Node getNextSibling()
{
Node next = getParent().getChildAfter(this);
if (log.isTraceEnabled())
log.trace((new StringBuilder()).append("getNextSibling on ").append(getNodeName()).append(": ").append(next != null ? next.getNodeName() : "null").toString());
return next;
}
public Node getPreviousSibling()
{
return getParent().getChildBefore(this);
}
public String getPropertyName()
{
return propertyName;
}
public void setPropertyName(String name)
{
propertyName = name;
}
public AdapterFactory getAdapterFactory()
{
return adapterFactory;
}
public void setAdapterFactory(AdapterFactory adapterFactory)
{
this.adapterFactory = adapterFactory;
}
public boolean isSupported(String string, String string1)
{
throw operationNotSupported();
}
public Node appendChild(Node node)
throws DOMException
{
throw operationNotSupported();
}
public Node cloneNode(boolean b)
{
log.trace("cloneNode");
throw operationNotSupported();
}
public boolean hasAttributes()
{
return false;
}
public boolean hasChildNodes()
{
return false;
}
public Node insertBefore(Node node, Node node1)
throws DOMException
{
throw operationNotSupported();
}
public void normalize()
{
log.trace("normalize");
throw operationNotSupported();
}
public Node removeChild(Node node)
throws DOMException
{
throw operationNotSupported();
}
public Node replaceChild(Node node, Node node1)
throws DOMException
{
throw operationNotSupported();
}
public boolean isDefaultNamespace(String string)
{
throw operationNotSupported();
}
public String lookupNamespaceURI(String string)
{
throw operationNotSupported();
}
public String getNodeName()
{
throw operationNotSupported();
}
public short getNodeType()
{
throw operationNotSupported();
}
public String getBaseURI()
{
throw operationNotSupported();
}
public short compareDocumentPosition(Node node)
throws DOMException
{
throw operationNotSupported();
}
public String getTextContent()
throws DOMException
{
throw operationNotSupported();
}
public void setTextContent(String string)
throws DOMException
{
throw operationNotSupported();
}
public boolean isSameNode(Node node)
{
throw operationNotSupported();
}
public String lookupPrefix(String string)
{
throw operationNotSupported();
}
public boolean isEqualNode(Node node)
{
throw operationNotSupported();
}
public Object getFeature(String string, String string1)
{
throw operationNotSupported();
}
public Object setUserData(String string, Object object, UserDataHandler userDataHandler)
{
throw operationNotSupported();
}
public Object getUserData(String string)
{
throw operationNotSupported();
}
protected StrutsException operationNotSupported()
{
return new StrutsException("Operation not supported.");
}
public String toString()
{
return (new StringBuilder()).append(getClass()).append(": ").append(getNodeName()).append(" parent=").append(getParentNode()).toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -