Revision 342

View differences:

org.gvsig.lrs/tags/org.gvsig.lrs-1.0.54/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.54/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.54/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.54/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
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.54/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.54/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.54/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.54/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.54/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.54/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.54/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.54/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
}
0 41

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.54/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.54</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.54/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultLrsAlgorithmsSwingManager.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.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.lrs.swing.api.JLrsAlgorithmParams;
42
import org.gvsig.lrs.swing.api.JLrsLastUsedValues;
43
import org.gvsig.lrs.swing.api.JLrsProgressDialog;
44
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager;
45
import org.gvsig.tools.ToolsLocator;
46
import org.gvsig.tools.dynobject.DynObject;
47
import org.gvsig.tools.dynobject.DynObjectManager;
48
import org.gvsig.tools.service.Service;
49
import org.gvsig.tools.service.ServiceException;
50
import org.gvsig.tools.task.TaskStatus;
51

  
52

  
53
/**
54
 * @author fdiaz
55
 *
56
 */
57
public class DefaultLrsAlgorithmsSwingManager implements LrsAlgorithmsSwingManager {
58

  
59
    private JLrsLastUsedValues params;
60

  
61
	/* (non-Javadoc)
62
     * @see org.gvsig.tools.service.Manager#createServiceParameters(java.lang.String)
63
     */
64
    public DynObject createServiceParameters(String serviceName) throws ServiceException {
65
        // TODO Auto-generated method stub
66
        return null;
67
    }
68

  
69
    /* (non-Javadoc)
70
     * @see org.gvsig.tools.service.Manager#getService(org.gvsig.tools.dynobject.DynObject)
71
     */
72
    public Service getService(DynObject parameters) throws ServiceException {
73
        // TODO Auto-generated method stub
74
        return null;
75
    }
76

  
77
    /* (non-Javadoc)
78
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsAlgorithmParameters()
79
     */
80
    public JLrsAlgorithmParams createJLrsAlgorithmParameters() {
81
        // TODO Auto-generated method stub
82
        return null;
83
    }
84

  
85
    /* (non-Javadoc)
86
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsAlgorithmParameters(org.gvsig.tools.dynobject.DynObject)
87
     */
88
    public JLrsAlgorithmParams createJLrsAlgorithmParameters(DynObject parameters) {
89
        // TODO Auto-generated method stub
90
        return null;
91
    }
92

  
93
    /* (non-Javadoc)
94
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsCreateRouteAlgorithmParameters(org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams)
95
     */
96
    public JLrsAlgorithmParams createJLrsCreateRouteAlgorithmParameters(FLayers layers, LrsCreateRouteAlgorithmParams parameters) throws LrsNeededParameterException {
97
        return new JLrsCreateRouteParamsController(layers, parameters);
98
    }
99

  
100
    /* (non-Javadoc)
101
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsCalibrateRouteAlgorithmParameters(org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams)
102
     */
103
    public JLrsAlgorithmParams createJLrsCalibrateRouteAlgorithmParameters(FLayers layers, LrsCalibrateRouteAlgorithmParams parameters) throws LrsNeededParameterException {
104
        return new JLrsCalibrateRouteParamsController(layers, parameters);
105
    }
106

  
107
    /* (non-Javadoc)
108
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsEditRouteCalibrationSelectIdRouteAlgorithmParameters(org.gvsig.lrs.lib.api.LrsEditRouteCalibrationSelectIdRouteAlgorithmParams)
109
     */
110
    public JLrsAlgorithmParams createJLrsEditRouteCalibrationSelectIdRouteAlgorithmParameters(FLayer layer, LrsEditRouteCalibrationSelectIdRouteAlgorithmParams parameters) throws LrsNeededParameterException {
111
        return new JLrsEditRouteCalibrationSelectIdRouteController(layer, parameters);
112
    }
113

  
114
    /* (non-Javadoc)
115
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsEditRouteCalibrationAlgorithmParameters(org.gvsig.lrs.lib.api.LrsEditRouteCalibrationAlgorithmParameters)
116
     */
117
    public JLrsAlgorithmParams createJLrsEditRouteCalibrationAlgorithmParameters(FLayer layer, MapContext mapContext, FeatureAttributeDescriptor selectedIdRoute, LrsEditRouteCalibrationAlgorithmParams parameters) throws LrsNeededParameterException, LrsGettingParametersException {
118
        return new JLrsEditRouteCalibrationController(layer, mapContext, selectedIdRoute, parameters);
119
    }
120

  
121
    /* (non-Javadoc)
122
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsShowMeasuresAlgorithmParameters(org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams)
123
     */
124
    public JLrsAlgorithmParams createJLrsShowMeasuresAlgorithmParameters(FLayer layer, LrsShowMeasuresAlgorithmParams parameters) throws LrsNeededParameterException {
125
        return new JLrsShowMeasuresParamsController(layer, parameters);
126
    }
127

  
128
    /* (non-Javadoc)
129
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsShowMeasuresAlgorithmParameters(org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams)
130
     */
131
    public JLrsAlgorithmParams createJLrsGenerateDynamicSegmentationAlgorithmParameters(FLayers layers, List<FeatureStore> tables, LrsGenerateDynamicSegmentationAlgorithmParams parameters) throws LrsNeededParameterException{
132
        return new JLrsGenerateDynamicSegmentationParamsController(layers, tables, parameters);
133
    }
134

  
135
    /* (non-Javadoc)
136
     * @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsProgressDialog(org.gvsig.tools.task.TaskStatus)
137
     */
138
    public JLrsProgressDialog createJLrsProgressDialog(TaskStatus taskStatus) {
139
        return new DefaultProgressDialogController(taskStatus);
140
    }
141

  
142
	public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer) throws LrsNeededParameterException {
143
		return createJLrsCalculateMRoutePanel(layer, null);
144
	}
