Revision 38607
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/info/gui/FInfoDialog.java | ||
---|---|---|
4 | 4 |
import java.awt.BorderLayout; |
5 | 5 |
|
6 | 6 |
import javax.swing.JPanel; |
7 |
import javax.swing.JScrollPane; |
|
7 | 8 |
|
8 | 9 |
import org.gvsig.andami.PluginServices; |
9 | 10 |
import org.gvsig.andami.ui.mdiManager.IWindowListener; |
... | ... | |
23 | 24 |
IWindowListener { |
24 | 25 |
|
25 | 26 |
private static final long serialVersionUID = -6707094091114785970L; |
27 |
|
|
26 | 28 |
private LayersDynObjectSetComponent infoViewer; |
29 |
private JScrollPane scroll = null; |
|
27 | 30 |
|
28 | 31 |
public FInfoDialog(LayersDynObjectSetComponent info) { |
29 | 32 |
super(new BorderLayout()); |
30 | 33 |
this.infoViewer = info; |
31 |
add(infoViewer.asJComponent(), BorderLayout.CENTER); |
|
34 |
|
|
35 |
scroll = new JScrollPane( |
|
36 |
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, |
|
37 |
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
38 |
scroll.setViewportView(infoViewer.asJComponent()); |
|
39 |
add(scroll, BorderLayout.CENTER); |
|
32 | 40 |
setSize(500, 375); |
33 | 41 |
} |
34 | 42 |
|
... | ... | |
37 | 45 |
if (infoViewer != null) { |
38 | 46 |
infoViewer.dispose(); |
39 | 47 |
} |
40 |
|
|
48 |
|
|
41 | 49 |
this.removeAll(); |
42 | 50 |
this.infoViewer = info; |
43 |
add(infoViewer.asJComponent(), BorderLayout.CENTER); |
|
51 |
|
|
52 |
scroll = new JScrollPane( |
|
53 |
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, |
|
54 |
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
55 |
scroll.setViewportView(infoViewer.asJComponent()); |
|
56 |
add(scroll, BorderLayout.CENTER); |
|
44 | 57 |
} |
45 | 58 |
|
46 | 59 |
public WindowInfo getWindowInfo() { |
branches/v2_0_0_prep/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/swing/dynfield/GeometryDynFieldComponent.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.mapcontrol.swing.dynfield; |
24 | 24 |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
|
|
28 |
import javax.swing.BoxLayout; |
|
29 |
import javax.swing.JCheckBox; |
|
25 | 30 |
import javax.swing.JComponent; |
26 |
import javax.swing.JLabel; |
|
31 |
import javax.swing.JPanel; |
|
32 |
import javax.swing.JTextField; |
|
27 | 33 |
|
34 |
import org.slf4j.Logger; |
|
35 |
import org.slf4j.LoggerFactory; |
|
36 |
|
|
28 | 37 |
import org.gvsig.fmap.geom.Geometry; |
29 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
30 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
31 | 38 |
import org.gvsig.i18n.Messages; |
32 | 39 |
import org.gvsig.tools.dynobject.DynField; |
33 | 40 |
import org.gvsig.tools.service.ServiceException; |
... | ... | |
45 | 52 |
* |
46 | 53 |
*/ |
47 | 54 |
public class GeometryDynFieldComponent extends |
48 |
AbstractJDynFieldComponent { |
|
55 |
AbstractJDynFieldComponent implements ActionListener {
|
|
49 | 56 |
|
50 |
private JLabel label = null; |
|
57 |
private static Logger logger = |
|
58 |
LoggerFactory.getLogger(GeometryDynFieldComponent.class); |
|
59 |
|
|
60 |
private JCheckBox wktCheckBox = null; |
|
61 |
private JTextField txtField = null; |
|
62 |
private JPanel panel = null; |
|
51 | 63 |
|
52 | 64 |
public GeometryDynFieldComponent( |
53 | 65 |
DynField definition, |
... | ... | |
69 | 81 |
} |
70 | 82 |
|
71 | 83 |
public JComponent asJComponent() { |
72 |
return label;
|
|
84 |
return panel;
|
|
73 | 85 |
} |
74 | 86 |
|
75 | 87 |
public Object getValue() { |
... | ... | |
84 | 96 |
|
85 | 97 |
protected void initData() { |
86 | 98 |
} |
87 |
|
|
88 |
protected void initUI() {
|
|
99 |
|
|
100 |
private String getValueText(boolean wkt) {
|
|
89 | 101 |
Object val = this.getFieldValue(); |
102 |
String txt = null; |
|
103 |
|
|
90 | 104 |
if (val == null || (!(val instanceof Geometry))) { |
91 |
label = new JLabel("[" + Messages.getText("_Null") + "]");
|
|
105 |
txt = "[" + Messages.getText("_Invalid_value") + "]";
|
|
92 | 106 |
} else { |
93 | 107 |
Geometry geom = (Geometry) val; |
94 |
label = new JLabel(geom.getGeometryType().getName()); |
|
108 |
if (wkt) { |
|
109 |
try { |
|
110 |
txt = geom.convertToWKT(); |
|
111 |
} catch (Exception e) { |
|
112 |
logger.info("Error while getting WKT: " + e.getMessage(), e); |
|
113 |
txt = "[" + Messages.getText("_Unable_to_show_value") + "]"; |
|
114 |
} |
|
115 |
} else { |
|
116 |
txt = geom.getGeometryType().getName(); |
|
117 |
} |
|
95 | 118 |
} |
119 |
return txt; |
|
96 | 120 |
} |
97 | 121 |
|
122 |
protected void initUI() { |
|
123 |
|
|
124 |
wktCheckBox = |
|
125 |
new JCheckBox(Messages.getText("_Show_as_text") + " "); |
|
126 |
wktCheckBox.setSelected(false); |
|
127 |
wktCheckBox.addActionListener(this); |
|
128 |
txtField = new JTextField(); |
|
129 |
// txtField.setEditable(false); |
|
130 |
txtField.setText(this.getValueText(wktCheckBox.isSelected())); |
|
131 |
txtField.setHorizontalAlignment(JTextField.LEFT); |
|
132 |
|
|
133 |
panel = new JPanel(); // new GridBagLayout()); |
|
134 |
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS)); |
|
135 |
|
|
136 |
/* |
|
137 |
GridBagConstraints constr = new GridBagConstraints(); |
|
138 |
constr.insets = new Insets(3, 3, 3, 3); |
|
139 |
constr.gridx = 0; |
|
140 |
constr.gridy = 0; |
|
141 |
constr.fill = GridBagConstraints.NONE; |
|
142 |
*/ |
|
143 |
|
|
144 |
panel.add(wktCheckBox); // , constr); |
|
145 |
/* |
|
146 |
constr.gridx = 1; |
|
147 |
constr.fill = GridBagConstraints.HORIZONTAL; |
|
148 |
*/ |
|
149 |
panel.add(txtField); // , constr); |
|
150 |
} |
|
151 |
|
|
98 | 152 |
protected void setNonNullValue(Object value) { |
99 | 153 |
} |
100 | 154 |
|
... | ... | |
104 | 158 |
protected void setReadOnly() { |
105 | 159 |
} |
106 | 160 |
|
161 |
|
|
162 |
public void actionPerformed(ActionEvent e) { |
|
163 |
// update txt field when check box state changes |
|
164 |
if (txtField != null && wktCheckBox != null) { |
|
165 |
txtField.setText(this.getValueText(wktCheckBox.isSelected())); |
|
166 |
txtField.setHorizontalAlignment(JTextField.LEFT); |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
107 | 170 |
} |
branches/v2_0_0_prep/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text.properties | ||
---|---|---|
17 | 17 |
up=Subir |
18 | 18 |
down=Bajar |
19 | 19 |
remove=Eliminar |
20 |
|
|
21 |
_Invalid_value=Valor no v?lido |
|
22 |
_Unable_to_show_value=No se ha podido mostrar valor |
|
23 |
_Show_as_text=Mostrar como texto |
|
24 |
|
branches/v2_0_0_prep/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_en.properties | ||
---|---|---|
16 | 16 |
registros_seleccionados_total=Total of selected records |
17 | 17 |
up=Up |
18 | 18 |
down=Down |
19 |
c |
|
19 |
|
|
20 |
_Invalid_value=Invalid Value |
|
21 |
_Unable_to_show_value=Unable to show value |
|
22 |
_Show_as_text=Show as text |
Also available in: Unified diff