rabbit.html
Class Tag

java.lang.Object
  extended by rabbit.html.Tag

public class Tag
extends Object

This class describes a HTML tag. That is something like "<tagname key=value key=value key>"

Author:
Robert Olofsson

Nested Class Summary
static class Tag.Pair
          This class is a key value pair.
 
Constructor Summary
Tag()
           
Tag(String type)
          Create a new Tag with given type
 
Method Summary
 void addArg(String key, String value)
          Add a new key/value Pair to this tag.
 void addArg(String key, String value, boolean changed)
          Add a new key/value Pair to this tag.
 String getAttribute(String key)
          Get the value of the given key.
 String getLowerCaseType()
          Get the lowercase type of this tag.
 TagType getTagType()
          Get the tagtype of this tag.
 Token getToken()
          Get the parent token of this tag.
 String getType()
          Get the type of this tag.
 void removeAttribute(String remover)
          Remove an attribute.
 void setAttribute(String key, String value)
          Set the attribute given.
 void setToken(Token token)
          Set the parent token of this tag.
 void setType(String type)
          Set the Type of this Tag.
 String toString()
          Get this Tag as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tag

public Tag()

Tag

public Tag(String type)
Create a new Tag with given type

Parameters:
type - the type of the tag (like "body").
Method Detail

setType

public void setType(String type)
Set the Type of this Tag.

Parameters:
type - the new type of this tag.

getType

public String getType()
Get the type of this tag.

Returns:
the type of this tag.

getLowerCaseType

public String getLowerCaseType()
Get the lowercase type of this tag.

Returns:
the type of this tag.

getTagType

public TagType getTagType()
Get the tagtype of this tag.

Returns:
the TagType of this tag.

getToken

public Token getToken()
Get the parent token of this tag.

Returns:
the parent Token for this tag.

setToken

public void setToken(Token token)
Set the parent token of this tag.

Parameters:
token - the parent of this tag.

addArg

public void addArg(String key,
                   String value)
Add a new key/value Pair to this tag.

Parameters:
key - the key.
value - the value.

addArg

public void addArg(String key,
                   String value,
                   boolean changed)
Add a new key/value Pair to this tag.

Parameters:
key - the key.
value - the value.
changed - if true this tag is changed by this (that is a new parameter is added) if false this tag is still considered unchanged after this operation (useful while parsing a page).

removeAttribute

public void removeAttribute(String remover)
Remove an attribute.

Parameters:
remover - the attribute key to remove.

getAttribute

public String getAttribute(String key)
Get the value of the given key.

Parameters:
key - the attribute to get the value from.
Returns:
the value or null (if not found of key has no value).

setAttribute

public void setAttribute(String key,
                         String value)
Set the attribute given. If the key already exist its value is set otherwise the Pair is added.

Parameters:
key - the key to set.
value - the value to set.

toString

public String toString()
Get this Tag as a String.

Overrides:
toString in class Object
Returns:
a String representation of this object.