145

  
146
	public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer, JLrsLastUsedValues params)
147
			throws LrsNeededParameterException {
148
		if(params == null){
149
			DynObjectManager dynmanager = ToolsLocator.getDynObjectManager();
150
			params = getJLrsLastUsedValues(dynmanager.createDynObject("JLrsLastUsedValues"));
151
		}
152
		return new JLrsCalculateMRouteController(layer, params);
153
	}
154

  
155
	public JLrsLastUsedValues getJLrsLastUsedValues(DynObject pluginProperties) {
156
		if(params == null){
157
			params = new DefaultJLrsLastUsedValues(pluginProperties);
158
		}
159
		else{
160
			params.setParams(pluginProperties);
161
		}
162
		return params;
163
	}
164

  
165
	public JLrsLastUsedValues getJLrsLastUsedValues() {
166
		return params;
167
	}
168

  
169
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.54/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultProgressDialogView.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3
<object classname="com.jeta.forms.store.memento.FormPackage">
4
 <at name="fileversion">
5
  <object classname="com.jeta.forms.store.memento.FormsVersion2">
6
   <at name="major">2</at>
7
   <at name="minor">0</at>
8
   <at name="sub">0</at>
9
  </object>
10
 </at>
11
 <at name="form">
12
  <object classname="com.jeta.forms.store.memento.FormMemento">
13
   <super classname="com.jeta.forms.store.memento.ComponentMemento">
14
    <at name="cellconstraints">
15
     <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
16
      <at name="column">1</at>
17
      <at name="row">1</at>
18
      <at name="colspan">1</at>
19
      <at name="rowspan">1</at>
20
      <at name="halign">default</at>
21
      <at name="valign">default</at>
22
      <at name="insets" object="insets">0,0,0,0</at>
23
     </object>
24
    </at>
25
    <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
26
   </super>
27
   <at name="id">/home/paco/tmp/cosa/DefaultProgressDialogView.xml</at>
28
   <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:61DLU:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at>
29
   <at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE</at>
30
   <at name="components">
31
    <object classname="java.util.LinkedList">
32
     <item >
33
      <at name="value">
