Revision 27564

View differences:

branches/v2_0_0_prep/extensions/extGeocoding/config/config.xml
8 8
		<extension class-name="org.gvsig.geocoding.extension.GeocodingExtension"
9 9
			description="Extension that geocoding a address."
10 10
			active="true">			
11
			<menu text="Tabla/geocoding" 
12
				tooltip="geocoding"
11
			<menu text="Capa/geocoder" 
12
				tooltip="geocodertip"
13 13
				action-command="GEOCODING"
14
				icon="images/geocodingicon.png"
14
				icon="images/icons16/geocodingicon.png"
15 15
				position="9999" />
16
			<tool-bar name="field_toolbar">				
16
			<tool-bar name="geocoder">				
17 17
				<action-tool icon="images/icons16/geocodingicon.png"
18 18
					action-command="GEOCODING"
19
					tooltip="geocoding"
19
					tooltip="geocodertip"
20 20
					position="9999"/>
21 21
			</tool-bar>
22 22
		</extension>
branches/v2_0_0_prep/extensions/extGeocoding/config/text.properties
1 1
# Geocoding Extension
2 2

  
3
geocoder=Geocodificar
4
geocodertip=Geocodificar un direcci?n
3 5
geocoding=Geocodificaci?n
4 6
geocodingrun=Geocodificando ...
5 7
new_geocoding_pattern=Nuevo patr?n de geocodificai?n
......
39 41
gtabletip=Geocodificar los diferentes registros de una tabla
40 42

  
41 43
butnewpattern=Crear nuevo patr?n
42
buteditpattern=Modificar las carcater?sticas del patr?n
44
buteditpattern=Modificar las caracter?sticas del patr?n
43 45
butloadpattern=Cargar un patr?n desde fichero
44 46
literalempty=El nuevo patr?n no posee ning?n elemento de direcci?n que permita la geocodificaci?n
45 47

  
......
131 133
addressgeocoded= direcci?n geocodificada
132 134
addressesgeocoded= direcciones geocodificadas
133 135

  
136
#create table results
137
tableresults=Guardar tabla de resultados
138
dbf_file=*.dbf
branches/v2_0_0_prep/extensions/extGeocoding/config/text_en.properties
1 1
# Geocoding Extension
2 2

  
3
geocoder=Geocoder
4
geocodertip=Geocoder address
3 5
geocoding=Geocoding
6
geocodingrun=Geocodiing ...
4 7
new_geocoding_pattern=New geocoding pattern
5 8

  
6
preference_file=Address element
9
preference_file=Address elements
7 10
preference_location=File path
8
preference_edit=You can modify the address elements list
11
preference_edit=You can edit the list with new address elements
9 12

  
10
nolayersinview=No layers in view
13
nolayersinview=None layers in View
11 14
combodefaulttext=...
12
combonamefields=Fields names
15
combonamefields=fields names
13 16
comboaddresselements=Address elements
14 17

  
15 18
pattern_geoco_file=Geocoding pattern file (*.xml)
......
23 26
tablestructureelement=Element
24 27
tableelementname=Name
25 28

  
29

  
26 30
#main panel
27
accuracy=Accuracy
28
maxresults=Results
31

  
29 32
patternpath=File
30 33
pattern=Geocoding pattern
31
quality=Quality
32
gtype=Geocoding type
33
atype=Address Type
34
type=Type
34

  
35
gtype=Select geocoding type
36
atype=Complete address elements
37
type=Select geocoding type
35 38
gsimple=Simple
36
gsimpletip=Geocoding only address
39
gsimpletip=Geocoder one address
37 40
gtable=Table
38
gtabletip=Geocoding all table registries
41
gtabletip=Geocoder all table registries
39 42

  
40
butclose=Close
41
butnewpattern=Create new pattern
43
butnewpattern=Build new pattern
44
buteditpattern=Modify settings pattern
42 45
butloadpattern=Load pattern from file
43
butrun=Search
46
literalempty=New pattern hasn't address elements that it allows geocoding process
44 47

  
45
street1=Street 1
46
street2=Street 2
47
street3=Street 3
48
street1=Address
49
street2=Address
50
street3=Address
48 51

  
49 52
cancel=Cancel
50 53
ok=Ok
......
53 56
export=Export
54 57
search=Search
55 58

  
56
adrelements=Address components
59
adrelements=Address elements
57 60
valuename=Values
61
valuefield=Field
58 62

  
59
typeA=One address
60
typeB=Two Address (Crossing streets)
61
typeC=Three Address (Strech of street between two streets)
63
xcross=Crossing paths
64
xbetween=Path section between two path
62 65

  
63
settings=Search settings
64
maxresults=Maximum results
65
quality=Quality
66
accuracy=Accuracy
66
settings=Search parameters
67
maxresults=Results number
68
score=Score higher than
69
maxresultstip=Maximum number of search results
70
scoretip=Level of search score
67 71

  
68 72
results=Results
69 73

  
......
71 75
oktip=Select result
72 76
nexttip=Next registry
73 77

  
78
##New pattern panel
79
datasource=Select data source
80
selectedlayer=Vectorial layer 
81
components=Define pattern elements
82

  
83
xfield=Data source fields
84
xelement=Elements
85
xvalue=Address
86
xvalue1=Address 1
87
xvalue2=Address 2
88
xvalue3=Address 3
89
xmainvalue=Main address
90
xnumAddress=Door number
91

  
92
simcenstyle=Geocoding geometries by centroid. \n[Layer of points, lines and polygons]
93
rangesimstyle=Geocoding path that this has single numeric range (odd and even number). \n [Layer of lines]
94
rangedoustyle=Geocoding path that this has double numeric range, pairs number on the right and odd number on the left or vice versa. \n [Layer of lines]
95
compostyle=Geocoding on the cross paths or the stretch of path between two paths . \n [Layer of lines]
96

  
97
fid=Id
74 98
fsel=Ok
75
fquality=Calidad
76
faccuracy=Precisi?n
77
fx=Coordenada X
78
fy=Coordenada Y
99
fscore=Points
100
fx=X
101
fy=Y
102
flong=Long
103
flat=Lat
104
fnumber=Number
105

  
106
row=Row
107
loadlayer=Do you want load the layer related with geocoding pattern?
108

  
109
nopatternlayer=You haven't selected the layer related with geocoding pattern
110
nolayers=To build new geocoding pattern you must load vectorial layer on the gvSIG view on which geocodified
111
rangenum=Path numeric range
112

  
113
numright=Right numeric range
114
numleft=Left numeric range
115

  
116
fromnum=From
117
tonum=To
118

  
119
rightfromnum=(Right) From
120
righttonum=(Right) To
121
leftfromnum=(Left) From
122
lefttomnum=(Left) To
123

  
124

  
125

  
126
#styles
127
composedstyle=Composite geocoding
128
doublerangestyle=Simple geocoding by double range
129
simplerangestyle=Simple geocoding by single range
130
simplecentroidstyle=Simple geocoding by centroid
131

  
132
#process
133
addressgeocoded= address geocoded
134
addressesgeocoded= addresses geocoded
135

  
136
#create table results
137
tableresults=Save results table
138
dbf_file=*.dbf
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/extension/GeocoController.java
34 34
import java.util.ArrayList;
35 35
import java.util.List;
36 36
import java.util.Locale;
37
import java.util.Set;
37 38

  
38 39
import javax.swing.DefaultComboBoxModel;
39 40
import javax.swing.JFileChooser;
......
42 43

  
43 44
import org.gvsig.fmap.dal.DALLocator;
44 45
import org.gvsig.fmap.dal.DataManager;
46
import org.gvsig.fmap.dal.DataParameters;
47
import org.gvsig.fmap.dal.DataServerExplorer;
48
import org.gvsig.fmap.dal.DataServerExplorerParameters;
49
import org.gvsig.fmap.dal.NewDataStoreParameters;
50
import org.gvsig.fmap.dal.exception.DataException;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
45 53
import org.gvsig.fmap.dal.exception.ReadException;
54
import org.gvsig.fmap.dal.feature.EditableFeatureType;
46 55
import org.gvsig.fmap.dal.feature.FeatureStore;
47 56
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
48 57
import org.gvsig.geocoding.Literal;
......
55 64
import org.gvsig.geocoding.gui.address.AddressSimpleCentroidPanel;
56 65
import org.gvsig.geocoding.gui.newpattern.NewGeocoPatternPanel;
57 66
import org.gvsig.geocoding.pattern.Patterngeocoding;
67
import org.gvsig.geocoding.result.GeocodingResult;
58 68
import org.gvsig.geocoding.styles.AbstractGeocodingStyle;
59 69
import org.gvsig.geocoding.styles.AbstractRange;
60 70
import org.gvsig.geocoding.styles.Composed;
......
80 90
	private static final Logger log = LoggerFactory
