Skip to content

Commit 0671858

Browse files
hansonrhansonr
authored andcommitted
fixes missing org.w3c.Node.getTextContent() implementation in
swingjs.xml.JSXMLNode Adds /jars directory for closure-compiler. Should probably be in tools.
1 parent 47e0caa commit 0671858

File tree

13 files changed

+56
-27
lines changed

13 files changed

+56
-27
lines changed
7.81 MB
Binary file not shown.
5.68 MB
Binary file not shown.
5 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190924231443
1+
20190929051131
5 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190924231443
1+
20190929051131
5 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/JSUtil.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,11 @@ public static void notImplemented(String msg) {
390390
*/
391391
{
392392
}
393-
if (mapNotImpl.containsKey(s))
393+
if (mapNotImpl.containsKey(s + msg))
394394
return;
395-
mapNotImpl.put(s, Boolean.TRUE);
395+
mapNotImpl.put(s + msg, Boolean.TRUE);
396396
System.out.println(s + " has not been implemented in SwingJS. "
397-
+ (msg == "" ? "" : (msg == null ? "" : msg) + getStackTrace(-5)));
398-
397+
+ (msg == "" ? "" : (msg == null ? "" : msg) + getStackTrace(-5)));
399398
}
400399

401400
static Map<String, Boolean> mapNotImpl;

sources/net.sf.j2s.java.core/src/swingjs/xml/JSXMLDocument.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.w3c.dom.EntityReference;
1515
import org.w3c.dom.NamedNodeMap;
1616
import org.w3c.dom.Node;
17+
import org.w3c.dom.NodeList;
1718
import org.w3c.dom.ProcessingInstruction;
1819
import org.w3c.dom.Text;
1920
import org.xml.sax.InputSource;
@@ -209,6 +210,13 @@ public String getDocumentURI() {
209210
return null;
210211
}
211212

213+
@Override
214+
public NodeList getElementsByAttributeValue(String namespaceURI, String localName, String value) {
215+
JSUtil.notImplemented(null);
216+
return null;
217+
}
218+
219+
212220
private class ImplementationImpl implements DOMImplementation {
213221

214222
DOMNode domImpl;
@@ -294,4 +302,5 @@ public String getInternalSubset() {
294302
}
295303

296304
}
305+
297306
}

sources/net.sf.j2s.java.core/src/swingjs/xml/JSXMLNode.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package swingjs.xml;
22

3+
import java.util.HashMap;
4+
import java.util.Map;
5+
36
import org.w3c.dom.DOMException;
47
import org.w3c.dom.Document;
58
import org.w3c.dom.NamedNodeMap;
69
import org.w3c.dom.Node;
710
import org.w3c.dom.NodeList;
811

12+
import swingjs.JSUtil;
913
import swingjs.api.js.DOMNode;
1014

1115
public class JSXMLNode implements Node {
@@ -229,20 +233,16 @@ public int compareTreePosition(Node other) throws DOMException {
229233

230234
@Override
231235
public String getTextContent() {
232-
// TODO Auto-generated method stub
233-
return null;
236+
return /** @j2sNative 1 ? this.node.textContent : */ null;
234237
}
235238

236239
@Override
237240
public void setTextContent(String textContent) {
238-
// TODO Auto-generated method stub
239-
240241
}
241242

242243
@Override
243244
public boolean isSameNode(Node other) {
244-
// TODO Auto-generated method stub
245-
return false;
245+
return node == ((JSXMLNode) other).node;
246246
}
247247

248248
@Override
@@ -263,38 +263,42 @@ public void normalizeNS() {
263263

264264
}
265265

266+
private Map<String, Object> htData;
266267
@Override
268+
@Deprecated
267269
public Object setUserData(Object data, String key) {
268-
// TODO Auto-generated method stub
269-
return null;
270+
if (key == null)
271+
return null;
272+
if (htData == null)
273+
htData = new HashMap<>();
274+
htData.put(key, data);
275+
return data;
270276
}
271277

272278
@Override
279+
@Deprecated
273280
public Object getUserData(String key) {
274-
// TODO Auto-generated method stub
275-
return null;
281+
return (htData == null || key == null ? null : htData.get(key));
276282
}
277283

278284
@Override
285+
@Deprecated
279286
public Object getKey() {
280-
// TODO Auto-generated method stub
281287
return null;
282288
}
283289

284290
@Override
285-
public boolean isEqualNode(Node child2) {
286-
// TODO Auto-generated method stub
287-
return false;
291+
public boolean isEqualNode(Node node) {
292+
return (/** @j2sNative this.node.outerHTML == node.outerHTML ||*/false);
288293
}
289294

290295
@Override
291296
public boolean hasAttributes() {
292-
// TODO Auto-generated method stub
293-
return false;
297+
return /** @j2sNative this.node.hasAttributes || */false;
294298
}
295299

296300
public NodeList getElementsByAttributeValue(String namespaceURI, String localName, String value) {
297-
// TODO Auto-generated method stub
301+
// Document3
298302
return null;
299303
}
300304

0 commit comments

Comments
 (0)