blob: c596972d7fc237b518497a51819950f813c0ef06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.traccar.web.client;
import org.traccar.web.client.controller.LoginController;
import org.traccar.web.shared.model.XmlParser;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.xml.client.DOMException;
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
import com.google.gwt.xml.client.XMLParser;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
public class Traccar implements EntryPoint, LoginController.LoginHandler {
@Override
public void onModuleLoad() {
//new LoginController().login(this);
try {
String messageXml = "<a>1</a><b>2</b>";
//parse the XML document into a DOM
String x = XmlParser.getElement(messageXml, "b");
XmlParser.enumerateElements(messageXml);
// find the sender's display name in an attribute of the <from> tag
/*Node fromNode = messageDom.getElementsByTagName("from").item(0);
String from = ((Element)fromNode).getAttribute("displayName");
fromLabel.setText(from);
// get the subject using Node's getNodeValue() function
String subject = messageDom.getElementsByTagName("subject").item(0).getFirstChild().getNodeValue();
subjectLabel.setText(subject);
// get the message body by explicitly casting to a Text node
Text bodyNode = (Text)messageDom.getElementsByTagName("body").item(0).getFirstChild();
String body = bodyNode.getData();
bodyLabel.setText(body);*/
new AlertMessageBox("Info", "a=" + x).show();
} catch (DOMException e) {
new AlertMessageBox("Error", e.getMessage()).show();
}
}
@Override
public void onLogin() {
new Application().run();
}
}
|