81 91
			.getLogger(GeocoController.class);
82 92

  
93
	private PluginServices ps = null;
94

  
83 95
	public static final String GEOCODINGELEMENTS = "GeocodingElements";
84 96

  
85 97
	public static final String ROW = PluginServices.getText(null, "row")
......
92 104
	/**
93 105
	 * Controller Constructor
94 106
	 * 
95
	 * @param ps
96 107
	 */
97 108
	public GeocoController() {
98 109

  
99 110
		manager = DALLocator.getDataManager();
100 111

  
101 112
		// Load the model
102
		this.gmodel = new GeocodingModel(this);
113
		this.gmodel = new GeocodingModel();
103 114

  
104 115
		// Load the view and put it visible
105 116
		this.gpanel = new GeocodingPanel(this);
......
284 295
		} else {
285 296
			// show warning message
286 297
			String title = PluginServices.getText(null, "geocoding");
287
			
298

  
288 299
			String message = PluginServices.getText(null, "nolayers");
289 300
			JOptionPane.showMessageDialog(null, message, title,
290 301
					JOptionPane.WARNING_MESSAGE);
......
463 474
		return this.gpanel.getJTableResults();
464 475
	}
465 476

  
477
	/**
478
	 * Create initial array with list of selected results elements to export
479
	 * 
480
	 * @param results
481
	 * @return
482
	 */
483
	public Integer[] createInitialResultsExportElements(
484
			List<Set<GeocodingResult>> results) {
485
		int cant = results.size();
486
		Integer[] expElems = new Integer[cant];
487
		int i = 0;
488
		for (Set<GeocodingResult> res : results) {
489
			if (res.size() > 0) {
490
				expElems[i] = 0;
491
			} else {
492
				expElems[i] = -1;
493
			}
494
			i++;
495
		}
496
		return expElems;
497
	}
498

  
499
	/**
500
	 * 
501
	 */
502
	public void createDBFTableResults() {
503

  
504
		File thefile = null;
505
		JFileChooser jfc = new JFileChooser();
506
		jfc.setDialogTitle(PluginServices.getText(this, "tableresults"));
507
		String[] extensions = { "dbf" };
508
		jfc.setCurrentDirectory(new File(""));
509
		jfc.addChoosableFileFilter(new GenericFileFilter(extensions,
510
				PluginServices.getText(this, "dbf_file")));
511
		int returnval = jfc.showSaveDialog((java.awt.Component) PluginServices
512
				.getMainFrame());
513
		if (returnval == JFileChooser.APPROVE_OPTION) {
514
			thefile = jfc.getSelectedFile();
515
			log.debug("file opened: " + thefile);
516
		}
517
		if (thefile != null) {
518
			thefile = GeocoUtils.addDBFSuffix(thefile);
519
			// build store
520
			try {
521
				File parentfile = thefile.getParentFile();
522
				String name = thefile.getName();
523

  
524
				DataServerExplorerParameters eparams = manager
525
						.createServerExplorerParameters("FilesystemExplorer");
526
				eparams
527
						.setDynValue("initialpath", parentfile
528
								.getAbsolutePath());
529

  
530
				DataServerExplorer serverExplorer = manager
531
						.createServerExplorer(eparams);
532

  
533
				DataParameters sparams = serverExplorer.getAddParameters("dbf");
534

  
535
				sparams.setDynValue("fileName", name);
536
				EditableFeatureType featureType = (EditableFeatureType) sparams
537
						.getDynValue("defaultFeatureType");
538

  
539
				serverExplorer.add((NewDataStoreParameters) sparams, true);
540

  
541
			} catch (InitializeException e) {
542
				// TODO Auto-generated catch block
543
				e.printStackTrace();
544
			} catch (ProviderNotRegisteredException e) {
545
				// TODO Auto-generated catch block
546
				e.printStackTrace();
547
			} catch (DataException e) {
548
				// TODO Auto-generated catch block
549
				e.printStackTrace();
550
			}
551
			// fill store
552
		}
553

  
554
	}
555

  
466 556
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/extension/GeocodingTask.java
119 119
				.getAllResults();
120 120
		Set<GeocodingResult> result = results.get(0);
121 121
		control.getGmodel().setNumResultShowed(0);
122
		// arrya selected results
123
		Integer[] expElems = control
124
				.createInitialResultsExportElements(results);
125
		control.getGmodel().setExportElements(expElems);
122 126
		if (result.size() > 0) {
123 127
			int max = control.getPattern().getSettings().getResultsNumber();
124 128

  
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/utils/ResultProof.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 Prodevelop S.L  vsanjaime   programador
26
 */
27

  
28
package org.gvsig.geocoding.utils;
29

  
30
import java.util.ArrayList;
31
import java.util.List;
32

  
33
import org.gvsig.geocoding.result.GeocodingResult;
34

  
35
public class ResultProof {
36
	
37

  
38
	public static List<List<GeocodingResult>> getDefaultResults() {
39

  
40
		List<List<GeocodingResult>> results = new ArrayList<List<GeocodingResult>>();
41
		
42
		List<GeocodingResult> list1 = new ArrayList<GeocodingResult>();
43

  
44
//		//Optional
45
//		OpGeocoLocation opt1 = new OpGeocoLocation(100,80,678273.2,4395030.6);
46
//		OpGeocoLocation opt2 = new OpGeocoLocation(77,70,755656.3,4456384.7);
47
//		OpGeocoLocation opt3 = new OpGeocoLocation(80,100,640687.4,4366288.5);
48
//		OpGeocoLocation opt4 = new OpGeocoLocation(70,70,688222.6,4254083.3);
49
//		OpGeocoLocation opt5 = new OpGeocoLocation(50,100,669429.5,4320964.2);
50
//		// First
51
//		GeocoLocationSet loc1 = new GeocoLocationSet();		
52
//		loc1.add(opt1);
53
//		loc1.add(opt2);
54
//		loc1.add(opt3);
55
//		loc1.add(opt4);
56
//		loc1.add(opt5);		
57
//
58
//		// Second
59
//		GeocoLocationSet loc2 = new GeocoLocationSet();		
60
//		loc2.add(opt1);
61
//		loc2.add(opt2);
62
//		loc2.add(opt3);
63
//		loc2.add(opt4);
64
//		loc2.add(opt5);	
65
//		// Third
66
//		GeocoLocationSet loc3 = new GeocoLocationSet();		
67
//		loc3.add(opt1);
68
//		loc3.add(opt2);
69
//		loc3.add(opt3);
70
//		loc3.add(opt4);
71
//		loc3.add(opt5);	
72
//		
73
//		list.add(loc1);
74
//		list.add(loc2);
75
//		list.add(loc3);
76
		
77
		return results;
78

  
79
	}
80

  
81
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/utils/GeocoUtils.java
86 86
		}
87 87
		return file;
88 88
	}
89
	
90
	/**
91
	 * Add to the file name the suffix .dbf
92
	 * 
93
	 * @param file
94
	 * @return
95
	 */
96
	public static File addDBFSuffix(File file) {
97
		if (!(file.getPath().toLowerCase().endsWith(".dbf"))) {
98
			return new File(file.getPath() + ".dbf");
99
		}
100
		return file;
101
	}
89 102

  
90 103
	/**
91 104
	 * @param name
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/utils/Export.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 Prodevelop S.L  vsanjaime   programador
26
 */
27

  
28
package org.gvsig.geocoding.utils;
29

  
30
import org.gvsig.geocoding.extension.GeocoController;
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33

  
34
/**
35
 * This class generates a Layer from feature store
36
 * 
37
 * @author Jorge Gaspar Sanz Salinas (jsanz@prodevelop.es)
38
 * @author Vicente Sanjaime Calvet (vsanjaime@prodevelop.es)
39
 * 
40
 */
41

  
42
public class Export extends Thread {
43

  
44
	private Logger log = LoggerFactory.getLogger(Export.class);
45
	GeocoController control = null;
46

  
47
	
48

  
49
	/**
50
	 * Constructor with list of results
51
	 * 
52
	 * @param file
53
	 */
54
	public Export(GeocoController control) {
55
		super();
56
		this.control = control;
57
		
58
	}
59

  
60
	/**
61
	 * Run
62
	 */
63
	public void run() {
64
		
65
//		boolean compose = false;
66
//		boolean cross = true;
67
//		
68
//	// address fields
69
//		Set<GeocodingResult> result = control.getGmodel().getAllResults().get(0);
70
//		Address address = null;
71
//		for (GeocodingResult res : result) {
72
//			address = res.getAddress();
73
//			break;
74
//		}
75
//		Literal literal = address.getMainLiteral();	
76
//		int cant = literal.size();
77
//		String[] fields = new String[cant];
78
//		int i = 0;
79
//		for (Object obj : literal) {
80
//			AddressComponent aComp= (AddressComponent)obj;
81
//			fields[i]= aComp.getKeyElement();
82
//			i++;
83
//		}
84
//		if(address instanceof ComposeAddress){
85
//			compose = true;		
86
//			ComposeAddress caddress = (ComposeAddress)address;
87
//			List<Literal> inter = caddress.getIntersectionLiteral();		
88
//			if(inter.size() == 2){
89
//				cross = false;
90
//			}
91
//		}		
92
//		
93
//		// new store
94
//		DataManager manager = DALLocator.getDataManager();
95
//		try {
96
//		DataServerExplorerParameters eparams = manager
97
//				.createServerExplorerParameters("FilesystemExplorer");
98
//		eparams.setDynValue("initialpath","c:/temp");
99
//		DataServerExplorer serverExplorer = manager.createServerExplorer(eparams);
100
//		
101
//		DataParameters sparams = serverExplorer.getAddParameters("Shape");
102
//		sparams.setDynValue("fileName","geocode.shp");
103
//		
104
//		EditableFeatureType featureType = (EditableFeatureType) sparams.getDynValue("defaultFeatureType");
105
//		
106
//		// no compose address
107
//		if(!compose){
108
//			for (String field : fields) {
109
//				featureType.add(field, DefaultFeatureAttributeDescriptor.TYPE_STRING,50);
110
//			}
111
//		
112
//		}
113
//		// compose address
114
//		else{
115
//			for (String field : fields) {
116
//				featureType.add(field+"_1", FeatureAttributeDescriptor.TYPE_STRING,50);
117
//			}
118
//			for (String field : fields) {
119
//				featureType.add(field+"_2", FeatureAttributeDescriptor.TYPE_STRING,50);
120
//			}		
121
//			
122
//			
123
//			// compose between address
124
//			if(!cross){
125
//				for (String field : fields) {
126
//					featureType.add(field+"_3", FeatureAttributeDescriptor.TYPE_STRING,50);
127
//				}	
128
//			
129
//			}
130
//			
131
//		
132
//		}
133
//		featureType.add("GEOM", FeatureAttributeDescriptor.TYPE_GEOMETRY);
134
//		
135
//		serverExplorer.add(sparams, true);
136

  
137
	
138

  
139
//		// create layer
140
//		LayerFactory factory = LayerFactory.getInstance();
141
//		String layerName = "GEOCODE";
142
//		try {
143
//			FLayer lyr = factory.createLayer(layerName, params);
144
//		} catch (LoadLayerException e) {
145
//			// TODO Auto-generated catch block
146
//			e.printStackTrace();
147
//		}
148
//		// add layer TOC
149

  
150
	}
151

  
152

  
153

  
154
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/utils/LayerGenerator.java
82 82
//				features, def);
83 83
//		FLyrVect lyr = new FLyrVect();
84 84

  
85
		
86
		
85 87
	}
86 88

  
87 89
	/**
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/newpattern/ComboLayer.java
38 38
 */
39 39
public class ComboLayer implements ComboShowName {
40 40

  
41
	
42 41
	private FLyrVect lyr = null;
43
	
42

  
44 43
	/**
45 44
	 * Constructor
45
	 * 
46 46
	 * @param lyr
47 47
	 */
48
	public ComboLayer(FLyrVect lyr){
48
	public ComboLayer(FLyrVect lyr) {
49 49
		this.lyr = lyr;
50 50
	}
51
	
51

  
52 52
	/**
53 53
	 * to String
54
	 * 
54 55
	 * @return layer name
55 56
	 */
56
	public String toString(){
57
		
57
	public String toString() {
58

  
58 59
		return lyr.getName();
59 60
	}
60
	
61

  
61 62
	/**
62 63
	 * get the layer stored
64
	 * 
63 65
	 * @return
64 66
	 */
65
	public FLyrVect getLayer(){
67
	public FLyrVect getLayer() {
66 68
		return lyr;
67 69
	}
68
	
70

  
69 71
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/newpattern/ComboDesc.java
37 37
 * @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
38 38
 */
39 39

  
40
public class ComboDesc implements ComboShowName{
40
public class ComboDesc implements ComboShowName {
41 41

  
42 42
	private FeatureAttributeDescriptor desc = null;
43 43

  
......
69 69
		return desc;
70 70
	}
71 71

  
72

  
73

  
74 72
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/newpattern/DoubleRangePanel.java
366 366
		}
367 367
		return null;
368 368
	}
369
	
369

  
370 370
	/**
371 371
	 * set description RightFromMun Combo
372 372
	 * 
373 373
	 * @return
374 374
	 */
375 375
	public void setDescriptorRightFronMun(FeatureAttributeDescriptor desc) {
376
		
376

  
377 377
		ComboDesc cDesc = new ComboDesc(desc);
378 378
		jComboRightFromNum.getModel().setSelectedItem(cDesc);
379 379
	}
......
384 384
	 * @return
385 385
	 */
386 386
	public void setDescriptorRightToMun(FeatureAttributeDescriptor desc) {
387
		
387

  
388 388
		ComboDesc cDesc = new ComboDesc(desc);
389 389
		jComboRightToNum.getModel().setSelectedItem(cDesc);
390 390
	}
......
395 395
	 * @return
396 396
	 */
397 397
	public void setDescriptorLeftFronMun(FeatureAttributeDescriptor desc) {
398
		
398

  
399 399
		ComboDesc cDesc = new ComboDesc(desc);
400 400
		jComboLeftFromNum.getModel().setSelectedItem(cDesc);
401 401
	}
......
406 406
	 * @return
407 407
	 */
408 408
	public void setDescriptorLeftToMun(FeatureAttributeDescriptor desc) {
409
		
409

  
410 410
		ComboDesc cDesc = new ComboDesc(desc);
411 411
		jComboLeftToNum.getModel().setSelectedItem(cDesc);
412 412
	}
......
419 419
		fillCombos(desc);
420 420
		this.validate();
421 421
	}
422
	
422

  
423 423
	/**
424 424
	 * This method updates all labels of the panel from properties file
425 425
	 */
......
427 427

  
428 428
		PluginServices ps = PluginServices.getPluginServices(this);
429 429

  
430
		jPanRight.setBorder(GeocoUtils.getTitledBorder(ps
431
				.getText("right")));
432
		jPanLeft.setBorder(GeocoUtils.getTitledBorder(ps
433
				.getText("left")));
434
		
430
		jPanRight.setBorder(GeocoUtils.getTitledBorder(ps.getText("right")));
431
		jPanLeft.setBorder(GeocoUtils.getTitledBorder(ps.getText("left")));
432

  
435 433
		jLabRightFromNum.setText(ps.getText("rightfromnum"));
436 434
		jLabRightToNum.setText(ps.getText("righttonum"));
437 435
		jLabLeftFromNum.setText(ps.getText("leftfromnum"));
438 436
		jLabLeftToNum.setText(ps.getText("lefttomnum"));
439
		
437

  
440 438
	}
441 439
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/IGeocodingModel.java
141 141
	 * 
142 142
	 * @return
143 143
	 */
144
	public List<FeatureAttributeDescriptor> getListDescriptorSelectedTable();	
145
	
144
	public List<FeatureAttributeDescriptor> getListDescriptorSelectedTable();
145

  
146 146
	/**
147 147
	 * get store of selected table
148
	 * 
148 149
	 * @return
149 150
	 */
150 151
	public FeatureStore getSelectedTableStore();
151 152

  
152 153
	/**
153
	 * set store of selected table 
154
	 * set store of selected table
155
	 * 
154 156
	 * @param selectedTableStore
155 157
	 */
156 158
	public void setSelectedTableStore(FeatureStore selectedTableStore);
157
	
159

  
158 160
	/**
159 161
	 * Add one result to list of results
162
	 * 
160 163
	 * @param result
161 164
	 */
162 165
	public void addResult(Set<GeocodingResult> result);
163
	
166

  
164 167
	/**
165 168
	 * Clear list of geocoding results
166 169
	 */
......
168 171

  
169 172
	/**
170 173
	 * set number of result of results list showed
174
	 * 
171 175
	 * @param i
172 176
	 */
173 177
	public void setNumResultShowed(int i);
174
	
178

  
175 179
	/**
176 180
	 * get number of result of the results list showed
181
	 * 
177 182
	 * @return
178 183
	 */
179 184
	public int getNumResultShowed();
180 185

  
186
	/**
187
	 * get selected results export elements
188
	 * 
189
	 * @return
190
	 */
191
	public Integer[] getExportElements();
192

  
193
	/**
194
	 * set selected results export elements
195
	 * 
196
	 * @param exportElements
197
	 */
198
	public void setExportElements(Integer[] exportElements);
199

  
181 200
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/TableResultsModel.java
363 363
	 */
364 364
	private void getMainColumnNames() {
365 365

  
366
		columnNames[0] = ps.getText("fid");
367
		columnNames[1] = ps.getText("fsel");
368
		columnNames[2] = ps.getText("fscore");
369
		View view = GeocoUtils.getCurrentView();
370
		if (view != null) {
371
			MapContext context = view.getModel().getMapContext();
372
			MapControl mControl = new MapControl();
373
			mControl.setMapContext(context);
374
			IProjection proj = mControl.getProjection();
375
			if (proj.isProjected()) {
366
		if (ps != null) {
367
			columnNames[0] = ps.getText("fid");
368
			columnNames[1] = ps.getText("fsel");
369
			columnNames[2] = ps.getText("fscore");
370
			View view = GeocoUtils.getCurrentView();
371
			if (view != null) {
372
				MapContext context = view.getModel().getMapContext();
373
				MapControl mControl = new MapControl();
374
				mControl.setMapContext(context);
375
				IProjection proj = mControl.getProjection();
376
				if (proj.isProjected()) {
377
					columnNames[3] = ps.getText("fx");
378
					columnNames[4] = ps.getText("fy");
379
				} else {
380
					columnNames[3] = ps.getText("flong");
381
					columnNames[4] = ps.getText("flat");
382
				}
383
			} else {
376 384
				columnNames[3] = ps.getText("fx");
377 385
				columnNames[4] = ps.getText("fy");
378
			} else {
379
				columnNames[3] = ps.getText("flong");
380
				columnNames[4] = ps.getText("flat");
381 386
			}
382
		} else {
383
			columnNames[3] = ps.getText("fx");
384
			columnNames[4] = ps.getText("fy");
385 387
		}
386 388
	}
387 389

  
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/GeocodingPanel.java
58 58
import org.gvsig.geocoding.gui.settings.SettingsPanel;
59 59
import org.gvsig.geocoding.pattern.Patterngeocoding;
60 60
import org.gvsig.geocoding.result.GeocodingResult;
61
import org.gvsig.geocoding.utils.Export;
61 62
import org.gvsig.geocoding.utils.GeocoUtils;
62 63
import org.gvsig.project.document.table.FeatureTableDocument;
63 64
import org.slf4j.Logger;
......
136 137
	 * 
137 138
	 */
138 139
	private void setImages() {
139
		String baseDir = PluginServices.getPluginServices(this)
140
				.getClassLoader().getBaseDir();
140
		PluginServices ps = PluginServices.getPluginServices(this);
141
		if (ps != null) {
142
			String baseDir = ps.getClassLoader().getBaseDir();
141 143

  
142
		jButLoad.setIcon(new ImageIcon(baseDir + File.separator + "images"
143
				+ File.separator + "icons16" + File.separator + "open.png"));
144
		jButNew.setIcon(new ImageIcon(baseDir + File.separator + "images"
145
				+ File.separator + "icons16" + File.separator + "new.png"));
144
			jButLoad
145
					.setIcon(new ImageIcon(baseDir + File.separator + "images"
146
							+ File.separator + "icons16" + File.separator
147
							+ "open.png"));
148
			jButNew.setIcon(new ImageIcon(baseDir + File.separator + "images"
149
					+ File.separator + "icons16" + File.separator + "new.png"));
146 150

  
147
		jButEdit.setIcon(new ImageIcon(baseDir + File.separator + "images"
148
				+ File.separator + "icons16" + File.separator + "edit.png"));
151
			jButEdit
152
					.setIcon(new ImageIcon(baseDir + File.separator + "images"
153
							+ File.separator + "icons16" + File.separator
154
							+ "edit.png"));
149 155

  
150
		jButNext.setIcon(new ImageIcon(baseDir + File.separator + "images"
151
				+ File.separator + "icons16" + File.separator + "next.png"));
156
			jButNext
157
					.setIcon(new ImageIcon(baseDir + File.separator + "images"
158
							+ File.separator + "icons16" + File.separator
159
							+ "next.png"));
152 160

  
153
		jButPrevious
154
				.setIcon(new ImageIcon(baseDir + File.separator + "images"
155
						+ File.separator + "icons16" + File.separator
156
						+ "previous.png"));
161
			jButPrevious.setIcon(new ImageIcon(baseDir + File.separator
162
					+ "images" + File.separator + "icons16" + File.separator
163
					+ "previous.png"));
157 164

  
158
		jButSearch.setIcon(new ImageIcon(baseDir + File.separator + "images"
159
				+ File.separator + "icons16" + File.separator + "search.png"));
165
			jButSearch.setIcon(new ImageIcon(baseDir + File.separator
166
					+ "images" + File.separator + "icons16" + File.separator
167
					+ "search.png"));
160 168

  
161
		jButExit.setIcon(new ImageIcon(baseDir + File.separator + "images"
162
				+ File.separator + "icons16" + File.separator + "out.png"));
169
			jButExit.setIcon(new ImageIcon(baseDir + File.separator + "images"
170
					+ File.separator + "icons16" + File.separator + "out.png"));
163 171

  
164
		jButExport.setIcon(new ImageIcon(baseDir + File.separator + "images"
165
				+ File.separator + "icons16" + File.separator + "up.png"));
166

  
172
			jButExport.setIcon(new ImageIcon(baseDir + File.separator
173
					+ "images" + File.separator + "icons16" + File.separator
174
					+ "up.png"));
175
		}
167 176
	}
168 177

  
169 178
	/**
......
172 181
	private void setMesages() {
173 182
		PluginServices ps = PluginServices.getPluginServices(this);
174 183

  
175
		jPanPattern
176
				.setBorder(GeocoUtils.getTitledBorder(ps.getText("pattern")));
184
		if (ps != null) {
185
			jPanPattern.setBorder(GeocoUtils.getTitledBorder(ps
186
					.getText("pattern")));
177 187

  
178
		this.jButLoad.setToolTipText(ps.getText("butloadpattern"));
188
			this.jButLoad.setToolTipText(ps.getText("butloadpattern"));
179 189

  
180
		this.jButNew.setToolTipText(ps.getText("butnewpattern"));
190
			this.jButNew.setToolTipText(ps.getText("butnewpattern"));
181 191

  
182
		this.jButEdit.setToolTipText(ps.getText("buteditpattern"));
192
			this.jButEdit.setToolTipText(ps.getText("buteditpattern"));
183 193

  
184
		this.jLabPatternPath.setText(ps.getText("patternpath"));
194
			this.jLabPatternPath.setText(ps.getText("patternpath"));
185 195

  
186
		jPanGeocodingType.setBorder(GeocoUtils.getTitledBorder(ps
187
				.getText("gtype")));
196
			jPanGeocodingType.setBorder(GeocoUtils.getTitledBorder(ps
197
					.getText("gtype")));
188 198

  
189
		this.jRadioSimple.setText(ps.getText("gsimple"));
190
		this.jRadioSimple.setToolTipText(ps.getText("gsimpletip"));
199
			this.jRadioSimple.setText(ps.getText("gsimple"));
200
			this.jRadioSimple.setToolTipText(ps.getText("gsimpletip"));
191 201

  
192
		this.jRadioTable.setText(ps.getText("gtable"));
193
		this.jRadioTable.setToolTipText(ps.getText("gtabletip"));
202
			this.jRadioTable.setText(ps.getText("gtable"));
203
			this.jRadioTable.setToolTipText(ps.getText("gtabletip"));
194 204

  
195
		jPanType.setBorder(GeocoUtils.getTitledBorder(ps.getText("atype")));
205
			jPanType.setBorder(GeocoUtils.getTitledBorder(ps.getText("atype")));
196 206

  
197
		jPanSettings.setBorder(GeocoUtils.getTitledBorder(ps
198
				.getText("settings")));
207
			jPanSettings.setBorder(GeocoUtils.getTitledBorder(ps
208
					.getText("settings")));
199 209

  
200
		jPanResults
201
				.setBorder(GeocoUtils.getTitledBorder(ps.getText("results")));
210
			jPanResults.setBorder(GeocoUtils.getTitledBorder(ps
211
					.getText("results")));
202 212

  
203
		this.jButPrevious.setToolTipText(ps.getText("previoustip"));
204
		this.jButNext.setToolTipText(ps.getText("nexttip"));
213
			this.jButPrevious.setToolTipText(ps.getText("previoustip"));
214
			this.jButNext.setToolTipText(ps.getText("nexttip"));
205 215

  
206
		this.jButExit.setText(ps.getText("exit"));
207
		this.jButSearch.setText(ps.getText("search"));
208
		this.jButExport.setText(ps.getText("export"));
216
			this.jButExit.setText(ps.getText("exit"));
217
			this.jButSearch.setText(ps.getText("search"));
218
			this.jButExport.setText(ps.getText("export"));
219
		}
209 220

  
210 221
	}
211 222

  
......
578 589

  
579 590
		jButExport.setText("Export");
580 591
		jButExport.setToolTipText("Export");
592
		jButExport.setEnabled(false);
581 593
		jButExport.addActionListener(new java.awt.event.ActionListener() {
582 594
			public void actionPerformed(java.awt.event.ActionEvent evt) {
583 595
				evExport(evt);
......
604 616
		boolean apto = control.loadPatternXML();
605 617

  
606 618
		if (apto) {
607

  
608 619
			/* update the url of the pattern in the panel */
609 620
			if (control.getGmodel().getPatternFile() != null) {
610 621
				jTextPatternPath.setText(control.getGmodel().getPatternFile()
......
616 627
					.getResultsNumber());
617 628
			settingsPanel.setScore(control.getPattern().getSettings()
618 629
					.getScore());
619

  
620 630
			// enable components
621 631
			if (control.getPattern() != null) {
622 632
				this.enableComponents();
......
655 665
		control.getGmodel().setSimple(true);
656 666
		activeTableGUIFeatures(false);
657 667
		jButExport.setEnabled(false);
658

  
659 668
		// insert address panel
660 669
		insertAddressPanel();
661 670
	}
......
677 686
		control.getGmodel().setSimple(false);
678 687
		jComboTable.setEnabled(true);
679 688
		jButExport.setEnabled(false);
680

  
681 689
		// save descriptor table in the model
682 690
		List<FeatureAttributeDescriptor> descs = getListOfDescriptorSelectedTable();
683 691
		control.getGmodel().setListDescriptorSelectedTable(descs);
684

  
685 692
		// insert address panel
686 693
		insertAddressPanel();
687 694

  
......
697 704
		// save descriptor table in the model
698 705
		List<FeatureAttributeDescriptor> descs = getListOfDescriptorSelectedTable();
699 706
		control.getGmodel().setListDescriptorSelectedTable(descs);
700

  
701 707
		// insert address panel
702 708
		insertAddressPanel();
703

  
704 709
	}
705 710

  
706 711
	/**
......
748 753
	 * @param evt
749 754
	 */
750 755
	private void evSearch(java.awt.event.ActionEvent evt) {
751

  
752 756
		jTableResults.setModel(new TableResultsModel(control));
753 757
		jTableResults.validate();
754 758
		// // GEOCODING PROCESS
755 759
		control.geocoding();
756
		// // GEOCODING PROCESS
757 760
	}
758 761

  
759 762
	/**
......
762 765
	 * @param evt
763 766
	 */
764 767
	private void evExport(java.awt.event.ActionEvent evt) {
765

  
768
		new Export(control).run();
766 769
	}
767 770

  
768 771
	/**
......
784 787
	 * get window info
785 788
	 */
786 789
	public WindowInfo getWindowInfo() {
787
		// WindowInfo info = new WindowInfo(WindowInfo.MODALDIALOG
788
		// | WindowInfo.RESIZABLE);
789 790
		WindowInfo info = new WindowInfo(WindowInfo.RESIZABLE);
790

  
791 791
		info.setMinimumSize(this.getMinimumSize());
792 792
		info.setWidth(600);
793 793
		info.setHeight(530);
794 794
		info.setTitle(PluginServices.getText(this, "geocoding"));
795

  
796 795
		return info;
797 796
	}
798 797

  
......
897 896
			jButNext.setEnabled(active);
898 897
			jButPrevious.setEnabled(active);
899 898
			jLabRow.setEnabled(active);
899
			jButExport.setEnabled(active);
900 900

  
901 901
		} else {
902 902
			jLabRow.setText("");
903 903
			jButNext.setEnabled(false);
904 904
			jButPrevious.setEnabled(false);
905
			jButExport.setEnabled(false);
905 906
		}
906 907
	}
907 908

  
......
939 940
	 * Mouse pressed events
940 941
	 */
941 942
	public void mousePressed(MouseEvent e) {
942

  
943
		int row = jTableResults.getSelectedRow();
944
		TableResultsModel model = (TableResultsModel) jTableResults.getModel();
945
		boolean sel = (Boolean) model.getValueAt(row, 1);
946
		if (sel) {
947
			model.setValueAt(new Boolean(false), row, 1);
948
			// update list of selected result elements
949
			int num = control.getGmodel().getNumResultShowed();
950
			control.getGmodel().getExportElements()[num] = -1;
951
		} else {
952
			model.setValueAt(new Boolean(true), row, 1);
953
			// update list of selected result elements
954
			int num = control.getGmodel().getNumResultShowed();
955
			control.getGmodel().getExportElements()[num] = row;
956
		}
943 957
	}
944 958

  
945 959
	/**
......
955 969
		for (int i = 0; i < cant; i++) {
956 970
			if (i != row) {
957 971
				model.setValueAt(new Boolean(false), i, 1);
972
				// update list of selected result elements
973
				int num = control.getGmodel().getNumResultShowed();
958 974
			}
959
		}		
975

  
976
		}
960 977
		// zoom to geom
961 978
		Point2D pto = model.getGeometry(row);
962 979
		try {
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/GeocodingModel.java
35 35
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
36 36
import org.gvsig.fmap.dal.feature.FeatureStore;
37 37
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
38
import org.gvsig.geocoding.extension.GeocoController;
39 38
import org.gvsig.geocoding.pattern.Patterngeocoding;
40 39
import org.gvsig.geocoding.result.GeocodingResult;
41 40
import org.slf4j.Logger;
......
50 49

  
51 50
public class GeocodingModel implements IGeocodingModel {
52 51

  
52
	@SuppressWarnings("unused")
53 53
	private static final Logger log = LoggerFactory
54 54
			.getLogger(GeocodingModel.class);
55 55

  
56
	private GeocoController control = null;
57

  
58 56
	private Patterngeocoding pattern = null;
59 57

  
60 58
	private File patternFile = null;
......
68 66
	private List<FeatureAttributeDescriptor> selDescs = null;
69 67

  
70 68
	private FeatureStore selectedTableStore = null;
71
	
69

  
72 70
	private int numResultShowed;
73 71

  
72
	private Integer[] exportElements = null;
73

  
74 74
	/**
75 75
	 * Constructor
76 76
	 * 
77
	 * @param _control
78 77
	 */
79
	public GeocodingModel(GeocoController control) {
80

  
81
		this.control = control;
78
	public GeocodingModel() {
82 79
		listResults = new ArrayList<Set<GeocodingResult>>();
83 80
	}
84 81

  
......
217 214
	public void setSelectedTableStore(FeatureStore selectedTableStore) {
218 215
		this.selectedTableStore = selectedTableStore;
219 216
	}
220
	
217

  
221 218
	/**
222 219
	 * Add one result to list of results
220
	 * 
223 221
	 * @param result
224 222
	 */
225
	public void addResult(Set<GeocodingResult> result){
223
	public void addResult(Set<GeocodingResult> result) {
226 224
		this.listResults.add(result);
227 225
	}
228
	
226

  
229 227
	/**
230 228
	 * Clear list of geocoding results
231 229
	 */
232
	public void clearResults(){
230
	public void clearResults() {
233 231
		this.listResults.clear();
234 232
	}
235 233

  
......
242 240

  
243 241
	/**
244 242
	 * set number of result of results list showed
243
	 * 
245 244
	 * @param
246 245
	 */
247 246
	public void setNumResultShowed(int i) {
248 247
		this.numResultShowed = i;
249
		
248

  
250 249
	}
251 250

  
251
	/**
252
	 * get results export elements
253
	 * 
254
	 * @return
255
	 */
256
	public Integer[] getExportElements() {
257
		return exportElements;
258
	}
252 259

  
260
	/**
261
	 * set results export elemnts
262
	 * 
263
	 * @param exportElements
264
	 */
265
	public void setExportElements(Integer[] exportElements) {
266
		this.exportElements = exportElements;
267
	}
253 268

  
254 269
}
branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/gui/settings/SettingsPanel.java
11 11

  
12 12
package org.gvsig.geocoding.gui.settings;
13 13

  
14
import java.awt.event.FocusEvent;
15
import java.awt.event.FocusListener;
16 14
import java.awt.event.KeyEvent;
17 15
import java.awt.event.KeyListener;
18 16

  
......
30 28
 * @author vsanjaime
31 29
 */
32 30
public class SettingsPanel extends JPanel implements KeyListener {
33
	
31

  
34 32
	private static final int MAXRESULTS = 10;
35 33

  
36 34
	private static final long serialVersionUID = 1L;
......
133 131
		add(jPanScore, gridBagConstraints);
134 132
	}
135 133

  
136

  
137 134
	/**
138 135
	 * change score value event
139 136
	 * 
......
141 138
	 */
142 139
	private void evChangeScore(javax.swing.event.ChangeEvent evt) {
143 140
		double score = (double) jSliderScore.getValue();
144
		jLabScorePercent.setText(Integer.toString((int)score));
145
		if(control.getPattern() != null){
141
		jLabScorePercent.setText(Integer.toString((int) score));
142
		if (control.getPattern() != null) {
146 143
			control.getPattern().getSettings().setScore(score);
147
		}		
144
		}
148 145
	}
149 146

  
150 147
	/**
......
152 149
	 */
153 150
	private void setMesages() {
154 151
		PluginServices ps = PluginServices.getPluginServices(this);
155

  
156
		this.jLabMaxResults.setText(ps.getText("maxresults"));
157
		this.jLabScore.setText(ps.getText("score"));
158
		jTextMaxResults.setToolTipText(ps.getText("maxresultstip"));
159
		jSliderScore.setToolTipText(ps.getText("scoretip"));
152
		if (ps != null) {
153
			this.jLabMaxResults.setText(ps.getText("maxresults"));
154
			this.jLabScore.setText(ps.getText("score"));
155
			jTextMaxResults.setToolTipText(ps.getText("maxresultstip"));
156
			jSliderScore.setToolTipText(ps.getText("scoretip"));
157
		}
160 158
	}
161 159

  
162 160
	/**
......
175 173
	 */
176 174
	public void setScore(double score) {
177 175
		jSliderScore.setValue((int) score);
178
		jLabScorePercent.setText(Integer.toString((int)score));
176
		jLabScorePercent.setText(Integer.toString((int) score));
179 177
	}
180 178

  
181

  
182

  
183 179
	/**
184 180
	 * swich on and off components
185 181
	 * 
......
195 191

  
196 192
	/**
197 193
	 * get new pattern maximum results
194
	 * 
198 195
	 * @return
199 196
	 */
200
	public int getMaxResults() {		
197
	public int getMaxResults() {
201 198
		return Integer.parseInt(jTextMaxResults.getText());
202 199
	}
203 200

  
204 201
	/**
205 202
	 * get new pattern minimum score
203
	 * 
206 204
	 * @return
207 205
	 */
208
	public double getScore() {		
209
		return (double)jSliderScore.getValue();
206
	public double getScore() {
207
		return (double) jSliderScore.getValue();
210 208
	}
211 209

  
212
//	/**
213
//	 * focus gained event
214
//	 * @param event
215
//	 */
216
//	public void focusGained(FocusEvent e) {
217
//		// nothing to do
218
//		
219
//	}
220
//
221
//	/**
222
//	 * focus lost event
223
//	 * @param event
224
//	 */
225
//	public void focusLost(FocusEvent e) {
226
//		String max = jTextMaxResults.getText().trim();
227
//		int maxresults;
228
//		try {
229
//			maxresults = Integer.parseInt(max);
230
//			if (maxresults < 1) {
231
//				maxresults = 1;
232
//				jTextMaxResults.setText(Integer.toString(maxresults));
233
//				control.getPattern().getSettings().setResultsNumber(maxresults);
234
//			}
235
//			else{
236
//				control.getPattern().getSettings().setResultsNumber(maxresults);
237
//			}
238
//		} catch (Exception ex) {			
239
//			jTextMaxResults.setText(Integer.toString(MAXRESULTS));
240
//			jTextMaxResults.requestFocus();
241
//		}
242
//		
243
//	}
244

  
210
	/**
211
	 * key pressed event
212
	 * 
213
	 * @param e
214
	 */
245 215
	public void keyPressed(KeyEvent e) {
246
		// TODO Auto-generated method stub
247
		
216
		// nothing to do
217

  
248 218
	}
249 219

  
220
	/**
221
	 * key released event
222
	 * 
223
	 * @param e
224
	 */
250 225
	public void keyReleased(KeyEvent e) {
251 226
		String max = jTextMaxResults.getText().trim();
252 227
		int maxresults;
......
256 231
				maxresults = 1;
257 232
				jTextMaxResults.setText(Integer.toString(maxresults));
258 233
				control.getPattern().getSettings().setResultsNumber(maxresults);
259
			}
260
			else{
234
			} else {
261 235
				control.getPattern().getSettings().setResultsNumber(maxresults);
262 236
			}
263
		} catch (Exception ex) {			
237
		} catch (Exception ex) {
264 238
			jTextMaxResults.setText(Integer.toString(MAXRESULTS));
265 239
			jTextMaxResults.requestFocus();
266 240
		}
267
		
241

  
268 242
	}
269 243

  
244
	/**
245
	 * key typed event
246
	 * 
247
	 * @param e
248
	 */
270 249
	public void keyTyped(KeyEvent e) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff