Revision 38672

View differences:

tags/v2_0_0_Build_2050/libraries/libFMap_controls/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
6
                      
7
	<modelVersion>4.0.0</modelVersion>
8
	<artifactId>org.gvsig.fmap.control</artifactId>
9
	<packaging>jar</packaging>
10
	<version>2.0-SNAPSHOT</version>
11
	<name>libFMap_controls</name>
12
	<parent>
13
		<groupId>org.gvsig</groupId>
14
		<artifactId>gvsig-base-library-pom</artifactId>
15
		<version>2.0-SNAPSHOT</version>
16
	</parent>	
17
	<properties>
18
		<build-dir>${basedir}/../build</build-dir>
19
        <eclipse.project.name>libFMap_controls</eclipse.project.name>
20
	</properties>
21
	<dependencies>
22
        <dependency>
23
            <groupId>org.gvsig</groupId>
24
            <artifactId>org.gvsig.tools.lib</artifactId>
25
            <scope>compile</scope>
26
        </dependency>
27
        <dependency>
28
            <groupId>org.gvsig</groupId>
29
            <artifactId>org.gvsig.tools.swing.api</artifactId>
30
            <scope>compile</scope>
31
        </dependency>
32
        <dependency>
33
            <groupId>org.gvsig</groupId>
34
            <artifactId>org.gvsig.tools.swing.impl</artifactId>
35
            <scope>runtime</scope>
36
        </dependency>
37
        <dependency>
38
            <groupId>org.gvsig</groupId>
39
            <artifactId>org.gvsig.tools.swing.spi</artifactId>
40
            <scope>compile</scope>
41
        </dependency>
42
        <dependency>
43
            <groupId>org.gvsig</groupId>
44
            <artifactId>org.gvsig.tools.swing.serv.field</artifactId>
45
            <scope>runtime</scope>
46
        </dependency>
47
        <dependency>
48
            <groupId>org.gvsig</groupId>
49
            <artifactId>org.gvsig.tools.swing.serv.jform</artifactId>
50
            <scope>runtime</scope>
51
        </dependency>
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.tools.swing.serv.jlist</artifactId>
55
            <scope>runtime</scope>
56
        </dependency>
57
		<dependency>
58
			<groupId>org.gvsig</groupId>
59
			<artifactId>org.gvsig.utils</artifactId>
60
            <scope>compile</scope>
61
		</dependency>
62
		<dependency>
63
			<groupId>org.gvsig</groupId>
64
			<artifactId>org.gvsig.fmap.dal</artifactId>
65
            <scope>compile</scope>
66
		</dependency>
67
        <dependency>
68
            <groupId>org.gvsig</groupId>
69
            <artifactId>org.gvsig.fmap.geometry</artifactId>
70
            <scope>compile</scope>
71
        </dependency>        
72
        <dependency>
73
            <groupId>org.gvsig</groupId>
74
            <artifactId>org.gvsig.fmap.geometry</artifactId>
75
            <classifier>operation</classifier>
76
            <scope>compile</scope>
77
        </dependency>
78
        <dependency>
79
            <groupId>org.gvsig</groupId>
80
            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
81
            <scope>compile</scope>
82
        </dependency>        
83
        <dependency>
84
            <groupId>org.gvsig</groupId>
85
            <artifactId>org.gvsig.projection</artifactId>
86
            <scope>compile</scope>
87
        </dependency>
88
		<dependency>
89
    		<!-- TODO: remove -->
90
			<groupId>org.gvsig</groupId>
91
			<artifactId>org.gvsig.fmap.dal</artifactId>
92
			<classifier>impl</classifier>
93
            <scope>compile</scope>
94
		</dependency>
95
		<dependency>
96
			<groupId>org.gvsig</groupId>
97
			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
98
            <scope>compile</scope>
99
		</dependency>
100
		<dependency>
101
			<groupId>org.gvsig</groupId>
102
			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
103
			<classifier>operation</classifier>
104
            <scope>compile</scope>
105
		</dependency>
106
		<dependency>
107
			<groupId>org.gvsig</groupId>
108
			<artifactId>org.gvsig.tools.lib</artifactId>
109
			<type>test-jar</type>
110
			<scope>test</scope>
111
		</dependency>
112
        <dependency>
113
            <groupId>org.gvsig</groupId>
114
            <artifactId>org.gvsig.i18n</artifactId>
115
            <scope>compile</scope>
116
        </dependency>
117
        <dependency>
118
            <groupId>org.slf4j</groupId>
119
            <artifactId>slf4j-api</artifactId>
120
            <scope>compile</scope>
121
        </dependency>
122
        <dependency>
123
            <groupId>com.vividsolutions</groupId>
124
            <artifactId>jts</artifactId>
125
            <scope>compile</scope>
126
        </dependency>
127
        <dependency>
128
            <groupId>org.gvsig</groupId>
129
            <artifactId>org.gvsig.tools.swing.api</artifactId>
130
            <scope>compile</scope>
131
        </dependency>
132
		<!-- TODO: uncomment when mapcontexts tests work again 
133
		<dependency>
134
			<groupId>org.gvsig</groupId>
135
			<artifactId>org.gvsig.fmap.mapcontext</artifactId>
136
            <type>test-jar</type>
137
			<scope>test</scope>
138
		</dependency>
139
		 -->
140
	    <dependency>
141
            <groupId>org.gvsig</groupId>