34
       <object classname="com.jeta.forms.store.memento.BeanMemento">
35
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
36
         <at name="cellconstraints">
37
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
38
           <at name="column">2</at>
39
           <at name="row">2</at>
40
           <at name="colspan">2</at>
41
           <at name="rowspan">1</at>
42
           <at name="halign">fill</at>
43
           <at name="valign">default</at>
44
           <at name="insets" object="insets">0,0,0,0</at>
45
          </object>
46
         </at>
47
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
48
        </super>
49
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
50
        <at name="beanclass">javax.swing.JPanel</at>
51
        <at name="beanproperties">
52
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
53
          <at name="classname">javax.swing.JPanel</at>
54
          <at name="properties">
55
           <object classname="com.jeta.forms.store.support.PropertyMap">
56
            <at name="height">12</at>
57
            <at name="width">720</at>
58
            <at name="name">progressBar</at>
59
           </object>
60
          </at>
61
         </object>
62
        </at>
63
       </object>
64
      </at>
65
     </item>
66
     <item >
67
      <at name="value">
68
       <object classname="com.jeta.forms.store.memento.BeanMemento">
69
        <super classname="com.jeta.forms.store.memento.ComponentMemento">
70
         <at name="cellconstraints">
71
          <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
72
           <at name="column">3</at>
73
           <at name="row">3</at>
74
           <at name="colspan">1</at>
75
           <at name="rowspan">1</at>
76
           <at name="halign">default</at>
77
           <at name="valign">default</at>
78
           <at name="insets" object="insets">0,0,0,0</at>
79
          </object>
80
         </at>
81
         <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
82
        </super>
83
        <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
84
        <at name="beanclass">javax.swing.JButton</at>
85
        <at name="beanproperties">
86
         <object classname="com.jeta.forms.store.memento.PropertiesMemento">
87
          <at name="classname">javax.swing.JButton</at>
88
          <at name="properties">
89
           <object classname="com.jeta.forms.store.support.PropertyMap">
90
            <at name="text">_Close</at>
91
            <at name="height">22</at>
92
            <at name="width">70</at>
93
            <at name="name">btnClose</at>
94
            <at name="actionCommand">_Close</at>
95
            <at name="border">
96
             <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
97
              <super classname="com.jeta.forms.store.properties.BorderProperty">
98
               <at name="name">border</at>
99
              </super>
100
              <at name="borders">
101
               <object classname="java.util.LinkedList">
102
                <item >
103
                 <at name="value">
104
                  <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
105
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
106
                    <at name="name">border</at>
107
                   </super>
108
                  </object>
109
                 </at>
110
                </item>
111
               </object>
112
              </at>
113
             </object>
114
            </at>
115
           </object>
116
          </at>
117
         </object>
118
        </at>
119
       </object>
120
      </at>
121
     </item>
122
    </object>
123
   </at>
124
   <at name="properties">
125
    <object classname="com.jeta.forms.store.memento.PropertiesMemento">
126
     <at name="classname">com.jeta.forms.gui.form.GridView</at>
127
     <at name="properties">
128
      <object classname="com.jeta.forms.store.support.PropertyMap">
129
       <at name="name"></at>
130
       <at name="fill">
131
        <object classname="com.jeta.forms.store.properties.effects.PaintProperty">
132
         <at name="name">fill</at>
133
        </object>
134
       </at>
135
       <at name="scollBars">
136
        <object classname="com.jeta.forms.store.properties.ScrollBarsProperty">
137
         <at name="name">scollBars</at>
138
         <at name="verticalpolicy">21</at>
139
         <at name="horizontalpolicy">31</at>
140
         <at name="border">
141
          <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
142
           <super classname="com.jeta.forms.store.properties.BorderProperty">
143
            <at name="name">border</at>
144
           </super>
145
           <at name="borders">
146
            <object classname="java.util.LinkedList">
147
             <item >
148
              <at name="value">
149
               <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
150
                <super classname="com.jeta.forms.store.properties.BorderProperty">
151
                 <at name="name">border</at>
