Revision 1364
org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.app/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/infobypoint/MainInfoByPointDialog.java | ||
---|---|---|
24 | 24 |
import java.awt.BorderLayout; |
25 | 25 |
import java.awt.Component; |
26 | 26 |
import java.awt.Dimension; |
27 |
import java.io.Reader; |
|
27 | 28 |
import java.util.HashMap; |
28 | 29 |
|
29 | 30 |
import javax.swing.ImageIcon; |
... | ... | |
32 | 33 |
import javax.swing.JScrollPane; |
33 | 34 |
import javax.swing.event.HyperlinkEvent; |
34 | 35 |
import javax.swing.event.HyperlinkListener; |
36 |
import javax.swing.text.Document; |
|
37 |
import javax.swing.text.html.HTMLEditorKit; |
|
38 |
import javax.swing.text.html.StyleSheet; |
|
35 | 39 |
|
36 | 40 |
import org.gvsig.andami.IconThemeHelper; |
37 | 41 |
import org.gvsig.andami.PluginServices; |
... | ... | |
103 | 107 |
} |
104 | 108 |
|
105 | 109 |
public void setWMSInfoText(String text, String type) { |
110 |
if(type.equals("text/html")) { |
|
111 |
HTMLEditorKit kit = new HTMLEditorKit(); |
|
112 |
jeditor.setEditorKit(kit); |
|
113 |
|
|
114 |
if(text.contains("<style") && text.contains("</style>")) { |
|
115 |
int initIndex = text.indexOf("<style"); |
|
116 |
int endIndex = text.indexOf("</style>"); |
|
117 |
text = text.substring(0, initIndex) + text.substring(endIndex + 8, text.length()); |
|
118 |
} |
|
119 |
|
|
120 |
StyleSheet s = kit.getStyleSheet(); |
|
121 |
s.addRule("body {font-family:verdana; margin: 15px; }"); |
|
122 |
s.addRule("caption {background-color:#FBFFE1;font-style:normal;color:black}"); |
|
123 |
s.addRule("th {background-color:#D6D6D6;color:white;}"); |
|
124 |
s.addRule("td {background-color:#FEEDD6;color:black;}"); |
|
125 |
Document doc = kit.createDefaultDocument(); |
|
126 |
jeditor.setDocument(doc); |
|
127 |
} |
|
106 | 128 |
jeditor.setContentType(type); |
107 | 129 |
jeditor.setText(text); |
108 | 130 |
} |
Also available in: Unified diff