Revision 38098

View differences:

branches/v2_0_0_prep/libraries/libUIComponent/src/org/gvsig/gui/beans/swing/ValidatingTextField.java
1
/*
2
 * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
3
 * for visualizing and manipulating spatial features with geometry and attributes.
4
 *
5
 * Copyright (C) 2003 Vivid Solutions
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 *
21
 * For more information, contact:
22
 *
23
 * Vivid Solutions
24
 * Suite #1A
25
 * 2328 Government Street
26
 * Victoria BC  V8T 5G5
27
 * Canada
28
 *
29
 * (250)385-6040
30
 * www.vividsolutions.com
31
 */
32
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
33
 *
34
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
35
 *
36
 * This program is free software; you can redistribute it and/or
37
 * modify it under the terms of the GNU General Public License
38
 * as published by the Free Software Foundation; either version 2
39
 * of the License, or (at your option) any later version.
40
 *
41
 * This program is distributed in the hope that it will be useful,
42
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44
 * GNU General Public License for more details.
45
 *
46
 * You should have received a copy of the GNU General Public License
47
 * along with this program; if not, write to the Free Software
48
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
49
 *
50
 * For more information, contact:
51
 *
52
 *  Generalitat Valenciana
53
 *   Conselleria d'Infraestructures i Transport
54
 *   Av. Blasco Ib??ez, 50
55
 *   46010 VALENCIA
56
 *   SPAIN
57
 *
58
 *      +34 963862235
59
 *   gvsig@gva.es
60
 *      www.gvsig.gva.es
61
 *
62
 *    or
63
 *
64
 *   IVER T.I. S.A
65
 *   Salamanca 50
66
 *   46005 Valencia
67
 *   Spain
68
 *
69
 *   +34 963163400
70
 *   dac@iver.es
71
 */
72
package org.gvsig.gui.beans.swing;
73

  
74
import java.awt.event.FocusAdapter;
75
import java.awt.event.FocusEvent;
76

  
77
import javax.swing.JOptionPane;
78
import javax.swing.JTextField;
79
import javax.swing.text.AttributeSet;
80
import javax.swing.text.BadLocationException;
81
import javax.swing.text.PlainDocument;
82

  
83
import org.gvsig.gui.beans.Messages;
84

  
85

  
86
/**
87
 * Prevents the user from entering invalid data.
88
 */