152
                </super>
153
               </object>
154
              </at>
155
             </item>
156
            </object>
157
           </at>
158
          </object>
159
         </at>
160
        </object>
161
       </at>
162
       <at name="border">
163
        <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
164
         <super classname="com.jeta.forms.store.properties.BorderProperty">
165
          <at name="name">border</at>
166
         </super>
167
         <at name="borders">
168
          <object classname="java.util.LinkedList"/>
169
         </at>
170
        </object>
171
       </at>
172
      </object>
173
     </at>
174
    </object>
175
   </at>
176
   <at name="cellpainters">
177
    <object classname="com.jeta.forms.store.support.Matrix">
178
     <at name="rows">
179
      <object classname="[Ljava.lang.Object;" size="4">
180
       <at name="item" index="0">
181
        <object classname="[Ljava.lang.Object;" size="4"/>
182
       </at>
183
       <at name="item" index="1">
184
        <object classname="[Ljava.lang.Object;" size="4"/>
185
       </at>
186
       <at name="item" index="2">
187
        <object classname="[Ljava.lang.Object;" size="4"/>
188
       </at>
189
       <at name="item" index="3">
190
        <object classname="[Ljava.lang.Object;" size="4"/>
191
       </at>
192
      </object>
193
     </at>
194
    </object>
195
   </at>
196
   <at name="rowgroups">
197
    <object classname="com.jeta.forms.store.memento.FormGroupSet">
198
     <at name="groups">
199
      <object classname="java.util.HashMap"/>
200
     </at>
201
    </object>
202
   </at>
203
   <at name="colgroups">
204
    <object classname="com.jeta.forms.store.memento.FormGroupSet">
205
     <at name="groups">
206
      <object classname="java.util.HashMap"/>
207
     </at>
208
    </object>
209
   </at>
210
  </object>
211
 </at>
212
</object>
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.54/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/FeatureStoresComboBoxModel.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.MutableComboBoxModel;
30

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

  
34
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36

  
37
/**
38
 * @author dmartinez
39
 *
40
 */