142
            <artifactId>org.gvsig.timesupport.lib.api</artifactId>
143
            <scope>compile</scope>
144
        </dependency>
145
	</dependencies>
146
	<build>
147
		<sourceDirectory>src</sourceDirectory>
148
		<testSourceDirectory>src-test</testSourceDirectory>
149
		<resources>
150
			<resource>
151
				<filtering>false</filtering>
152
				<directory>${basedir}/resources</directory>
153
			</resource>
154
		</resources>
155

  
156
		<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
157
		<plugins>
158
			<plugin>
159
				<groupId>org.apache.maven.plugins</groupId>
160
				<artifactId>maven-surefire-plugin</artifactId>
161
				<configuration>
162
					<skipTests>true</skipTests>
163
				</configuration>
164
			</plugin>
165
      		<plugin>
166
				<groupId>org.apache.maven.plugins</groupId>
167
				<artifactId>maven-compiler-plugin</artifactId>
168
				<configuration>
169
					<testExcludes>
170
						<exclude>**</exclude>
171
					</testExcludes>
172
				</configuration>
173
			</plugin>		
174
		</plugins>
175
	</build>
176
</project>
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_ca.properties
1
registros_seleccionados_total=Total registres seleccionats
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_pt.properties
1
registros_seleccionados_total=Total de registos seleccionados
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_cs.properties
1
registros_seleccionados_total=Celkem zvolen\u00fdch z\u00e1znam\u016f
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_fr.properties
1
registros_seleccionados_total=Total registres s\u00e9lectionn\u00e9s
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_de.properties
1
registros_seleccionados_total=Alle ausgew\u00e4hlten register
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_eu.properties
1
registros_seleccionados_total=Hautatutako erregistroak guztira
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_it.properties
1
registros_seleccionados_total=Totale registri selezionati
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text.properties
1
Visible=Visible
2
Nombre=Nombre
3
Alias=Alias
4

  
5
Error_editar_geometria=Error al editar la geometr?a
6
Geometria_no_editable_WKT=Geometr?a no editable en formato WKT, valor demasiado grande.
7

  
8
geometry_to_wkt_exception=Error al convertir la geometr?a de la celda a formato WKT
9
features_data_reload_exception=Error al recargar los fen?menos (features)
10
get_feature_at_exception=Error al obtener el fen?meno de la fila = %(rowIndex)
11
get_row_count_exception=Error al obtener el n?mero total de filas en la tabla
12
set_feature_value_exception=Error al establecer el valor de la celda en la fila = %(rowIndex) y columna = %(columnIndex) con el valor = %(value)
13
wkt_to_geometry_exception=Error al convertir a geometr?a el valor en WKT: %(wkt)
14
table_selection_change_exception=Error al cambiar la selecci?n en la tabla de fen?menos (features)
15

  
16
registros_seleccionados_total=Total registros seleccionados
17
up=Subir
18
down=Bajar
19
remove=Eliminar
20

  
21
_Invalid_value=Valor no v?lido
22
_Unable_to_show_value=No se ha podido mostrar valor
23
_Show_as_text=Mostrar como texto
24

  
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_zh.properties
1
registros_seleccionados_total=\u5df2\u9009\u5b9a\u8bb0\u5f55\u603b\u6570
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_en.properties
1
Visible=Visible
2
Nombre=Name
3
Alias=Alias
4

  
5
Error_editar_geometria=Error while editing the geometry
6
Geometria_no_editable_WKT=Geometry not editable on WKT format, text value too big.
7

  
8
geometry_to_wkt_exception=Error getting the geometry value of the cell as WKT
9
features_data_reload_exception=Error reloading the features
10
get_feature_at_exception=Error getting the feature at row = %(rowIndex)
11
get_row_count_exception=Error getting the total table row count
12
set_feature_value_exception=Error setting the value of the cell at row = %(rowIndex) and column = %(columnIndex) with the value = %(value)
13
wkt_to_geometry_exception=Error getting the geometry value of the WKT value %(wkt)
14
table_selection_change_exception=Error while changing the selection on the list of Features
15

  
16
registros_seleccionados_total=Total of selected records
17
up=Up
18
down=Down
19

  
20
_Invalid_value=Invalid Value
21
_Unable_to_show_value=Unable to show value
22
_Show_as_text=Show as text
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/org/gvsig/fmap/mapcontrol/i18n/text_gl.properties
1
registros_seleccionados_total=Total rexistros seleccionados
tags/v2_0_0_Build_2050/libraries/libFMap_controls/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.fmap.mapcontrol.MapControlLibrary
2
org.gvsig.fmap.mapcontrol.impl.DefaultMapControlLibrary
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src-test/org/gvsig/fmap/mapcontrol/tools/AreaListenerTest.java
1
package org.gvsig.fmap.mapcontrol.tools;
2

  
3
import java.awt.geom.Point2D;
4

  
5
import org.cresques.cts.IProjection;
6
import org.gvsig.fmap.crs.CRSFactory;
7
import org.gvsig.fmap.mapcontext.MapContext;
8
import org.gvsig.fmap.mapcontext.ViewPort;
9
import org.gvsig.fmap.mapcontrol.MapControl;
10
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
11

  
12

  
13
public class AreaListenerTest extends AbstractLibraryAutoInitTestCase {
14
	private IProjection projectionUTM = CRSFactory.getCRS("EPSG:23030");
15
	private IProjection projectionGeo = CRSFactory.getCRS("EPSG:4230");
16
		
17
	@Override
18
	protected void doSetUp() throws Exception {
19
		// Nothing to do	
20
	}
21

  
22
	public void test1() {
23
		AreaListenerImpl areaListenerUTM=new AreaListenerImpl(newMapControlUTM());
24
		AreaListenerImpl areaListenerGeo=new AreaListenerImpl(newMapControlGeo());
25
		Double[] xsUTM=new Double[] {new Double(731292),new Double(731901),new Double(730138)};
26
		Double[] ysUTM=new Double[] {new Double(4351223),new Double(4350768),new Double(4349232)};
27
		double areaUTM=areaListenerUTM.returnCoordsArea(xsUTM,ysUTM,new Point2D.Double(730138,4349232));
28
		Double[] xsGeo=new Double[] {new Double(-0.31888183),new Double(-0.31173131),new Double(-0.33268401)};
29
		Double[] ysGeo=new Double[] {new Double(39.27871741),new Double(39.27464327),new Double(39.26117368)};
30
		double areaGeo=areaListenerGeo.returnGeoCArea(xsGeo,ysGeo,new Point2D.Double(-0.33268401,39.26117368));
31
		assertTrue("Area UTM igual a Geo",areaUTM<(areaGeo+1000)&& areaUTM>(areaGeo-1000));
32
	}
33
	private MapControl newMapControlUTM() {
34
		ViewPort vp = new ViewPort(projectionUTM);
35
		MapControl mc=new MapControl();
36
		mc.setMapContext(new MapContext(vp));
37
		return mc;
38
	}
39
	private MapControl newMapControlGeo() {
40
		ViewPort vp = new ViewPort(projectionGeo);
41
		MapControl mc=new MapControl();
42
		mc.setMapContext(new MapContext(vp));
43
		return mc;
44
	}
45
}
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src/org/gvsig/app/gui/JComboBoxUnits.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.app.gui;
42

  
43
import org.gvsig.fmap.mapcontext.MapContext;
44
import org.gvsig.i18n.Messages;
45
import org.gvsig.utils.swing.JComboBox;
46

  
47

  
48
/**
49
 * <p>Class representing a JComboBox with the measure units handled by the application.
50
 * It takes values from Attributes.NAMES and Attributes.CHANGE static fields. So, to
51
 * add more measure units, you must edit Attributes class and change will be automatically
52
 * reflected in the combo box.</p>
53
 *
54
 * <p>The internatiolanization of the field is automatically handled by the system</p>
55
 * @author jaume dominguez faus - jaume.dominguez@iver.es
56
 */
57
public class JComboBoxUnits extends JComboBox {
58
	private static final long serialVersionUID = 8015263853737441433L;
59

  
60
	/**
61
	 * Creates a new instance of JUnitComboBox including "pixel" units and
62
	 * setting them as automatically pre-selected.
63
	 */
64
	public JComboBoxUnits() {
65
		this(true);
66
	}
67

  
68
	/**
69
	 *
70
	 * Creates a new instance of JUnitComboBox. If includePixel is true
71
	 * then pixel units are included in the list and they are automatically
72
	 * pre-selected. Otherwise, meters are preselected.
73
	 *
74
	 */
75
	public JComboBoxUnits(boolean includePixel) {
76
		super();
77
		String[] names=MapContext.getDistanceNames();
78

  
79
		for (int i = 0; i < names.length; i++) {
80
			super.addItem(Messages.getText(names[i]));
81
		}
82
		if (includePixel) {
83
			super.addItem(Messages.getText("pixels"));
84
			setSelectedItem(Messages.getText("pixels"));
85
		} else {
86
			setSelectedIndex(1);
87
		}
88
		setMaximumRowCount(10);
89
	}
90

  
91

  
92
	/**
93
	 * Returns the conversion factor from the <b>unit selected in the combo box</b>
94
	 * to <b>meters</b> or <b>0</b> if pixels have been selected as the size unit.
95
	 * @return
96
	 */
97
	public double getUnitConversionFactor() {
98
			double unitFactor;
99
			try {
100
				unitFactor = MapContext.getDistanceTrans2Meter()[getSelectedIndex()];
101
			} catch (ArrayIndexOutOfBoundsException aioobEx) { //jijiji
102
				unitFactor = 0; // which represents size in pixel
103
			}
104
			return unitFactor;
105

  
106
	}
107

  
108
	/**
109
	 * the use of this method is not allowed in this combo box.
110
	 * @deprecated
111
	 */
112
	public void addItem(Object anObject) {
113
		throw new Error("Operation not allowed");
114
	}
115

  
116
	/**
117
	 * the use of this method is not allowed for this combo box.
118
	 * @deprecated
119
	 */
120
	public void removeAllItems() {
121
		throw new Error("Operation not allowed");
122
	}
123

  
124
	public int getSelectedUnitIndex() {
125
		int i = getSelectedIndex();
126
		if (i>MapContext.getDistanceNames().length-1)
127
			return -1;
128
		else return i;
129
	}
130

  
131
	public void setSelectedUnitIndex(int unitIndex) {
132
		if (unitIndex == -1) {
133
			setSelectedIndex(getItemCount()-1);
134
		} else {
135
			setSelectedIndex(unitIndex);
136
		}
137
	}
138

  
139

  
140

  
141
}
0 142

  
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src/org/gvsig/fmap/IconThemeHelper.java
1
package org.gvsig.fmap;
2

  
3
import java.awt.Image;
4

  
5
import javax.swing.ImageIcon;
6

  
7
import org.gvsig.tools.swing.api.ToolsSwingLocator;
8
import org.gvsig.tools.swing.icontheme.IconTheme;
9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11

  
12
public class IconThemeHelper {
13

  
14
	private static Logger logger = LoggerFactory.getLogger(IconThemeHelper.class);
15
	
16
	public static void registerIcon(String group, String name, Object obj) {
17
		String resourceName;
18
		ClassLoader loader;
19
		IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent();
20
		if( group == null || group.trim().length()==0 ) {
21
			resourceName = "images/"+name+".png";
22
		} else {
23
			resourceName = "images/"+group+"/"+name+".png";
24
		}
25
		if( obj instanceof Class ) {
26
			loader = ((Class) obj).getClassLoader();
27
		} else {
28
			loader = obj.getClass().getClassLoader();
29
		}
30
		try {
31
			iconTheme.registerDefault("mapcontrol", group, name, null, loader.getResource(resourceName));
32
		} catch( Throwable e) {
33
			logger.info(e.getMessage());
34
		}
35
	}
36

  
37
	public static ImageIcon getImageIcon(String iconName) {
38
		IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent();
39
		return iconTheme.get(iconName);
40
	}
41
	
42
	public static Image getImage(String iconName) {
43
		IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent();
44
		return iconTheme.get(iconName).getImage();
45
	}
46
}
0 47

  
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/PrimitivesDrawer.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.fmap.mapcontrol;
29

  
30
import java.awt.Color;
31
import java.awt.Graphics;
32

  
33
/**
34
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
35
 */
