Revision 533

View differences:

org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLibrary
0 2

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/resources/JLrsCalculateMLastUsedValues.xml
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.exportto.app.extension.  
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="JLrsCalculateMLastUsedValues">
9
      <description>Persistence of the LRS plugin</description>
10
      <fields>
11
        <field name="pkInicial" type="string" mandatory="false">
12
          <description>Initial pk selected by the user</description>
13
        </field>
14
 		<field name="pkFinal" type="string" mandatory="false">
15
          <description>Final pk selected by the user</description>
16
        </field>
17
      </fields>
18
    </class>
19
  </classes>
20
</definitions>  
0 21

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsAlgorithmParams.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25
import java.awt.event.ActionListener;
26

  
27
import org.gvsig.lrs.lib.api.LrsAlgorithmParams;
28
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException;
29
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException;
30
import org.gvsig.tools.dynobject.DynObject;
31
import org.gvsig.tools.swing.api.Component;
32

  
33

  
34
/**
35
 * @author fdiaz
36
 *
37
 */
38
public interface JLrsAlgorithmParams extends Component {
39

  
40
    public LrsAlgorithmParams getParams() throws LrsGettingParametersException, LrsNeededParameterException;
41

  
42
    public void setParams(LrsAlgorithmParams params);
43

  
44
    public void clear();
45

  
46
    public boolean isCanceled();
47

  
48
    public void setVisibleAceptCancel(boolean visible);
49

  
50
    public boolean getVisibleAceptCancel();
51

  
52
    public void addActionListener(ActionListener listener);
53

  
54
    public void removeActionListener(ActionListener listener);
55
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingLocator.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25
import org.gvsig.tools.locator.AbstractLocator;
26
import org.gvsig.tools.locator.Locator;
27
import org.gvsig.tools.locator.LocatorException;
28

  
29

  
30
/**
31
 * @author fdiaz
32
 *
33
 */
34
public class LrsAlgorithmsSwingLocator extends AbstractLocator {
35
    /**
36
     * LrsSwing locator name
37
     */
38
    private static final String LOCATOR_NAME = "LrsAlgorithmsSwingLocator";
39

  
40
    /**
41
     * LrsSwing manager name
42
     */
43
    public static final String MANAGER_NAME = "LrsAlgorithmsSwingManager";
44

  
45
    /**
46
     * LrsSwing manager description
47
     */
48
    private static final String MANAGER_DESCRIPTION =
49
        "Lrs Swing Algorithms Manager of gvSIG";
50

  
51

  
52
    /**
53
     * Unique instance
54
     */
55
    private static final LrsAlgorithmsSwingLocator instance = new LrsAlgorithmsSwingLocator();
56

  
57

  
58
    /* (non-Javadoc)
59
     * @see org.gvsig.tools.locator.Locator#getLocatorName()
60
     */
61
    public String getLocatorName() {
62
        return LOCATOR_NAME;
63
    }
64

  
65

  
66
    /**
67
     * Registers the Class implementing the LrsSwingManager interface.
68
     *
69
     * @param clazz
70
     *            implementing the LrsAlgorthmsSwingManager interface
71
     */
72
    public static void registerLrsAlgorithmsSwingManager(Class clazz){
73
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
74
    }
75

  
76
    /**
77
     * Registers the default Class implementing the LrsSwingManager interface
78
     *
79
     * @param clazz
80
     *            implementing the LrsAlgorthmsSwingManager interface
81
     */
82
    public static void registerDefaultLrsAlgorithmsSwingManager(Class clazz){
83
        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
84
    }
85

  
86
    /**
87
     * Return a reference to LrsAlgorithmsSwingManager.
88
     *
89
     * @return a reference to LrsAlgorithmsSwingManager
90
     * @throws LocatorException
91
     *             if there is no access to the class or the class
92
     *             cannot be instantiated
93
     * @see Locator#get(String)
94
     */
95
    public static LrsAlgorithmsSwingManager getLrsAlgorithmsSwingManager() throws LocatorException {
96
        return (LrsAlgorithmsSwingManager)(getInstance().get(MANAGER_NAME));
97
    }
98

  
99
    /**
100
     * @return
101
     */
102
    public static Locator getInstance() {
103
        return instance;
104
    }
105

  
106
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25
import java.io.InputStream;
26

  
27
import org.gvsig.tools.ToolsLocator;
28
import org.gvsig.tools.dynobject.DynStruct;
29
import org.gvsig.tools.library.AbstractLibrary;
30
import org.gvsig.tools.library.LibraryException;
31
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
32
import org.gvsig.tools.persistence.PersistenceManager;
33
import org.slf4j.Logger;
34
import org.slf4j.LoggerFactory;
35

  
36

  
37
/**
38
 * @author fdiaz
39
 *
40
 */
41
public class LrsAlgorithmsSwingLibrary extends AbstractLibrary {
42

  
43
	private static final Logger LOG = LoggerFactory.getLogger(LrsAlgorithmsSwingLibrary.class);
44
    private static final String DYNCLASS_NAME = "JLrsLastUsedValues";
45
	
46
	/* (non-Javadoc)
47
	 * @see org.gvsig.tools.library.AbstractLibrary#doInitialize()
48
	 */
49
	@Override
50
	protected void doInitialize() throws LibraryException {
51
		registerAsAPI(LrsAlgorithmsSwingLibrary.class);
52
		
53
		registerLrsCalculateMLastUsedValuesDefinition();
54
		
55
		
56
//		DynObjectManager dynManager = ToolsLocator.getDynObjectManager();
57
//		InputStream resource = this.getClass().getResourceAsStream("/JLrsCalculateMLastUsedValues.xml");
58
//		Map classes = null;
59
//		try {
60
//			classes = dynManager.importDynClassDefinitions(resource, this.getClass().getClassLoader());
61
//		} catch (XmlPullParserException e) {
62
//			LOG.warn("Error parsing the resource.", e);
63
//		} catch (IOException e) {
64
//			LOG.warn("Error opening the resource.", e);
65
//		}
66
//		Iterator it = classes.entrySet().iterator();
67
//		while(it.hasNext()){
68
//			Map.Entry entry = (Map.Entry) it.next();
69
//			DynClass dynClass = (DynClass) entry.getValue();
70
//			if(!dynManager.has(dynClass.getFullName())){
71
//				dynManager.add((DynClass) entry.getValue());
72
//			}
73
//		}
74
	}
75
	
76
	
77
	private void registerLrsCalculateMLastUsedValuesDefinition(){
78
		String name = "JLrsCalculateMLastUsedValues";
79
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
80
		DynStruct definition = manager.getDefinition(name);
81
		if ( definition == null) {
82
			InputStream stream = this.getClass().getResourceAsStream("/JLrsCalculateMLastUsedValues.xml");
83
			if( stream == null ) {
84
				throw new RuntimeException("Error file not found: JLrsCalculateMLastUsedValues.xml");
85
			}
86
			definition = manager.addDefinition(
87
					this.getClass(),
88
					name, 
89
					stream,
90
					this.getClass().getClassLoader(), 
91
					null, 
92
					null
93
			);
94
		}
95
	}
96

  
97
	/* (non-Javadoc)
98
	 * @see org.gvsig.tools.library.AbstractLibrary#doPostInitialize()
99
	 */
100
	@Override
101
	protected void doPostInitialize() throws LibraryException {
102
		// Validate there is any implementation registered.
103
		LrsAlgorithmsSwingManager manager = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager();
104
		if (manager == null) {
105
			throw new ReferenceNotRegisteredException(
106
					LrsAlgorithmsSwingLocator.MANAGER_NAME, LrsAlgorithmsSwingLocator.getInstance());
107
		}
108
	}
109

  
110

  
111
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsCreateRouteAlgorithmParams.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25

  
26
/**
27
 * @author fdiaz
28
 *
29
 */
30
public interface JLrsCreateRouteAlgorithmParams extends JLrsAlgorithmParams {
31

  
32
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsCalibrateRouteAlgorithmParams.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25

  
26
/**
27
 * @author fdiaz
28
 *
29
 */
30
public interface JLrsCalibrateRouteAlgorithmParams extends JLrsAlgorithmParams {
31

  
32
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25
import java.util.List;
26

  
27
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
28
import org.gvsig.fmap.dal.feature.FeatureStore;
29
import org.gvsig.fmap.mapcontext.MapContext;
30
import org.gvsig.fmap.mapcontext.layers.FLayer;
31
import org.gvsig.fmap.mapcontext.layers.FLayers;
32
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
33
import org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams;
34
import org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams;
35
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationAlgorithmParams;
36
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationSelectIdRouteAlgorithmParams;
37
import org.gvsig.lrs.lib.api.LrsGenerateDynamicSegmentationAlgorithmParams;
38
import org.gvsig.lrs.lib.api.LrsShowMeasuresAlgorithmParams;
39
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException;
40
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException;
41
import org.gvsig.tools.dynobject.DynObject;
42
import org.gvsig.tools.service.Manager;
43
import org.gvsig.tools.task.TaskStatus;
44

  
45

  
46
/**
47
 * @author fdiaz
48
 *
49
 */
50
public interface LrsAlgorithmsSwingManager extends Manager {
51

  
52
    public JLrsAlgorithmParams createJLrsCreateRouteAlgorithmParameters(FLayers layers, LrsCreateRouteAlgorithmParams parameters) throws LrsNeededParameterException;
53

  
54
    public JLrsProgressDialog createJLrsProgressDialog(TaskStatus taskStatus);
55

  
56
    public JLrsAlgorithmParams createJLrsCalibrateRouteAlgorithmParameters(FLayers layers, LrsCalibrateRouteAlgorithmParams parameters) throws LrsNeededParameterException;
57

  
58
    public JLrsAlgorithmParams createJLrsEditRouteCalibrationSelectIdRouteAlgorithmParameters(FLayer layer, LrsEditRouteCalibrationSelectIdRouteAlgorithmParams parameters) throws LrsNeededParameterException;
59

  
60
    public JLrsAlgorithmParams createJLrsEditRouteCalibrationAlgorithmParameters(FLayer layer, MapContext mapContext, FeatureAttributeDescriptor selectedIdRoute, LrsEditRouteCalibrationAlgorithmParams parameters) throws LrsNeededParameterException, LrsGettingParametersException;
61

  
62
    public JLrsAlgorithmParams createJLrsShowMeasuresAlgorithmParameters(FLayer layer, LrsShowMeasuresAlgorithmParams parameters) throws LrsNeededParameterException;
63

  
64
    public JLrsAlgorithmParams createJLrsGenerateDynamicSegmentationAlgorithmParameters(FLayers layers, List<FeatureStore> tables, LrsGenerateDynamicSegmentationAlgorithmParams parameters) throws LrsNeededParameterException;
65

  
66
    public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer) throws LrsNeededParameterException;
67

  
68
	public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer, JLrsLastUsedValues params) throws LrsNeededParameterException;
69

  
70
	public JLrsLastUsedValues getJLrsLastUsedValues(DynObject pluginProperties);
71
	
72
	public JLrsLastUsedValues getJLrsLastUsedValues();
73
	
74
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsLastUsedValues.java
1
package org.gvsig.lrs.swing.api;
2

  
3
import org.gvsig.tools.dynobject.DynObject;
4

  
5
public interface JLrsLastUsedValues{
6
	
7
	public String getPkInicial();
8
	
9
	public String getPkFinal();
10
	
11
	public void setPkInicial(String ini);
12
	
13
	public void setPkFinal(String fin);
14

  
15
	public void setParams(DynObject pluginProperties);
16
	
17
	public DynObject getParams();
18

  
19
}
0 20

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsProgressDialog.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25
import java.awt.event.ActionListener;
26

  
27
import org.gvsig.tools.swing.api.Component;
28

  
29

  
30
/**
31
 * @author fdiaz
32
 *
33
 */
34
public interface JLrsProgressDialog extends Component {
35
    public boolean isCanceled();
36

  
37
    public void addActionListener(ActionListener listener);
38

  
39
    public void removeActionListener(ActionListener listener);
40
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsEditRouteCalibrationAlgorithmParams.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25

  
26
/**
27
 * @author fdiaz
28
 *
29
 */
30
public interface JLrsEditRouteCalibrationAlgorithmParams extends JLrsAlgorithmParams {
31

  
32
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsGenerateDynamicSegmentationAlgorithmParams.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.api;
24

  
25

  
26
/**
27
 * @author fdiaz
28
 *
29
 */
30
public interface JLrsGenerateDynamicSegmentationAlgorithmParams extends JLrsAlgorithmParams {
31

  
32
}
0 33

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.lrs.swing</artifactId>
6
    <version>1.0.92</version>
7
  </parent>
8
  <artifactId>org.gvsig.lrs.swing.api</artifactId>
9
  <name>${project.artifactId}</name>
10
  <dependencies>
11
    <dependency>
12
      <groupId>org.gvsig</groupId>
13
      <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
14
    </dependency>
15
    <dependency>
16
      <groupId>org.gvsig</groupId>
17
      <artifactId>org.gvsig.tools.swing.api</artifactId>
18
    </dependency>
19
    <dependency>
20
      <groupId>org.gvsig</groupId>
21
      <artifactId>org.gvsig.lrs.lib.api</artifactId>
22
    </dependency>
23
  </dependencies>
24
</project>
0 25

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsCalculateMRouteController.java
1
/*
2
 * Copyright 2015 DiSiD Technologies S.L.L. All rights reserved.
3
 *
4
 * Project  : DiSiD org.gvsig.lrs.swing.impl
5
 * SVN Id   : $Id$
6
 */
7
package org.gvsig.lrs.swing.impl;
8

  
9
import java.awt.Dimension;
10
import java.awt.Rectangle;
11
import java.awt.event.ActionEvent;
12
import java.awt.event.ActionListener;
13
import java.util.Locale;
14

  
15
import javax.swing.JComponent;
16
import javax.swing.ListCellRenderer;
17

  
18
import org.gvsig.fmap.dal.exception.DataException;
19
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
20
import org.gvsig.fmap.dal.feature.FeatureStore;
21
import org.gvsig.fmap.dal.feature.FeatureType;
22
import org.gvsig.fmap.mapcontext.layers.FLayer;
23
import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
24
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
25
import org.gvsig.fmap.mapcontrol.dal.feature.swing.FeatureTablePanel;
26
import org.gvsig.lrs.lib.api.LrsAlgorithmParams;
27
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException;
28
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException;
29
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams;
30
import org.gvsig.lrs.swing.api.JLrsLastUsedValues;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.exception.BaseException;
33
import org.gvsig.tools.i18n.I18nManager;
34
import org.gvsig.tools.swing.api.ActionListenerSupport;
35
import org.gvsig.tools.swing.api.ToolsSwingLocator;
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

  
39
import com.jgoodies.forms.layout.CellConstraints;
40

  
41
public class JLrsCalculateMRouteController extends JLrsCalculateMRouteView  implements JLrsAlgorithmParams{
42

  
43
    /**
44
     *
45
     */
46
    private static final long serialVersionUID = -9145489136943076981L;
47

  
48
    private static final Logger logger = LoggerFactory.getLogger(JLrsCalculateMRouteController.class);
49

  
50
    private boolean canceled;
51
    private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport();
52

  
53
    private FLayer layer;
54
	private JLrsLastUsedValues params;
55

  
56
    /**
57
     * @param layer
58
     * @throws LrsNeededParameterException
59
     * @throws  
60
     *
61
     */
62
    public JLrsCalculateMRouteController(FLayer layer,  JLrsLastUsedValues jLrsLastUsedValues) throws LrsNeededParameterException {
63
        super();
64
        this.layer = layer;
65
        this.params = jLrsLastUsedValues;
66
        initComponents();
67
        translate();
68
    }
69

  
70
    public void addActionListener(ActionListener listener) {
71
        listeners.addActionListener(listener);
72
    }
73

  
74
    public void removeActionListener(ActionListener listener) {
75
        listeners.removeActionListener(listener);
76
    }
77

  
78
    private void translate() {
79
        I18nManager i18nManager = ToolsLocator.getI18nManager();
80
        jroutesselected
81
            .setText(i18nManager.getTranslation(jroutesselected.getText()));
82
        pkilabel.setText(i18nManager.getTranslation(pkilabel.getText())+"  ");
83
        pkflabel.setText(i18nManager.getTranslation(pkflabel.getText())+"  ");
84

  
85
    }
86

  
87
    /**
88
     *
89
     */
90
    public void setLocate(Locale locale) {
91
        Locale l = super.getLocale();
92
        if (!l.equals(locale)) {
93
            translate();
94
        }
95
        super.setLocale(locale);
96
    }
97
    
98
    
99

  
100
    /**
101
     * Validates the layers:
102
     *  - At least 2 layers
103
     *  - At least 1 curve layer with at least 1 non-geometric field
104
     *  - At least 1 point layer with at least 1 non-geometric field and 1 numeric field
105
     *  if they are not correct throws an exception
106
     * @throws LrsNeededParameterException
107
     */
108
    public static void validateLayers(LayerCollection layers)throws LrsNeededParameterException {
109
        logger.debug("Validating layers for Calibrate Route");
110
        if (layers==null||layers.getLayersCount()<2){
111
            logger.error("Two or more layers are needed");
112
            throw new LrsNeededParameterException("two_or_more_layers_are_needed", null);
113
        }
114

  
115
        if (!JLrsUtils.validatedMCurveAndPointLayer(layers)){
116
            logger.error("Impossible to find the layers needed");
117
            throw new LrsNeededParameterException("impossible_to_find_needed_layers",null);
118
        }
119
    }
120

  
121
    /**
122
     * @throws LrsNeededParameterException
123
     * @throws DataException 
124
     */
125
    private void initComponents() throws LrsNeededParameterException {
126

  
127
//        validateLayers(layers);
128

  
129
//        FeatureAttributeDescriptorsComboBoxModel idRouteFieldInitialComboBoxModel =
130
//            new FeatureAttributeDescriptorsComboBoxModel();
131
//        FeatureAttributeDescriptorsComboBoxModel idRouteFieldFinalComboBoxModel =
132
//                new FeatureAttributeDescriptorsComboBoxModel();
133
//
134
//        // Renderer para los combos de attributeDescriptors
135
//        ListCellRenderer featureAttributeDescriptorCellRenderer = new FLayersAttributeDescriptorCellRenderer();
136
//        // asignaci?n de renderers y modelos
137
//        pkicombo.setRenderer(featureAttributeDescriptorCellRenderer);
138
//        pkicombo.setModel(idRouteFieldInitialComboBoxModel);
139
//        
140
//        pkfcombo.setRenderer(featureAttributeDescriptorCellRenderer);
141
//        pkfcombo.setModel(idRouteFieldFinalComboBoxModel);
142
//        
143
        
144
        pkicombo.addActionListener(new ActionListener() {
145
			@Override
146
			public void actionPerformed(ActionEvent e) {
147
				String desc = (String) pkicombo.getSelectedItem();
148
				if(desc != null){
149
					logger.debug("Selected pk-initial combo option: " + desc);
150
					params.setPkInicial(desc);
151
				}
152
			}
153
		});
154
        
155
        pkfcombo.addActionListener(new ActionListener() {
156
			@Override
157
			public void actionPerformed(ActionEvent e) {
158
				String desc = (String) pkfcombo.getSelectedItem();
159
				if(desc != null){
160
					logger.debug("Selected pk-final combo option: " + desc);
161
					params.setPkFinal(desc);
162
				}
163
			}
164
		});
165
        
166
        if (layer instanceof FLyrVect) {
167
        	FLyrVect lyrVect = (FLyrVect) layer;
168
        	FeatureStore featStore = lyrVect.getFeatureStore();
169
        	try {
170
        		FeatureType featType = featStore.getDefaultFeatureType();
171
        		FeatureAttributeDescriptor[] descrips = featType.getAttributeDescriptors();
172
        		for(int i=0; i<descrips.length; i++){
173
        			FeatureAttributeDescriptor featureAttributeDescriptor = descrips[i];
174
        			if (featureAttributeDescriptor.getDataType().isNumeric()) {
175
        				pkicombo.addItem(featureAttributeDescriptor.getName());
176
        				pkfcombo.addItem(featureAttributeDescriptor.getName());
177
        			}
178
        		}
179

  
180
        		if(params != null){
181
        			pkicombo.setSelectedItem(params.getPkInicial());
182
        			pkfcombo.setSelectedItem(params.getPkFinal());
183
        		}
184

  
185
        		routestable = new FeatureTablePanel(featStore);
186
        		//routestable.setSelectionUp(true);
187
        		
188
        		//int selectIdx = routestable.getTable().getSelectedRow();
189
        		//routestable.getTable().getSelectionModel().setSelectionInterval(selectIdx, selectIdx);
190
        		//routestable.getTable().scrollRectToVisible(new Rectangle(routestable.getTable().getCellRect(selectIdx, 0, true)));
191

  
192
        		CellConstraints cc = new CellConstraints();
193
        		routestable.setName("routestable");
194
        		jLrsCalculateMRoutePanel.add(routestable,cc.xyw(1,5,5));
195

  
196

  
197
        	} catch (BaseException e) {
198
        		throw new LrsNeededParameterException(e);
199
        	}
200

  
201

  
202
        }
203

  
204

  
205
        canceled = false;
206
    }
207

  
208

  
209

  
210
    public boolean isCanceled() {
211
        return this.canceled;
212
    }
213

  
214

  
215
    public JComponent asJComponent() {
216
        return this;
217
    }
218

  
219

  
220
    @Override
221
    public Dimension getPreferredSize() {
222
        return new Dimension(650, 350);
223
    }
224

  
225
	public LrsAlgorithmParams getParams() throws LrsGettingParametersException, LrsNeededParameterException {
226
		// TODO Auto-generated method stub
227
		return null;
228
	}
229

  
230
	public void setParams(LrsAlgorithmParams params) {
231
		// TODO Auto-generated method stub
232
		
233
	}
234

  
235
	public void clear() {
236
		// TODO Auto-generated method stub
237
		
238
	}
239

  
240
	public void setVisibleAceptCancel(boolean visible) {
241
		// TODO Auto-generated method stub
242
		
243
	}
244

  
245
	public boolean getVisibleAceptCancel() {
246
		// TODO Auto-generated method stub
247
		return false;
248
	}
249

  
250

  
251

  
252
}
0 253

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultLrsAlgorithmsSwingLibrary.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 gvSIG Association
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.lrs.swing.impl;
26

  
27
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLibrary;
28
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLocator;
29
import org.gvsig.tools.library.AbstractLibrary;
30
import org.gvsig.tools.library.LibraryException;
31

  
32

  
33
/**
34
 * @author fdiaz</a>
35
 *
36
 */
37
public class DefaultLrsAlgorithmsSwingLibrary extends AbstractLibrary {
38

  
39

  
40

  
41
	@Override
42
    public void doRegistration() {
43
        registerAsImplementationOf(LrsAlgorithmsSwingLibrary.class);
44
    }
45

  
46
    @Override
47
    protected void doInitialize() throws LibraryException {
48
        LrsAlgorithmsSwingLocator.registerLrsAlgorithmsSwingManager(DefaultLrsAlgorithmsSwingManager.class);
49
    }
50

  
51
    @Override
52
    protected void doPostInitialize() throws LibraryException {
53

  
54
	}
55

  
56
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/FLayersMComboBoxModel.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.impl;
24

  
25
import java.util.ArrayList;
26
import java.util.List;
27

  
28
import javax.swing.AbstractListModel;
29
import javax.swing.ComboBoxModel;
30

  
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
33

  
34
import org.gvsig.fmap.geom.Geometry;
35
import org.gvsig.fmap.mapcontext.layers.FLayer;
36
import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
37
import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
38
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
39
import org.gvsig.tools.exception.BaseException;
40
import org.gvsig.tools.visitor.VisitCanceledException;
41

  
42
/**
43
 * @author fdiaz
44
 *
45
 */
46
public class FLayersMComboBoxModel extends AbstractListModel<FLayer> implements ComboBoxModel<FLayer> {
47

  
48
    /**
49
     *
50
     */
51
    private static final long serialVersionUID = 3596872067610443726L;
52

  
53
    private static final Logger logger = LoggerFactory.getLogger(FLayersMComboBoxModel.class);
54

  
55
    private List<FLyrVect> vectLayers;
56
    private FLayer selectedLayer;
57

  
58
    /**
59
     *
60
     */
61
    public FLayersMComboBoxModel(LayerCollection layers) {
62
        vectLayers = new ArrayList<FLyrVect>();
63
        try {
64
            layers.accept(new LayersVisitor() {
65

  
66
                public void visit(Object obj) throws VisitCanceledException, BaseException {
67
                    // TODO Auto-generated method stub
68

  
69
                }
70

  
71
                public void visit(FLayer layer) throws BaseException {
72
                    if (layer instanceof FLyrVect) {
73
                        FLyrVect lyrVect = (FLyrVect) layer;
74
                        if ((lyrVect.getGeometryType().isTypeOf(Geometry.TYPES.CURVE)
75
                            || lyrVect.getGeometryType().isTypeOf(Geometry.TYPES.MULTICURVE))
76
                            &&
77
                            (lyrVect.getGeometryType().isSubTypeOf(Geometry.SUBTYPES.GEOM2DM)
78
                                || lyrVect.getGeometryType().isSubTypeOf(Geometry.SUBTYPES.GEOM3DM))
79
                            ) {
80
                            vectLayers.add(lyrVect);
81
                            if(lyrVect.isActive()){
82
                                selectedLayer = lyrVect;
83
                            }
84
                        }
85
                    }
86
                }
87
            });
88
        } catch (BaseException e1) {
89
            logger.warn("Can't get linear vector layers", e1);
90
        }
91
    }
92

  
93
    /*
94
     * (non-Javadoc)
95
     *
96
     * @see javax.swing.ListModel#getSize()
97
     */
98
    public int getSize() {
99
        return vectLayers.size(); //.getLayersCount();
100
    }
101

  
102
    /*
103
     * (non-Javadoc)
104
     *
105
     * @see javax.swing.ListModel#getElementAt(int)
106
     */
107
    public FLayer getElementAt(int index) {
108
        return vectLayers.get(index); //.getLayer(index);
109
    }
110

  
111
    /*
112
     * (non-Javadoc)
113
     *
114
     * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object)
115
     */
116
    public void setSelectedItem(final Object anItem) {
117
        selectedLayer = (FLayer) anItem;
118
        fireContentsChanged(this, -1, -1);
119
    }
120

  
121
    /*
122
     * (non-Javadoc)
123
     *
124
     * @see javax.swing.ComboBoxModel#getSelectedItem()
125
     */
126
    public Object getSelectedItem() {
127
        return selectedLayer;
128
    }
129

  
130
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultProgressDialogController.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.swing.impl;
24

  
25
import java.awt.BorderLayout;
26
import java.awt.Dimension;
27
import java.awt.event.ActionEvent;
28
import java.awt.event.ActionListener;
29
import java.util.Locale;
30

  
31
import javax.swing.JComponent;
32

  
33
import org.gvsig.lrs.swing.api.JLrsProgressDialog;
34
import org.gvsig.tools.ToolsLocator;
35
import org.gvsig.tools.i18n.I18nManager;
36
import org.gvsig.tools.swing.api.ActionListenerSupport;
37
import org.gvsig.tools.swing.api.ToolsSwingLocator;
38
import org.gvsig.tools.swing.api.task.JTaskStatus;
39
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager;
40
import org.gvsig.tools.task.TaskStatus;
41

  
42

  
43
/**
44
 * @author fdiaz
45
 *
46
 */
47
public class DefaultProgressDialogController extends DefaultProgressDialogView implements JLrsProgressDialog {
48

  
49

  
50
    /**
51
     *
52
     */
53
    private static final long serialVersionUID = -209468236996921114L;
54
    private TaskStatus taskStatus;
55
    private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport();
56

  
57
    private boolean canceled;
58

  
59

  
60
    /**
61
     *
62
     */
63
    public DefaultProgressDialogController(TaskStatus taskStatus) {
64
        super();
65
        this.taskStatus = taskStatus;
66
        initComponents();
67
        translate();
68

  
69
    }
70

  
71
    private void initComponents() {
72
        setPreferredSize(new Dimension(400, 150));
73
        TaskStatusSwingManager jTaskManager = ToolsSwingLocator.getTaskStatusSwingManager();
74
        this.progressBar.setLayout(new BorderLayout());
75
        JTaskStatus jTaskStatus = jTaskManager.createJTaskStatus();
76
        jTaskStatus.bind(this.taskStatus);
77
        jTaskStatus.setShowCancelButton(false);
78
        jTaskStatus.setShowRemoveTaskButton(false);
79

  
80
        this.progressBar.add(jTaskStatus, BorderLayout.CENTER);
81

  
82
        this.btnClose.addActionListener(new ActionListener() {
83
            public void actionPerformed(ActionEvent e) {
84
                canceled = false;
85
                if (!DefaultProgressDialogController.this.taskStatus.isRunning()) {
86
                    doClose();
87
                    listeners.fireActionEvent(new ActionEvent(DefaultProgressDialogController.this, 0, "close"));
88
                }
89
            }
90
        });
91
        canceled = false;
92
    }
93

  
94
    private void translate() {
95
        I18nManager i18nManager = ToolsLocator.getI18nManager();
96
        btnClose.setText(i18nManager.getTranslation(btnClose.getText()));
97

  
98
    }
99
    /* (non-Javadoc)
100
     * @see org.gvsig.tools.swing.api.Component#asJComponent()
101
     */
102
    public JComponent asJComponent() {
103
        return this;
104
    }
105

  
106
    /* (non-Javadoc)
107
     * @see org.gvsig.lrs.swing.api.JLrsProgressDialog#isCanceled()
108
     */
109
    public boolean isCanceled() {
110
        // TODO Auto-generated method stub
111
        return false;
112
    }
113

  
114
    /* (non-Javadoc)
115
     * @see org.gvsig.lrs.swing.api.JLrsProgressDialog#addActionListener(java.awt.event.ActionListener)
116
     */
117
    public void addActionListener(ActionListener listener) {
118
        listeners.addActionListener(listener);
119
    }
120

  
121
    /* (non-Javadoc)
122
     * @see org.gvsig.lrs.swing.api.JLrsProgressDialog#removeActionListener(java.awt.event.ActionListener)
123
     */
124
    public void removeActionListener(ActionListener listener) {
125
        listeners.removeActionListener(listener);
126
    }
127

  
128

  
129
    private void doClose() {
130
        this.setVisible(false);
131
    }
132

  
133
    /**
134
    *
135
    */
136
   public void setLocate(Locale locale) {
137
       Locale l = super.getLocale();
138
       if (!l.equals(locale)) {
139
           translate();
140
       }
141
       super.setLocale(locale);
142
   }
143

  
144
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.92/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsCalibrateRouteParamsView.java
1
package org.gvsig.lrs.swing.impl;
2

  
3
import com.jgoodies.forms.layout.CellConstraints;
4
import com.jgoodies.forms.layout.FormLayout;
5
import java.awt.BorderLayout;
6
import java.awt.ComponentOrientation;
7
import java.awt.Container;
8
import java.awt.Dimension;
9
import javax.swing.Box;
10
import javax.swing.ImageIcon;
11
import javax.swing.JButton;
12
import javax.swing.JCheckBox;
13
import javax.swing.JComboBox;
14
import javax.swing.JFrame;
15
import javax.swing.JLabel;
16
import javax.swing.JPanel;
17
import javax.swing.JTextField;
18

  
19

  
20
public class JLrsCalibrateRouteParamsView extends JPanel
21
{
22
   JLabel lblInputLayer = new JLabel();
23
   JComboBox cmbInputLayer = new JComboBox();
24
   JLabel lblIdRouteField = new JLabel();
25
   JComboBox cmbIdRouteField = new JComboBox();
26
   JLabel lblMeasureField = new JLabel();
27
   JComboBox cmbMeasureField = new JComboBox();
28
   JLabel lblOutputFile = new JLabel();
29
   JComboBox cmbCalibratePointLayer = new JComboBox();
30
   JLabel lblCalibratePointLayer = new JLabel();
31
   JComboBox cmbCalibrationPointIdRouteField = new JComboBox();
32
   JLabel lblCalibrationPointIdRouteField = new JLabel();
33
   JComboBox cmbMeasureCalcMethod = new JComboBox();
34
   JLabel lblMeasureCalcMethod = new JLabel();
35
   JCheckBox chkInterpolateBetweenCalibrationPoints = new JCheckBox();
36
   JCheckBox chkExtrapolateBeforeCalibrationPoints = new JCheckBox();
37
   JCheckBox chkExtrapolateAfterCalibrationPoints = new JCheckBox();
38
   JCheckBox chkIgnoreSpatialGaps = new JCheckBox();
39
   JCheckBox chkIncludeAll = new JCheckBox();
40
   JLabel lblSearchRadius = new JLabel();
41
   JTextField txtOutputFile = new JTextField();
42
   JButton btnBrowser = new JButton();
43
   JComboBox cmbMeasureUnits = new JComboBox();
44
   JTextField txtSearchRadius = new JTextField();
45
   JButton btnAccept = new JButton();
46
   JButton btnCancel = new JButton();
47

  
48
   /**
49
    * Default constructor
50
    */
51
   public JLrsCalibrateRouteParamsView()
52
   {
53
      initializePanel();
54
   }
55

  
56
   /**
57
    * Adds fill components to empty cells in the first row and first column of the grid.
58
    * This ensures that the grid spacing will be the same as shown in the designer.
59
    * @param cols an array of column indices in the first row where fill components should be added.
60
    * @param rows an array of row indices in the first column where fill components should be added.
61
    */
62
   void addFillComponents( Container panel, int[] cols, int[] rows )
63
   {
64
      Dimension filler = new Dimension(10,10);
65

  
66
      boolean filled_cell_11 = false;
67
      CellConstraints cc = new CellConstraints();
68
      if ( cols.length > 0 && rows.length > 0 )
69
      {
70
         if ( cols[0] == 1 && rows[0] == 1 )
71
         {
72
            /** add a rigid area  */
73
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
74
            filled_cell_11 = true;
75
         }
76
      }
77

  
78
      for( int index = 0; index < cols.length; index++ )
79
      {
80
         if ( cols[index] == 1 && filled_cell_11 )
81
         {
82
            continue;
83
         }
84
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
85
      }
86

  
87
      for( int index = 0; index < rows.length; index++ )
88
      {
89
         if ( rows[index] == 1 && filled_cell_11 )
90
         {
91
            continue;
92
         }
93
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
94
      }
95

  
96
   }
97

  
98
   /**
99
    * Helper method to load an image file from the CLASSPATH
100
    * @param imageName the package and name of the file to load relative to the CLASSPATH
101
    * @return an ImageIcon instance with the specified image file
102
    * @throws IllegalArgumentException if the image resource cannot be loaded.
103
    */
104
   public ImageIcon loadImage( String imageName )
105
   {
106
      try
107
      {
108
         ClassLoader classloader = getClass().getClassLoader();
109
         java.net.URL url = classloader.getResource( imageName );
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff