Revision 9508

View differences:

org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.tasseledcap.swing.TasseledCapSwingLibrary
0 2

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.api/src/main/java/org/gvsig/raster/tasseledcap/swing/TasseledCapSwingManager.java
1
package org.gvsig.raster.tasseledcap.swing;
2

  
3
import org.gvsig.raster.algorithm.BasicAPISwingPanel;
4

  
5
/**
6
 * This class is responsible of the management of the library's business logic.
7
 * It is the library's main entry point, and provides all the services to manage
8
 * {@link TasseledCapService}s.
9
 * 
10
 * @see TasseledCapsService
11
 * @author gvSIG team
12
 * @version $Id$
13
 */
14
public interface TasseledCapSwingManager {
15
	public BasicAPISwingPanel createTasseledCapMainPanel(
16
			Object inputStore, 
17
			String layerName, 
18
			int bandList, 
19
			String roisEPSG);
20
}
0 21

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.api/src/main/java/org/gvsig/raster/tasseledcap/swing/TasseledCapSwingLocator.java
1
package org.gvsig.raster.tasseledcap.swing;
2

  
3
import org.gvsig.tools.locator.BaseLocator;
4

  
5
/**
6
 * This locator is the entry point for the Raster library, providing
7
 * access to all Raster services through the {@link TasseledCapManager}
8
 * .
9
 * 
10
 * @author gvSIG team
11
 * @version $Id$
12
 */
13
public class TasseledCapSwingLocator extends BaseLocator {
14
    /**
15
     * Validation swing manager name.
16
     */
17
    public static final String SWING_MANAGER_NAME =
18
        "TasseledCap.swing.manager";
19

  
20
    /**
21
     * Validation swing manager description.
22
     */
23
    public static final String SWING_MANAGER_DESCRIPTION =
24
        "TasseledCap UIManager";
25

  
26
    private static final String LOCATOR_NAME = "TasseledCap.swing.locator";
27

  
28
    /**
29
     * Unique instance.
30
     */
31
    private static final TasseledCapSwingLocator INSTANCE =
32
        new TasseledCapSwingLocator();
33

  
34
    /**
35
     * Return the singleton instance.
36
     * 
37
     * @return the singleton instance
38
     */
39
    public static TasseledCapSwingLocator getInstance() {
40
        return INSTANCE;
41
    }
42

  
43
    /**
44
     * Return the Locator's name
45
     * 
46
     * @return a String with the Locator's name
47
     */
48
    public final String getLocatorName() {
49
        return LOCATOR_NAME;
50
    }
51

  
52
    /**
53
     * Registers the Class implementing the PersistenceManager interface.
54
     * 
55
     * @param clazz
56
     *            implementing the PersistenceManager interface
57
     */
58
    public static void registerSwingManager(
59
        Class<? extends TasseledCapSwingManager> clazz) {
60
        getInstance().register(SWING_MANAGER_NAME, SWING_MANAGER_DESCRIPTION, clazz);
61
    }
62

  
63
    /**
64
     * Gets the instance of the {@link ScriptingUIManager} registered.
65
     * 
66
     * @return {@link ScriptingUIManager}
67
     */
68
    public static TasseledCapSwingManager getSwingManager() {
69
        return (TasseledCapSwingManager) getInstance().get(SWING_MANAGER_NAME);
70
    }
71
}
0 72

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.api/src/main/java/org/gvsig/raster/tasseledcap/swing/TasseledCapSwingLibrary.java
1
package org.gvsig.raster.tasseledcap.swing;
2

  
3
import org.gvsig.tools.library.AbstractLibrary;
4
import org.gvsig.tools.library.LibraryException;
5
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
6

  
7
/**
8
 * Library for API initialization and configuration.
9
 * 
10
 * @author gvSIG team
11
 * @version $Id$
12
 */