89
public class ValidatingTextField extends JTextField {
90
		private static final long serialVersionUID = -3725027007216791855L;
91

  
92
		public static final Validator LONG_VALIDATOR = new ValidatingTextField.Validator() {
93
            public boolean isValid(String text) {
94
                try {
95
                    Long.parseLong(text.trim());
96

  
97
                    return true;
98
                } catch (NumberFormatException e) {
99
                    return false;
100
                }
101
            }
102
        };
103

  
104
    /**
105
     * Prevents the user from entering invalid integer.
106
     */
107
    public static final Validator INTEGER_VALIDATOR = new ValidatingTextField.Validator() {
108
            public boolean isValid(String text) {
109
                try {
110
                    Integer.parseInt(text.trim());
111

  
112
                    return true;
113
                } catch (NumberFormatException e) {
114
                    return false;
115
                }
116
            }
117
        };
118

  
119
    /**
120
     * Prevents the user from entering invalid double.
121
     */
122
    public static final Validator DOUBLE_VALIDATOR = new ValidatingTextField.Validator() {
123
            public boolean isValid(String text) {
124
                try {
125
                    //Add "0" so user can type "-" [Jon Aquino]
126
                    Double.parseDouble(text.trim() + "0");
127

  
128
                    return true;
129
                } catch (NumberFormatException e) {
130
                    return false;
131
                }
132
            }
133
        };
134

  
135
    /**
136
     * Cleaner that does nothing.
137
     */
138
    public static Cleaner DUMMY_CLEANER = new Cleaner() {
139
            public String clean(String text) {
140
                return text;
141
            }
142
        };
143

  
144
    /**
145
     * The validators allow the user to simply enter "+", "-", or ".". If the user
146
     * doesn't go any farther, this cleaner will set the text to 0, which is reasonable.
147
     */
148
    public static Cleaner NUMBER_CLEANER = new Cleaner() {
149
            public String clean(String text) {
150
            	if (text!=null) {
151
            		try {
152
            			Double.parseDouble(text.trim());
153

  
154
            		} catch (NumberFormatException e) {
155
            			return "0";
156
            		}
157
            	}
158
            	return text;
159

  
160
            }
161
        };
162

  
163

  
164
    /**
165
     * The validators allow the user to simply enter "+", "-", or ".". If the user
166
     * doesn't go any farther, this cleaner will set the text to 0, which is reasonable.
167
     */
168
        public static Cleaner NUMBER_CLEANER_2_DECIMALS = new Cleaner() {
169
            public String clean(String text) {
170
            	if (text!=null) {
171
            		try {
172
            			double d = Double.parseDouble(text.trim());
173
            			long integerPart = (long) d; //(int) d;
174
            			double decimalPart = d - integerPart;
175
            			int truncatedDecimalPart = Math.abs((int) Math.round(decimalPart*100));
176
            			text = "";
177
            			if (d<0.0 && integerPart >=0.0){
178
            				text = "-";
179
            			}
180
            			if (truncatedDecimalPart<10){
181
               				text = text + integerPart + ".0" + truncatedDecimalPart;
182
            			} else {
183
               				text = text + integerPart + "." + truncatedDecimalPart;
184
            			}
185
            		} catch (NumberFormatException e) {
186
            			return "0";
187
            		}
188
            	}
189

  
190
            	return text;
191
            }
192
        };
193

  
194
//        public static class NumberWithDefinedDecimalNumberCuntCleaner extends NumberCleaner {
195
//        	private int decimalCount = 2;
196
//        	public NumberWithDefinedDecimalNumberCuntCleaner(String textToAppend) {
197
//    			this(textToAppend, 2);
198
//    		}
199
//    		public NumberWithDefinedDecimalNumberCuntCleaner(String textToAppend, int decimalCount) {
200
//        		super(textToAppend);
201
//        		this.decimalCount = decimalCount;
202
//    		}
203
//
204
//    		@Override
205
//    		public String clean(String text) {
206
//    			String s = super.clean(text);
207
//    			if (s.indexOf(ch)
208
//
209
//    			return s;
210
//    		}
211
//        }
212

  
213
    /**
214
     * Validator that does nothing.
215
     */
216
    public static Validator DUMMY_VALIDATOR = new Validator() {
217
            public boolean isValid(String text) {
218
                return true;
219
            }
220
        };
221

  
222
    private Cleaner cleaner;
223

  
224
    /**
225
     * Validator that uses dummy cleaner.
226
     */
227
    public ValidatingTextField(String text, int columns,
228
        final Validator validator) {
229
        this(text, columns, LEFT, validator, DUMMY_CLEANER);
230
    }
231

  
232
    /**
233
     * Validator for text fields.
234
     */
235
    public ValidatingTextField(String text, int columns,
236
        int horizontalAlignment, final Validator validator,
237
        final Cleaner cleaner) {
238
        super(columns);
239
        this.cleaner = cleaner;
240
        setHorizontalAlignment(horizontalAlignment);
241
        installValidationBehavior(this, validator, cleaner);
242

  
243
        //Clean the text, mainly so that parties wishing to install a BlankCleaner
244
        //need only pass "" for the text. [Jon Aquino]
245
//        setText(cleaner.clean(text));
246
        setText(text);
247
        //Bonus: workaround for how GridBagLayout shrinks components to
248
        //minimum sizes if it can't accomodate their preferred sizes. [Jon Aquino]
249
        setMinimumSize(getPreferredSize());
250
    }
251

  
252
    //Hopefully this will let us add validation behaviour to combo boxes. [Jon Aquino]
253
    public static void installValidationBehavior(final JTextField textField,
254
    		final Validator validator, final Cleaner cleaner) {
255
    	textField.setDocument(new PlainDocument() {
256
    		private static final long serialVersionUID = 7097829094600558963L;
257

  
258
    		public void insertString(int offs, String str, AttributeSet a)
259
    		throws BadLocationException {
260
    			String currentText = this.getText(0, getLength());
261
    			String beforeOffset = currentText.substring(0, offs);
262
    			String afterOffset = currentText.substring(offs,
263
    					currentText.length());
264
    			String proposedResult = beforeOffset + str + afterOffset;
265
    			if (validator.isValid(cleaner.clean(proposedResult))) {
266
    				super.insertString(offs, str, a);
267
    			}
268
    		}
269

  
270
    		public void remove(int offs, int len)
271
    		throws BadLocationException {
272
    			String currentText = this.getText(0, getLength());
273
    			String beforeOffset = currentText.substring(0, offs);
274
    			String afterOffset = currentText.substring(len + offs,
275
    					currentText.length());
276
    			String proposedResult = beforeOffset + afterOffset;
277
    			if (validator.isValid(cleaner.clean(proposedResult))) {
278
    				super.remove(offs, len);
279
    			}
280
    		}
281
    	});
282
    	textField.addFocusListener(new FocusAdapter() {
283
    		public void focusLost(FocusEvent e) {
284
    			textField.setText(cleaner.clean(textField.getText()));
285
    		}
286
    	});
287
    }
288

  
289
    public String getText() {
290
        //Focus may not be lost yet (e.g. when syncing with scrollbar) [Jon Aquino]
291
    	return cleaner.clean(super.getText());
292
    }
293

  
294
    public void setText(String text) {
295
        super.setText(cleaner.clean(text));
296
    }
297

  
298
    public double getDouble() {
299
        return Double.parseDouble(getText().trim());
300
    }
301

  
302
    public int getInteger() {
303
        return Integer.parseInt(getText().trim());
304
    }
305

  
306
    public static interface Validator {
307
        public boolean isValid(String text);
308
    }
309

  
310
    public static interface Cleaner {
311
        public String clean(String text);
312
    }
313

  
314
/**
315
 * Implements validator with a greater than threshold.
316
 */
317

  
318
    public static class GreaterThanValidator implements Validator {
319
        private double threshold;
320

  
321
        public GreaterThanValidator(double threshold) {
322
            this.threshold = threshold;
323
        }
324

  
325
        public boolean isValid(String text) {
326
            return Double.parseDouble(text.trim()) > threshold;
327
        }
328
    }
329
/**
330
 * Implements validator with a less than threshold.
331
 */
332

  
333
    public static class LessThanValidator implements Validator {
334
        private double threshold;
335

  
336
        public LessThanValidator(double threshold) {
337
            this.threshold = threshold;
338
        }
339

  
340
        public boolean isValid(String text) {
341
            return Double.parseDouble(text.trim()) < threshold;
342
        }
343
    }
344
/**
345
 * Implements validator with a greater than or equal to threshold.
346
 */
347

  
348
    public static class GreaterThanOrEqualValidator implements Validator {
349
        private double threshold;
350

  
351
        public GreaterThanOrEqualValidator(double threshold) {
352
            this.threshold = threshold;
353
        }
354

  
355
        public boolean isValid(String text) {
356
            return Double.parseDouble(text.trim()) >= threshold;
357
        }
358
    }
359
/**
360
 * Implements validator with a less than or equal to threshold.
361
 */
362

  
363
    public static class LessThanOrEqualValidator implements Validator {
364
        private double threshold;
365

  
366
        public LessThanOrEqualValidator(double threshold) {
367
            this.threshold = threshold;
368
        }
369

  
370
        public boolean isValid(String text) {
371
            return Double.parseDouble(text.trim()) <= threshold;
372
        }
373
    }
374

  
375
    /**
376
 * Implements cleaner which cleans up blank strings.
377
 */
378

  
379

  
380
    public static class BlankCleaner implements Cleaner {
381
        private String replacement;
382

  
383
        public BlankCleaner(String replacement) {
384
            this.replacement = replacement;
385
        }
386

  
387
        public String clean(String text) {
388
            return (text.trim().length() == 0) ? replacement : text;
389
        }
390
    }
391

  
392
    /**
393
     * Allow the user to start typing a number with "-" or "."
394
     * @author jaquino
395
     *
396
     * To change the template for this generated type comment go to
397
     * Window>Preferences>Java>Code Generation>Code and Comments
398
     */
399
    public static class NumberCleaner implements Cleaner {
400
        private String textToAppend;
401

  
402
        public NumberCleaner(String textToAppend) {
403
            this.textToAppend = textToAppend;
404
        }
405

  
406
        public String clean(String text) {
407
            if (text.trim().length() == 0) { return text; }
408
            try {
409
                Double.parseDouble(text);
410
                return text;
411
            }
412
            catch (NumberFormatException e) {
413
                return text + textToAppend;
414
            }
415
        }
416
    }
417

  
418

  
419

  
420
    public static class MinIntCleaner implements Cleaner {
421
        private int minimum;
422

  
423
        public MinIntCleaner(int minimum) {
424
            this.minimum = minimum;
425
        }
426

  
427
        public String clean(String text) {
428
        	String s="";
429
        	s=""+ Math.max(minimum, Integer.parseInt(text));
430
        	return s;
431
        }
432
    }
433

  
434
/**
435
 * Extends CompositeValidator to validat that integers is within a set of boundary values.
436
 */
437
    public static class BoundedIntValidator extends CompositeValidator {
438
        public BoundedIntValidator(int min, int max) {
439
            super(new Validator[] {
440
                    INTEGER_VALIDATOR, new GreaterThanOrEqualValidator(min),
441
                    new LessThanOrEqualValidator(max)
442
                });
443
            assert (min < max);
444
        }
445
    }
446

  
447
    public static class BoundedDoubleValidator extends CompositeValidator {
448
        public BoundedDoubleValidator(double min, boolean includeMin,
449
            double max, boolean includeMax) {
450
            super(new Validator[] {
451
                    DOUBLE_VALIDATOR,
452
                    includeMin
453
                    ? (Validator) new GreaterThanOrEqualValidator(min)
454
                    : new GreaterThanValidator(min),
455
                    includeMax ? (Validator) new LessThanOrEqualValidator(max)
456
                               : new LessThanValidator(max)
457
                });
458
            assert (min < max);
459
        }
460
    }
461

  
462
    public static class MaxIntCleaner implements Cleaner {
463
        private int maximum;
464

  
465
        public MaxIntCleaner(int maximum) {
466
            this.maximum = maximum;
467
        }
468

  
469
        public String clean(String text) {
470
        	String s="";
471
        	s=""+ Math.min(maximum, Integer.parseInt(text));
472
        	return s;
473
        }
474
    }
475
/**
476
 * Implements validator to check for more than one condition.
477
 */
478

  
479
    public static class CompositeValidator implements Validator {
480
        private Validator[] validators;
481

  
482
        public CompositeValidator(Validator[] validators) {
483
            this.validators = validators;
484
        }
485

  
486
        public boolean isValid(String text) {
487
            for (int i = 0; i < validators.length; i++) {
488
                if (!validators[i].isValid(text)) {
489
                    return false;
490
                }
491
            }
492

  
493
            return true;
494
        }
495
    }
496

  
497
    public static class CompositeCleaner implements Cleaner {
498
        private Cleaner[] cleaners;
499

  
500
        public CompositeCleaner(Cleaner[] cleaners) {
501
            this.cleaners = cleaners;
502
        }
503

  
504
        public String clean(String text) {
505
            String result = text;
506
            try{
507
            	for (int i = 0; i < cleaners.length; i++) {
508
            		result = cleaners[i].clean(result);
509
            	}
510
        	}catch (NumberFormatException e) {
511
   			 	JOptionPane.showMessageDialog(null, Messages.getText("numero_incorrecto"));
512
           	}
513

  
514

  
515
            return result;
516
        }
517
    }
518
}
branches/v2_0_0_prep/libraries/libUIComponent/pom.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2

  
3
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4 5

  
5
    <modelVersion>4.0.0</modelVersion>
6
    <artifactId>org.gvsig.ui</artifactId>
7
    <packaging>jar</packaging>
8
    <version>2.0.1-SNAPSHOT</version>
9
    <name>libUIComponent</name>
10
    <description>Swing components collection</description>
11
    <parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.maven.base.pom</artifactId>
14
        <version>1.0.8-SNAPSHOT</version>
15
    </parent>
16
    <scm>
17
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/libUIComponent</connection>
18
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/libUIComponent</developerConnection>
19
        <url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/libraries/libUIComponent</url>
20
    </scm>
21
    <repositories>
22
        <repository>
23
            <id>gvsig-public-http-repository</id>
24
            <name>gvSIG maven public HTTP repository</name>
25
            <url>http://devel.gvsig.org/m2repo/j2se</url>
26
            <releases>
27
                <enabled>true</enabled>
28
                <updatePolicy>daily</updatePolicy>
29
                <checksumPolicy>warn</checksumPolicy>
30
            </releases>
31
            <snapshots>
32
                <enabled>true</enabled>
33
                <updatePolicy>daily</updatePolicy>
34
                <checksumPolicy>warn</checksumPolicy>
35
            </snapshots>
36
        </repository>
37
    </repositories>
38
    <dependencyManagement>
39
        <dependencies>
40
            <dependency>
41
                <groupId>org.gvsig</groupId>
42
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
43
                <version>2.0.1-SNAPSHOT</version>
44
                <type>pom</type>
45
                <scope>import</scope>
46
            </dependency>
47
        </dependencies>
48
    </dependencyManagement>
49
    <dependencies>
50
        <dependency>
51
            <groupId>org.gvsig</groupId>
52
            <artifactId>org.gvsig.i18n</artifactId>
53
            <scope>compile</scope>
54
        </dependency>
55
        <dependency>
56
            <groupId>org.gvsig</groupId>
57
            <artifactId>org.gvsig.tools.lib</artifactId>
58
            <scope>compile</scope>
59
        </dependency>
60
        <dependency>
61
            <groupId>jfree</groupId>
62
            <artifactId>jcommon</artifactId>
63
            <scope>compile</scope>
64
        </dependency>
65
        <dependency>
66
            <groupId>jfree</groupId>
67
            <artifactId>jfreechart</artifactId>
68
            <scope>compile</scope>
69
        </dependency>
70
        <dependency>
71
            <groupId>net.sf</groupId>
72
            <artifactId>flib-jcalendar</artifactId>
73
            <scope>compile</scope>
74
        </dependency>
75
        <dependency>
76
            <groupId>jwizardcomponent</groupId>
77
            <artifactId>jwizardcomponent</artifactId>
78
            <scope>compile</scope>
79
        </dependency>
80
        <dependency>
81
            <groupId>org.slf4j</groupId>
82
            <artifactId>slf4j-api</artifactId>
83
            <scope>compile</scope>
84
        </dependency>
85
    </dependencies>
86
    <build>
87
        <sourceDirectory>src</sourceDirectory>
88
        <testSourceDirectory>src-test-ui</testSourceDirectory>
89
        <resources>
90
            <resource>
91
                <directory>src</directory>
92
                <includes>
93
                    <include>**/*.gif</include>
94
                    <include>**/*.png</include>
95
                    <include>**/*.PNG</include>
96
                    <include> **/*.bmp</include>
97
                    <include> **/*.jpg</include>
98
                    <include> **/*.jpeg</include>
99
                    <include> **/*.properties</include>
100
                </includes>
101
            </resource>
102
            <resource>
103
                <targetPath>org/gvsig/gui/beans/resources/translations</targetPath>
104
                <filtering>false</filtering>
105
                <directory>${basedir}/config</directory>
106
                <includes>
107
                    <include>*.properties</include>
108
                </includes>
109
            </resource>
110
        </resources>
111
        <!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
112
        <plugins>
113
            <plugin>
114
                <groupId>org.apache.maven.plugins</groupId>
115
                <artifactId>maven-surefire-plugin</artifactId>
116
                <configuration>
117
                    <skipTests>true</skipTests>
118
                </configuration>
119
            </plugin>
120
            <plugin>
121
                <groupId>org.apache.maven.plugins</groupId>
122
                <artifactId>maven-compiler-plugin</artifactId>
123
                <configuration>
124
                    <testExcludes>
125
                        <exclude>**</exclude>
126
                    </testExcludes>
127
                </configuration>
128
            </plugin>
129
        </plugins>
130
    </build>
6
	<modelVersion>4.0.0</modelVersion>
7
	<artifactId>org.gvsig.ui</artifactId>
8
	<packaging>jar</packaging>
9
	<version>2.0.1-SNAPSHOT</version>
10
	<name>libUIComponent</name>
11
	<description>Swing components collection</description>
12
	<parent>
13
		<groupId>org.gvsig</groupId>
14
		<artifactId>org.gvsig.maven.base.pom</artifactId>
15
		<version>1.0.8-SNAPSHOT</version>
16
	</parent>
17
	<scm>
18
		<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/libUIComponent</connection>
19
		<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/libUIComponent</developerConnection>
20
		<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/libraries/libUIComponent</url>
21
	</scm>
22
	<repositories>
23
		<repository>
24
			<id>gvsig-public-http-repository</id>
25
			<name>gvSIG maven public HTTP repository</name>
26
			<url>http://devel.gvsig.org/m2repo/j2se</url>
27
			<releases>
28
				<enabled>true</enabled>
29
				<updatePolicy>daily</updatePolicy>
30
				<checksumPolicy>warn</checksumPolicy>
31
			</releases>
32
			<snapshots>
33
				<enabled>true</enabled>
34
				<updatePolicy>daily</updatePolicy>
35
				<checksumPolicy>warn</checksumPolicy>
36
			</snapshots>
37
		</repository>
38
	</repositories>
39
	<dependencyManagement>
40
		<dependencies>
41
			<dependency>
42
				<groupId>org.gvsig</groupId>
43
				<artifactId>org.gvsig.core.maven.dependencies</artifactId>
44
				<version>2.0.1-SNAPSHOT</version>
45
				<type>pom</type>
46
				<scope>import</scope>
47
			</dependency>
48
		</dependencies>
49
	</dependencyManagement>
50
	<dependencies>
51
		<dependency>
52
			<groupId>org.gvsig</groupId>
53
			<artifactId>org.gvsig.i18n</artifactId>
54
			<scope>compile</scope>
55
		</dependency>
56
		<dependency>
57
			<groupId>org.gvsig</groupId>
58
			<artifactId>org.gvsig.tools.lib</artifactId>
59
			<scope>compile</scope>
60
		</dependency>
61
		<dependency>
62
			<groupId>jfree</groupId>
63
			<artifactId>jcommon</artifactId>
64
			<scope>compile</scope>
65
		</dependency>
66
		<dependency>
67
			<groupId>jfree</groupId>
68
			<artifactId>jfreechart</artifactId>
69
			<scope>compile</scope>
70
		</dependency>
71
		<dependency>
72
			<groupId>net.sf</groupId>
73
			<artifactId>flib-jcalendar</artifactId>
74
			<scope>compile</scope>
75
		</dependency>
76
		<dependency>
77
			<groupId>jwizardcomponent</groupId>
78
			<artifactId>jwizardcomponent</artifactId>
79
			<scope>compile</scope>
80
		</dependency>
81
		<dependency>
82
			<groupId>org.slf4j</groupId>
83
			<artifactId>slf4j-api</artifactId>
84
			<scope>compile</scope>
85
		</dependency>
86
		<dependency>
87
			<groupId>org.gvsig.external</groupId>
88
			<artifactId>org.gvsig.external.jump</artifactId>
89
			<scope>compile</scope>
90
			<version>1.0.0-SNAPSHOT</version>
91
		</dependency>
92
	</dependencies>
93
	<build>
94
		<sourceDirectory>src</sourceDirectory>
95
		<testSourceDirectory>src-test-ui</testSourceDirectory>
96
		<resources>
97
			<resource>
98
				<directory>src</directory>
99
				<includes>
100
					<include>**/*.gif</include>
