101 |
protected boolean getBooleanHTMLAttribute(String name) |
protected boolean getBooleanHTMLAttribute(String name) |
102 |
{ |
{ |
103 |
String value = getHTMLAttribute(name); |
String value = getHTMLAttribute(name); |
104 |
return "true".equals(value); |
return value != null; |
105 |
} |
} |
106 |
|
|
107 |
/** |
/** |
119 |
String attrName = attr.getLocalName(); |
String attrName = attr.getLocalName(); |
120 |
if (attrName.equalsIgnoreCase(name)) |
if (attrName.equalsIgnoreCase(name)) |
121 |
{ |
{ |
122 |
attr.setNodeValue(value); |
if (value != null) |
123 |
|
{ |
124 |
|
attr.setNodeValue(value); |
125 |
|
} |
126 |
|
else |
127 |
|
{ |
128 |
|
attrs.removeNamedItem(attr.getNodeName()); |
129 |
|
} |
130 |
return; |
return; |
131 |
} |
} |
132 |
} |
} |
133 |
// Create a new attribute |
if (value != null) |
134 |
DomHTMLDocument doc = (DomHTMLDocument) getOwnerDocument(); |
{ |
135 |
// XXX namespace URI for attribute? |
// Create a new attribute |
136 |
attr = doc.createAttribute(name); |
DomHTMLDocument doc = (DomHTMLDocument) getOwnerDocument(); |
137 |
attr.setNodeValue(value); |
// XXX namespace URI for attribute? |
138 |
|
attr = doc.createAttribute(name); |
139 |
|
attr.setNodeValue(value); |
140 |
|
} |
141 |
} |
} |
142 |
|
|
143 |
protected void setIntHTMLAttribute(String name, int value) |
protected void setIntHTMLAttribute(String name, int value) |
147 |
|
|
148 |
protected void setBooleanHTMLAttribute(String name, boolean value) |
protected void setBooleanHTMLAttribute(String name, boolean value) |
149 |
{ |
{ |
150 |
setHTMLAttribute(name, value ? "true" : "false"); |
setHTMLAttribute(name, value ? name : null); |
151 |
|
} |
152 |
|
|
153 |
|
/** |
154 |
|
* Returns the first parent element with the specified name. |
155 |
|
*/ |
156 |
|
protected Node getParentElement(String name) |
157 |
|
{ |
158 |
|
for (Node parent = getParentNode(); parent != null; |
159 |
|
parent = parent.getParentNode()) |
160 |
|
{ |
161 |
|
if (name.equalsIgnoreCase(parent.getLocalName())) |
162 |
|
{ |
163 |
|
return parent; |
164 |
|
} |
165 |
|
} |
166 |
|
return null; |
167 |
} |
} |
168 |
|
|
169 |
public String getId() |
public String getId() |