13
public class TasseledCapSwingLibrary extends AbstractLibrary {
14
	
15
    @Override
16
    protected void doInitialize() throws LibraryException {
17
    }
18

  
19
    @Override
20
    protected void doPostInitialize() throws LibraryException {
21
        // Validate there is any implementation registered.
22
    	TasseledCapSwingManager manager = TasseledCapSwingLocator.getSwingManager();
23
        if (manager == null) {
24
            throw new ReferenceNotRegisteredException(
25
            		TasseledCapSwingLocator.SWING_MANAGER_NAME, 
26
            		TasseledCapSwingLocator.getInstance());
27
        }
28
    }
29

  
30
}
0 31

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.api/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<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/maven-v4_0_0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<artifactId>org.gvsig.raster.tasseledcap.swing.api</artifactId>
5
	<packaging>jar</packaging>
6
	<name>org.gvsig.raster.tasseledcap.swing.api</name>
7
	<parent>
8
		<groupId>org.gvsig</groupId>
9
		<artifactId>org.gvsig.raster.tasseledcap.swing</artifactId>
10
		<version>2.2.79</version>
11
	</parent>
12
	<dependencies>
13
		<dependency>
14
            <groupId>org.gvsig</groupId>
15
            <artifactId>org.gvsig.tools.lib</artifactId>      
16
            <scope>compile</scope>
17
        </dependency> 
18
        <dependency>
19
            <groupId>org.gvsig</groupId>
20
            <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
21
            <scope>compile</scope>
22
        </dependency>
23
        <dependency>
24
            <groupId>org.gvsig</groupId>
25
            <artifactId>org.gvsig.fmap.mapcontext.impl</artifactId>
26
            <scope>runtime</scope>
27
        </dependency>
28
        <dependency>
29
            <groupId>org.gvsig</groupId>
30
            <artifactId>org.gvsig.i18n</artifactId>
31
            <scope>compile</scope>
32
        </dependency>
33
	</dependencies>
34
</project>
0 35

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3

  
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.raster.tasseledcap.swing</artifactId>
6
	<packaging>pom</packaging>
7
	<name>org.gvsig.raster.tasseledcap.swing</name>
8
	<parent>
9
		<groupId>org.gvsig</groupId>
10
		<artifactId>org.gvsig.raster.tasseledcap</artifactId>
11
		<version>2.2.79</version>
12
	</parent>
13
	<dependencies>
14
		<dependency>
15
			<groupId>org.gvsig</groupId>
16
			<artifactId>org.gvsig.andami</artifactId>
17
                        <scope>compile</scope>
18
		</dependency>
19
		<dependency>
20
			<groupId>org.gvsig</groupId>
21
			<artifactId>org.gvsig.ui</artifactId>
22
                        <scope>compile</scope>
23
		</dependency>
24
               <dependency>
25
                  <groupId>org.gvsig</groupId>
26
                  <artifactId>org.gvsig.raster.algorithm</artifactId>           
27
                  <scope>compile</scope>
28
              </dependency>
29
               <dependency>
30
                  <groupId>org.gvsig</groupId>
31
                  <artifactId>org.gvsig.raster.swing.api</artifactId>           
32
                  <scope>compile</scope>
33
              </dependency>
34
               <dependency>
35
                  <groupId>org.gvsig</groupId>
36
                  <artifactId>org.gvsig.raster.swing.impl</artifactId>           
37
                  <scope>runtime</scope>
38
              </dependency>
39
              <dependency>
40
			      <groupId>org.gvsig</groupId>
41
			      <artifactId>org.gvsig.raster.tasseledcap.algorithm</artifactId>
42
			      <scope>compile</scope>
43
		      </dependency>
44
	</dependencies>
45
	<modules>
46
		<module>org.gvsig.raster.tasseledcap.swing.api</module>
47
		<module>org.gvsig.raster.tasseledcap.swing.impl</module>
48
	</modules>
