Revision 18258 trunk/extensions/extTopology/src/org/gvsig/topology/ui/NewTopologyRulePanel.java
NewTopologyRulePanel.java | ||
---|---|---|
49 | 49 |
package org.gvsig.topology.ui; |
50 | 50 |
|
51 | 51 |
import java.awt.BorderLayout; |
52 |
import java.awt.Dimension; |
|
52 | 53 |
import java.awt.Insets; |
53 | 54 |
import java.awt.event.ActionEvent; |
54 | 55 |
import java.awt.event.ActionListener; |
56 |
import java.lang.reflect.Method; |
|
57 |
import java.net.URL; |
|
55 | 58 |
import java.util.HashMap; |
56 | 59 |
import java.util.Iterator; |
57 | 60 |
import java.util.List; |
58 | 61 |
import java.util.Map; |
59 | 62 |
|
60 | 63 |
import javax.swing.JComboBox; |
64 |
import javax.swing.JEditorPane; |
|
61 | 65 |
import javax.swing.JLabel; |
62 | 66 |
import javax.swing.JPanel; |
67 |
import javax.swing.JScrollPane; |
|
68 |
import javax.swing.text.html.HTMLEditorKit; |
|
63 | 69 |
|
64 | 70 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
65 | 71 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
... | ... | |
90 | 96 |
|
91 | 97 |
private WindowInfo viewInfo; |
92 | 98 |
private GridBagLayoutPanel leftPanel; |
93 |
private JPanel rightPanel;
|
|
99 |
private JScrollPane rightPanel;
|
|
94 | 100 |
private AcceptCancelPanel acceptCancelPanel; |
95 | 101 |
private LayerJComboBox lyrCombo; |
96 | 102 |
private LayerJComboBox lyrCombo2; |
97 | 103 |
private JComboBox topologyRulesCombo; |
104 |
private JEditorPane htmlViewer; |
|
105 |
|
|
98 | 106 |
/** |
99 | 107 |
* Relates the user friendly rule name (showed in the rules' combobox) with the |
100 | 108 |
* class that implements this rule |
... | ... | |
163 | 171 |
lyrCombo2.setEnabled(true); |
164 | 172 |
} |
165 | 173 |
} |
174 |
|
|
175 |
private void updateRuleDescription(){ |
|
176 |
Class clazz = ruleName_ruleClass.get(topologyRulesCombo.getSelectedItem()); |
|
177 |
ITopologyRule rule; |
|
178 |
try { |
|
179 |
rule = (ITopologyRule) clazz.newInstance(); |
|
180 |
URL description = rule.getDescription(); |
|
181 |
htmlViewer.setPage(description); |
|
182 |
} catch (Exception e) { |
|
183 |
htmlViewer.setText("<p>"+PluginServices.getText(this, "UNAVAILABLE_DESCRIPTION")+"</p>"); |
|
184 |
} |
|
185 |
} |
|
166 | 186 |
/** |
167 | 187 |
* Initializes the component |
168 | 188 |
*/ |
... | ... | |
185 | 205 |
topologyRulesCombo = createRulesCombo(); |
186 | 206 |
topologyRulesCombo.addActionListener(new ActionListener(){ |
187 | 207 |
public void actionPerformed(ActionEvent e) { |
208 |
updateRuleDescription(); |
|
188 | 209 |
updateSecondLayerComboStatus(); |
189 | 210 |
}}); |
190 | 211 |
|
... | ... | |
202 | 223 |
leftPanel.addComponent(destinationLyrText, insets); |
203 | 224 |
leftPanel.addComponent(lyrCombo2, insets); |
204 | 225 |
|
205 |
rightPanel = new JPanel(); |
|
206 |
rightPanel.setLayout(new BorderLayout()); |
|
207 |
JLabel text = new JLabel("AQUI VA DESCRIPCION DE REGLA SELECCIONADA");//Codigo de descripcion de la regla seleccionada |
|
208 |
text.setHorizontalAlignment(JLabel.LEFT); |
|
209 |
text.setVerticalAlignment(JLabel.TOP); |
|
210 |
rightPanel.add(text); |
|
211 |
rightPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); |
|
226 |
rightPanel = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
227 |
htmlViewer = new JEditorPane(){ |
|
228 |
public URL getPage() { |
|
229 |
return null; |
|
230 |
} |
|
231 |
}; |
|
232 |
htmlViewer.setEditable(false); |
|
233 |
htmlViewer.setEditorKit(new HTMLEditorKit()); |
|
234 |
rightPanel.setViewportView(htmlViewer); |
|
235 |
rightPanel.setPreferredSize(new Dimension(250, 140)); |
|
236 |
updateRuleDescription(); |
|
212 | 237 |
|
213 | 238 |
|
214 | 239 |
acceptCancelPanel = new AcceptCancelPanel( |
Also available in: Unified diff