41
public class FeatureStoresComboBoxModel extends AbstractListModel<FeatureStore> implements MutableComboBoxModel<FeatureStore> {
42

  
43

  
44

  
45
    private static final Logger logger = LoggerFactory.getLogger(FeatureStoresComboBoxModel.class);
46

  
47
    private List<FeatureStore> featureStores;
48
    private FeatureStore selected;
49

  
50
    /**
51
     *
52
     */
53
    public FeatureStoresComboBoxModel(List<FeatureStore> featureStores) {
54
        this.featureStores = featureStores;
55
    }
56

  
57
    /*
58
     * (non-Javadoc)
59
     *
60
     * @see javax.swing.ListModel#getSize()
61
     */
62
    public int getSize() {
63
        return featureStores.size();
64
    }
65

  
66
    /*
67
     * (non-Javadoc)
68
     *
69
     * @see javax.swing.ListModel#getElementAt(int)
70
     */
71
    public FeatureStore getElementAt(int index) {
72
        return featureStores.get(index);
73
    }
74

  
75
    /*
76
     * (non-Javadoc)
77
     *
78
     * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object)
79
     */
80
    public void setSelectedItem(final Object anItem) {
81
        selected = (FeatureStore) anItem;
82
        fireContentsChanged(this, -1, -1);
83
    }
84

  
85
    /*
86
     * (non-Javadoc)
87
     *
88
     * @see javax.swing.ComboBoxModel#getSelectedItem()
89
     */
90
    public Object getSelectedItem() {
91
        return selected;
92
    }
93

  
94
    /* (non-Javadoc)
95
     * @see javax.swing.MutableComboBoxModel#addElement(java.lang.Object)
96
     */
97
    public void addElement(FeatureStore item) {
98
        featureStores.add(item);
99
        fireIntervalAdded(this, featureStores.size()-1, featureStores.size()-1);
100
    }
101

  
102
    /* (non-Javadoc)
103
     * @see javax.swing.MutableComboBoxModel#removeElement(java.lang.Object)
104
     */
105
    public void removeElement(Object obj) {
106
        int index = featureStores.indexOf(obj);
107
        featureStores.remove(obj);
108
        fireIntervalRemoved(this, index, index);
109
    }
110

  
111
    /* (non-Javadoc)
112
     * @see javax.swing.MutableComboBoxModel#insertElementAt(java.lang.Object, int)
113
     */
114
    public void insertElementAt(FeatureStore item, int index) {
115
        featureStores.add(index, item);
116
        fireIntervalAdded(this, index, index);
117
    }
118

  
119
    /* (non-Javadoc)
120
     * @see javax.swing.MutableComboBoxModel#removeElementAt(int)
121
     */
122
    public void removeElementAt(int index) {
123
        featureStores.remove(index);
124
        fireIntervalRemoved(this, index, index);
125
    }
126

  
127
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.54/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsEditRouteCalibrationParamsView.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.JComboBox;
13
import javax.swing.JFrame;
14
import javax.swing.JLabel;
15
import javax.swing.JPanel;
16
import javax.swing.JScrollPane;
17
import javax.swing.JTable;
18
import javax.swing.JTextField;
19

  
20

  
21
public class JLrsEditRouteCalibrationParamsView extends JPanel
22
{
23
   JLabel lblIdRouteField = new JLabel();
24
   JLabel lblMinimum = new JLabel();
25
   JLabel lblMaximum = new JLabel();
26
   JTable tblLayerInfo = new JTable();
27
   JButton btnInvert = new JButton();
28
   JButton btnApply = new JButton();
29
   JButton btnAccept = new JButton();
30
   JButton btnCancel = new JButton();
31
   JComboBox cmbRoute = new JComboBox();
32
   JTextField txtMaximum = new JTextField();
33
   JTextField txtMinimum = new JTextField();
34

  
35
   /**
36
    * Default constructor
37
    */
38
   public JLrsEditRouteCalibrationParamsView()
39
   {
40
      initializePanel();
41
   }
42

  
43
   /**
44
    * Adds fill components to empty cells in the first row and first column of the grid.
45
    * This ensures that the grid spacing will be the same as shown in the designer.
46
    * @param cols an array of column indices in the first row where fill components should be added.
47
    * @param rows an array of row indices in the first column where fill components should be added.
48
    */
49
   void addFillComponents( Container panel, int[] cols, int[] rows )
50
   {
51
      Dimension filler = new Dimension(10,10);
52

  
53
      boolean filled_cell_11 = false;
54
      CellConstraints cc = new CellConstraints();
55
      if ( cols.length > 0 && rows.length > 0 )
56
      {
57
         if ( cols[0] == 1 && rows[0] == 1 )
58
         {
59
            /** add a rigid area  */
60
            panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
61
            filled_cell_11 = true;
62
         }
63
      }
64

  
65
      for( int index = 0; index < cols.length; index++ )
66
      {
67
         if ( cols[index] == 1 && filled_cell_11 )
68
         {
69
            continue;
70
         }
71
         panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
72
      }
73

  
74
      for( int index = 0; index < rows.length; index++ )
75
      {
76
         if ( rows[index] == 1 && filled_cell_11 )
77
         {
78
            continue;
79
         }
80
         panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
81
      }
82

  
83
   }
84

  
85
   /**
86
    * Helper method to load an image file from the CLASSPATH
87
    * @param imageName the package and name of the file to load relative to the CLASSPATH
88
    * @return an ImageIcon instance with the specified image file
89
    * @throws IllegalArgumentException if the image resource cannot be loaded.
90
    */
91
   public ImageIcon loadImage( String imageName )
92
   {
93
      try
94
      {
95
         ClassLoader classloader = getClass().getClassLoader();
96
         java.net.URL url = classloader.getResource( imageName );
97
         if ( url != null )
98
         {
99
            ImageIcon icon = new ImageIcon( url );
100
            return icon;
101
         }
102
      }
103
      catch( Exception e )
104
      {
105
         e.printStackTrace();
106
      }
107
      throw new IllegalArgumentException( "Unable to load image: " + imageName );
108
   }
109

  
110
   /**
111
    * Method for recalculating the component orientation for
112
    * right-to-left Locales.
113
    * @param orientation the component orientation to be applied
114
    */
115
   public void applyComponentOrientation( ComponentOrientation orientation )
116
   {
117
      // Not yet implemented...
118
      // I18NUtils.applyComponentOrientation(this, orientation);
119
      super.applyComponentOrientation(orientation);
120
   }
121

  
122
   public JPanel createPanel()
123
   {
124
      JPanel jpanel1 = new JPanel();
125
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:120PX:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:73PX:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:74PX:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
126
      CellConstraints cc = new CellConstraints();
127
      jpanel1.setLayout(formlayout1);
128

  
129
      lblIdRouteField.setName("lblIdRouteField");
130
      lblIdRouteField.setText("id_route_field");
131
      jpanel1.add(lblIdRouteField,cc.xy(2,4));
132

  
133
      lblMinimum.setName("lblMinimum");
134
      lblMinimum.setText("minimum");
135
      jpanel1.add(lblMinimum,cc.xy(6,4));
136

  
137
      lblMaximum.setName("lblMaximum");
138
      lblMaximum.setText("maximum");
139
      jpanel1.add(lblMaximum,cc.xy(10,4));
140

  
141
      tblLayerInfo.setName("tblLayerInfo");
142
      JScrollPane jscrollpane1 = new JScrollPane();
143
      jscrollpane1.setViewportView(tblLayerInfo);
144
      jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
145
      jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
146
      jpanel1.add(jscrollpane1,cc.xywh(2,2,11,1));
147

  
148
      jpanel1.add(createPanel1(),new CellConstraints(2,6,11,1,CellConstraints.RIGHT,CellConstraints.DEFAULT));
149
      jpanel1.add(createPanel2(),new CellConstraints(2,8,11,1,CellConstraints.RIGHT,CellConstraints.DEFAULT));
150
      cmbRoute.setName("cmbRoute");
151
      jpanel1.add(cmbRoute,cc.xy(4,4));
152

  
153
      txtMaximum.setName("txtMaximum");
154
      jpanel1.add(txtMaximum,cc.xy(12,4));
155

  
156
      txtMinimum.setName("txtMinimum");
157
      jpanel1.add(txtMinimum,cc.xy(8,4));
158

  
159
      addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9 });
160
      return jpanel1;
161
   }
