![JAR search and dependency download from the Maven repository](/logo.png)
com.hp.gagawa.java.elements.Base Maven / Gradle / Ivy
The newest version!
/**Generated by the Gagawa TagBuilder Fri Jan 30 21:29:45 PST 2009*/
/**
(c) Copyright 2008 Hewlett-Packard Development Company, L.P.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package com.hp.gagawa.java.elements;
import com.hp.gagawa.java.FertileNode;
import com.hp.gagawa.java.Node;
import com.hp.gagawa.java.elements.Text;
import java.util.List;
public class Base extends FertileNode {
public Base(String href){
super("base");
setHref(href);
}
public Base setHref(String value){setAttribute("href", value); return this;}
public String getHref(){return getAttribute("href");}
public boolean removeHref(){return removeAttribute("href");}
/**
* Appends a child node to the end of this element's DOM tree
* @param child node to be appended
* @return the node
*/
public Base appendChild(Node child){
if(this == child){
throw new Error("Cannot append a node to itself.");
}
child.setParent(this);
children.add(child);
return this;
}
/**
* Appends a child node at the given index
* @param index insert point
* @param child node to be appended
* @return the node
*/
public Base appendChild(int index, Node child){
if(this == child){
throw new Error("Cannot append a node to itself.");
}
child.setParent(this);
children.add(index, child);
return this;
}
/**
* Appends a list of children in the order given in the list
* @param children nodes to be appended
* @return the node
*/
public Base appendChild(List children){
if(children != null){;
for(Node child: children){
appendChild(child);
}
}
return this;
}
/**
* Appends the given children in the order given
* @param children nodes to be appended
* @return the node
*/
public Base appendChild(Node... children){
for(int i = 0; i < children.length; i++){
appendChild(children[i]);
}
return this;
}
/**
* Convenience method which appends a text node to this element
* @param text the text to be appended
* @return the node
*/
public Base appendText(String text){
return appendChild(new Text(text));
}
/**
* Removes the child node
* @param child node to be removed
* @return the node
*/
public Base removeChild(Node child){
children.remove(child);
return this;
}
/**
* Removes all child nodes
* @return the node
*/
public Base removeChildren(){
children.clear();
return this;
}
public Base setTarget(String value){setAttribute("target", value); return this;}
public String getTarget(){return getAttribute("target");}
public boolean removeTarget(){return removeAttribute("target");}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy