Revision 36

View differences:

org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
	<modelVersion>4.0.0</modelVersion>
3
	<parent>
4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.desktop</artifactId>
6
		<version>2.0.76</version>
7
	</parent>
8
	<groupId>org.gvsig</groupId>
9
	<artifactId>org.gvsig.attributeeditor</artifactId>
10
	<version>1.0.2</version>
11
	<packaging>pom</packaging>
12
	<name>org.gvsig.attributeeditor</name>
13
	<description>This plugins allows to edit the alphanumeric attributes of a layer.</description>
14

  
15
	<repositories>
16
		<repository>
17
			<id>gvsig-public-http-repository</id>
18
			<name>gvSIG maven public HTTP repository</name>
19
			<url>http://devel.gvsig.org/m2repo/j2se</url>
20
			<releases>
21
				<enabled>true</enabled>
22
				<updatePolicy>daily</updatePolicy>
23
				<checksumPolicy>warn</checksumPolicy>
24
			</releases>
25
			<snapshots>
26
				<enabled>true</enabled>
27
				<updatePolicy>daily</updatePolicy>
28
				<checksumPolicy>warn</checksumPolicy>
29
			</snapshots>
30
		</repository>
31
	</repositories>
32

  
33
	<scm>
34
		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-attributeeditor/org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2</connection>
35
		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-attributeeditor/org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2</developerConnection>
36
		<url>https://devel.gvsig.org/redmine/projects/gvsig-attributeeditor/repository/show/org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2</url>
37
	</scm>
38

  
39

  
40
	<dependencyManagement>
41
		<dependencies>
42
			<dependency>
43
				<groupId>org.gvsig</groupId>
44
				<artifactId>
45
    				org.gvsig.featureform.swing.api
46
    			</artifactId>
47
				<version>1.0.2</version>
48
			</dependency>
49
			<dependency>
50
				<groupId>org.gvsig</groupId>
51
				<artifactId>
52
    				org.gvsig.featureform.swing.impl
53
    			</artifactId>
54
				<version>1.0.2</version>
55
			</dependency>
56
			<dependency>
57
				<groupId>org.gvsig</groupId>
58
				<artifactId>
59
    				org.gvsig.attributeeditor.app.mainplugin
60
    			</artifactId>
61
				<version>1.0.2</version>
62
			</dependency>
63
			<dependency>
64
				<groupId>org.gvsig</groupId>
65
				<artifactId>
66
    				org.gvsig.attributeeditor.mapcontrol
67
    			</artifactId>
68
				<version>1.0.2</version>
69
			</dependency>
70
		</dependencies>
71
	</dependencyManagement>
72

  
73
	<build>
74
		<plugins>
75
			<plugin>
76
				<groupId>org.apache.maven.plugins</groupId>
77
				<artifactId>maven-release-plugin</artifactId>
78
				<configuration>
79
					<tagBase>https://devel.gvsig.org/svn/gvsig-attributeeditor/${project.artifactId}/tags</tagBase>
80
					<goal>deploy</goal>
81
				</configuration>
82
			</plugin>
83
		</plugins>
84
	</build>
85

  
86
	<modules>
87
		<module>org.gvsig.featureform.swing</module>
88
		<module>org.gvsig.attributeeditor.mapcontrol</module>
89
		<module>org.gvsig.attributeeditor.app</module>
90
	</modules>
91

  
92
</project>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.mapcontrol/src/main/java/org/gvsig/fmap/mapcontrol/tools/Listeners/AttributeEditorBehavior.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.tools.Listeners;
24

  
25
import java.awt.Image;
26

  
27
import org.gvsig.fmap.mapcontrol.MapControl;
28
import org.gvsig.fmap.mapcontrol.tools.CompoundBehavior;
29
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
30
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
31

  
32

  
33
/**
34
 * @author fdiaz
35
 *
36
 */
37
public class AttributeEditorBehavior extends CompoundBehavior {
38

  
39
    AttributeEditorPointListener attributeEditorPointListener;
40

  
41
    /**
42
     * @param behaviors
43
     */
44
    public AttributeEditorBehavior(MapControl mapControl) {
45
        super(new Behavior[0]);
46
        this.attributeEditorPointListener =
47
            new AttributeEditorPointListener(mapControl);
48

  
49
        this.addMapBehavior(new PointBehavior(attributeEditorPointListener), true);
50

  
51
    }
52

  
53
    public Image getImageCursor() {
54
        return this.attributeEditorPointListener.getImageCursor();
55
    }
56

  
57
    public ToolListener getListener(){
58
        return this.attributeEditorPointListener;
59
    }
60

  
61
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.mapcontrol/src/main/java/org/gvsig/fmap/mapcontrol/tools/Listeners/AttributeEditorPointListener.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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

  
24
package org.gvsig.fmap.mapcontrol.tools.Listeners;
25

  
26
import java.awt.Dimension;
27
import java.awt.event.ComponentEvent;
28
import java.awt.event.ComponentListener;
29
import java.awt.event.InputEvent;
30
import java.awt.event.MouseEvent;
31

  
32
import javax.swing.JOptionPane;
33
import javax.swing.SwingUtilities;
34

  
35
import org.cresques.cts.IProjection;
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

  
39
import org.gvsig.featureform.swing.CreateJFeatureFormException;
40
import org.gvsig.featureform.swing.FeatureFormSwingLocator;
41
import org.gvsig.featureform.swing.FeatureFormSwingManager;
42
import org.gvsig.featureform.swing.JFeatureForm;
43
import org.gvsig.fmap.dal.exception.DataException;
44
import org.gvsig.fmap.dal.feature.FeatureQuery;
45
import org.gvsig.fmap.dal.feature.FeatureStore;
46
import org.gvsig.fmap.dal.feature.FeatureType;
47
import org.gvsig.fmap.geom.Geometry;
48
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
49
import org.gvsig.fmap.geom.Geometry.TYPES;
50
import org.gvsig.fmap.geom.GeometryLocator;
51
import org.gvsig.fmap.geom.GeometryManager;
52
import org.gvsig.fmap.geom.exception.CreateGeometryException;
53
import org.gvsig.fmap.geom.primitive.Circle;
54
import org.gvsig.fmap.geom.primitive.Point;
55
import org.gvsig.fmap.mapcontext.ViewPort;
56
import org.gvsig.fmap.mapcontext.layers.FLayer;
57
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
58
import org.gvsig.fmap.mapcontext.layers.vectorial.IntersectsGeometryEvaluator;
59
import org.gvsig.fmap.mapcontrol.MapControl;
60
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
61
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
62
import org.gvsig.tools.ToolsLocator;
63
import org.gvsig.tools.i18n.I18nManager;
64
import org.gvsig.tools.service.ServiceException;
65
import org.gvsig.tools.swing.api.ToolsSwingLocator;
66
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
67

  
68
/**
69
 * @author fdiaz
70
 *
71
 */
72
public class AttributeEditorPointListener extends AbstractPointListener implements ComponentListener{
73

  
74
    private static Logger logger = LoggerFactory.getLogger(AttributeEditorPointListener.class);
75

  
76
    public static final String ATTRIBUTE_EDITOR_TOOL_NAME = "attributeEditorTool";
77
    private static final String ATTRIBUTE_EDITOR_FORM_NAME = "attributeEditorForm";
78
    private MapControl mapControl;
79
    private JFeatureForm form;
80
    private FLyrVect currentLayer = null;
81
    /**
82
     * Radius as tolerance around the selected point, the area will be used to
83
     * look for information.
84
     */
85
    private static int TOL = 7;
86

  
87
    public AttributeEditorPointListener(MapControl mapControl,
88
        JFeatureForm form) {
89
        super();
90
        this.mapControl = mapControl;
91
        this.form = form;
92
    }
93

  
94
    public AttributeEditorPointListener(MapControl mapControl) {
95
        super();
96
        this.mapControl = mapControl;
97
    }
98

  
99
    private FLyrVect getLayer(){
100
        FLayer[] layers = mapControl.getMapContext().getLayers().getActives();
101
        if(layers==null || layers.length!=1){
102
            return null;
103
        }
104
        return (FLyrVect) layers[0];
105

  
106
    }
107

  
108
    public void point(PointEvent e) throws BehaviorException {
109
        MouseEvent mouseEvent = e.getEvent();
110
        if (((mouseEvent.getModifiersEx() & (InputEvent.CTRL_DOWN_MASK
111
            | InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK
112
            | InputEvent.ALT_GRAPH_DOWN_MASK | InputEvent.META_DOWN_MASK)) != 0) || !SwingUtilities.isLeftMouseButton(mouseEvent)) {
113
            return;
114
        }
115

  
116
        I18nManager i18nManager = ToolsLocator.getI18nManager();
117
        String layerName = "";
118
        try {
119
            FLyrVect layer = getLayer();
120
            if (layer == null) {
121
                String msg = i18nManager.getTranslation("There_is_no_one_and_only_one_active_layer");
122
                ToolsSwingLocator.getThreadSafeDialogsManager().messageDialog(
123
                    msg,
124
                    i18nManager.getTranslation("attribute_editor"),
125
                    JOptionPane.INFORMATION_MESSAGE);
126
                return;
127
            }
128
            if (layer != this.currentLayer) {
129
                if (this.currentLayer != null) {
130
                    if (this.form != null) {
131
                        this.form.saveChanges();
132
                    }
133
                }
134
                this.currentLayer = layer;
135
                if (this.form != null) {
136
                    FeatureStore featureStore =
137
                        this.currentLayer.getFeatureStore();
138
                    this.form.bind(featureStore);
139
                }
140
            }
141
            layerName = layer.getName();
142
            ViewPort vp = this.mapControl.getViewPort();
143
            Point point = vp.convertToMapPoint(e.getPoint());
144
            double tolerance = vp.toMapDistance(TOL);
145
            FeatureQuery query = null;
146
            query = queryByPoint(point, tolerance);
147
            if (query != null) {
148
                if (this.form == null) {
149
                    this.form = getForm();
150
                    this.form.showForm(MODE.TOOL);
151
                }
152
                this.form.setQuery(query);
153
            }
154
        } catch (Exception ex) {
155
            logger.warn("Can't show attribute information from point on the layer "+layerName, ex);
156
            String msg = i18nManager.getTranslation("Cant_show_attribute_information_for_layer_%1_on_point",new String[]{layerName});
157
            ToolsSwingLocator.getThreadSafeDialogsManager().messageDialog(
158
                msg,
159
                i18nManager.getTranslation("attribute_editor"),
160
                JOptionPane.WARNING_MESSAGE);
161
        }
162
    }
163

  
164
    private JFeatureForm getForm() throws CreateJFeatureFormException, ServiceException, DataException {
165
        if (this.form == null) {
166
            FeatureFormSwingManager swingManager =
167
                FeatureFormSwingLocator.getSwingManager();
168
                FeatureStore store = this.currentLayer.getFeatureStore();
169
                this.form = swingManager.createJFeatureForm(store);
170
                this.form.setPreferredSize(new Dimension(300, 200));
171
                this.form.asJComponent().setName(ATTRIBUTE_EDITOR_FORM_NAME);
172
                this.form.asJComponent().addComponentListener(this);
173
        }
174
        return this.form;
175
    }
176

  
177
    private FeatureQuery queryByPoint(Point point, double tol)
178
        throws CreateGeometryException, DataException {
179
        GeometryManager manager = GeometryLocator.getGeometryManager();
180
        Circle circle = (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
181
        circle.setPoints(point, tol);
182

  
183
        FeatureStore featureStore = this.currentLayer.getFeatureStore();
184
        FeatureQuery featureQuery = featureStore.createFeatureQuery();
185
        FeatureType featureType = featureStore.getDefaultFeatureType();
186
        String geomName = featureType.getDefaultGeometryAttributeName();
187
        featureQuery.setFeatureType(featureType);
188

  
189
        Geometry query_geo =
190
            this.currentLayer.transformToSourceCRS(circle, true);
191

  
192
        IProjection query_proj = this.currentLayer.getMapContext().getProjection();
193
        if (this.currentLayer.getCoordTrans() != null) {
194
            query_proj = this.currentLayer.getCoordTrans().getPOrig();
195
        }
196

  
197
        IntersectsGeometryEvaluator iee =
198
            new IntersectsGeometryEvaluator(query_geo, query_proj,
199
                featureStore.getDefaultFeatureType(), geomName);
200
        featureQuery.setFilter(iee);
201
        featureQuery.setAttributeNames(null);
202
        return featureQuery;
203
    }
204

  
205
    public void componentResized(ComponentEvent e) {
206
        // TODO Auto-generated method stub
207

  
208
    }
209

  
210
    public void componentMoved(ComponentEvent e) {
211
        // TODO Auto-generated method stub
212

  
213
    }
214

  
215
    public void componentShown(ComponentEvent e) {
216
        // TODO Auto-generated method stub
217

  
218
    }
219

  
220
    public void componentHidden(ComponentEvent e) {
221
        this.form = null;
222
    }
223

  
224
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.mapcontrol/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.attributeeditor</artifactId>
6
    <version>1.0.2</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.attributeeditor.mapcontrol</artifactId>
10
  <version>1.0.2</version>
11
  <name>org.gvsig.atributeeditor.mapcontrol</name>
12
  <dependencies>
13
  	<dependency>
14
  		<groupId>org.gvsig</groupId>
15
  		<artifactId>org.gvsig.fmap.control</artifactId>
16
  	</dependency>
17
  	<dependency>
18
  		<groupId>org.gvsig</groupId>
19
  		<artifactId>org.gvsig.featureform.swing.api</artifactId>
20
  	</dependency>
21
  	<dependency>
22
  		<groupId>org.gvsig</groupId>
23
  		<artifactId>org.gvsig.featureform.swing.impl</artifactId>
24
  	</dependency>
25
  </dependencies>
26
</project>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/buildNumber.properties
1
#Tue Jan 20 11:59:57 CET 2015
2
buildNumber=3
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2014 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<assembly>
27
  <id>gvsig-plugin-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>${project.artifactId}</baseDirectory>
32
  <includeBaseDirectory>true</includeBaseDirectory>
33
  <files>
34
    <file>
35
      <source>target/${project.artifactId}-${project.version}.jar</source>
36
      <outputDirectory>lib</outputDirectory>
37
    </file>
38
    <file>
39
      <source>target/package.info</source>
40
    </file>
41
  </files>
42

  
43
  <fileSets>
44
    <fileSet>
45
      <directory>src/main/resources-plugin</directory>
46
      <outputDirectory>.</outputDirectory>
47
    </fileSet>
48
  </fileSets>
49

  
50
  <dependencySets>
51
    <dependencySet>
52
      <useProjectArtifact>false</useProjectArtifact>
53
      <useTransitiveDependencies>false</useTransitiveDependencies>
54
      <outputDirectory>lib</outputDirectory>
55
      <includes>
56
        <include>org.gvsig:org.gvsig.featureform.swing.api</include>
57
        <include>org.gvsig:org.gvsig.featureform.swing.impl</include>
58
        <include>org.gvsig:org.gvsig.attributeeditor.mapcontrol</include>
59
      </includes>
60
    </dependencySet>
61
  </dependencySets>
62

  
63
</assembly>
64

  
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/src/main/java/org/gvsig/app/mainplugin/extension/AttributeEditorExtension.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.app.mainplugin.extension;
24

  
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27

  
28
import org.gvsig.andami.IconThemeHelper;
29
import org.gvsig.andami.plugins.Extension;
30
import org.gvsig.app.ApplicationLocator;
31
import org.gvsig.app.project.documents.view.ViewDocument;
32
import org.gvsig.app.project.documents.view.ViewManager;
33
import org.gvsig.app.project.documents.view.gui.IView;
34
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener;
35
import org.gvsig.fmap.mapcontext.layers.FLayer;
36
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
37
import org.gvsig.fmap.mapcontrol.MapControl;
38
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
39
import org.gvsig.fmap.mapcontrol.tools.Listeners.AttributeEditorBehavior;
40
import org.gvsig.fmap.mapcontrol.tools.Listeners.AttributeEditorPointListener;
41

  
42
/**
43
 * @author fdiaz
44
 *
45
 */
46
public class AttributeEditorExtension extends Extension {
47
    private static Logger logger = LoggerFactory.getLogger(
48
        AttributeEditorExtension.class);
49

  
50

  
51
    public void execute(String actionCommand) {
52

  
53
        if (actionCommand.compareToIgnoreCase("attribute-editor") != 0) {
54
            return;
55
        }
56

  
57
        IView vw = (IView) ApplicationLocator.getManager().getActiveComponent(ViewDocument.class);
58

  
59
        if (vw != null) {
60

  
61
            FLayer[] act_lyr = vw.getMapControl().getMapContext().getLayers().getActives();
62
            if (act_lyr == null || act_lyr.length != 1
63
                    || !(act_lyr[0] instanceof FLyrVect)) {
64
                //do nothing
65

  
66
            } else {
67

  
68
                FLyrVect lyr = (FLyrVect)act_lyr[0];
69
                MapControl mapControl = vw.getMapControl();
70
                if (!mapControl.hasTool(AttributeEditorPointListener.ATTRIBUTE_EDITOR_TOOL_NAME)){
71
//                    StatusBarListener sbl = new StatusBarListener(mapControl);
72

  
73
                    AttributeEditorBehavior attributeEditorBehavior = new AttributeEditorBehavior(mapControl);
74
//                    attributeEditorBehavior.addMapBehavior(new MouseMovementBehavior(sbl), false);
75
                    mapControl.addBehavior(AttributeEditorPointListener.ATTRIBUTE_EDITOR_TOOL_NAME, attributeEditorBehavior);
76
                }
77

  
78
                mapControl.setTool(AttributeEditorPointListener.ATTRIBUTE_EDITOR_TOOL_NAME);
79

  
80
            }
81
        }
82

  
83
    }
84

  
85
    public void initialize() {
86

  
87
        IconThemeHelper.registerIcon("action", "attribute-editor", this);
88
    }
89

  
90
    public boolean isEnabled() {
91

  
92
        /*
93
         * It's enabled if there is exactly one vector layer in the active view
94
         * and it has a selection
95
         */
96

  
97
        ViewDocument vw = actWin();
98

  
99
        if (vw != null) {
100

  
101
            FLayer[] act_lyr = vw.getMapContext().getLayers().getActives();
102
            if (act_lyr == null || act_lyr.length != 1
103
                    || !(act_lyr[0] instanceof FLyrVect)) {
104
                return false;
105

  
106
            } else {
107
                FLyrVect vect = (FLyrVect) act_lyr[0];
108
                if (!vect.isAvailable()) {
109
                    /*
110
                     * This can happen when opening a persisted project
111
                     * and there is a "slow" layer (GeoDB)
112
                     */
113
                    return false;
114
                }
115
                return true;
116
            }
117

  
118
        } else {
119
            return false;
120
        }
121
    }
122

  
123
    public boolean isVisible() {
124

  
125
        return actWin() != null;
126
    }
127

  
128

  
129
    /**
130
     * Gets active window
131
     * @return
132
     */
133
    private ViewDocument actWin() {
134
        return (ViewDocument) ApplicationLocator.getManager().getActiveDocument(ViewManager.TYPENAME);
135
    }
136
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
# Resource bundle texts for the Spanish language locale (es)
2
attribute_editor=Editor de atributos
3
error_saving_data_will_not_save=Se ha producido un error intentando guardar los datos. Los datos no se guardar\u00e1n.
4
cant_edit_the store_XstorenameX=No se ha podido poner en edici\u00f3n el store '%(storename)'
5
cant_get_the_associated_feature_to_index_XindexX=No se ha podido obtener la feature asociada al index '%(index)'
6
cant_update_the_feature_XindexX_in_the_store_XstorenameX=No se ha podido actualizar la feature '%(index)' en el store '%(storename)'
7
cant_finish_the_edition_of_the_store_XstorenameX=No se ha podido finalizar la edici\u00f3n del store '%(storename)'
8
There_is_no_one_and_only_one_active_layer=No hay una y solo una capa activa.
9
Cant_show_attribute_information_for_layer_%1_on_point=No se ha podido mostrar la informaci\u00f3n de los atributos de la capa %1 sobre este punto.
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
# Resource bundle texts for the English language locale (en)
2
attribute_editor=Attribute editor
3
error_saving_data_will_not_save=There was an error trying to save the data. The data will not be saved.
4
cant_edit_the store_XstorenameX=Can't edit the store '%(storename)'
5
cant_get_the_associated_feature_to_index_XindexX=Can't get the associated feature to index '%(index)'
6
cant_update_the_feature_XindexX_in_the_store_XstorenameX=Can't update the feature '%(index)' in the store '%(storename)'
7
cant_finish_the_edition_of_the_store_XstorenameX=Can't finish the edition of the store '%(storename)'
8
There_is_no_one_and_only_one_active_layer=There is no one and only one active layer
9
Cant_show_attribute_information_for_layer_%1_on_point=Can't show the attribute information for layer %1 on this point.
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2014
3
	gvSIG Association. This program is free software; you can redistribute it
4
	and/or modify it under the terms of the GNU General Public License as published
5
	by the Free Software Foundation; either version 3 of the License, or (at
6
	your option) any later version. This program is distributed in the hope that
7
	it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
8
	of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
9
	Public License for more details. You should have received a copy of the GNU
10
	General Public License along with this program; if not, write to the Free
11
	Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
12
	USA. For any additional information, do not hesitate to contact us at info
13
	AT gvsig.com, or visit our website www.gvsig.com. -->
14
<plugin-config>
15
	<depends plugin-name="org.gvsig.app.mainplugin" />
16
	<resourceBundle name="text" />
17
	<libraries library-dir="lib"/>
18
	<extensions>
19
		<extension
20
			class-name="org.gvsig.app.mainplugin.extension.AttributeEditorExtension"
21
			description="" active="true" priority="1">
22

  
23
			<action name="attribute-editor" label="attribute_editor"
24
				tooltip="attribute_editor" position="300300000" action-command="attribute-editor"
25
				icon="attribute-editor" accelerator="" />
26

  
27
			<menu name="attribute-editor" text="Layer/attribute_editor" position="600550100" action-command="attribute-editor"/>
28

  
29
			<tool-bar name="attribute-editor">
30
				<selectable-tool name="attribute-editor" />
31
			</tool-bar>
32

  
33
		</extension>
34
	</extensions>
35
</plugin-config>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/org.gvsig.attributeeditor.app.mainplugin/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.attributeeditor.app</artifactId>
6
    <version>1.0.2</version>
7
  </parent>
8
  <artifactId>org.gvsig.attributeeditor.app.mainplugin</artifactId>
9
  <name>org.gvsig.attributeeditor.app.mainplugin</name>
10

  
11
	<properties>
12
		<!-- Package info property values -->
13
		<!-- Default values in org.gvsig.desktop -->
14
		<gvsig.package.info.state>testing</gvsig.package.info.state>
15
		<gvsig.package.info.official>true</gvsig.package.info.official>
16
		<gvsig.package.info.name>Attribute editor</gvsig.package.info.name>
17
		<gvsig.package.info.categories>Vector</gvsig.package.info.categories>
18
		<gvsig.package.info.description>Attribute editor: provides a tool to edit the attributes of vector layers easily and quickly.</gvsig.package.info.description>
19
		<gvsig.package.info.dependencies>required: org.gvsig.app -ge 2.1.0</gvsig.package.info.dependencies>
20
		<gvsig.package.info.javaVM>j1_6</gvsig.package.info.javaVM>
21
		<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-attributeeditor/pool/</gvsig.package.info.poolURL>
22
	</properties>
23
  <dependencies>
24
    <dependency>
25
        <groupId>org.gvsig</groupId>
26
        <artifactId>org.gvsig.app.mainplugin</artifactId>
27
        <scope>compile</scope>
28
    </dependency>
29
    <dependency>
30
    	<groupId>org.gvsig</groupId>
31
    	<artifactId>org.gvsig.featureform.swing.api</artifactId>
32
    </dependency>
33
    <dependency>
34
    	<groupId>org.gvsig</groupId>
35
    	<artifactId>org.gvsig.featureform.swing.impl</artifactId>
36
    </dependency>
37
    <dependency>
38
    	<groupId>org.gvsig</groupId>
39
    	<artifactId>org.gvsig.attributeeditor.mapcontrol</artifactId>
40
    </dependency>
41
  </dependencies>
42
</project>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.attributeeditor.app/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
	<modelVersion>4.0.0</modelVersion>
3
	<parent>
4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.attributeeditor</artifactId>
6
		<version>1.0.2</version>
7
	</parent>
8
	<groupId>org.gvsig</groupId>
9
	<artifactId>org.gvsig.attributeeditor.app</artifactId>
10
	<version>1.0.2</version>
11
	<packaging>pom</packaging>
12
	<name>org.gvsig.attributeeditor.app</name>
13
	<modules>
14
		<module>org.gvsig.attributeeditor.app.mainplugin</module>
15
	</modules>
16

  
17
</project>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.featureform.swing.impl.FeatureFormSwingImplLibrary
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.impl/src/main/java/org/gvsig/featureform/swing/impl/DefaultFeatureFormSwingManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.featureform.swing.impl;
24

  
25
import org.gvsig.featureform.swing.CreateJFeatureFormException;
26
import org.gvsig.featureform.swing.FeatureFormSwingManager;
27
import org.gvsig.featureform.swing.JFeatureForm;
28
import org.gvsig.fmap.dal.exception.DataException;
29
import org.gvsig.fmap.dal.feature.FeatureQuery;
30
import org.gvsig.fmap.dal.feature.FeatureStore;
31
import org.gvsig.tools.exception.BaseException;
32
import org.gvsig.tools.service.ServiceException;
33

  
34

  
35
/**
36
 * @author fdiaz
37
 *
38
 */
39
public class DefaultFeatureFormSwingManager implements
40
FeatureFormSwingManager {
41

  
42
    public JFeatureForm createJFeatureForm(FeatureStore store) throws CreateJFeatureFormException {
43
        DefaultJFeatureForm form = new DefaultJFeatureForm();
44
        try {
45
            form.bind(store);
46
        } catch (ServiceException e) {
47
            throw new CreateJFeatureFormException(e);
48
        } catch (DataException e) {
49
            throw new CreateJFeatureFormException(e);
50
        }
51
        return form;
52
    }
53

  
54

  
55

  
56
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.impl/src/main/java/org/gvsig/featureform/swing/impl/DefaultJFeatureForm.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.featureform.swing.impl;
24

  
25
import java.awt.BorderLayout;
26
import java.awt.Dimension;
27
import java.util.Iterator;
28
import java.util.List;
29

  
30
import javax.swing.JComponent;
31
import javax.swing.JPanel;
32

  
33
import org.slf4j.Logger;
34
import org.slf4j.LoggerFactory;
35

  
36
import org.gvsig.featureform.swing.JFeatureForm;
37
import org.gvsig.fmap.dal.DALLocator;
38
import org.gvsig.fmap.dal.exception.DataException;
39
import org.gvsig.fmap.dal.feature.EditableFeature;
40
import org.gvsig.fmap.dal.feature.Feature;
41
import org.gvsig.fmap.dal.feature.FeatureQuery;
42
import org.gvsig.fmap.dal.feature.FeatureSelection;
43
import org.gvsig.fmap.dal.feature.FeatureStore;
44
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper;
45
import org.gvsig.tools.ToolsLocator;
46
import org.gvsig.tools.dynform.AbortActionException;
47
import org.gvsig.tools.dynform.DynFormLocator;
48
import org.gvsig.tools.dynform.DynFormManager;
49
import org.gvsig.tools.dynform.JDynForm;
50
import org.gvsig.tools.dynform.JDynFormSet;
51
import org.gvsig.tools.dynform.JDynFormSet.JDynFormSetListener;
52
import org.gvsig.tools.dynobject.DynObject;
53
import org.gvsig.tools.exception.BaseException;
54
import org.gvsig.tools.i18n.I18nManager;
55
import org.gvsig.tools.locator.LocatorException;
56
import org.gvsig.tools.service.ServiceException;
57
import org.gvsig.tools.swing.api.ToolsSwingLocator;
58
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
59
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
60

  
61
/**
62
 * @author fdiaz
63
 *
64
 */
65
public class DefaultJFeatureForm implements JFeatureForm, JDynFormSetListener{
66

  
67
    private static final Logger LOGGER = LoggerFactory
68
        .getLogger(DefaultJFeatureForm.class);
69

  
70
    private static final int PAGE_SIZE = 500;
71
    private JPanel panel;
72
    private JDynFormSet formset;
73
    private FeatureStore store;
74
    private FeaturePagingHelper ph;
75

  
76
    /**
77
     *
78
     */
79
    public DefaultJFeatureForm() {
80
        this.panel = new JPanel(new BorderLayout());
81
    }
82

  
83
    /*
84
     * (non-Javadoc)
85
     *
86
     * @see
87
     * org.gvsig.attributeeditor.swing.JFeatureForm#setPreferredSize(java.awt
88
     * .Dimension)
89
     */
90
    public void setPreferredSize(Dimension dimension) {
91
        panel.setPreferredSize(dimension);
92
    }
93

  
94
    public JComponent asJComponent() {
95
        return this.panel;
96
    }
97

  
98
    /*
99
     * (non-Javadoc)
100
     *
101
     * @see
102
     * org.gvsig.attributeeditor.swing.JFeatureForm#bind(org.gvsig.fmap.dal.
103
     * feature.FeatureStore)
104
     */
105
    public void bind(FeatureStore store) throws ServiceException, DataException {
106
        if (this.store == store) {
107
            return;
108
        }
109

  
110
        if (formset != null) {
111
            this.panel.remove(formset.asJComponent());
112
            this.formset = null;
113
        }
114
        this.store = store;
115
        this.ph = null;
116
    }
117

  
118
    private JDynFormSet getFormset() throws ServiceException, DataException{
119
        if (this.formset == null){
120
            DynFormManager formManager = DynFormLocator.getDynFormManager();
121
            this.formset = formManager.createJDynFormSet(store.getDefaultFeatureType());
122

  
123
            this.formset.setLayoutMode(JDynForm.USE_SEPARATORS);
124
            this.formset.setReadOnly(false);
125
            this.formset.setAllowClose(true);
126
            this.formset.setAllowDelete(false);
127
            this.formset.setAllowNew(false);
128
            this.formset.setAllowSearch(false);
129
            this.formset.setAllowUpdate(true);
130
            this.formset.setAutosave(true);
131

  
132
            this.formset.addListener(this);
133
        }
134
        return this.formset;
135
    }
136

  
137
    /*
138
     * (non-Javadoc)
139
     *
140
     * @see
141
     * org.gvsig.attributeeditor.swing.JFeatureForm#setQuery(org.gvsig.fmap.
142
     * dal.feature.FeatureQuery)
143
     */
144
    public void setQuery(FeatureQuery query) throws LocatorException,
145
        BaseException {
146
        if (this.ph != null) {
147
            if (this.formset != null && this.formset.isAutosave()
148
                && this.formset.countValues() > 0) {
149
                if (!store.isEditing()) {
150
                    try {
151
                        store.edit();
152
                    } catch (DataException e1) {
153
                        throw new StoreEditException(e1, store.getName());
154
                    }
155
                }
156
                saveChanges(this.formset);
157
            }
158
        }
159
        if (this.formset == null){
160
            this.formset = getFormset();
161
            this.panel.add(this.formset.asJComponent(),BorderLayout.CENTER);
162
        }
163
        this.ph =
164
            DALLocator.getDataManager().createFeaturePagingHelper(store, query,
165
                PAGE_SIZE);
166
        FeatureSelection selection = (FeatureSelection) store.getSelection();
167
        selection.deselectAll();
168
        List<?> features = ph.asList();
169
        for (Iterator<?> iterator = features.iterator(); iterator.hasNext();) {
170
            Feature feature = (Feature) iterator.next();
171
            selection.select(feature);
172
        }
173
        if (features.size()>0) {
174
            this.showForm(MODE.TOOL);
175
        }
176

  
177
        this.formset.setValues(ph.asListOfDynObjects());
178
        this.formset.setReadOnly(false);
179
    }
180

  
181
    /*
182
     * (non-Javadoc)
183
     *
184
     * @see org.gvsig.attributeeditor.swing.JFeatureForm#showForm()
185
     */
186
    public void showForm(MODE mode) throws ServiceException, DataException {
187
        if (this.formset == null) {
188
            this.formset = getFormset();
189
            this.panel.add(this.formset.asJComponent(),BorderLayout.CENTER);
190
            WindowManager winmgr = ToolsSwingLocator.getWindowManager();
191
            winmgr.showWindow(panel, store.getName(), mode);
192
        }
193
        this.panel.setVisible(true);
194

  
195
    }
196

  
197
    public void formMessage(String message) {
198
        // TODO Auto-generated method stub
199

  
200
    }
201

  
202
    public void formClose() {
203
        this.panel.setVisible(false);
204
    }
205

  
206
    public void formMovedTo(int currentPosition) throws AbortActionException {
207
        LOGGER.info("formMovedTo " + currentPosition);
208
    }
209

  
210
    class StoreEditException extends AbortActionException {
211

  
212
        /**
213
         *
214
         */
215
        private static final long serialVersionUID = -7682017811778577130L;
216

  
217
        public StoreEditException(Throwable cause, String storename) {
218
            super("Can't edit the store '%(storename)'", cause,
219
                "cant_edit_the store_XstorenameX", serialVersionUID);
220
            setValue("storename", storename);
221
        }
222
    }
223

  
224
    public void formBeforeSave(JDynFormSet dynformSet)
225
        throws AbortActionException {
226
        LOGGER.info("formBeforeSave");
227
        if (!store.isEditing()) {
228
            try {
229
                store.edit();
230
            } catch (DataException e1) {
231
                throw new StoreEditException(e1, store.getName());
232
            }
233
        }
234
    }
235

  
236
    public void formBeforeNew(JDynFormSet dynformSet)
237
        throws AbortActionException {
238
        LOGGER.info("formBeforeNew");
239
    }
240

  
241
    public void formBeforeDelete(JDynFormSet dynformSet)
242
        throws AbortActionException {
243
        LOGGER.info("formBeforeDelete");
244
    }
245

  
246
    class GetFeatureException extends AbortActionException {
247

  
248
        /**
249
         *
250
         */
251
        private static final long serialVersionUID = -3545660152672760731L;
252

  
253
        public GetFeatureException(Throwable cause, int index) {
254
            super("Can't get the associated feature to index '%(index)'",
255
                cause, "cant_get_the_associated_feature_to_index_XindexX",
256
                serialVersionUID);
257
            setValue("index", index);
258
        }
259
    }
260

  
261
    class UpdateFeatureException extends AbortActionException {
262

  
263
        /**
264
         *
265
         */
266
        private static final long serialVersionUID = 6473287361543242618L;
267

  
268
        public UpdateFeatureException(Throwable cause, int index,
269
            String storename) {
270
            super(
271
                "Can't update the feature '%(index)' in the store '%(storename)'",
272
                cause,
273
                "cant_update_the_feature_XindexX_in_the_store_XstorenameX",
274
                serialVersionUID);
275
            setValue("storename", storename);
276
            setValue("index", index);
277
        }
278
    }
279

  
280
    public void formAfterSave(JDynFormSet dynformSet)
281
        throws AbortActionException {
282

  
283
        LOGGER.info("formAfterSave");
284
        saveChanges(dynformSet);
285
    }
286

  
287
    private void saveChanges(JDynFormSet dynformSet)
288
        throws AbortActionException {
289
        int index = dynformSet.getCurrentIndex();
290
        DynObject dynObject = dynformSet.get(index);
291
        dynformSet.getFormValues(dynObject);
292
        Feature feat = store.getFeature(dynObject);
293
        if (feat == null) {
294
            LOGGER.warn("Can't get the associated feature index " + index);
295
            I18nManager i18nManager = ToolsLocator.getI18nManager();
296
            dynformSet.message(i18nManager
297
                .getTranslation("error_saving_data_will_not_save"));
298
            throw new GetFeatureException(null, index);
299
        }
300

  
301
        try {
302
            ph.update((EditableFeature) feat);
303
        } catch (BaseException e) {
304
            throw new UpdateFeatureException(null, index, store.getName());
305
        }
306
    }
307

  
308
    public void saveChanges() throws BaseException {
309
        if (this.formset != null && this.formset.countValues() > 0 ) {
310
            if (store != null && !store.isEditing()) {
311
                try {
312
                    store.edit();
313
                } catch (DataException e1) {
314
                    LOGGER.warn("Can't edit the store " + store.getName());
315
                    throw new StoreEditException(e1, store.getName());
316
                }
317
            }
318
            this.saveChanges(this.formset);
319
        }
320
    }
321

  
322
    public void formAfterNew(JDynFormSet dynformSet)
323
        throws AbortActionException {
324
        LOGGER.info("formAfterNew");
325
    }
326

  
327
    public void formAfterDelete(JDynFormSet dynformSet)
328
        throws AbortActionException {
329
        LOGGER.info("formAfterDelete");
330
    }
331

  
332
    public void formBeforeSearch(JDynFormSet dynformSet)
333
        throws AbortActionException {
334
        LOGGER.info("formBeforeSearch");
335
    }
336

  
337
    public void formAfterSearch(JDynFormSet dynformSet)
338
        throws AbortActionException {
339
        LOGGER.info("formAfterSearch");
340
    }
341

  
342
    public long getDataSetSize() {
343
        if (this.ph != null) {
344
            return ph.getTotalSize();
345
        }
346
        return 0;
347
    }
348

  
349

  
350
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.impl/src/main/java/org/gvsig/featureform/swing/impl/FeatureFormSwingImplLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.featureform.swing.impl;
24

  
25
import org.gvsig.featureform.swing.FeatureFormSwingLibrary;
26
import org.gvsig.featureform.swing.FeatureFormSwingLocator;
27
import org.gvsig.tools.library.AbstractLibrary;
28
import org.gvsig.tools.library.LibraryException;
29

  
30

  
31
/**
32
 * @author fdiaz
33
 *
34
 */
35
public class FeatureFormSwingImplLibrary extends AbstractLibrary {
36

  
37
    /**
38
     *
39
     */
40
    public FeatureFormSwingImplLibrary() {
41
        // TODO Auto-generated constructor stub
42
    }
43

  
44
    @Override
45
    public void doRegistration() {
46
        super.doRegistration();
47
        registerAsImplementationOf(FeatureFormSwingLibrary.class);
48
    }
49

  
50

  
51
    /* (non-Javadoc)
52
     * @see org.gvsig.tools.library.AbstractLibrary#doInitialize()
53
     */
54
    @Override
55
    protected void doInitialize() throws LibraryException {
56
        FeatureFormSwingLocator.registerSwingManager(DefaultFeatureFormSwingManager.class);
57
    }
58

  
59
    /* (non-Javadoc)
60
     * @see org.gvsig.tools.library.AbstractLibrary#doPostInitialize()
61
     */
62
    @Override
63
    protected void doPostInitialize() throws LibraryException {
64
        // TODO Auto-generated method stub
65

  
66
    }
67

  
68
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.impl/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.featureform.swing</artifactId>
6
    <version>1.0.2</version>
7
  </parent>
8
  <artifactId>org.gvsig.featureform.swing.impl</artifactId>
9
  <name>org.gvsig.attributeeditor.swing.impl</name>
10
  <dependencies>
11
  	<dependency>
12
  		<groupId>org.gvsig</groupId>
13
  		<artifactId>org.gvsig.featureform.swing.api</artifactId>
14
  	</dependency>
15
  	<dependency>
16
  		<groupId>org.gvsig</groupId>
17
  		<artifactId>org.gvsig.tools.dynform.api</artifactId>
18
  	</dependency>
19

  
20
  </dependencies>
21
  <version>1.0.2</version>
22
  <groupId>org.gvsig</groupId>
23
</project>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
	<modelVersion>4.0.0</modelVersion>
3
	<parent>
4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.attributeeditor</artifactId>
6
		<version>1.0.2</version>
7
	</parent>
8
	<groupId>org.gvsig</groupId>
9
	<artifactId>org.gvsig.featureform.swing</artifactId>
10
	<version>1.0.2</version>
11
	<name>org.gvsig.featureform.swing</name>
12
	<packaging>pom</packaging>
13

  
14
	<modules>
15
		<module>org.gvsig.featureform.swing.api</module>
16
		<module>org.gvsig.featureform.swing.impl</module>
17
	</modules>
18

  
19
</project>
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.api/src/main/java/org/gvsig/featureform/swing/FeatureFormSwingManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.featureform.swing;
24

  
25
import org.gvsig.fmap.dal.feature.FeatureStore;
26

  
27
/**
28
 * @author fdiaz
29
 *
30
 */
31
public interface FeatureFormSwingManager {
32

  
33
    public JFeatureForm createJFeatureForm(FeatureStore store) throws CreateJFeatureFormException;
34

  
35
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.api/src/main/java/org/gvsig/featureform/swing/JFeatureForm.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.featureform.swing;
24

  
25
import java.awt.Dimension;
26

  
27
import javax.swing.JComponent;
28

  
29
import org.gvsig.fmap.dal.exception.DataException;
30
import org.gvsig.fmap.dal.feature.FeatureQuery;
31
import org.gvsig.fmap.dal.feature.FeatureStore;
32
import org.gvsig.tools.exception.BaseException;
33
import org.gvsig.tools.locator.LocatorException;
34
import org.gvsig.tools.service.ServiceException;
35
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
36

  
37
/**
38
 * @author fdiaz
39
 *
40
 */
41
public interface JFeatureForm {
42

  
43
    public void setPreferredSize(Dimension dimension);
44

  
45
    public void bind(FeatureStore store) throws ServiceException, DataException;
46

  
47
    public void setQuery(FeatureQuery query) throws LocatorException, BaseException;
48

  
49
    public long getDataSetSize();
50

  
51
    public void showForm(MODE mode) throws ServiceException, DataException;
52

  
53
    public JComponent asJComponent();
54

  
55
    public void saveChanges() throws BaseException;
56

  
57

  
58
}
org.gvsig.attributeeditor/tags/org.gvsig.attributeeditor-1.0.2/org.gvsig.featureform.swing/org.gvsig.featureform.swing.api/src/main/java/org/gvsig/featureform/swing/FeatureFormSwingLocator.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2014 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.featureform.swing;
24

  
25
import org.gvsig.tools.locator.BaseLocator;
26

  
27

  
28
/**
29
 * @author fdiaz
30
 *
31
 */
32
public class FeatureFormSwingLocator  extends BaseLocator{
33

  
34
    /**
35
     * AttributeEditor swing manager name.
36
     */
37
    public static final String SWING_MANAGER_NAME =
38
        "AttributeEditor.swing.manager";
39

  
40
    /**
41
     * AttributeEditor swing manager description.
42
     */
43
    public static final String SWING_MANAGER_DESCRIPTION =
44
        "AttributeEditor UIManager";
45

  
46
    private static final String LOCATOR_NAME = "AttributeEditor.swing.locator";
47

  
48
    /**
49
     * Unique instance.
50
     */
51
    private static final FeatureFormSwingLocator INSTANCE =
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff