Revision 2289
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
161 | 161 |
_graphic_distance = Distancia gr\u00e1fica |
162 | 162 |
geometry_to_extend_to=Geometr\u00eda hasta la que extender |
163 | 163 |
geometry_to_trim_with=Geometr\u00eda con la que recortar |
164 |
shearing_point=Punto de recorte |
|
164 |
shearing_point=Punto de recorte |
|
165 |
_dismiss=Descartar |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
159 | 159 |
_graphic_distance = Graphic distance |
160 | 160 |
geometry_to_extend_to= Geometry to extend to |
161 | 161 |
geometry_to_trim_with=Geometry to trim with |
162 |
shearing_point=Shearing point |
|
162 |
shearing_point=Shearing point |
|
163 |
_dismiss=Dismiss |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
12 | 12 |
or visit our website www.gvsig.com. --> |
13 | 13 |
<plugin-config> |
14 | 14 |
<depends plugin-name="org.gvsig.app.mainplugin" /> |
15 |
<depends plugin-name="org.gvsig.exportto.app.mainplugin" /> |
|
15 | 16 |
<resourceBundle name="text" /> |
16 | 17 |
<libraries library-dir="lib" /> |
17 | 18 |
<extensions> |
... | ... | |
25 | 26 |
<action name="end-editing" label="end_editing" tooltip="end_editing" |
26 | 27 |
position="600800000" action-command="end-editing" icon="vector-editing" |
27 | 28 |
accelerator="" /> |
28 |
|
|
29 |
|
|
29 | 30 |
<menu text="Layer/start_editing" name="start-editing" /> |
30 | 31 |
<menu text="Layer/end_editing" name="end-editing" /> |
31 | 32 |
|
... | ... | |
35 | 36 |
</tool-bar> |
36 | 37 |
|
37 | 38 |
</extension> |
39 |
|
|
40 |
<extension class-name="org.gvsig.vectorediting.app.mainplugin.FinishEditingExtension2" |
|
41 |
description="" active="true" priority="1"> |
|
42 |
|
|
43 |
<action name="end-editing-JList" label="end_editing-JList" tooltip="end_editing-JList" |
|
44 |
position="600900000" action-command="end-editing-JList" icon="vector-editing" |
|
45 |
accelerator="" /> |
|
46 |
|
|
47 |
<menu text="Layer/end_editing-JList" name="end-editing-JList" /> |
|
48 |
|
|
49 |
<tool-bar name="vector_editing" position="4000"> |
|
50 |
<action-tool name="end-editing-JList" /> |
|
51 |
</tool-bar> |
|
52 |
|
|
53 |
</extension> |
|
38 | 54 |
|
39 | 55 |
<extension class-name="org.gvsig.vectorediting.app.mainplugin.ServiceExtension" |
40 | 56 |
description="" active="true" priority="1"> |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/FinishEditingView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jovivas/datos/devel/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/FinishEditingView.xml</at> |
|
28 |
<at name="path">datos/devel/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/FinishEditingView.xml</at> |
|
29 |
<at name="rowspecs">CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE</at> |
|
30 |
<at name="colspecs">FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE</at> |
|
31 |
<at name="components"> |
|
32 |
<object classname="java.util.LinkedList"> |
|
33 |
<item > |
|
34 |
<at name="value"> |
|
35 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
36 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
37 |
<at name="cellconstraints"> |
|
38 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
39 |
<at name="column">2</at> |
|
40 |
<at name="row">2</at> |
|
41 |
<at name="colspan">1</at> |
|
42 |
<at name="rowspan">1</at> |
|
43 |
<at name="halign">default</at> |
|
44 |
<at name="valign">default</at> |
|
45 |
<at name="insets" object="insets">0,0,0,0</at> |
|
46 |
</object> |
|
47 |
</at> |
|
48 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
49 |
</super> |
|
50 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
51 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
52 |
<at name="beanproperties"> |
|
53 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
54 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
55 |
<at name="properties"> |
|
56 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
57 |
<at name="border"> |
|
58 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
59 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
60 |
<at name="name">border</at> |
|
61 |
</super> |
|
62 |
<at name="borders"> |
|
63 |
<object classname="java.util.LinkedList"> |
|
64 |
<item > |
|
65 |
<at name="value"> |
|
66 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
67 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
68 |
<at name="name">border</at> |
|
69 |
</super> |
|
70 |
</object> |
|
71 |
</at> |
|
72 |
</item> |
|
73 |
</object> |
|
74 |
</at> |
|
75 |
</object> |
|
76 |
</at> |
|
77 |
<at name="name">lblListEditLayers</at> |
|
78 |
<at name="width">843</at> |
|
79 |
<at name="text">_list_of_edit_layer</at> |
|
80 |
<at name="fill"> |
|
81 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
82 |
<at name="name">fill</at> |
|
83 |
</object> |
|
84 |
</at> |
|
85 |
<at name="height">14</at> |
|
86 |
</object> |
|
87 |
</at> |
|
88 |
</object> |
|
89 |
</at> |
|
90 |
</object> |
|
91 |
</at> |
|
92 |
</item> |
|
93 |
<item > |
|
94 |
<at name="value"> |
|
95 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
96 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
97 |
<at name="cellconstraints"> |
|
98 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
99 |
<at name="column">2</at> |
|
100 |
<at name="row">4</at> |
|
101 |
<at name="colspan">1</at> |
|
102 |
<at name="rowspan">1</at> |
|
103 |
<at name="halign">default</at> |
|
104 |
<at name="valign">default</at> |
|
105 |
<at name="insets" object="insets">0,0,0,0</at> |
|
106 |
</object> |
|
107 |
</at> |
|
108 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
109 |
</super> |
|
110 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
111 |
<at name="beanclass">javax.swing.JTable</at> |
|
112 |
<at name="beanproperties"> |
|
113 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
114 |
<at name="classname">javax.swing.JTable</at> |
|
115 |
<at name="properties"> |
|
116 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
117 |
<at name="border"> |
|
118 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
119 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
120 |
<at name="name">border</at> |
|
121 |
</super> |
|
122 |
<at name="borders"> |
|
123 |
<object classname="java.util.LinkedList"> |
|
124 |
<item > |
|
125 |
<at name="value"> |
|
126 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
127 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
128 |
<at name="name">border</at> |
|
129 |
</super> |
|
130 |
</object> |
|
131 |
</at> |
|
132 |
</item> |
|
133 |
</object> |
|
134 |
</at> |
|
135 |
</object> |
|
136 |
</at> |
|
137 |
<at name="name">tableFinishEditing</at> |
|
138 |
<at name="width">841</at> |
|
139 |
<at name="scollBars"> |
|
140 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
141 |
<at name="name">scollBars</at> |
|
142 |
<at name="verticalpolicy">20</at> |
|
143 |
<at name="horizontalpolicy">30</at> |
|
144 |
<at name="border"> |
|
145 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
146 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
147 |
<at name="name">border</at> |
|
148 |
</super> |
|
149 |
<at name="borders"> |
|
150 |
<object classname="java.util.LinkedList"> |
|
151 |
<item > |
|
152 |
<at name="value"> |
|
153 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
154 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
155 |
<at name="name">border</at> |
|
156 |
</super> |
|
157 |
</object> |
|
158 |
</at> |
|
159 |
</item> |
|
160 |
</object> |
|
161 |
</at> |
|
162 |
</object> |
|
163 |
</at> |
|
164 |
</object> |
|
165 |
</at> |
|
166 |
<at name="height">32</at> |
|
167 |
</object> |
|
168 |
</at> |
|
169 |
</object> |
|
170 |
</at> |
|
171 |
</object> |
|
172 |
</at> |
|
173 |
</item> |
|
174 |
</object> |
|
175 |
</at> |
|
176 |
<at name="properties"> |
|
177 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
178 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
179 |
<at name="properties"> |
|
180 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
181 |
<at name="border"> |
|
182 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
183 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
184 |
<at name="name">border</at> |
|
185 |
</super> |
|
186 |
<at name="borders"> |
|
187 |
<object classname="java.util.LinkedList"/> |
|
188 |
</at> |
|
189 |
</object> |
|
190 |
</at> |
|
191 |
<at name="name"></at> |
|
192 |
<at name="fill"> |
|
193 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
194 |
<at name="name">fill</at> |
|
195 |
</object> |
|
196 |
</at> |
|
197 |
<at name="scollBars"> |
|
198 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
199 |
<at name="name">scollBars</at> |
|
200 |
<at name="verticalpolicy">21</at> |
|
201 |
<at name="horizontalpolicy">31</at> |
|
202 |
<at name="border"> |
|
203 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
204 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
205 |
<at name="name">border</at> |
|
206 |
</super> |
|
207 |
<at name="borders"> |
|
208 |
<object classname="java.util.LinkedList"> |
|
209 |
<item > |
|
210 |
<at name="value"> |
|
211 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
212 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
213 |
<at name="name">border</at> |
|
214 |
</super> |
|
215 |
</object> |
|
216 |
</at> |
|
217 |
</item> |
|
218 |
</object> |
|
219 |
</at> |
|
220 |
</object> |
|
221 |
</at> |
|
222 |
</object> |
|
223 |
</at> |
|
224 |
</object> |
|
225 |
</at> |
|
226 |
</object> |
|
227 |
</at> |
|
228 |
<at name="cellpainters"> |
|
229 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
230 |
<at name="rows"> |
|
231 |
<object classname="[Ljava.lang.Object;" size="5"> |
|
232 |
<at name="item" index="0"> |
|
233 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
234 |
</at> |
|
235 |
<at name="item" index="1"> |
|
236 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
237 |
</at> |
|
238 |
<at name="item" index="2"> |
|
239 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
240 |
</at> |
|
241 |
<at name="item" index="3"> |
|
242 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
243 |
</at> |
|
244 |
<at name="item" index="4"> |
|
245 |
<object classname="[Ljava.lang.Object;" size="3"/> |
|
246 |
</at> |
|
247 |
</object> |
|
248 |
</at> |
|
249 |
</object> |
|
250 |
</at> |
|
251 |
<at name="rowgroups"> |
|
252 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
253 |
<at name="groups"> |
|
254 |
<object classname="java.util.HashMap"/> |
|
255 |
</at> |
|
256 |
</object> |
|
257 |
</at> |
|
258 |
<at name="colgroups"> |
|
259 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
260 |
<at name="groups"> |
|
261 |
<object classname="java.util.HashMap"/> |
|
262 |
</at> |
|
263 |
</object> |
|
264 |
</at> |
|
265 |
</object> |
|
266 |
</at> |
|
267 |
</object> |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/FinishEditingView.java | ||
---|---|---|
1 |
package org.gvsig.project.documents.view.gui; |
|
2 |
|
|
3 |
import com.jeta.open.i18n.I18NUtils; |
|
4 |
import com.jgoodies.forms.layout.CellConstraints; |
|
5 |
import com.jgoodies.forms.layout.FormLayout; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.ComponentOrientation; |
|
8 |
import java.awt.Container; |
|
9 |
import java.awt.Dimension; |
|
10 |
import javax.swing.Box; |
|
11 |
import javax.swing.ImageIcon; |
|
12 |
import javax.swing.JFrame; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JPanel; |
|
15 |
import javax.swing.JScrollPane; |
|
16 |
import javax.swing.JTable; |
|
17 |
|
|
18 |
|
|
19 |
public class FinishEditingView extends JPanel |
|
20 |
{ |
|
21 |
JLabel lblListEditLayers = new JLabel(); |
|
22 |
JTable tableFinishEditing = new JTable(); |
|
23 |
|
|
24 |
/** |
|
25 |
* Default constructor |
|
26 |
*/ |
|
27 |
public FinishEditingView() |
|
28 |
{ |
|
29 |
initializePanel(); |
|
30 |
} |
|
31 |
|
|
32 |
/** |
|
33 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
34 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
35 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
36 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
37 |
*/ |
|
38 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
39 |
{ |
|
40 |
Dimension filler = new Dimension(10,10); |
|
41 |
|
|
42 |
boolean filled_cell_11 = false; |
|
43 |
CellConstraints cc = new CellConstraints(); |
|
44 |
if ( cols.length > 0 && rows.length > 0 ) |
|
45 |
{ |
|
46 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
47 |
{ |
|
48 |
/** add a rigid area */ |
|
49 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
50 |
filled_cell_11 = true; |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
for( int index = 0; index < cols.length; index++ ) |
|
55 |
{ |
|
56 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
57 |
{ |
|
58 |
continue; |
|
59 |
} |
|
60 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
61 |
} |
|
62 |
|
|
63 |
for( int index = 0; index < rows.length; index++ ) |
|
64 |
{ |
|
65 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
66 |
{ |
|
67 |
continue; |
|
68 |
} |
|
69 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
70 |
} |
|
71 |
|
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Helper method to load an image file from the CLASSPATH |
|
76 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
77 |
* @return an ImageIcon instance with the specified image file |
|
78 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
79 |
*/ |
|
80 |
public ImageIcon loadImage( String imageName ) |
|
81 |
{ |
|
82 |
try |
|
83 |
{ |
|
84 |
ClassLoader classloader = getClass().getClassLoader(); |
|
85 |
java.net.URL url = classloader.getResource( imageName ); |
|
86 |
if ( url != null ) |
|
87 |
{ |
|
88 |
ImageIcon icon = new ImageIcon( url ); |
|
89 |
return icon; |
|
90 |
} |
|
91 |
} |
|
92 |
catch( Exception e ) |
|
93 |
{ |
|
94 |
e.printStackTrace(); |
|
95 |
} |
|
96 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Method for recalculating the component orientation for |
|
101 |
* right-to-left Locales. |
|
102 |
* @param orientation the component orientation to be applied |
|
103 |
*/ |
|
104 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
105 |
{ |
|
106 |
// Not yet implemented... |
|
107 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
108 |
super.applyComponentOrientation(orientation); |
|
109 |
} |
|
110 |
|
|
111 |
public JPanel createPanel() |
|
112 |
{ |
|
113 |
JPanel jpanel1 = new JPanel(); |
|
114 |
FormLayout formlayout1 = new FormLayout("FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:4DLU:NONE","CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE"); |
|
115 |
CellConstraints cc = new CellConstraints(); |
|
116 |
jpanel1.setLayout(formlayout1); |
|
117 |
|
|
118 |
lblListEditLayers.setName("lblListEditLayers"); |
|
119 |
lblListEditLayers.setText("_list_of_edit_layer"); |
|
120 |
jpanel1.add(lblListEditLayers,cc.xy(2,2)); |
|
121 |
|
|
122 |
tableFinishEditing.setName("tableFinishEditing"); |
|
123 |
JScrollPane jscrollpane1 = new JScrollPane(); |
|
124 |
jscrollpane1.setViewportView(tableFinishEditing); |
|
125 |
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
126 |
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
127 |
jpanel1.add(jscrollpane1,cc.xy(2,4)); |
|
128 |
|
|
129 |
addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,2,3,4,5 }); |
|
130 |
return jpanel1; |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* Initializer |
|
135 |
*/ |
|
136 |
protected void initializePanel() |
|
137 |
{ |
|
138 |
setLayout(new BorderLayout()); |
|
139 |
add(createPanel(), BorderLayout.CENTER); |
|
140 |
} |
|
141 |
|
|
142 |
|
|
143 |
} |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/FinishEditingView2.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.project.documents.view.gui; |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
* @author jovivas |
|
11 |
*/ |
|
12 |
public class FinishEditingView2 { |
|
13 |
|
|
14 |
} |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/GridLayersPanel.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.project.documents.view.gui; |
|
7 |
|
|
8 |
import java.awt.Dimension; |
|
9 |
import java.awt.GridBagConstraints; |
|
10 |
import java.awt.GridBagLayout; |
|
11 |
import java.awt.Insets; |
|
12 |
import java.awt.event.ActionEvent; |
|
13 |
import java.awt.event.ActionListener; |
|
14 |
import java.awt.event.MouseAdapter; |
|
15 |
import java.awt.event.MouseEvent; |
|
16 |
import java.util.ArrayList; |
|
17 |
import java.util.Collection; |
|
18 |
import java.util.Iterator; |
|
19 |
import java.util.List; |
|
20 |
import javax.swing.Action; |
|
21 |
import javax.swing.DefaultComboBoxModel; |
|
22 |
import javax.swing.JButton; |
|
23 |
import javax.swing.JComboBox; |
|
24 |
import javax.swing.JComponent; |
|
25 |
import javax.swing.JLabel; |
|
26 |
import javax.swing.JOptionPane; |
|
27 |
import javax.swing.JPanel; |
|
28 |
import javax.swing.JScrollPane; |
|
29 |
import static org.exolab.castor.xml.util.DOMEventProducer.process; |
|
30 |
import org.gvsig.andami.PluginServices; |
|
31 |
import org.gvsig.export.ExportLocator; |
|
32 |
import org.gvsig.export.ExportManager; |
|
33 |
import org.gvsig.export.ExportProcess; |
|
34 |
import org.gvsig.export.swing.ExportSwingLocator; |
|
35 |
import org.gvsig.export.swing.ExportSwingManager; |
|
36 |
import org.gvsig.export.swing.JExportProcessPanel; |
|
37 |
import org.gvsig.fmap.dal.exception.DataException; |
|
38 |
import org.gvsig.fmap.dal.swing.DALActionFactory; |
|
39 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
40 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
42 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
43 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
44 |
import org.gvsig.tools.ToolsLocator; |
|
45 |
import org.gvsig.tools.i18n.I18nManager; |
|
46 |
import org.gvsig.tools.swing.api.Component; |
|
47 |
import org.gvsig.tools.swing.api.DropDown; |
|
48 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
49 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
|
50 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
51 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
52 |
import org.gvsig.tools.swing.impl.DropDownLabel; |
|
53 |
import org.gvsig.tools.util.LabeledValue; |
|
54 |
import org.gvsig.tools.util.LabeledValueImpl; |
|
55 |
import org.gvsig.vectorediting.app.mainplugin.EditingExtension; |
|
56 |
import org.slf4j.Logger; |
|
57 |
import org.slf4j.LoggerFactory; |
|
58 |
|
|
59 |
/** |
|
60 |
* |
|
61 |
* @author jovivas |
|
62 |
*/ |
|
63 |
public class GridLayersPanel extends JPanel implements Component { |
|
64 |
|
|
65 |
private static final int OPTION_SAVE = 0; |
|
66 |
private static final int OPTION_DISMISS = 1; |
|
67 |
private static final int OPTION_CONTINUE = 2; |
|
68 |
private static final int OPTION_EXPORT = 3; |
|
69 |
|
|
70 |
private static final Logger LOGGER = LoggerFactory.getLogger(EditingExtension.class); |
|
71 |
|
|
72 |
private static class Row { |
|
73 |
|
|
74 |
private final FLyrVect layer; |
|
75 |
private final DropDown dropDownOptions; |
|
76 |
private final JButton jButtonExport; |
|
77 |
private final LabeledValue[] options; |
|
78 |
|
|
79 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
80 |
private final JLabel dropDownComponent; |
|
81 |
|
|
82 |
public Row(FLyrVect layer) { |
|
83 |
this.layer = layer; |
|
84 |
|
|
85 |
options = new LabeledValue[]{ |
|
86 |
new LabeledValueImpl(i18n.getTranslation("_save"),OPTION_SAVE), |
|
87 |
new LabeledValueImpl(i18n.getTranslation("_dismiss"), OPTION_DISMISS), |
|
88 |
new LabeledValueImpl(i18n.getTranslation("_continue"), OPTION_CONTINUE), |
|
89 |
new LabeledValueImpl(i18n.getTranslation("_export"), OPTION_EXPORT)}; |
|
90 |
|
|
91 |
DefaultComboBoxModel modelJComboBoxOptions = new DefaultComboBoxModel(); |
|
92 |
for (LabeledValue option : options) { |
|
93 |
modelJComboBoxOptions.addElement(option); |
|
94 |
} |
|
95 |
|
|
96 |
ToolsSwingManager toolSwingmanager = ToolsSwingLocator.getToolsSwingManager(); |
|
97 |
this.dropDownComponent = new JLabel(); |
|
98 |
this.dropDownOptions = toolSwingmanager.createDropDown(dropDownComponent); |
|
99 |
this.dropDownOptions.setModel(modelJComboBoxOptions); |
|
100 |
if (this.layer.getFeatureStore().allowWrite()) { |
|
101 |
this.dropDownOptions.setSelectedIndex(OPTION_SAVE); |
|
102 |
} else { |
|
103 |
this.dropDownOptions.setSelectedIndex(OPTION_EXPORT); |
|
104 |
} |
|
105 |
this.dropDownOptions.setVisibleDropdownArrow(true); |
|
106 |
|
|
107 |
this.jButtonExport = new JButton(i18n.getTranslation("_export")); |
|
108 |
|
|
109 |
this.jButtonExport.addActionListener(new ActionListener() { |
|
110 |
@Override |
|
111 |
public void actionPerformed(ActionEvent e) { |
|
112 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
113 |
ExportManager exportManager = ExportLocator.getManager(); |
|
114 |
ExportSwingManager exportSwingManager = ExportSwingLocator.getSwingManager(); |
|
115 |
ExportProcess process = exportManager.createProcess(layer.getFeatureStore()); |
|
116 |
JExportProcessPanel panel = exportSwingManager.createJExportProcessPanel(process); |
|
117 |
windowManager.showWindow(panel.asJComponent(), "_export", WindowManager.MODE.WINDOW); |
|
118 |
} |
|
119 |
//en algun lugar de aqui hay que especificar que tras pulsar el boton la opci?n cambia a dismiss |
|
120 |
}); |
|
121 |
} |
|
122 |
|
|
123 |
public FLyrVect getLayer() { |
|
124 |
return this.layer; |
|
125 |
} |
|
126 |
|
|
127 |
public JLabel getJLabel() { |
|
128 |
String layerName = this.layer.getName(); |
|
129 |
JLabel layerNameJLabel = new JLabel(layerName); |
|
130 |
return layerNameJLabel; |
|
131 |
} |
|
132 |
|
|
133 |
public JComponent getJDropDown() { |
|
134 |
return this.dropDownComponent; |
|
135 |
} |
|
136 |
|
|
137 |
public JButton getJButton() { |
|
138 |
return this.jButtonExport; |
|
139 |
} |
|
140 |
|
|
141 |
public int getJComboBoxOption() { |
|
142 |
LabeledValue<Integer> optionSelected = (LabeledValue) this.dropDownOptions.getSelectedItem(); |
|
143 |
return optionSelected.getValue(); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
private List<Row> rows; |
|
148 |
private final MapContext mapContext; |
|
149 |
|
|
150 |
public GridLayersPanel(MapContext mapContext) { |
|
151 |
rows = new ArrayList<>(); |
|
152 |
this.mapContext = mapContext; |
|
153 |
this.initComponents(); |
|
154 |
} |
|
155 |
|
|
156 |
public Row getRow(int rowIndex) { |
|
157 |
Row row = this.rows.get(rowIndex); |
|
158 |
return row; |
|
159 |
} |
|
160 |
|
|
161 |
public void addLayer(FLayer layer) { |
|
162 |
if (layer instanceof FLyrVect) { |
|
163 |
FLyrVect layerVect = (FLyrVect) layer; |
|
164 |
this.rows.add(new Row(layerVect)); |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
public void build() { |
|
169 |
this.removeAll(); |
|
170 |
this.setLayout(new GridBagLayout()); |
|
171 |
int rownum = 0; |
|
172 |
for (Row row : rows) { |
|
173 |
addComponent(rownum, 0, row.getJLabel()); |
|
174 |
addComponent(rownum, 1, row.getJDropDown()); |
|
175 |
addComponent(rownum, 2, row.getJButton()); |
|
176 |
rownum++; |
|
177 |
} |
|
178 |
GridBagConstraints c = new GridBagConstraints(); |
|
179 |
c.fill = GridBagConstraints.BOTH; |
|
180 |
c.weighty = 0.9; |
|
181 |
c.weightx = 0.9; |
|
182 |
c.gridx = 1; |
|
183 |
c.gridy = rownum; |
|
184 |
this.add(new JLabel(""), c); |
|
185 |
|
|
186 |
} |
|
187 |
|
|
188 |
private void addComponent(int gridY, int gridX, JComponent component) { |
|
189 |
GridBagConstraints c = new GridBagConstraints(); |
|
190 |
c.insets = new Insets(5, 5, 5, 5); |
|
191 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
192 |
c.ipadx = 2; |
|
193 |
c.ipady = 2; |
|
194 |
c.gridx = gridX; |
|
195 |
c.gridy = gridY; |
|
196 |
this.add(component, c); |
|
197 |
} |
|
198 |
|
|
199 |
private void initComponents() { |
|
200 |
Iterator<FLayer> layers = mapContext.deepiterator(); |
|
201 |
while (layers.hasNext()) { |
|
202 |
FLayer layer = layers.next(); |
|
203 |
if (layer.isEditing()) { |
|
204 |
this.addLayer(layer); |
|
205 |
} |
|
206 |
} |
|
207 |
this.build(); |
|
208 |
|
|
209 |
// this.addMouseListener(new MouseAdapter() { |
|
210 |
// @Override |
|
211 |
// public void mouseClicked(MouseEvent e) { |
|
212 |
// checkExportLayers(); |
|
213 |
// } |
|
214 |
// }); |
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
} |
|
219 |
|
|
220 |
public boolean checkExportLayers() { |
|
221 |
boolean exportLayer = false; |
|
222 |
// List exportLayers = new ArrayList(); |
|
223 |
for (int i = 0; i < this.rows.size(); i++) { |
|
224 |
Row row = this.getRow(i); |
|
225 |
if (row.getJComboBoxOption() == OPTION_EXPORT) { |
|
226 |
exportLayer = true; |
|
227 |
// exportLayers.add(row.getLayer().getName()); |
|
228 |
} |
|
229 |
// if (exportLayer) { |
|
230 |
// I18nManager i18n = ToolsLocator.getI18nManager(); |
|
231 |
// StringBuilder message = new StringBuilder(); |
|
232 |
// message.append(i18n.getTranslation("_The_following_layers_must_be_exported")); |
|
233 |
// String title = i18n.getTranslation("_Need_export_layers"); |
|
234 |
// ToolsSwingLocator.getThreadSafeDialogsManager().messageDialog (message.toString(), |
|
235 |
// title, |
|
236 |
// JOptionPane.WARNING_MESSAGE); |
|
237 |
// } |
|
238 |
} |
|
239 |
return exportLayer; |
|
240 |
} |
|
241 |
|
|
242 |
public void doApplyChanges() { |
|
243 |
// SnappingTableModel model = (SnappingTableModel) this.tableSnapping.getModel(); |
|
244 |
// ArrayList<FLyrVect> layersToSnap = new ArrayList<>(); |
|
245 |
for (int i = 0; i < this.rows.size(); i++) { |
|
246 |
Row row = this.getRow(i); |
|
247 |
if (row.getJComboBoxOption() == OPTION_SAVE) { |
|
248 |
try { |
|
249 |
row.getLayer().getFeatureStore().finishEditing(); |
|
250 |
} catch (DataException ex) { |
|
251 |
LOGGER.error(PluginServices.getText(this, ""), ex); |
|
252 |
// Logger.getLogger(GridLayersPanel.class.getName()).log(Level.SEVERE, null, ex); |
|
253 |
} |
|
254 |
} else if (row.getJComboBoxOption() == OPTION_DISMISS) { |
|
255 |
try { |
|
256 |
row.getLayer().getFeatureStore().cancelEditing(); |
|
257 |
} catch (DataException ex) { |
|
258 |
LOGGER.error(PluginServices.getText(this, ""), ex); |
|
259 |
// Logger.getLogger(GridLayersPanel.class.getName()).log(Level.SEVERE, null, ex); |
|
260 |
} |
|
261 |
} |
|
262 |
|
|
263 |
|
|
264 |
// row.getLayerOption().setMaxFeaturesInEditionCache(row.getCacheFeatures()); |
|
265 |
// if (row.isSelected()) { |
|
266 |
// row.getLayer().getSpatialCache().setEnabled(true); |
|
267 |
// layersToSnap.add(row.getLayer()); |
|
268 |
// } else { |
|
269 |
// row.getLayer().getSpatialCache().setEnabled(false); |
|
270 |
// } |
|
271 |
} |
|
272 |
// this.mapContext.setLayersToSnap(layersToSnap); |
|
273 |
// |
|
274 |
// try { |
|
275 |
// MapControlLocator.getMapControlManager().setTolerance(Integer.parseInt(this.textFieldTolSnapping.getText())); |
|
276 |
// |
|
277 |
// } catch (Exception e) { |
|
278 |
// LOGGER.error(PluginServices.getText(this, "tolerancia_incorrecta"), e); |
|
279 |
// |
|
280 |
// } |
|
281 |
// this.mapContext.invalidate(); |
|
282 |
} |
|
283 |
|
|
284 |
@Override |
|
285 |
public JComponent asJComponent() { |
|
286 |
ToolsSwingManager toolSwingmanager = ToolsSwingLocator.getToolsSwingManager(); |
|
287 |
|
|
288 |
this.build(); |
|
289 |
this.setPreferredSize(new Dimension(400, 200)); |
|
290 |
|
|
291 |
JScrollPane scrollPanel = new JScrollPane(); |
|
292 |
scrollPanel.setPreferredSize(new Dimension(420, 220)); |
|
293 |
scrollPanel.setViewportView(this); |
|
294 |
|
|
295 |
toolSwingmanager.removeBorder(this); |
|
296 |
return scrollPanel; |
|
297 |
} |
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
} |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/project/documents/view/gui/FinishEditingImpl.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.project.documents.view.gui; |
|
7 |
|
|
8 |
import java.util.ArrayList; |
|
9 |
import java.util.List; |
|
10 |
import javax.swing.JList; |
|
11 |
import javax.swing.table.AbstractTableModel; |
|
12 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
13 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
14 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
15 |
import org.gvsig.tools.ToolsLocator; |
|
16 |
import org.gvsig.tools.i18n.I18nManager; |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* @author jovivas |
|
21 |
*/ |
|
22 |
public class FinishEditingImpl extends FinishEditingView { |
|
23 |
|
|
24 |
public static class finishEditingTableModel extends AbstractTableModel { |
|
25 |
|
|
26 |
public class TableRow { |
|
27 |
|
|
28 |
private final FLyrVect layer; |
|
29 |
private final JList finishEditingList; |
|
30 |
|
|
31 |
public TableRow(FLyrVect layer, JList finishEditingList) { |
|
32 |
this.layer = layer; |
|
33 |
this.finishEditingList = finishEditingList; |
|
34 |
} |
|
35 |
|
|
36 |
public FLyrVect getLayer() { |
|
37 |
return layer; |
|
38 |
} |
|
39 |
|
|
40 |
public JList getList() { |
|
41 |
return finishEditingList; |
|
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
private String[] columnNames; |
|
46 |
|
|
47 |
private Class<?>[] columnClases = new Class<?>[]{ |
|
48 |
String.class, |
|
49 |
JList.class |
|
50 |
}; |
|
51 |
|
|
52 |
private List<TableRow> rows; |
|
53 |
|
|
54 |
public finishEditingTableModel() { |
|
55 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
56 |
this.rows = new ArrayList<>(); |
|
57 |
columnNames = new String[]{ |
|
58 |
i18n.getTranslation("_layer"), |
|
59 |
i18n.getTranslation("_action") |
|
60 |
}; |
|
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public int getRowCount() { |
|
65 |
return this.rows.size(); |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public int getColumnCount() { |
|
70 |
return 2; |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public Class<?> getColumnClass(int columnIndex) { |
|
75 |
return this.columnClases[columnIndex]; |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public String getColumnName(int column) { |
|
80 |
return this.columnNames[column]; |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public Object getValueAt(int rowIndex, int columnIndex) { |
|
85 |
TableRow row = this.rows.get(rowIndex); |
|
86 |
switch (columnIndex) { |
|
87 |
case 0: |
|
88 |
return row.getLayer().getName(); |
|
89 |
case 1: |
|
90 |
return row.getList(); |
|
91 |
default: |
|
92 |
return ""; |
|
93 |
|
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
private void addLayer(FLayer layer) { |
|
98 |
if (layer instanceof FLyrVect) { |
|
99 |
FLyrVect layerVect = (FLyrVect) layer; |
|
100 |
JList JList = null; |
|
101 |
TableRow row = new TableRow(layerVect, JList); |
|
102 |
rows.add(row); |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
private final MapContext mapContext; |
|
109 |
|
|
110 |
public FinishEditingImpl(MapContext mapContext){ |
|
111 |
this.mapContext=mapContext; |
|
112 |
// this.initComponents(); |
|
113 |
} |
|
114 |
|
|
115 |
} |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/vectorediting/app/mainplugin/FinishEditingExtension.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.vectorediting.app.mainplugin; |
|
7 |
|
|
8 |
|
|
9 |
import org.gvsig.andami.plugins.Extension; |
|
10 |
import org.gvsig.app.ApplicationLocator; |
|
11 |
import org.gvsig.app.ApplicationManager; |
|
12 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
13 |
import org.gvsig.project.documents.view.gui.FinishEditingImpl; |
|
14 |
import org.gvsig.tools.ToolsLocator; |
|
15 |
import org.gvsig.tools.i18n.I18nManager; |
|
16 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
17 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
18 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
19 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
20 |
|
|
21 |
/** |
|
22 |
* |
|
23 |
* @author jovivas |
|
24 |
*/ |
|
25 |
public class FinishEditingExtension extends Extension { |
|
26 |
|
|
27 |
public void initialize() { |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
public void execute(String s) { |
|
32 |
|
|
33 |
if (s.equalsIgnoreCase("end-editing-JList")) { |
|
34 |
ViewDocument viewDoc = getActiveView(); |
|
35 |
if (viewDoc==null) { |
|
36 |
return; |
|
37 |
} |
|
38 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
39 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
40 |
|
|
41 |
FinishEditingImpl finishEditingPanel = new FinishEditingImpl( viewDoc.getMapContext()); |
|
42 |
|
|
43 |
Dialog dialog = windowManager.createDialog( |
|
44 |
finishEditingPanel, |
|
45 |
i18n.getTranslation("_finish_edition"), |
|
46 |
null, |
|
47 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
48 |
); |
|
49 |
// dialog.addActionListener((ActionEvent e) -> { |
|
50 |
// if (dialog.getAction() == WindowManager_v2.BUTTON_OK) { |
|
51 |
// finishEditingPanel.applyChanges(); |
|
52 |
// |
|
53 |
// } |
|
54 |
// }); |
|
55 |
dialog.show(WindowManager.MODE.WINDOW); |
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
private ViewDocument getActiveView() { |
|
63 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
64 |
ViewDocument view = (ViewDocument) application.getActiveDocument(ViewDocument.class); |
|
65 |
return view; |
|
66 |
} |
|
67 |
|
|
68 |
public boolean isEnabled() { |
|
69 |
return true; |
|
70 |
} |
|
71 |
|
|
72 |
public boolean isVisible() { |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
} |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/src/main/java/org/gvsig/vectorediting/app/mainplugin/FinishEditingExtension2.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.vectorediting.app.mainplugin; |
|
7 |
|
|
8 |
import java.awt.Dimension; |
|
9 |
import java.awt.event.ActionEvent; |
|
10 |
import java.awt.event.MouseAdapter; |
|
11 |
import java.awt.event.MouseEvent; |
|
12 |
import javax.swing.JScrollPane; |
|
13 |
import org.gvsig.andami.plugins.Extension; |
|
14 |
import org.gvsig.app.ApplicationLocator; |
|
15 |
import org.gvsig.app.ApplicationManager; |
|
16 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
17 |
import org.gvsig.project.documents.view.gui.GridLayersPanel; |
|
18 |
import org.gvsig.tools.ToolsLocator; |
|
19 |
import org.gvsig.tools.i18n.I18nManager; |
|
20 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
21 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
|
22 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
23 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
24 |
|
|
25 |
/** |
|
26 |
* |
|
27 |
* @author jovivas |
|
28 |
*/ |
|
29 |
public class FinishEditingExtension2 extends Extension { |
|
30 |
|
|
31 |
public void initialize() { |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
public void execute(String s) { |
|
36 |
|
|
37 |
if (s.equalsIgnoreCase("end-editing-JList")) { |
|
38 |
ViewDocument viewDoc = getActiveView(); |
|
39 |
if (viewDoc == null) { |
|
40 |
return; |
|
41 |
} |
|
42 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
43 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
|
44 |
|
|
45 |
GridLayersPanel gridLayersPanel = new GridLayersPanel(viewDoc.getMapContext()); |
|
46 |
|
|
47 |
Dialog dialog = windowManager.createDialog( |
|
48 |
gridLayersPanel.asJComponent(), |
|
49 |
i18n.getTranslation("_finish_edition"), |
|
50 |
i18n.getTranslation("_layer_list"), |
|
51 |
WindowManager_v2.BUTTONS_OK_CANCEL |
|
52 |
); |
|
53 |
|
|
54 |
// hay que meter la forma de que cuando se realice un a pulsacion en la ventana se ejecute checkExportLayers |
|
55 |
// dialog.addActionListener((ActionEvent e) -> { |
|
56 |
// if (dialog.getAction() == ) { |
|
57 |
// if (gridLayersPanel.checkExportLayers()){ |
|
58 |
// dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, false); |
|
59 |
// } |
|
60 |
// } |
|
61 |
// });ooooo |
|
62 |
|
|
63 |
if (gridLayersPanel.checkExportLayers()) { |
|
64 |
dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, false); |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
gridLayersPanel.addMouseListener(new MouseAdapter() { |
|
69 |
@Override |
|
70 |
public void mouseClicked(MouseEvent e) { |
|
71 |
if (gridLayersPanel.checkExportLayers()){ |
|
72 |
dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, false); |
|
73 |
} else { |
|
74 |
dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, true); |
|
75 |
} |
|
76 |
} |
|
77 |
}); |
|
78 |
|
|
79 |
dialog.addActionListener((ActionEvent e) -> { |
|
80 |
if (dialog.getAction() == WindowManager_v2.BUTTON_OK) { |
|
81 |
gridLayersPanel.doApplyChanges(); |
|
82 |
} |
|
83 |
}); |
|
84 |
dialog.show(WindowManager.MODE.WINDOW); |
|
85 |
|
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
private ViewDocument getActiveView() { |
|
90 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
91 |
ViewDocument view = (ViewDocument) application.getActiveDocument(ViewDocument.class); |
|
92 |
return view; |
|
93 |
} |
|
94 |
|
|
95 |
public boolean isEnabled() { |
|
96 |
return true; |
|
97 |
} |
|
98 |
|
|
99 |
public boolean isVisible() { |
|
100 |
return true; |
|
101 |
} |
|
102 |
|
|
103 |
} |
org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.app/org.gvsig.vectorediting.app.mainplugin/pom.xml | ||
---|---|---|
243 | 243 |
<groupId>org.gvsig</groupId> |
244 | 244 |
<artifactId>org.gvsig.vectorediting.lib.prov.reversedirection</artifactId> |
245 | 245 |
</dependency> |
246 |
<dependency> |
|
247 |
<groupId>org.gvsig</groupId> |
|
248 |
<artifactId>org.gvsig.exportto.swing.api</artifactId> |
|
249 |
<version>2.0.287-SNAPSHOT</version> |
|
250 |
<type>jar</type> |
|
251 |
</dependency> |
|
246 | 252 |
</dependencies> |
247 | 253 |
</project> |
Also available in: Unified diff