162

  
163
   public JPanel createPanel1()
164
   {
165
      JPanel jpanel1 = new JPanel();
166
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
167
      CellConstraints cc = new CellConstraints();
168
      jpanel1.setLayout(formlayout1);
169

  
170
      btnInvert.setActionCommand("_Invert");
171
      btnInvert.setName("btnInvert");
172
      btnInvert.setText("_Invert");
173
      jpanel1.add(btnInvert,new CellConstraints(1,1,1,1,CellConstraints.CENTER,CellConstraints.DEFAULT));
174

  
175
      btnApply.setActionCommand("_Apply");
176
      btnApply.setName("btnApply");
177
      btnApply.setText("_Apply");
178
      jpanel1.add(btnApply,cc.xy(3,1));
179

  
180
      addFillComponents(jpanel1,new int[]{ 2 },new int[0]);
181
      return jpanel1;
182
   }
183

  
184
   public JPanel createPanel2()
185
   {
186
      JPanel jpanel1 = new JPanel();
187
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE");
188
      CellConstraints cc = new CellConstraints();
189
      jpanel1.setLayout(formlayout1);
190

  
191
      btnAccept.setActionCommand("_Accept");
192
      btnAccept.setName("btnAccept");
193
      btnAccept.setText("_Accept");
194
      jpanel1.add(btnAccept,new CellConstraints(1,1,1,1,CellConstraints.CENTER,CellConstraints.DEFAULT));
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff