| org.zkoss.idom.Attributable
All known Subclasses: org.zkoss.idom.Element,
Attributable | public interface Attributable (Code) | | Represents a class that has attributes.
It is usually implemented by a class that also implements Item or Group.
Currently, only Element implements it.
Design consideration: Be as similar to Group as possible.
author: tomyeh See Also: Item See Also: Attribute |
Method Summary | |
public int | getAttributeIndex(int indexFrom, String namespace, String name, int mode) Gets the index of the first attribute that matches
the specified criteria. | public int | getAttributeIndex(int indexFrom, String tname) Gets the index of the attribute with the giving local name. | public Attribute | getAttributeItem(String namespace, String name, int mode) Gets the first attribute that matches the specified criteria. | public Attribute | getAttributeItem(String tname) Gets the attribute with the tag name. | public List | getAttributeItems() Returns all attributes of this object.
The returned list is "live". | public String | getAttributeValue(String namespace, String name, int mode) Gets the value of the first attribute that matches
the giving criteria, or null if not found. | public String | getAttributeValue(String tname) Returns the value of the attribute of the specified tag name,
or null if not specified. | public List | getAttributes(String namespace, String name, int mode) Gets a list of attributes of the specified criteria. | public boolean | isAttributeModificationAware() Returns whether it is aware of the modificatioin of attributes. | public Attribute | setAttribute(Attribute attr) Adds the giving attribute.
If there is any existent one with the same tag name,
it will be replaced. | public void | setAttributeModificationAware(boolean aware) Sets whether it is aware of the modificatioin of attributes. | public Attribute | setAttributeValue(String tname, String value) Sets the value of the attribute with the giving tag name.
If the attribute doesn't exist, a new attribute will be created
and added.
Note: it looks similar to Attribute(String, String), but
this method requires the tag name.
Parameters: tname - the tag name (i.e., Attribute.getName) Parameters: value - the new value. |
getAttributeIndex | public int getAttributeIndex(int indexFrom, String namespace, String name, int mode)(Code) | | Gets the index of the first attribute that matches
the specified criteria.
Parameters: indexFrom - the index to start searching from; 0 for beginning Parameters: namespace - the namspace URI if FIND_BY_PREFIX is not specified;the namespace prefix if FIND_BY_PREFIX specified; null to ingore Parameters: name - the local name if FIND_BY_TAGNAME is not sepcified;the tag name if FIND_BY_TAGNAME specified; null to ignore Parameters: mode - the serach mode; zero or any combination of Item.FIND_xxx the index if found; -1 if not found |
getAttributeIndex | public int getAttributeIndex(int indexFrom, String tname)(Code) | | Gets the index of the attribute with the giving local name.
Parameters: indexFrom - the index to start searching from; 0 for beginning Parameters: tname - the tag name (i.e., Attribute.getName) --consists of the prefix and the local name the index if found; -1 if not found |
getAttributeItem | public Attribute getAttributeItem(String namespace, String name, int mode)(Code) | | Gets the first attribute that matches the specified criteria.
The name is a bit strange because we have to avoid name conflicts
with org.w3c.dom.Node.
Parameters: namespace - the namspace URI if FIND_BY_PREFIX is not specified;the namespace prefix if FIND_BY_PREFIX specified; null to ingore Parameters: name - the local name if FIND_BY_TAGNAME is not sepcified;the tag name if FIND_BY_TAGNAME specified; null to ignore Parameters: mode - the serach mode; zero or any combination of Item.FIND_xxx the index if found; -1 if not found |
getAttributeItem | public Attribute getAttributeItem(String tname)(Code) | | Gets the attribute with the tag name.
The name is a bit strange because we have to avoid name conflicts
with org.w3c.dom.Node.
Parameters: tname - the tag name (i.e., Attribute.getName) --consists of the prefix and the local name null if not found |
getAttributeItems | public List getAttributeItems()(Code) | | Returns all attributes of this object.
The returned list is "live". Any modification to it affects
the object that owns the attributes.
If the new added attribute has the same tag name as
that of any existent attribute, DOMException is thrown.
Thus, it is, sometimes, more convenient to ue setAttribute.
Naming reason: we don't call it getAttributes() to avoid
the name conflict with Node.getAttributes().
an empty list if no attribute at all |
getAttributeValue | public String getAttributeValue(String namespace, String name, int mode)(Code) | | Gets the value of the first attribute that matches
the giving criteria, or null if not found.
According to Section 3.3.3 of XML 1.0 spec, the value is normalized,
including trimmed.
Parameters: namespace - the namspace URI if FIND_BY_PREFIX is not specified;the namespace prefix if FIND_BY_PREFIX specified; null to ingore Parameters: name - the local name if FIND_BY_TAGNAME is not sepcified;the tag name if FIND_BY_TAGNAME specified; null to ignore the value of the attribute; null if not found |
getAttributeValue | public String getAttributeValue(String tname)(Code) | | Returns the value of the attribute of the specified tag name,
or null if not specified.
Note: unlike W3C's getAttribute, which returns empty if not specified,
this method returns null if not specified.
|
getAttributes | public List getAttributes(String namespace, String name, int mode)(Code) | | Gets a list of attributes of the specified criteria.
Parameters: namespace - the namspace URI if FIND_BY_PREFIX is not specified;the namespace prefix if FIND_BY_PREFIX specified; null to ingore Parameters: name - the local name if FIND_BY_TAGNAME is not sepcified;the tag name if FIND_BY_TAGNAME specified; null to ignore Parameters: mode - the serach mode; zero or any combination of Item.FIND_xxx null if not found |
isAttributeModificationAware | public boolean isAttributeModificationAware()(Code) | | Returns whether it is aware of the modificatioin of attributes.
If true, the modified flag is set if any of its attribute is modified.
Default: false.
|
setAttribute | public Attribute setAttribute(Attribute attr)(Code) | | Adds the giving attribute.
If there is any existent one with the same tag name,
it will be replaced. If not, the new attribute will be appended.
Parameters: attr - the new attribute to add the attribute being replaced; null if no one is replaced |
setAttributeModificationAware | public void setAttributeModificationAware(boolean aware)(Code) | | Sets whether it is aware of the modificatioin of attributes.
|
setAttributeValue | public Attribute setAttributeValue(String tname, String value)(Code) | | Sets the value of the attribute with the giving tag name.
If the attribute doesn't exist, a new attribute will be created
and added.
Note: it looks similar to Attribute(String, String), but
this method requires the tag name.
Parameters: tname - the tag name (i.e., Attribute.getName) Parameters: value - the new value. the attribute being replaced; null if no one is replaced |
|
|