101
					<include>**/*.png</include>
102
					<include>**/*.PNG</include>
103
					<include> **/*.bmp</include>
104
					<include> **/*.jpg</include>
105
					<include> **/*.jpeg</include>
106
					<include> **/*.properties</include>
107
				</includes>
108
			</resource>
109
			<resource>
110
				<targetPath>org/gvsig/gui/beans/resources/translations</targetPath>
111
				<filtering>false</filtering>
112
				<directory>${basedir}/config</directory>
113
				<includes>
114
					<include>*.properties</include>
115
				</includes>
116
			</resource>
117
		</resources>
118
		<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
119
		<plugins>
120
			<plugin>
121
				<groupId>org.apache.maven.plugins</groupId>
122
				<artifactId>maven-surefire-plugin</artifactId>
123
				<configuration>
124
					<skipTests>true</skipTests>
125
				</configuration>
126
			</plugin>
127
			<plugin>
128
				<groupId>org.apache.maven.plugins</groupId>
129
				<artifactId>maven-compiler-plugin</artifactId>
130
				<configuration>
131
					<testExcludes>
132
						<exclude>**</exclude>
133
					</testExcludes>
134
				</configuration>
135
			</plugin>
136
		</plugins>
137
	</build>
131 138

  
132
    <profiles>
133
        <profile>
134
            <id>eclipse-project</id>
135
            <build>
136
                <plugins>
137
                    <plugin>
138
                        <artifactId>maven-antrun-plugin</artifactId>
139
                        <configuration>
140
                            <tasks>
141
                                <ant antfile="${basedir}/../build/ant-tasks/eclipse-tasks.xml" target="eclipse.eclipse" />
142
                            </tasks>
143
                        </configuration>
144
                        <dependencies>
145
                            <dependency>
146
                                <groupId>org.apache.ant</groupId>
147
                                <artifactId>ant-trax</artifactId>
148
                                <version>1.7.1</version>
149
                            </dependency>
150
                            <dependency>
151
                                <groupId>xalan</groupId>
152
                                <artifactId>xalan</artifactId>
153
                                <version>2.6.0</version>
154
                            </dependency>
155
                        </dependencies>
156
                    </plugin>
157
                </plugins>
158
            </build>
159
        </profile>
160
        <profile>
161
            <id>gvsig-install</id>
162
            <activation>
163
                <activeByDefault>true</activeByDefault>
164
            </activation>
165
            <properties>
166
                <!-- gvSIG installation folder -->
167
                <gvsig.install.dir>${basedir}/../build/product
168
                </gvsig.install.dir>
169
            </properties>
170
        </profile>
171
    </profiles>
172
    <properties>
173
        <eclipse.project.name>libUIComponent</eclipse.project.name>
174
    </properties>
139
	<profiles>
140
		<profile>
141
			<id>eclipse-project</id>
142
			<build>
143
				<plugins>
144
					<plugin>
145
						<artifactId>maven-antrun-plugin</artifactId>
146
						<configuration>
147
							<tasks>
148
								<ant antfile="${basedir}/../build/ant-tasks/eclipse-tasks.xml"
149
									target="eclipse.eclipse" />
150
							</tasks>
151
						</configuration>
152
						<dependencies>
153
							<dependency>
154
								<groupId>org.apache.ant</groupId>
155
								<artifactId>ant-trax</artifactId>
156
								<version>1.7.1</version>
157
							</dependency>
158
							<dependency>
159
								<groupId>xalan</groupId>
160
								<artifactId>xalan</artifactId>
161
								<version>2.6.0</version>
162
							</dependency>
163
						</dependencies>
164
					</plugin>
165
				</plugins>
166
			</build>
167
		</profile>
168
		<profile>
169
			<id>gvsig-install</id>
170
			<activation>
171
				<activeByDefault>true</activeByDefault>
172
			</activation>
173
			<properties>
174
				<!-- gvSIG installation folder -->
175
				<gvsig.install.dir>${basedir}/../build/product
176
				</gvsig.install.dir>
177
			</properties>
178
		</profile>
179
	</profiles>
180
	<properties>
181
		<eclipse.project.name>libUIComponent</eclipse.project.name>
182
	</properties>
175 183
</project>

Also available in: Unified diff