root / trunk / extensions / extTopology / src / org / gvsig / topology / ui / util / HTMLPanel.java @ 24989
History | View | Annotate | Download (3.15 KB)
1 |
/*
|
---|---|
2 |
* Created on 10-abr-2006
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id:
|
47 |
* $Log:
|
48 |
*/
|
49 |
package org.gvsig.topology.ui.util; |
50 |
|
51 |
import java.awt.BorderLayout; |
52 |
|
53 |
import javax.swing.JEditorPane; |
54 |
import javax.swing.JPanel; |
55 |
import javax.swing.JScrollPane; |
56 |
import javax.swing.text.html.HTMLEditorKit; |
57 |
|
58 |
import com.iver.andami.PluginServices; |
59 |
import com.iver.andami.ui.mdiManager.IWindow; |
60 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
61 |
|
62 |
public class HTMLPanel extends JPanel implements IWindow{ |
63 |
private static final long serialVersionUID = 1490785370826172129L; |
64 |
|
65 |
private JScrollPane scrollPanel; |
66 |
private JEditorPane htmlPanel; |
67 |
private StringBuffer htmlText = new StringBuffer(); |
68 |
private WindowInfo viewInfo;
|
69 |
|
70 |
private String title; |
71 |
|
72 |
public HTMLPanel(String title, String htmlBody) { |
73 |
super();
|
74 |
this.title = title;
|
75 |
|
76 |
setLayout(new BorderLayout()); |
77 |
scrollPanel = new JScrollPane(); |
78 |
htmlPanel = new JEditorPane(); |
79 |
htmlPanel.setEditable(false);
|
80 |
htmlPanel.setEditorKit(new HTMLEditorKit()); |
81 |
|
82 |
|
83 |
initialize(htmlBody); |
84 |
|
85 |
scrollPanel.setViewportView(htmlPanel); |
86 |
add(scrollPanel, BorderLayout.CENTER);
|
87 |
} |
88 |
|
89 |
|
90 |
private void initialize(String htmlBody) { |
91 |
htmlText.append( "<head>" );
|
92 |
htmlText.append( "<style type='text/css'>" );
|
93 |
htmlText.append( "</style>" );
|
94 |
htmlText.append( "</head>" );
|
95 |
htmlText.append( "<body>" );
|
96 |
|
97 |
htmlText.append( htmlBody ); |
98 |
|
99 |
htmlText.append("</body>");
|
100 |
|
101 |
htmlPanel.setText(htmlText.toString()); |
102 |
|
103 |
} |
104 |
|
105 |
public WindowInfo getWindowInfo() {
|
106 |
if (viewInfo == null) { |
107 |
viewInfo = new WindowInfo(WindowInfo.MODELESSDIALOG |
|
108 |
WindowInfo.RESIZABLE | |
109 |
WindowInfo.MAXIMIZABLE | |
110 |
WindowInfo.ICONIFIABLE | |
111 |
WindowInfo.PALETTE); |
112 |
viewInfo.setTitle(title); |
113 |
viewInfo.setWidth(200);
|
114 |
viewInfo.setHeight(250);
|
115 |
} |
116 |
return viewInfo;
|
117 |
} |
118 |
|
119 |
public Object getWindowProfile() { |
120 |
return WindowInfo.TOOL_PROFILE;
|
121 |
} |
122 |
|
123 |
} |