49
</project>
50

  
0 51

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/resources-plugin/org/gvsig/raster/tasseledcap/swing/impl/i18n/text.properties
1
components_selection=Selecci?n de componentes
2
autovalor=Autovalor
3
by_band=Por banda
4
var_covar=Matriz varianza-covarianza
5
autovector=Autovector
6
generate=Generar
7
stats=Estadisticas
8
gv_tools=gvSIG Herramientas
9
group_tools=Capas raster
10
raster_layer_not_active=Esta herramienta necesita una capa raster seleccionada en la vista
11
multispectral=Raster multiespectral
0 12

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/resources-plugin/org/gvsig/raster/tasseledcap/swing/impl/i18n/text_en.properties
1
components_selection=Component selection
2
autovalor=Eigenvalue
3
by_band=By band
4
var_covar=Matrix variance-covariance
5
autovector=Eigenvector
6
generate=Generate
7
stats=Statistics
8
gv_tools=gvSIG Tools
9
group_tools=Tools for raster layers
10
raster_layer_not_active=This tool needs a raster layer selected in the view
11
multispectral=Multispectral raster
0 12

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/resources/org/gvsig/raster/tasseledcap/swing/impl/i18n/text_en.properties
1
components_selection=Component selection
2
autovalor=Eigenvalue
3
by_band=By band
4
var_covar=Matrix variance-covariance
5
autovector=Eigenvector
6
generate=Generate
7
stats=Statistics
8
use_rois=Use regions of interest of the layer
9
band=Band
10
max=Maximum
11
min=Minimum
12
mean=Mean
13
variance=Variance
14
standard_deviation=Standard deviation
0 15

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/resources/org/gvsig/raster/tasseledcap/swing/impl/i18n/text.properties
1
components_selection=Selecci?n de componentes
2
autovalor=Autovalor
3
by_band=Por banda
4
var_covar=Matriz varianza-covarianza
5
autovector=Autovector
6
generate=Generar
7
stats=Estadisticas
8
use_rois=Usar regiones de inter?s de la capa
9
band=Banda
10
max=M?ximo
11
min=M?nimo
12
mean=Media
13
variance=Varianza
14
standard_deviation=Desviaci?n est?ndar
0 15

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.tasseledcap.swing.impl.TasseledCapDefaultSwingImplLibrary
0 2

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/java/org/gvsig/raster/tasseledcap/swing/impl/main/TasseledCapPanelImpl.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.tasseledcap.swing.impl.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.io.File;
28
import java.util.EventListener;
29
import java.util.List;
30

  
31
import javax.swing.BorderFactory;
32
import javax.swing.JComponent;
33
import javax.swing.JLabel;
34
import javax.swing.JPanel;
35

  
36
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
37
import org.gvsig.i18n.Messages;
38
import org.gvsig.raster.algorithm.BasicAPISwingPanel;
39
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary;
40
import org.gvsig.raster.algorithm.process.DataProcess;
41
import org.gvsig.raster.algorithm.process.ProcessException;
42
import org.gvsig.raster.tasseledcap.algorithm.TasseledCapAlgorithmLibrary;
43
import org.gvsig.raster.swing.RasterSwingLocator;
44
import org.gvsig.raster.swing.RasterSwingManager;
45
import org.gvsig.raster.swing.newlayer.CreateNewLayerPanel;
46
import org.gvsig.raster.swing.pagedtable.ModelLoader;
47
import org.gvsig.raster.swing.pagedtable.PagedTable;
48

  
49
/**
50
 * @author Nacho Brodin (nachobrodin@gmail.com)
51
 */
52
public class TasseledCapPanelImpl extends JPanel implements BasicAPISwingPanel {
53
	private static final long               serialVersionUID     = 1L;
54
	private String                          layerName            = null;
55
	private CreateNewLayerPanel             newLayerPanel        = null;
56
	private Object                          inputStore           = null;
57
	private PagedTable                      table                = null;
58
	private int                             bandList             = 0;
59
	
60
	public TasseledCapPanelImpl(Object inputStore, String layerName, int bandList) {
61
		this.inputStore = inputStore;
62
		this.layerName = layerName;
63
		this.bandList = bandList;
64
		init();
65
	}
66
	
67
	private void init() {
68
		setLayout(new GridBagLayout());
69
		
70
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
71
		gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
72
		gridBagConstraints1.weightx = 1;
73
		gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 0);
74
		gridBagConstraints1.gridx = 0;
75
		gridBagConstraints1.gridy = 0;
76
		add(getLayerPanel(), gridBagConstraints1);
77
		
78
		gridBagConstraints1.gridy = 2;
79
		add((JComponent)getCreateNewLayerPanel(), gridBagConstraints1);
80
		
81
		gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
82
		gridBagConstraints1.gridy = 1;
83
		gridBagConstraints1.weighty = 1;
84
		add(getInputsPanel(), gridBagConstraints1);
85
	}
86
	
87
	private JPanel getLayerPanel() {
88
		JPanel p = new JPanel();
89
		p.setBorder(BorderFactory.createTitledBorder(Messages.getText("layer")));
90
		p.setLayout(new GridBagLayout());
91
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
92
		gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
93
		gridBagConstraints1.weightx = 1;
94
		gridBagConstraints1.insets = new java.awt.Insets(0, 0, 2, 0);
95
		
96
		gridBagConstraints1.gridx = 0;
97
		gridBagConstraints1.gridy = 0;
98
		p.add(new JLabel(layerName), gridBagConstraints1);
99
		
100
		return p;
101
	}
102
	
103
	private JPanel getInputsPanel() {
104
		JPanel p = new JPanel();
105
		p.setBorder(BorderFactory.createTitledBorder(Messages.getText("bands")));
106
		p.setLayout(new BorderLayout());
107
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
108
		gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
109
		gridBagConstraints1.weightx = 1;
110
		gridBagConstraints1.weighty = 1;
111
		gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2);
112
		
113
		gridBagConstraints1.gridx = 0;
114
		gridBagConstraints1.gridy = 0;
115
		p.add(getPagedTable().getComponent(), BorderLayout.CENTER);
116
		
117
		return p;
118
	}
119
	
120
	public JComponent getComponent() {
121
		return this;
122
	}
123
	
124
	public PagedTable getPagedTable() {
125
		if(table == null) {
126
			RasterSwingManager manager = RasterSwingLocator.getSwingManager();
127
			String[] columnNames = {
128
					"", 
129
					Messages.getText("bands")};
130
			int[] columnSizes = {30, -1};
131

  
132
			BandTableModel model = new BandTableModel(columnNames);
133
			ModelLoader loader = manager.createModelLoader(model);
134
			CheckBoxColumnRenderer render = new CheckBoxColumnRenderer(null);
135
			CheckBoxColumnEditor editor = new CheckBoxColumnEditor();
136
			loader.setRenderForColumn(0, render);
137
			loader.setCellEditorForColumn(0, editor);
138
			loader.setColumnNames(columnNames);
139
			loader.setColumnWidths(columnSizes);
140
			
141
			table = manager.createPagedTable(loader);
142
			table.showControllerTable(false);
143
			table.showMoveRowsControls(false);
144
		}
145
		return table;
146
	}
147

  
148
	public DataProcess getResult() throws ProcessException {
149
		DataProcess task = RasterBaseAlgorithmLibrary.getManager().createRasterTask(TasseledCapAlgorithmLibrary.TASSELEDCAP_PROCESS_LABEL);
150
		List<String> params = task.getRasterTaskInputParameters(TasseledCapAlgorithmLibrary.TASSELEDCAP_PROCESS_LABEL);
151
		for (int i = 0; i < params.size(); i++) {
152
			String paramName = params.get(i);
153
			Class<?> paramType = task.getParameterTypeByProcess(TasseledCapAlgorithmLibrary.TASSELEDCAP_PROCESS_LABEL, paramName);
154
			if(paramType == RasterDataStore[].class) {
155
				task.addParam(paramName, new RasterDataStore[]{(RasterDataStore)inputStore});
156
			}
157
			if(paramType == String.class) {
158
				String filename = newLayerPanel.getDirectorySelected() + File.separator + newLayerPanel.getFileSelected();
159
				if(!filename.endsWith(".tif"))
160
					filename += ".tif";
161
				task.addParam(paramName, filename);
162
			}
163
			if(paramType == Boolean[].class) {
164
				boolean[] bands = new boolean[getPagedTable().getRowCount()];
165
				for (int j = 0; j < getPagedTable().getRowCount(); j++) {
166
					Object obj = getPagedTable().getValueAt(j, 0);
167
					if(obj instanceof Boolean)
168
						bands[j] = ((Boolean)obj).booleanValue();
169
				}
170
				task.addParam(paramName, bands);
171
			}
172
			
173
		}
174
		return task;
175
	}
176
	
177
	public CreateNewLayerPanel getCreateNewLayerPanel() {
178
		if(newLayerPanel == null) {
179
			newLayerPanel = RasterSwingLocator.getSwingManager().createNewLayerPanel();
180
		}
181
		return newLayerPanel;
182
	}
183

  
184
	public void initialize() {
185
		for (int i = 0; i < bandList; i++) {
186
			getPagedTable().addRow(new Object[]{true, "B" + i});			
187
		}			
188
	}
189

  
190
	public int getComponentIDByObject(Object obj) {
191
		return -1;
192
	}
193

  
194
	public void addListener(EventListener listener) {
195
		// TODO Auto-generated method stub
196
		
197
	}
198

  
199
}
0 200

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/java/org/gvsig/raster/tasseledcap/swing/impl/main/CheckBoxColumnEditor.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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
package org.gvsig.raster.tasseledcap.swing.impl.main;
25

  
26
import java.awt.Component;
27
import java.awt.event.ActionEvent;
28
import java.awt.event.ActionListener;
29

  
30
import javax.swing.AbstractCellEditor;
31
import javax.swing.JCheckBox;
32
import javax.swing.JTable;
33
import javax.swing.SwingUtilities;
34
import javax.swing.table.TableCellEditor;
35

  
36
/**
37
 * @author Nacho Brodin (nachobrodin@gmail.com)
38
 */
39
public class CheckBoxColumnEditor extends AbstractCellEditor
40
implements TableCellEditor {
41
    final private static long serialVersionUID = -3370601314380922368L;
42
    public JCheckBox theCheckBox;
43

  
44
    public CheckBoxColumnEditor() {
45
        super();
46
        theCheckBox = new JCheckBox();
47
        theCheckBox.addActionListener(new ActionListener() {
48
                public void actionPerformed(ActionEvent event) {
49
                    fireEditingStopped() ;
50
                    
51
                }
52
            });
53
    }
54

  
55
    public Component getTableCellEditorComponent(JTable table, Object obj,
56
                                                 boolean isSelected,
57
                                                 int row, int col) {
58
    	theCheckBox.setHorizontalAlignment(SwingUtilities.CENTER);
59

  
60
        Boolean lValueAsBoolean = (Boolean) obj;
61
        theCheckBox.setSelected(lValueAsBoolean.booleanValue());
62

  
63
        return theCheckBox;
64
    }
65

  
66
    public Object getCellEditorValue() {
67
        return new Boolean(theCheckBox.isSelected());
68
    }
69
}
0 70

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/java/org/gvsig/raster/tasseledcap/swing/impl/main/CheckBoxColumnRenderer.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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
package org.gvsig.raster.tasseledcap.swing.impl.main;
25

  
26
import java.awt.Component;
27
import java.awt.event.ActionEvent;
28
import java.awt.event.ActionListener;
29

  
30
import javax.swing.JCheckBox;
31
import javax.swing.JTable;
32
import javax.swing.SwingConstants;
33
import javax.swing.table.TableCellRenderer;
34

  
35
/**
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public class CheckBoxColumnRenderer extends JCheckBox implements TableCellRenderer {
39
    final private static long            serialVersionUID = -3370601314380922368L;
40
    private ActionListener               listener = null;
41

  
42
    public CheckBoxColumnRenderer() {}
43
    
44
    public CheckBoxColumnRenderer(ActionListener listener) {
45
    	this.listener = listener;
46
    }
47
    
48
    public Component getTableCellRendererComponent(JTable table,
49
                                                   Object value,
50
                                                   boolean isSelected,
51
                                                   boolean hasFocus,
52
                                                   int row, int column) {
53
        if (value == null) {
54
            this.setSelected(false);
55
        }
56
        if(isSelected)
57
        	if(listener != null) 
58
        		listener.actionPerformed(new ActionEvent(this, row, "SELECT_ROW"));
59
        	
60
        if(value instanceof Boolean){
61
	        Boolean ValueAsBoolean = (Boolean) value;
62
	        this.setSelected(ValueAsBoolean.booleanValue());
63
	        this.setHorizontalAlignment(SwingConstants.CENTER);
64
        }
65
        	
66
        return this;
67
    }
68
}
0 69

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/java/org/gvsig/raster/tasseledcap/swing/impl/main/BandTableModel.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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
package org.gvsig.raster.tasseledcap.swing.impl.main;
25

  
26
import javax.swing.table.DefaultTableModel;
27

  
28
import org.gvsig.raster.swing.pagedtable.TableModel;
29
/**
30
 * Model for the band table
31
 * 
32
 * @author Nacho Brodin (nachobrodin@gmail.com)
33
 */
34
public class BandTableModel extends DefaultTableModel implements TableModel {
35
	final private static long serialVersionUID = -3370601314380922368L;
36
	private int               nColumns         = 0;
37

  
38
	public BandTableModel(String[] columnNames) {
39
		super(new Object[0][columnNames.length], columnNames);
40
		this.nColumns = columnNames.length;
41
	}
42

  
43
	public Class<?> getColumnClass(int c) {
44
		return String.class;
45
	}
46

  
47
	public void setValueAt(Object value, int row, int col) {
48
		super.setValueAt(value, row, col);
49
	}
50

  
51
	public void addNew() {
52
		Object[] line = new Object[nColumns];
53
		line[0] = new Boolean(true);
54
		for (int i = 0; i < nColumns; i++)
55
			line[i] = new String("");
56
		super.addRow(line);
57
	}
58

  
59
	public Object[] getNewLine() {
60
		Object[] o = new Object[nColumns];
61
		o[0] = new Boolean(true);
62
		for (int i = 1; i < nColumns; i++)
63
			o[i] = "";
64
		return o;
65
	}
66

  
67
	public void addNewLine() {
68
		// TODO Auto-generated method stub
69
		
70
	}
71
}
0 72

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/java/org/gvsig/raster/tasseledcap/swing/impl/main/ComponentsTableModel.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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
package org.gvsig.raster.tasseledcap.swing.impl.main;
25

  
26
import javax.swing.table.DefaultTableModel;
27

  
28
import org.gvsig.raster.swing.pagedtable.TableModel;
29
/**
30
 * Model for the list of components
31
 * 
32
 * @author Nacho Brodin (nachobrodin@gmail.com)
33
 */
34
public class ComponentsTableModel extends DefaultTableModel implements TableModel {
35
	final private static long serialVersionUID = -3370601314380922368L;
36
	private int               nColumns         = 0;
37

  
38
	public ComponentsTableModel(String[] columnNames) {
39
		super(new Object[0][columnNames.length], columnNames);
40
		this.nColumns = columnNames.length;
41
	}
42

  
43
	public Class<?> getColumnClass(int c) {
44
		return String.class;
45
	}
46

  
47
	public void setValueAt(Object value, int row, int col) {
48
		super.setValueAt(value, row, col);
49
	}
50

  
51
	public void addNew() {
52
		Object[] line = new Object[nColumns];
53
		line[0] = new Boolean(true);
54
		for (int i = 0; i < nColumns; i++)
55
			line[i] = new String("");
56
		super.addRow(line);
57
	}
58

  
59
	public Object[] getNewLine() {
60
		Object[] o = new Object[nColumns];
61
		o[0] = new Boolean(true);
62
		for (int i = 1; i < nColumns; i++)
63
			o[i] = "";
64
		return o;
65
	}
66

  
67
	public void addNewLine() {
68
		// TODO Auto-generated method stub
69
		
70
	}
71
}
0 72

  
org.gvsig.raster.tasseledcap/tags/org.gvsig.raster.tasseledcap-2.2.79/org.gvsig.raster.tasseledcap.swing/org.gvsig.raster.tasseledcap.swing.impl/src/main/java/org/gvsig/raster/tasseledcap/swing/impl/main/TasseledCapMainPanelImpl.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.tasseledcap.swing.impl.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.io.File;
28
import java.util.EventListener;
29
import java.util.List;
30

  
31
import javax.swing.BorderFactory;
32
import javax.swing.ButtonGroup;
33
import javax.swing.JCheckBox;
34
import javax.swing.JComponent;
35
import javax.swing.JLabel;
36
import javax.swing.JPanel;
37
import javax.swing.JRadioButton;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff