Revision 38605
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toolListeners/InfoListener.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.app.project.documents.view.toolListeners; |
42 | 42 |
|
43 |
import java.awt.GridBagConstraints; |
|
43 | 44 |
import java.awt.Image; |
44 | 45 |
import java.util.HashMap; |
45 | 46 |
import java.util.Map; |
46 | 47 |
|
47 |
import javax.swing.JDialog; |
|
48 |
import javax.swing.JPanel; |
|
49 |
|
|
50 | 48 |
import org.slf4j.Logger; |
51 | 49 |
import org.slf4j.LoggerFactory; |
52 | 50 |
|
53 | 51 |
import org.gvsig.andami.PluginServices; |
54 | 52 |
import org.gvsig.andami.messages.NotificationManager; |
55 | 53 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
54 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
|
56 | 55 |
import org.gvsig.app.ApplicationLocator; |
57 | 56 |
import org.gvsig.app.ApplicationManager; |
58 | 57 |
import org.gvsig.app.project.documents.view.info.gui.FInfoDialog; |
... | ... | |
158 | 157 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
159 | 158 |
InfoByPointRenderer renderer = (InfoByPointRenderer)extensionPoints.get(EP_INFOTOOL_NAME).create(EP_INFOTOOL_RENDERER); |
160 | 159 |
|
161 |
IWindow window = renderer.getPanel(); |
|
162 |
boolean first_time = (window == null); |
|
163 |
renderer.resetPanel(layer2info); |
|
164 |
|
|
165 |
window = renderer.getPanel(); |
|
160 |
IWindow window = renderer.getPanel(layer2info); |
|
161 |
|
|
166 | 162 |
if (window == null) { |
167 | 163 |
logger.info("Error. Unable to create info panel."); |
168 | 164 |
return; |
169 | 165 |
} |
170 |
|
|
171 |
|
|
172 |
if (first_time) { |
|
173 |
PluginServices.getMDIManager().addCentredWindow(window); |
|
174 |
} else { |
|
175 |
// perhaps bring to front |
|
176 |
} |
|
177 |
|
|
178 | 166 |
|
167 |
PluginServices.getMDIManager().addWindow(window, GridBagConstraints.LAST_LINE_END); |
|
168 |
|
|
179 | 169 |
} catch (Exception e) { |
180 | 170 |
NotificationManager.addError("Info by Point", e); |
181 | 171 |
e.printStackTrace(); |
182 | 172 |
} |
183 | 173 |
} |
184 | 174 |
|
175 |
/** |
|
176 |
* @param window |
|
177 |
* @return whether the window is currently one the app windows |
|
178 |
*/ |
|
179 |
private boolean isCurrentlyAdded(IWindow iw) { |
|
180 |
|
|
181 |
IWindow[] iws = PluginServices.getMDIManager().getAllWindows(); |
|
182 |
for (int i=0; i<iws.length; i++) { |
|
183 |
if (iws[i] == iw) { |
|
184 |
return true; |
|
185 |
} |
|
186 |
} |
|
187 |
return false; |
|
188 |
} |
|
189 |
|
|
185 | 190 |
public Image getImageCursor() { |
186 | 191 |
return img; |
187 | 192 |
} |
... | ... | |
196 | 201 |
|
197 | 202 |
public interface InfoByPointRenderer { |
198 | 203 |
|
199 |
public FInfoDialog getPanel(); |
|
200 |
public void resetPanel(Map<String, DynObjectSet> layersInfo); |
|
204 |
public SingletonWindow getPanel(Map<String, DynObjectSet> layersInfo); |
|
201 | 205 |
|
202 | 206 |
} |
203 | 207 |
|
... | ... | |
205 | 209 |
|
206 | 210 |
private FInfoDialog dlgInfo = null; |
207 | 211 |
|
208 |
public FInfoDialog getPanel() { |
|
209 |
return dlgInfo; |
|
210 |
} |
|
211 |
|
|
212 |
|
|
213 |
public void resetPanel(Map<String, DynObjectSet> layersInfo) { |
|
212 |
public SingletonWindow getPanel(Map<String, DynObjectSet> layersInfo) { |
|
214 | 213 |
// TODO: set the writable parameter to true to activate |
215 | 214 |
// edition of the info by point information. |
216 | 215 |
LayersDynObjectSetComponent infoComponent = |
... | ... | |
222 | 221 |
} else { |
223 | 222 |
dlgInfo.setInfo(infoComponent); |
224 | 223 |
} |
224 |
return dlgInfo; |
|
225 | 225 |
} |
226 | 226 |
|
227 | 227 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java | ||
---|---|---|
815 | 815 |
featureStore.getDefaultFeatureType(), |
816 | 816 |
geomName); |
817 | 817 |
featureQuery.setFilter(iee); |
818 |
featureQuery.setAttributeNames(null); |
|
818 | 819 |
return getFeatureStore().getFeatureSet(featureQuery); |
819 | 820 |
|
820 | 821 |
} |
branches/v2_0_0_prep/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/MapControlLibrary.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import org.gvsig.fmap.IconThemeHelper; |
32 | 32 |
import org.gvsig.fmap.mapcontext.MapContextLibrary; |
33 |
import org.gvsig.fmap.mapcontrol.swing.dynfield.factory.GeometryDynFieldComponentFactory; |
|
33 | 34 |
import org.gvsig.i18n.Messages; |
34 | 35 |
import org.gvsig.tools.library.AbstractLibrary; |
35 | 36 |
import org.gvsig.tools.library.LibraryException; |
37 |
import org.gvsig.tools.service.spi.ServiceManager; |
|
38 |
import org.gvsig.tools.swing.spi.ToolsSwingServiceLocator; |
|
36 | 39 |
|
37 | 40 |
/** |
38 | 41 |
* Initialization of the MapControls library. |
... | ... | |
72 | 75 |
IconThemeHelper.registerIcon("layer", "layer-icon", this); |
73 | 76 |
IconThemeHelper.registerIcon("layer", "layer-icon-group", this); |
74 | 77 |
IconThemeHelper.registerIcon("layer", "layer-icon-vectorial", this); |
78 |
|
|
79 |
// ================================================= |
|
80 |
// Add factory for creation of |
|
81 |
// swing component representing geometry |
|
82 |
ServiceManager dsManager = ToolsSwingServiceLocator.getServiceManager(); |
|
83 |
dsManager.addServiceFactory(new GeometryDynFieldComponentFactory()); |
|
75 | 84 |
} |
76 | 85 |
} |
branches/v2_0_0_prep/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/swing/dynfield/factory/GeometryDynFieldComponentFactory.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.fmap.mapcontrol.swing.dynfield.factory; |
|
24 |
|
|
25 |
import org.gvsig.fmap.geom.DataTypes; |
|
26 |
import org.gvsig.fmap.geom.Geometry; |
|
27 |
import org.gvsig.fmap.mapcontrol.swing.dynfield.GeometryDynFieldComponent; |
|
28 |
import org.gvsig.tools.dynobject.DynField; |
|
29 |
import org.gvsig.tools.service.ServiceException; |
|
30 |
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent; |
|
31 |
import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField; |
|
32 |
import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory; |
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* This factory will create a swing component to represent |
|
37 |
* a {@link Geometry} object (for example when opening |
|
38 |
* a info by point dialog) |
|
39 |
* |
|
40 |
* @author jldominguez |
|
41 |
* |
|
42 |
*/ |
|
43 |
public class GeometryDynFieldComponentFactory extends |
|
44 |
AbstractJDynFieldComponentFactory { |
|
45 |
|
|
46 |
public JDynFieldComponent createJDynFieldComponent(DynField child, |
|
47 |
ValueField dynObject, boolean writable) throws ServiceException { |
|
48 |
|
|
49 |
return new GeometryDynFieldComponent(child, dynObject, writable); |
|
50 |
} |
|
51 |
|
|
52 |
public String getFactoryDescription() { |
|
53 |
// TODO Auto-generated method stub |
|
54 |
return null; |
|
55 |
} |
|
56 |
|
|
57 |
public String getFactorySubType() { |
|
58 |
// TODO Auto-generated method stub |
|
59 |
return null; |
|
60 |
} |
|
61 |
|
|
62 |
public Integer getFactoryType() { |
|
63 |
return DataTypes.GEOMETRY; |
|
64 |
} |
|
65 |
|
|
66 |
} |
branches/v2_0_0_prep/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/swing/dynfield/GeometryDynFieldComponent.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.fmap.mapcontrol.swing.dynfield; |
|
24 |
|
|
25 |
import javax.swing.JComponent; |
|
26 |
import javax.swing.JLabel; |
|
27 |
|
|
28 |
import org.gvsig.fmap.geom.Geometry; |
|
29 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
30 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.tools.dynobject.DynField; |
|
33 |
import org.gvsig.tools.service.ServiceException; |
|
34 |
import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField; |
|
35 |
import org.gvsig.tools.swing.spi.AbstractJDynFieldComponent; |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* |
|
40 |
* This class provides a swing component |
|
41 |
* to represent {@link Geometry} objects in dialogs/forms |
|
42 |
* |
|
43 |
* |
|
44 |
* @author jldominguez |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class GeometryDynFieldComponent extends |
|
48 |
AbstractJDynFieldComponent { |
|
49 |
|
|
50 |
private JLabel label = null; |
|
51 |
|
|
52 |
public GeometryDynFieldComponent( |
|
53 |
DynField definition, |
|
54 |
ValueField value, |
|
55 |
boolean writeable) throws ServiceException { |
|
56 |
|
|
57 |
super(definition, value, false /* cannot edit geometry. writeable*/); |
|
58 |
init(); |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
public void setEnabled(boolean isEnabled) { |
|
66 |
} |
|
67 |
|
|
68 |
public void requestFocus() { |
|
69 |
} |
|
70 |
|
|
71 |
public JComponent asJComponent() { |
|
72 |
return label; |
|
73 |
} |
|
74 |
|
|
75 |
public Object getValue() { |
|
76 |
return this.getFieldValue(); |
|
77 |
} |
|
78 |
|
|
79 |
protected void setJDynFieldComponentListeners() { |
|
80 |
} |
|
81 |
|
|
82 |
protected void afterUI() { |
|
83 |
} |
|
84 |
|
|
85 |
protected void initData() { |
|
86 |
} |
|
87 |
|
|
88 |
protected void initUI() { |
|
89 |
Object val = this.getFieldValue(); |
|
90 |
if (val == null || (!(val instanceof Geometry))) { |
|
91 |
label = new JLabel("[" + Messages.getText("_Null") + "]"); |
|
92 |
} else { |
|
93 |
Geometry geom = (Geometry) val; |
|
94 |
label = new JLabel(geom.getGeometryType().getName()); |
|
95 |
} |
|
96 |
} |
|
97 |
|
|
98 |
protected void setNonNullValue(Object value) { |
|
99 |
} |
|
100 |
|
|
101 |
protected void setNullValue() { |
|
102 |
} |
|
103 |
|
|
104 |
protected void setReadOnly() { |
|
105 |
} |
|
106 |
|
|
107 |
} |
branches/v2_0_0_prep/libraries/libFMap_controls/pom.xml | ||
---|---|---|
37 | 37 |
<dependency> |
38 | 38 |
<groupId>org.gvsig</groupId> |
39 | 39 |
<artifactId>org.gvsig.tools.swing.spi</artifactId> |
40 |
<scope>runtime</scope>
|
|
40 |
<scope>compile</scope>
|
|
41 | 41 |
</dependency> |
42 | 42 |
<dependency> |
43 | 43 |
<groupId>org.gvsig</groupId> |
Also available in: Unified diff