svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.utils / src / main / java / org / gvsig / utils / xmlViewer / sample / Sample.java @ 40561
History | View | Annotate | Download (2.58 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.utils.xmlViewer.sample; |
25 |
|
26 |
import javax.swing.JFrame; |
27 |
|
28 |
import org.gvsig.utils.xmlViewer.MultipleXMLContent; |
29 |
import org.gvsig.utils.xmlViewer.XMLViewer; |
30 |
import org.xml.sax.SAXException; |
31 |
|
32 |
public class Sample extends JFrame { |
33 |
|
34 |
private javax.swing.JPanel jContentPane = null; |
35 |
|
36 |
private XMLViewer XMLViewer = null; |
37 |
/**
|
38 |
* This method initializes XMLViewer
|
39 |
*
|
40 |
* @return com.iver.utiles.xmlViewer.XMLViewer
|
41 |
*/
|
42 |
private XMLViewer getXMLViewer() {
|
43 |
if (XMLViewer == null) { |
44 |
XMLViewer = new XMLViewer();
|
45 |
XMLViewer.getXmlTree().setRootVisible(false);
|
46 |
MultipleXMLContent model = new MultipleXMLContent();
|
47 |
model.addXML("<?xml version='1.0'?><hola><adios/></hola>");
|
48 |
model.addXML("<?xml version='1.0'?><adios><hola/></adios>");
|
49 |
try {
|
50 |
XMLViewer.setModel(model); |
51 |
} catch (SAXException e) {
|
52 |
e.printStackTrace(); |
53 |
} |
54 |
} |
55 |
return XMLViewer;
|
56 |
} |
57 |
public static void main(String[] args) { |
58 |
Sample s = new Sample();
|
59 |
s.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
60 |
s.show(); |
61 |
} |
62 |
/**
|
63 |
* This is the default constructor
|
64 |
*/
|
65 |
public Sample() {
|
66 |
super();
|
67 |
initialize(); |
68 |
} |
69 |
/**
|
70 |
* This method initializes this
|
71 |
*
|
72 |
* @return void
|
73 |
*/
|
74 |
private void initialize() { |
75 |
this.setSize(300,200); |
76 |
this.setContentPane(getJContentPane());
|
77 |
this.setTitle("JFrame"); |
78 |
} |
79 |
/**
|
80 |
* This method initializes jContentPane
|
81 |
*
|
82 |
* @return javax.swing.JPanel
|
83 |
*/
|
84 |
private javax.swing.JPanel getJContentPane() {
|
85 |
if(jContentPane == null) { |
86 |
jContentPane = new javax.swing.JPanel();
|
87 |
jContentPane.setLayout(new java.awt.BorderLayout());
|
88 |
jContentPane.add(getXMLViewer(), java.awt.BorderLayout.CENTER); |
89 |
} |
90 |
return jContentPane;
|
91 |
} |
92 |
} |