rabbit.html
Class Tag

java.lang.Object
  extended byrabbit.html.Tag

public class Tag
extends java.lang.Object

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


Nested Class Summary
 class Tag.pair
          This class is a key value pair.
 
Constructor Summary
Tag()
           
Tag(java.lang.String type)
          Create a new Tag with given type
 
Method Summary
 void addArg(java.lang.String key, java.lang.String value)
          Add a new key/value pair to this tag.
 void addArg(java.lang.String key, java.lang.String value, boolean changed)
          Add a new key/value pair to this tag.
 java.lang.String getAttribute(java.lang.String key)
          Get the value of the given key.
 java.lang.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.
 java.lang.String getType()
          Get the type of this tag.
 void removeAttribute(java.lang.String remover)
          Remove an attribute.
 void setAttribute(java.lang.String key, java.lang.String value)
          Set the attribute given.
 void setToken(Token token)
          Set the parent token of this tag.
 void setType(java.lang.String type)
          Set the Type of this Tag.
 java.lang.String toString()
          Get this Tag as a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tag

public Tag()

Tag

public Tag(java.lang.String type)
Create a new Tag with given type

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

setType

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

Parameters:
type - the new type of this tag.

getType

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

Returns:
the type of this tag.

getLowerCaseType

public java.lang.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(java.lang.String key,
                   java.lang.String value)
Add a new key/value pair to this tag.

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

addArg

public void addArg(java.lang.String key,
                   java.lang.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 (while parsing a page it is nice to be able to do this).

removeAttribute

public void removeAttribute(java.lang.String remover)
Remove an attribute.

Parameters:
remover - the attribute key to remove.

getAttribute

public java.lang.String getAttribute(java.lang.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(java.lang.String key,
                         java.lang.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 java.lang.String toString()
Get this Tag as a String.

Returns:
a String representation of this object.