Revision 33213

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/styling/JComboBoxColorScheme.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
4 5
 *
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
......
14 15
 *
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
18 20
 *
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 21
 */
41 22
package com.iver.cit.gvsig.gui.styling;
42 23

  
......
49 30
import java.awt.Rectangle;
50 31
import java.awt.event.ActionEvent;
51 32
import java.awt.event.ActionListener;
52
import java.io.File;
53 33
import java.util.ArrayList;
54 34

  
55 35
import javax.swing.JComboBox;
......
70 50
 * @autor jaume dominguez faus - jaume.dominguez@iver.es
71 51
 */
72 52
public class JComboBoxColorScheme extends JComboBox {
73
	private String palettesPath = System.getProperty("user.home") +
74
	File.separator +
75
	"gvSIG" +
76
	File.separator +
77
	"ColorSchemes";
78

  
53
	private String palettesPath = com.iver.andami.Launcher.getAppHomeDir() + "ColorSchemes";
79 54
	private boolean interpolated = false;
80 55
	private ArrayList fileList = new ArrayList();
81 56

  
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/styling/StyleSelector.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
4 5
 *
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
......
14 15
 *
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
18 20
 *
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 21
 */
41 22

  
42 23
/* CVS MESSAGES:
......
181 162

  
182 163
		styleType = ((StyleSelectorFilter)filter).getAllowedObject();
183 164
		Preferences prefs = Preferences.userRoot().node( "gvsig.foldering" );
184
		rootDir = new File(prefs.get("SymbolStylesFolder", System.getProperty("user.home")+"/gvSIG/Styles"));
165
		rootDir = new File(prefs.get("SymbolStylesFolder", com.iver.andami.Launcher.getAppHomeDir() + "Styles"));
185 166
		if (!rootDir.exists())
186 167
			rootDir.mkdir();
187 168

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/SymbologyFactory.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
4 5
 *
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
......
14 15
 *
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
18 20
 *
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 21
 */
41 22

  
42 23
/* CVS MESSAGES:
......
113 94
import java.awt.Stroke;
114 95
import java.awt.geom.AffineTransform;
115 96
import java.awt.geom.Ellipse2D;
116
import java.io.File;
117
import java.io.IOException;
118 97

  
119 98
import javax.print.attribute.PrintRequestAttributeSet;
120 99
import javax.swing.JFrame;
......
143 122
import com.iver.cit.gvsig.fmap.core.symbols.SymbolDrawingException;
144 123
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
145 124
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
125
import com.iver.utiles.FileUtils;
146 126
import com.iver.utiles.IPersistence;
147 127
import com.iver.utiles.NotExistInXMLEntity;
148 128
import com.iver.utiles.XMLEntity;
......
159 139
 *
160 140
 * @author jaume dominguez faus - jaume.dominguez@iver.es
161 141
 */
142

  
162 143
public class SymbologyFactory {
163 144

  
164 145
	/**
165
	 * This Constants are only used in SymbologyPage (preferences page for symbology),
146
 	* This Constants are only used in SymbologyPage (preferences page for symbology),
166 147
	 * do not use in other context.
167 148
	 */
168 149
	public static final Color FactoryDefaultSymbolColor = Color.GRAY;
169 150
	public static final Color FactoryDefaultFillSymbolColor = new Color(60, 235, 235);
170 151
	public static final Font FactoryDefaultTextFont =  new Font("Serif", Font.PLAIN, 8);
171
	public static final String FactorySymbolLibraryPath =
172
		System.getProperty("user.home") +
173
		File.separator +
174
		"gvSIG" +
175
		File.separator +
176
		"Symbols";
177 152

  
178
	public static final String FactoryStyleLibraryPath =
179
		System.getProperty("user.home") +
180
		File.separator +
181
		"gvSIG" +
182
		File.separator +
183
		"Styles";
153
	public static final String FactorySymbolLibraryPath = FileUtils.getAppHomeDir() + "Symbols";
154
	public static final String FactoryStyleLibraryPath = FileUtils.getAppHomeDir() + "Styles";
184 155

  
185 156
	public static final Boolean FactoryDefaultAleatoryFillColor = false;
186 157

  
trunk/libraries/libIverUtiles/src-test/com/iver/utiles/search/TestBinarySearchUsingFirstCharacters.java
8 8
import java.util.Locale;
9 9
import java.util.Vector;
10 10

  
11
import junit.framework.TestCase;
12

  
11 13
import com.iver.utiles.CompareLists;
12 14
import com.iver.utiles.StringComparator;
13 15

  
14
import junit.framework.TestCase;
15

  
16 16
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
17 17
 *
18 18
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
trunk/libraries/libIverUtiles/src-test/com/iver/utiles/TestStringComparator.java
2 2

  
3 3
import java.text.Collator;
4 4
import java.util.Collections;
5
import java.util.List;
5 6
import java.util.Locale;
6 7
import java.util.Vector;
7
import java.util.List;
8 8

  
9 9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10 10
 *
trunk/libraries/libIverUtiles/src-test/com/iver/utiles/vectorUtilities/TestVectorUtilities.java
4 4
import java.util.Locale;
5 5
import java.util.Vector;
6 6

  
7
import junit.framework.TestCase;
8

  
7 9
import com.iver.utiles.StringComparator;
8 10

  
9
import junit.framework.TestCase;
10

  
11 11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12 12
 *
13 13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
trunk/libraries/libIverUtiles/src/com/iver/utiles/connections/ConnectionDB.java
60 60
import org.apache.commons.pool.ObjectPool;
61 61
import org.apache.commons.pool.impl.GenericObjectPool;
62 62

  
63
import com.iver.utiles.FileUtils;
63 64

  
65

  
64 66
/**
65 67
 * Class responsible of the operations on the database.
66 68
 *
......
358 360
        properties.put("jdbc.connBeginning",ct.getConnBeginning());
359 361
        boolean success = true;
360 362
        File file = null;
361
        /*
362
         * TODO LWS: esto tiene pinta de no ser portable (case, en linux). Ahora
363
         * en el Launcher de Andami hay un appHome, pero si lo pongo aqui ya estamos metiendo
364
         * dependencias circulares ...
365
         */ 
366
        String directory = System.getProperty("user.home") + "\\" + "gvsig" +
367
            "\\" + "connections";
363
       
364
        String directory = FileUtils.getAppHomeDir() + "connections";
368 365

  
369 366
        if (!new File(directory).exists()) {
370 367
            file = new File(directory);
......
372 369
        }
373 370

  
374 371
        if (success) {
375
            File f = new File(directory + "/" + name + ".properties");
372
			File f = new File(directory + File.separator + name + ".properties");
376 373
            f.createNewFile();
377 374

  
378 375
            FileOutputStream out = new FileOutputStream(f);
......
381 378
        }
382 379
    }
383 380
    public void delPersistence(String name){
384
    	String directory = System.getProperty("user.home") + "\\" + "gvsig" +
385
        "\\" + "connections";
381
    	String directory = FileUtils.getAppHomeDir() + "connections";
386 382
    	 File dir = new File(directory);
387 383
         File[] files = dir.listFiles();
388 384
         for (int i = 0; i < files.length; i++) {
......
400 396
     */
401 397
    public ConnectionTrans[] getPersistence() throws IOException {
402 398
        ArrayList conns = new ArrayList();
403
        String directory = System.getProperty("user.home") + "\\" + "gvsig" +
404
            "\\" + "connections";
399
        String directory = FileUtils.getAppHomeDir() + "connections";
405 400
        File dir = new File(directory);
406 401
        File[] files = dir.listFiles();
407 402
        if (files == null)
trunk/libraries/libIverUtiles/src/com/iver/utiles/FileUtils.java
55 55
 * @author wolf
56 56
 */
57 57
public class FileUtils {
58
	private static String appHomeDir = null;
59
	
58 60
    private FileUtils() {
59 61
    }
62
    
63
	/**
64
	 * Gets Home Directory location of the application.
65
	 * @return
66
	 */
67
	public static String getAppHomeDir() {
68
		if(appHomeDir == null) 
69
			appHomeDir = System.getProperty("user.home") + File.separator + "gvSIG" + File.separator;
70
		return appHomeDir;
71
	}
60 72

  
73
	/**
74
	 * Sets Home Directory location of the application.
75
	 * @param appHomeDir
76
	 */
77
	public static void setAppHomeDir(String appHomeDir) {
78
		FileUtils.appHomeDir = appHomeDir;
79
	}
80

  
61 81
    public static String getFileExtension(File f) {
62 82
        String fileName = f.getName();
63 83
        int extensionStart = fileName.lastIndexOf('.');
trunk/libraries/libIverUtiles/src/com/iver/utiles/xmlViewer/XMLViewer.java
47 47
package com.iver.utiles.xmlViewer;
48 48

  
49 49
import java.util.ArrayList;
50
import java.util.HashMap;
51
import java.util.Iterator;
52 50
import java.util.Stack;
53 51

  
54 52
import javax.swing.JPanel;
trunk/extensions/extNormalization/src/org/gvsig/normalization/preferences/NormPreferences.java
47 47
 */
48 48

  
49 49
public class NormPreferences extends AbstractPreferencePage {
50

  
51
	/**
52
	 * 
53
	 */
54 50
	private static final long serialVersionUID = 1L;
51
	
52
	private String normFolder = com.iver.andami.Launcher.getAppHomeDir() + "normalization" + File.separator;
55 53

  
56
	private String normFolder = System.getProperty("user.home")
57
			+ File.separator + "gvSIG" + File.separator + "normalization"
58
			+ File.separator;
59

  
60 54
	private ImageIcon icon;
61 55

  
62 56
	private String tag = "Normalization_pattern_folder";
trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/gui/preferences/panels/PreferenceLoadLayer.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
4 5
 *
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
......
14 15
 *
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
18 21
 */
19 22
package org.gvsig.raster.gui.preferences.panels;
20 23

  
......
24 27
import java.awt.Insets;
25 28
import java.awt.event.ActionEvent;
26 29
import java.awt.event.ActionListener;
27
import java.io.File;
28 30
import java.util.ArrayList;
29 31

  
30 32
import javax.swing.BorderFactory;
......
41 43
import org.gvsig.raster.gui.preferences.combocolortable.PaintItem;
42 44
import org.gvsig.raster.gui.preferences.combocolortable.PreferenceColorTableIconPainter;
43 45
import org.gvsig.raster.util.BasePanel;
46

  
47
import com.iver.utiles.FileUtils;
44 48
/**
45 49
 * PreferenceLoadLayer es una clase para la configuracion de las preferencias
46 50
 * de una capa raster.
......
117 121
	 * @return
118 122
	 */
119 123
	public String getPalettesPath() {
120
		return System.getProperty("user.home") +
121
				File.separator +
122
				"gvSIG" + // PluginServices.getArguments()[0] +
123
				File.separator + "colortable";
124
		return ( FileUtils.getAppHomeDir() + "colortable" );
124 125
	}
125 126
	
126 127
	/**
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/colortable/ui/library/ColorTableLibraryPanel.java
1
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
4 5
 *
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
......
14 15
 *
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
18 21
 */
19 22
package org.gvsig.rastertools.colortable.ui.library;
20 23

  
......
50 53
import org.gvsig.rastertools.colortable.data.ColorTableData;
51 54

  
52 55
import com.iver.andami.PluginServices;
56
import com.iver.utiles.FileUtils;
53 57
/**
54 58
 * Panel que aparece en la parte inferior derecha que contiene la lista
55 59
 * de librerias disponibles para las tablas de color, con sus botones correspondientes
......
71 75

  
72 76
	private ArrayList         actionCommandListeners = new ArrayList();
73 77
	private ColorTableData    colorTableData         = null;
74
	
78

  
75 79
	private ColorTable        currentColorTable      = null;
76
	
77
	public static String palettesPath = System.getProperty("user.home") +
78
	File.separator +
79
	"gvSIG" + // PluginServices.getArguments()[0] +
80
	File.separator + "colortable";
80

  
81
	public static String      palettesPath           = FileUtils.getAppHomeDir() + "colortable";
81 82
		
82 83
	/**
83
	 *Inicializa componentes grficos y traduce
84
	 *Inicializa componentes gr?ficos y traduce
84 85
	 */
85 86
	public ColorTableLibraryPanel() {
86 87
		init();
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/raster/layers/FLyrRasterSE.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
1
/* gvSIG. Geographic Information System of the Valencian Government
2 2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
4 5
 *
5 6
 * This program is free software; you can redistribute it and/or
6 7
 * modify it under the terms of the GNU General Public License
......
14 15
 *
15 16
 * You should have received a copy of the GNU General Public License
16 17
 * 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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
18 21
 */
19 22
package org.gvsig.fmap.raster.layers;
20 23

  
......
105 108
import com.iver.cit.gvsig.fmap.layers.layerOperations.XMLItem;
106 109
import com.iver.cit.gvsig.fmap.rendering.ILegend;
107 110
import com.iver.cit.gvsig.fmap.rendering.LegendListener;
111
import com.iver.utiles.FileUtils;
108 112
import com.iver.utiles.NotExistInXMLEntity;
109 113
import com.iver.utiles.XMLEntity;
110 114
import com.iver.utiles.swing.threads.Cancellable;
111
import com.sun.swing.internal.plaf.synth.resources.synth;
112 115
/**
113 116
 * Capa raster
114 117
 * @author Nacho Brodin (nachobrodin@gmail.com)
......
473 476
	private void loadEnhancedOrColorTable(RasterFilterListManager filterManager) throws FilterTypeException {
474 477
		String colorTableName = configuration.getValueString("loadlayer_usecolortable", (String) null);
475 478

  
476
		String palettesPath = System.getProperty("user.home") +
477
			File.separator +
478
			"gvSIG" + // PluginServices.getArguments()[0] +
479
			File.separator + "colortable";
479
		String palettesPath = FileUtils.getAppHomeDir() + "colortable";
480 480

  
481 481
		IStatistics stats = getDataSource().getStatistics();
482 482

  
trunk/frameworks/_fwAndami/src/com/iver/andami/Launcher.java
141 141
import com.iver.andami.ui.theme.Theme;
142 142
import com.iver.andami.ui.wizard.UnsavedDataPanel;
143 143
import com.iver.utiles.DateTime;
144
import com.iver.utiles.FileUtils;
144 145
import com.iver.utiles.XMLEntity;
145 146
import com.iver.utiles.xml.XMLEncodingUtils;
146 147
import com.iver.utiles.xmlEntity.generate.XmlTag;
......
213 214

  
214 215
    		appName = args[0];
215 216

  
216
    		//Se crea el directorio de configuraci�n de la aplicaci�n
217 217
    		appHomeDir = System.getProperty(args[0]+".home");
218 218
    		if (appHomeDir == null)
219 219
    			appHomeDir = System.getProperty("user.home");
220 220

  
221 221
    		appHomeDir += File.separator + args[0] + File.separator;
222

  
223
    		// If gvSIG.confDir exists, then it will override any other setting for
224
    		// the configuration file path.
225
    		// This is a Java property, which means it has to be passed to the
226
    		// VM like this: java -DgvSIG.confDir=<path>
227
    		String gvsig_conf_dir = System.getProperty("gvSIG.confDir");    	
228
    		if ( gvsig_conf_dir != null ) {
229
    			gvsig_conf_dir = gvsig_conf_dir.trim();
230
    			if ( gvsig_conf_dir.length() > 0 ) {
231
    				if ( gvsig_conf_dir.endsWith(File.separator) ) {
232
    					appHomeDir = gvsig_conf_dir;
233
    				} else {
234
    					appHomeDir = gvsig_conf_dir + File.separator;
235
    				}
236
    			}
237
    		}
238
    		
239
    		FileUtils.setAppHomeDir(appHomeDir);
240
    		logger.debug("User settings will be stored in: " + appHomeDir );
241
    		
222 242
    		File parent = new File( appHomeDir );
223
    		parent.mkdirs();
243
    		parent.mkdirs();    		
224 244

  
225 245
    		// CHANGE FROM CARTOLAB TO ALLOW MORE THAN 1 GVSIG INSTALLATION
226 246
    		// WITH ITS OWN CONFIG FILE

Also available in: Unified diff