36
public interface PrimitivesDrawer {
37
	
38
	/**
39
	 * This method is used to start a drawing process that needs to 
40
	 * be synchronized.
41
	 * @param obj
42
	 * The object that locks the resource.
43
	 * @throws InterruptedException
44
	 */
45
	public void startDrawing(Object obj) throws InterruptedException;
46
	
47
	/**
48
	 * This method is used to finish a drawing process that needs to 
49
	 * be synchronized. 
50
	 * @param obj
51
	 * The object that has locked the resource.
52
	 */
53
	public void stopDrawing(Object obj);
54
	
55
	/**
56
	 * This method sets the <code>Graphics</code> where the 
57
	 * <code>Drawer</code> has to draw all the objects. 
58
	 * @param graphics
59
	 * The component where the new objects has to be drawn. 
60
	 */
61
	public void setGraphics(Graphics graphics);
62
	
63
	/**
64
	 * Sets the color that is used to draw the objects that don't 
65
	 * have a symbol.
66
	 * @param color
67
	 * The color to use on the drawing operations.
68
	 */
69
	public void setColor(Color color);
70
		
71
	/**
72
	 * It draws a rectangle on the map using the color 
73
	 * specified using the {@link #setColor(Color)} method. 
74
	 * @param x
75
	 * The minimum X coordinate.
76
	 * @param y
77
	 * The minimum Y coordinate.
78
	 * @param width
79
	 * The rectangle width.
80
	 * @param height
81
	 * The rectangle height.
82
	 */
83
	public void drawRect(int x, int y, int width, int height);
84
		
85
	/**
86
	 * It fills a rectangle on the map using the color 
87
	 * specified using the {@link #setColor(Color)} method. 
88
	 * @param x
89
	 * The minimum X coordinate.
90
	 * @param y
91
	 * The minimum Y coordinate.
92
	 * @param width
93
	 * The rectangle width.
94
	 * @param height
95
	 * The rectangle height.
96
	 */
97
	public void fillRect(int x, int y, int width, int height);
98
	
99
	public void drawOval(int i, int j, int sizePixels, int sizePixels2);
100

  
101
	public void drawLine(int x1, int y1, int x3, int y12);
102
}
0 103

  
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/dal/swing/datastore/DataStoreParametersCreationPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.mapcontrol.dal.swing.datastore;
23

  
24
import javax.swing.JPanel;
25

  
26
import org.gvsig.fmap.dal.DataServerExplorer;
27
import org.gvsig.fmap.dal.NewDataStoreParameters;
28

  
29

  
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public abstract class DataStoreParametersCreationPanel extends JPanel {
36
    private static final long serialVersionUID = 5265923639970241325L;
37

  
38
    public abstract NewDataStoreParameters getDataStoreParameters();
39
    
40
    public abstract DataServerExplorer getDataServerExplorer();
41
}
0 42

  
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/dal/swing/datastore/DefaultDataStoreParametersCreationPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.mapcontrol.dal.swing.datastore;
23

  
24
import java.awt.Dimension;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.awt.Insets;
28
import java.awt.event.ActionEvent;
29
import java.awt.event.ActionListener;
30
import java.util.Iterator;
31
import java.util.List;
32

  
33
import javax.swing.JButton;
34
import javax.swing.JComboBox;
35

  
36
import org.gvsig.fmap.dal.DALLocator;
37
import org.gvsig.fmap.dal.DataManager;
38
import org.gvsig.fmap.dal.DataServerExplorer;
39
import org.gvsig.fmap.dal.DataServerExplorerParameters;
40
import org.gvsig.fmap.dal.NewDataStoreParameters;
41
import org.gvsig.fmap.dal.exception.InitializeException;
42
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
43
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
44
import org.gvsig.fmap.mapcontrol.swing.dynobject.DynObjectEditor;
45
import org.gvsig.tools.service.ServiceException;
46
import org.slf4j.Logger;
47
import org.slf4j.LoggerFactory;
48

  
49

  
50
/**
51
 * @author gvSIG Team
52
 * @version $Id$
53
 *
54
 */
55
public class DefaultDataStoreParametersCreationPanel extends DataStoreParametersCreationPanel implements ActionListener{   
56
    private static final long serialVersionUID = -1453149638996485029L;
57

  
58
    private static final Logger LOG =
59
        LoggerFactory.getLogger(DefaultDataStoreParametersCreationPanel.class);
60

  
61
    private static final DataManager DATA_MANAGER = DALLocator.getDataManager();
62

  
63
    private static final int FORM_HEIGTH = 18;
64

  
65
    private DataServerExplorer dataServerExplorer = null;
66
    private DataServerExplorerParameters dataServerExplorerParameters = null;
67

  
68
    private NewDataStoreParameters dataStoreParameters = null;
69

  
70
    private JButton explorersButton;
71
    private JComboBox explorersComboBox;
72
    private JButton providersButton;
73
    private JComboBox providersComboBox;
74

  
75
    public DefaultDataStoreParametersCreationPanel() {
76
        super(); 
77
        initComponents();
78
        populateExplorerCombo();
79
        initListeners();
80
        enableExplorerControls(false);
81
    }     
82

  
83
    private void initListeners() {
84
        this.explorersComboBox.addActionListener(this);
85
        this.explorersButton.addActionListener(this);
86
        this.providersComboBox.addActionListener(this);
87
        this.providersButton.addActionListener(this);        
88
    }
89

  
90
    @SuppressWarnings("rawtypes")
91
    private void populateExplorerCombo(){
92
        explorersComboBox.addItem(null);
93

  
94
        Iterator it = DATA_MANAGER.getExplorerProviders().iterator();
95

  
96
        while(it.hasNext()) {
97
            String explorer = (String)it.next();
98
            explorersComboBox.addItem(explorer);            
99
        }
100
    }   
101

  
102
    private void initComponents() {
103
        GridBagConstraints gridBagConstraints;
104

  
105
        explorersComboBox = new JComboBox();
106
        providersComboBox = new JComboBox();
107
        explorersButton = new JButton();
108
        providersButton = new JButton();
109

  
110
        setLayout(new GridBagLayout());
111

  
112
        explorersComboBox.setPreferredSize(new Dimension(0, FORM_HEIGTH));
113
        gridBagConstraints = new GridBagConstraints();
114
        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
115
        gridBagConstraints.weightx = 1.0;
116
        gridBagConstraints.insets = new Insets(0, 2, 0, 2);
117
        add(explorersComboBox, gridBagConstraints);
118

  
119
        explorersButton.setText("...");
120
        explorersButton.setPreferredSize(new Dimension(25, FORM_HEIGTH));
121
        gridBagConstraints = new GridBagConstraints();
122
        gridBagConstraints.gridx = 1;
123
        gridBagConstraints.gridy = 0;
124
        gridBagConstraints.insets = new Insets(0, 2, 0, 2);
125
        add(explorersButton, gridBagConstraints);
126

  
127
        providersComboBox.setPreferredSize(new Dimension(0, FORM_HEIGTH));
128
        gridBagConstraints = new GridBagConstraints();
129
        gridBagConstraints.gridx = 2;
130
        gridBagConstraints.gridy = 0;
131
        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
132
        gridBagConstraints.weightx = 1.0;
133
        gridBagConstraints.insets = new Insets(0, 2, 0, 2);
134
        add(providersComboBox, gridBagConstraints);      
135

  
136
        providersButton.setText("...");
137
        providersButton.setPreferredSize(new Dimension(25, FORM_HEIGTH));
138
        gridBagConstraints = new GridBagConstraints();
139
        gridBagConstraints.gridx = 3;
140
        gridBagConstraints.gridy = 0;
141
        gridBagConstraints.insets = new Insets(0, 2, 0, 2);
142
        add(providersButton, gridBagConstraints);
143
    }
144

  
145
    @Override
146
    public NewDataStoreParameters getDataStoreParameters(){       
147
        return dataStoreParameters;
148
    }
149

  
150
    @Override
151
    public DataServerExplorer getDataServerExplorer() {       
152
        return dataServerExplorer;
153
    }
154

  
155
    public void actionPerformed(ActionEvent e) {       
156
        if (e.getSource().equals(explorersButton)) {           
157
            explorersButtonClicked();
158
        }else if (e.getSource().equals(providersButton)) {
159
            providersButtonClicked();
160
        }else if (e.getSource().equals(explorersComboBox)) {           
161
            explorersComboSelectionChanged();
162
        }else if (e.getSource().equals(providersComboBox)) {
163
            providersComboSelectionChanged();
164
        }
165
    }  
166

  
167
    private void explorersComboSelectionChanged(){        
168
        String explorerName = (String)explorersComboBox.getSelectedItem();
169
        if (explorerName == null){
170
            dataServerExplorerParameters = null;
171
            dataServerExplorer = null;
172
            removeProvidersCombo();
173
            enableExplorerControls(false);
174
        }else{
175
            //Only update the explorer if the selection is different
176
            if ((dataServerExplorer == null) || (!explorerName.equals(dataServerExplorer.getProviderName()))){        
177
                dataServerExplorerParameters = null;
178

  
179
                //Remove all the previous providers
180
                removeProvidersCombo(); 
181

  
182
                //Disable all the components and enable the explorer button
183
                this.enableExplorerControls(false);
184
                this.explorersButton.setEnabled(true);       
185
                //Sometimes is possible to create an explorer without parameters (e.g: filesystem explorer"
186
                try {                    
187
                    dataServerExplorerParameters =
188
                        DATA_MANAGER.createServerExplorerParameters(explorerName);
189
                    dataServerExplorer = 
190
                        DATA_MANAGER.openServerExplorer(explorerName, dataServerExplorerParameters);
191
                    populateProvidersCombo();  
192
                    this.providersComboBox.setEnabled(true);     
193
                } catch (InitializeException e) {
194
                    LOG.error("Error creating the explorer parameters", e);                    
195
                } catch (ProviderNotRegisteredException e) {
196
                    LOG.error("The explorer has not been registeger", e);                    
197
                } catch (ValidateDataParametersException e) {
198
                    LOG.error("Error creating the explorer", e);                  
199
                }                
200
            }
201
        }
202
    }
203

  
204
    private void enableExplorerControls(boolean isEnabled){        
205
        this.explorersButton.setEnabled(isEnabled);  
206
        this.providersComboBox.setEnabled(isEnabled);    
207
        this.providersButton.setEnabled(isEnabled);
208
    }
209

  
210
    private void enableProviderControls(boolean isEnabled){       
211
        this.providersButton.setEnabled(isEnabled);  
212
    }
213

  
214
    private void explorersButtonClicked(){
215
        dataServerExplorer = null;
216
        String explorerName = (String)explorersComboBox.getSelectedItem();
217
        if (explorerName != null){
218
            try {
219
                if ((dataServerExplorerParameters == null) || (!dataServerExplorerParameters.getExplorerName().equals(explorerName))){
220
                    dataServerExplorerParameters =
221
                        DATA_MANAGER.createServerExplorerParameters(explorerName);
222
                }
223
                DynObjectEditor dynObjectEditor = new DynObjectEditor(dataServerExplorerParameters);
224
                dynObjectEditor.editObject(true);               
225
                dataServerExplorer = 
226
                    DATA_MANAGER.openServerExplorer(explorerName, dataServerExplorerParameters);
227
                //Remove all the previous providers
228
                removeProvidersCombo(); 
229
                populateProvidersCombo();
230
                this.providersComboBox.setEnabled(true);  
231
            } catch (InitializeException e) {
232
                LOG.error("Error creating the explorer parameters", e);
233
            } catch (ProviderNotRegisteredException e) {
234
                LOG.error("The explorer has not been registered", e);
235
            } catch (ServiceException e) {
236
                LOG.error("Error creating the explorer panel", e);
237
            } catch (ValidateDataParametersException e) {
238
                LOG.error("Error creating the explorer", e);
239
            }    
240
        }
241
    }
242

  
243
    @SuppressWarnings("rawtypes")
244
    private void populateProvidersCombo(){       
245
        providersComboBox.addItem(null);
246
        if (dataServerExplorer != null){
247
            List providerNames = dataServerExplorer.getDataStoreProviderNames();
248
            for (int i=0 ; i<providerNames.size() ; i++){
249
                providersComboBox.addItem(providerNames.get(i));         
250
            }
251
        }
252
    }
253

  
254
    private void removeProvidersCombo(){
255
        providersComboBox.removeAllItems();
256
    }
257

  
258
    private void providersComboSelectionChanged(){
259
        dataStoreParameters = null;
260
        String providerName = (String)providersComboBox.getSelectedItem();   
261
        if ((dataServerExplorer != null) && (providerName != null)){
262
            enableProviderControls(true);
263
        }else{
264
            enableProviderControls(false);
265
        }
266
    }
267

  
268
    private void providersButtonClicked(){
269
        String providerName = (String)providersComboBox.getSelectedItem();       
270
        if ((dataServerExplorer != null) && (providerName != null)){
271
            try {
272
                if ((dataStoreParameters == null) || (!dataStoreParameters.getDataStoreName().equals(providerName))){
273
                    dataStoreParameters = 
274
                        DATA_MANAGER.createNewStoreParameters(dataServerExplorer.getProviderName(), providerName);
275
                }
276
                DynObjectEditor dynObjectEditor = new DynObjectEditor(dataStoreParameters);
277
                dynObjectEditor.editObject(true);             
278
            } catch (InitializeException e) {
279
                LOG.error("Error creating the store parameters", e);
280
            } catch (ProviderNotRegisteredException e) {
281
                LOG.error("The provider has not been registered", e);
282
            } catch (ServiceException e) {
283
                LOG.error("Error creating the store panel", e);
284
            }
285
        }
286
    }  
287
}
0 288

  
tags/v2_0_0_Build_2050/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/dal/feature/swing/FeatureSelectionModel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {}  {{Task}}
26
 */
27
package org.gvsig.fmap.mapcontrol.dal.feature.swing;
28

  
29
import javax.swing.ListSelectionModel;
30
import javax.swing.event.EventListenerList;
31
import javax.swing.event.ListSelectionEvent;
32
import javax.swing.event.ListSelectionListener;
33

  
34
import org.gvsig.fmap.dal.exception.DataException;
35
import org.gvsig.fmap.dal.feature.Feature;
36
import org.gvsig.fmap.dal.feature.FeatureSelection;
37
import org.gvsig.fmap.dal.feature.FeatureStore;
38
import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
39
import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
40
import org.gvsig.fmap.mapcontrol.dal.feature.swing.table.FeatureTableModel;
41
import org.gvsig.tools.observer.Observable;
42
import org.gvsig.tools.observer.Observer;
43
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
45

  
46
/**
47
 * @author 2010- C?sar Ordi?ana - gvSIG team
48
 */
49
public class FeatureSelectionModel implements ListSelectionModel, Observer {
50
    private static Logger LOG = 
51
        LoggerFactory.getLogger(FeatureSelectionModel.class);
52
    
53
	protected EventListenerList listenerList = new EventListenerList();
54

  
55
	private final FeatureTableModel featureTableModel;
56

  
57
	private int selectionMode = SINGLE_INTERVAL_SELECTION;
58

  
59
	private boolean isAdjusting = false;
60

  
61
	private int anchor = -1;
62

  
63
	private int lead = -1;
64
	
65
	private int currentFirst = -1;
66
	private int currentLast = -1;
67

  
68
	/**
69
	 * Creates a new {@link FeatureSelectionModel} with a
70
	 * {@link FeatureTableModel} used to get the {@link Feature}s by position in
71
	 * the table.
72
	 * 
73
	 * @param featureTableModel
74
	 *            to get Features from
75
	 * @throws DataException
76
	 *             if there is an error getting the store selection
77
	 */
78
	public FeatureSelectionModel(FeatureTableModel featureTableModel)
79
			throws DataException {
80
		this.featureTableModel = featureTableModel;
81
		this.featureTableModel.getFeatureStore().addObserver(this);
82
	}
83

  
84
	public int getAnchorSelectionIndex() {
85
		return anchor;
86
	}
87

  
88
	public int getLeadSelectionIndex() {
89
		return lead;
90
	}
91

  
92
	public int getMaxSelectionIndex() {
93
		FeatureSelection selection = getFeatureSelection();
94
		try {
95
			if (!selection.isEmpty()) {
96
				for (int i = featureTableModel.getRowCount() - 1; i >= 0; i--) {
97
					if (selection.isSelected(featureTableModel.getFeatureAt(i))) {
98
						return i;
99
					}
100
				}
101
			}
102
		} catch (DataException e) {
103
			throw new SelectionChangeException(e);
104
		}
105
		return -1;
106
	}
107

  
108
	public int getMinSelectionIndex() {
109
		FeatureSelection selection = getFeatureSelection();
110
		try {
111
			if (!selection.isEmpty()) {
112
				for (int i = 0; i < featureTableModel.getRowCount(); i++) {
113
					if (selection.isSelected(featureTableModel.getFeatureAt(i))) {
114
						return i;
115
					}
116
				}
117
			}
118
		} catch (DataException e) {
119
			throw new SelectionChangeException(e);
120
		}
121
		return -1;
122
	}
123

  
124
	public void insertIndexInterval(int index, int length, boolean before) {
125
		// Nothing to do
126
	}
127

  
128
	public void removeIndexInterval(int index0, int index1) {
129
		// Nothing to do
130
	}
131

  
132
	public void setAnchorSelectionIndex(int index) {
133
		this.anchor = index;
134
	}
135

  
136
	public void setLeadSelectionIndex(int index) {
137
		this.lead = index;
138
	}
139

  
140
	public void addSelectionInterval(int index0, int index1) {
141
		doWithSelection(new FeatureSelectionOperation() {
142

  
143
			public void doWithSelection(FeatureSelection selection, int first,
144
					int last) throws DataException {
145
				for (int i = first; i <= last; i++) {
146
					Feature feature = getFeature(i);
147
					if (!selection.isSelected(feature)) {
148
						selection.select(feature);
149
					}
150
				}
151
			}
152

  
153
		}, index0, index1, true);
154
	}
155

  
156
	public void setSelectionInterval(int index0, int index1) {
157
		doWithSelection(new FeatureSelectionOperation() {
158

  
159
			public void doWithSelection(FeatureSelection selection, int first,
160
					int last) throws DataException {
161
				selection.deselectAll();
162
				for (int i = first; i <= last; i++) {
163
					Feature feature = getFeature(i);
164
					selection.select(feature);
165
				}
166
			}
167

  
168
		}, index0, index1, true);
169
	}
170

  
171
	public void removeSelectionInterval(int index0, int index1) {
172
		doWithSelection(new FeatureSelectionOperation() {
173

  
174
			public void doWithSelection(FeatureSelection selection, int first,
175
					int last) throws DataException {
176
				for (int i = first; i <= last; i++) {
177
					Feature feature = getFeature(i);
178
					if (selection.isSelected(feature)) {
179
						selection.deselect(feature);
180
					}
181
				}
182
			}
183

  
184
		}, index0, index1, false);
185
	}
186

  
187
	public void clearSelection() {
188
		try {
189
			getFeatureSelection().deselectAll();
190
		} catch (DataException e) {
191
			throw new SelectionChangeException(e);
192
		}
193
	}
194

  
195
	public boolean isSelectedIndex(int index) {
196
		if (index == -1) {
197
			return false;
198
		}
199
		Feature feature = featureTableModel.getFeatureAt(index);
200
		return getFeatureSelection().isSelected(feature);
201
	}
202

  
203
	public boolean isSelectionEmpty() {
204
		try {
205
			return getFeatureSelection().isEmpty();
206
		} catch (DataException ex) {
207
			throw new SelectionChangeException(ex);
208
		}
209
	}
210

  
211
	public boolean getValueIsAdjusting() {
212
		return isAdjusting;
213
	}
214

  
215
	public void setValueIsAdjusting(boolean valueIsAdjusting) {
216
		if (this.isAdjusting != valueIsAdjusting) {
217
			this.isAdjusting = valueIsAdjusting;
218
			if (this.isAdjusting) {
219
				getFeatureSelection().beginComplexNotification();
220
			} else {
221
				getFeatureSelection().endComplexNotification();
222
			}
223
		}
224
	}
225

  
226
	public int getSelectionMode() {
227
		return selectionMode;
228
	}
229

  
230
	public void setSelectionMode(int selectionMode) {
231
		this.selectionMode = selectionMode;
232
	}
233

  
234
	public void addListSelectionListener(ListSelectionListener listener) {
235
		listenerList.add(ListSelectionListener.class, listener);
236
	}
237

  
238
	public void removeListSelectionListener(ListSelectionListener listener) {
239
		listenerList.remove(ListSelectionListener.class, listener);
240
	}
241

  
242
	public void update(Observable observable, Object notification) {
243
		if (notification instanceof FeatureStoreNotification) {
244
			FeatureStoreNotification fnotification =
245
					(FeatureStoreNotification) notification;
246
			if (!fnotification.getSource().equals(getFeatureStore())) {
247
				return;
248
			}
249
			if (FeatureStoreNotification.SELECTION_CHANGE.equals(fnotification.getType())) {
250
				try{
251
				    fireValueChanged(-1, -1, false);
252
				}catch(ConcurrentDataModificationException e){
253
				    LOG.warn("The store has been updated and the selection can not be refreshed", e);
254
				}
255
			}
256
		}
257
	}
258

  
259
	private FeatureSelection getFeatureSelection() {
260
		try {
261
			return (FeatureSelection) getFeatureStore().getSelection();
262
		} catch (DataException ex) {
263
			throw new SelectionChangeException(ex);
264
		}
265
	}
266

  
267
	/**
268
	 * @param operation
269
	 * @param index0
270
	 * @param index1
271
	 */
272
	private void doWithSelection(FeatureSelectionOperation operation,
273
			int index0, int index1, boolean select) {
274
		// Set the anchor and lead
275
		anchor = index0;
276
		lead = index1;
277

  
278
		// As index0 <= index1 is no guaranteed, calculate the first and second
279
		// values
280
		int first = (index0 <= index1) ? index0 : index1;
281
		int last = (index0 <= index1) ? index1 : index0;
282
		
283
		//If the new selection is not updated don't continue
284
		if ((currentFirst == first) && (currentLast == last)){
285
		    return;
286
		}
287
		currentFirst = first;
288
		currentLast = last;
289

  
290
		FeatureSelection selection = getFeatureSelection();
291

  
292
		// Perform the selection operation into a complex notification
293
		selection.beginComplexNotification();
294
		try {
295
			// Is a full select or deselect
296
			if (first == 00 && last == featureTableModel.getRowCount() - 1) {
297
				if (select) {
298
					selection.selectAll();
299
				} else {
300
					selection.deselectAll();
301
				}
302
			} else {
303
				operation.doWithSelection(selection, first, last);
304
			}
305
		} catch (DataException e) {
306
			throw new SelectionChangeException(e);
307
		} finally {
308
			selection.endComplexNotification();
309
		}
310

  
311
		fireValueChanged(first, last, isAdjusting);
312
	}
313

  
314
	/**
315
	 * Returns a Feature by table row position.
316
	 */
317
	private Feature getFeature(int index) {
318
		return featureTableModel.getFeatureAt(index);
319
	}
320

  
321
	/**
322
	 * Returns the FeatureStore.
323
	 */
324
	private FeatureStore getFeatureStore() {
325
		return featureTableModel.getFeatureStore();
326
	}
327

  
328
	/**
329
	 * @param firstIndex
330
	 *            the first index in the interval
331
	 * @param lastIndex
332
	 *            the last index in the interval
333
	 * @param isAdjusting
334
	 *            true if this is the final change in a series of adjustments
335
	 * @see EventListenerList
336
	 */
337
	protected void fireValueChanged(int firstIndex, int lastIndex,
338
			boolean isAdjusting) {
339
		Object[] listeners = listenerList.getListenerList();
340
		ListSelectionEvent e = null;
341

  
342
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
343
			if (listeners[i] == ListSelectionListener.class) {
344
				if (e == null) {
345
					e =
346
							new ListSelectionEvent(this, firstIndex, lastIndex,
347
									isAdjusting);
348
				}
349
				((ListSelectionListener) listeners[i + 1]).valueChanged(e);
350
			}
351
		}
352
	}
353

  
354
	private interface FeatureSelectionOperation {
355
		void doWithSelection(FeatureSelection selection, int first, int last)
356
				throws DataException;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff