|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.element.Element
public class Element
Provides a base class for rendering HTML elements, for example JavaScript (<script>) and Cascading Stylesheets (<link> / <style>).
Subclasses should overridegetTag()
to return a specific HTML tag.
Constructor Summary | |
---|---|
Element()
|
Method Summary | |
---|---|
protected void |
appendAttributes(HtmlStringBuffer buffer)
Append all the Element attributes to the specified buffer. |
String |
getAttribute(String name)
Return the HTML attribute with the given name, or null if the attribute does not exist. |
Map<String,String> |
getAttributes()
Return the Element attributes Map. |
Context |
getContext()
Return the thread local Context. |
String |
getId()
Return the "id" attribute value or null if no id is defined. |
String |
getTag()
Returns the Element HTML tag, the default value is null. |
boolean |
hasAttribute(String name)
Returns true if specified attribute is defined, false otherwise. |
boolean |
hasAttributes()
Return true if the Element has attributes or false otherwise. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the Element to the specified buffer. |
void |
setAttribute(String name,
String value)
Set the Element attribute with the given attribute name and value. |
void |
setId(String id)
Set the HTML id attribute for the with the given value. |
String |
toString()
Return the HTML string representation of the Element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Element()
Method Detail |
---|
public String getTag()
public String getAttribute(String name)
name
- the name of link HTML attribute
public void setAttribute(String name, String value)
name
- the attribute namevalue
- the attribute value
IllegalArgumentException
- if name parameter is nullpublic Map<String,String> getAttributes()
public boolean hasAttributes()
public boolean hasAttribute(String name)
name
- the specified attribute to check
public String getId()
public void setId(String id)
id
- the element HTML id attribute value to setpublic Context getContext()
public void render(HtmlStringBuffer buffer)
getTag()
returns null, this method will return an empty
string.
buffer
- the specified buffer to render the Element output topublic String toString()
toString
in class Object
protected void appendAttributes(HtmlStringBuffer buffer)
buffer
- the specified buffer to append all the attributes
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |