Revision 5988

View differences:

org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileDataParameters.java
49 49

  
50 50
	/**
51 51
	 * Returns true if this multifile has providers loaded
52
	 * @return
52
	 * @return boolean
53 53
	 */
54 54
	public boolean hasProviders();
55 55

  
......
61 61

  
62 62
	/**
63 63
	 * Adds a provider to the list if the this is not tiled
64
	 * @param provider
64 65
	 * @param prov
65 66
	 */
66 67
	public void addProviderNotTiled(DataStoreProvider provider);
......
73 74

  
74 75
	/**
75 76
	 * Adds a provider to the list
77
	 * @param provider
76 78
	 * @param prov
77 79
	 */
78 80
	public void addProvider(DataStoreProvider provider);
......
85 87

  
86 88
	/**
87 89
	 * Gets the list of providers
90
	 * @return the list of providers
88 91
	 */
89 92
	public List<RasterProvider> getProviders();
90 93
}
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormatSerializer.java
43 43
	public static final String URI               = "URI";
44 44
	public static final String NAME              = "Name";
45 45
	private MultiFileFormat   multiFileFormat    = null;
46
	
46

  
47
	/**
48
	 * @param timeSeriesFormat
49
	 */
47 50
	public MultiFileFormatSerializer(MultiFileFormat timeSeriesFormat) {
48 51
		this.multiFileFormat = timeSeriesFormat;
49 52
	}
50
	
53

  
51 54
 	/**
52 55
	 * Parsers a date list
53 56
	 * @param tInfo
54 57
	 * @param parser
55 58
	 * @param xml
59
 	 * @param parseableTag
56 60
	 * @param tag
57 61
	 * @throws XmlPullParserException
58 62
	 * @throws IOException
59 63
	 * @throws ParsingException
60 64
	 * @throws NumberFormatException
61
	 * @throws ParseException 
65
	 * @throws ParseException
62 66
	 */
63 67
	public void parseURIs(KXmlParser parser, String xml, String parseableTag) throws XmlPullParserException, IOException, NumberFormatException, ParsingException, ParseException  {
64 68
		boolean end = false;
......
160 164
	/**
161 165
	 * Writes a MultiFileFormat to disk
162 166
	 * @param multiFileFormat
167
	 * @param fileName
163 168
	 * @param file
164 169
	 * @throws IOException
165 170
	 */
......
171 176
		writer.write(serializer.write());
172 177
		writer.close();
173 178
	}
174
	
179

  
175 180
	/**
176 181
	 * Reads a TimeSeriesFormat from disk
177 182
	 * @param timeSeriesFormat
178 183
	 * @param file
184
	 * @return MultiFileFormat
179 185
	 * @throws IOException
180
	 * @throws ParsingException 
186
	 * @throws ParsingException
181 187
	 */
182 188
	public static MultiFileFormat read(MultiFileFormat timeSeriesFormat, String file) throws IOException, ParsingException {
183 189
		RmfBlocksManager manager = new RmfBlocksManager(file);
......
186 192
		manager.read(null);
187 193
		return timeSeriesFormat;
188 194
	}
189
	
195

  
190 196
	/*
191 197
	 * (non-Javadoc)
192 198
	 * @see org.gvsig.raster.dataset.io.rmf.IRmfBlock#write()
......
196 202
		b.append("<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n");
197 203
		b.append("<" + MAIN_TAG + ">\n");
198 204
		putProperty(b, NAME, multiFileFormat.getName(), 2);
199
		
205

  
200 206
		b.append("\t\t<" + URIS + ">\n");
201 207
		for (int i = 0; i < multiFileFormat.getNumberOfFiles(); i++) {
202 208
			putProperty(b, URI, multiFileFormat.getPathToFile(i), 3);
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileFormat.java
27 27

  
28 28
/**
29 29
 * MultiFileFormat information
30
 * 
30
 *
31 31
 * @author Nacho Brodin (nachobrodin@gmail.com)
32 32
 */
33 33
public class MultiFileFormat {
......
36 36

  
37 37
	/**
38 38
	 * Gets the name of this serial
39
	 * @return
39
	 * @return String
40 40
	 */
41 41
	public String getName() {
42 42
		return name;
43 43
	}
44
	
44

  
45 45
	/**
46 46
	 * Sets the name of this serie
47 47
	 * @param name
......
52 52

  
53 53
	/**
54 54
	 * Gets the number of files of this serial
55
	 * @return
55
	 * @return int
56 56
	 */
57 57
	public int getNumberOfFiles() {
58 58
		return fileList.size();
59 59
	}
60
	
60

  
61 61
	/**
62 62
	 * Gets the path of the file in the selected position
63 63
	 * @param file
64
	 * @return
64
	 * @return String
65 65
	 */
66 66
	public String getPathToFile(int file) {
67 67
		return fileList.get(file).getAbsolutePath();
68 68
	}
69
	
69

  
70 70
	/**
71 71
	 * Adds a file to the list
72 72
	 * @param file
......
74 74
	public void addFile(File file) {
75 75
		fileList.add(file);
76 76
	}
77
	
77

  
78 78
	/**
79
	 * Cleans the list of files 
79
	 * Cleans the list of files
80 80
	 */
81 81
	public void clean() {
82 82
		fileList.clear();
83 83
		name = null;
84 84
	}
85
	
85

  
86
	/**
87
	 * @param fileName
88
	 * @param path
89
	 * @param uriList
90
	 * @return String
91
	 * @throws IOException
92
	 */
86 93
	public static String saveMultiFileFormat(String fileName, String path, ArrayList<File> uriList) throws IOException {
87 94
		path = path + File.separator + fileName + ".mff";
88
		
95

  
89 96
		MultiFileFormat format = new MultiFileFormat();
90 97
		for (int i = 0; i < uriList.size(); i++) {
91 98
			format.addFile(uriList.get(i));
92 99
		}
93 100
		format.setName(fileName);
94
		
101

  
95 102
		format.write(path);
96 103
		return path;
97 104
	}
98
	
105

  
99 106
	/**
100 107
	 * Writes a MultiFileFormat to disk
108
	 * @param fileName
101 109
	 * @param file
102 110
	 * @throws IOException
103 111
	 */
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileProvider.java
102 102
    private static final Logger              logger                   = LoggerFactory.getLogger(MultiFileProvider.class);
103 103
    protected static String[]                formatList               = null;
104 104

  
105
	/**
106
	 *
107
	 */
105 108
	public static void register() {
106 109
		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
107 110
		registerFormats();
......
132 135
					MultiFileProvider.class);
133 136
	}
134 137

  
138
	/**
139
	 *
140
	 */
135 141
	public MultiFileProvider() {
136 142
	}
137 143

  
138 144
	/**
139 145
	 * Opens the dataset.
146
	 * @param params
140 147
	 * @param proj Projection
141 148
	 * @param fName File name
142 149
	 * @throws NotSupportedExtensionException
150
	 * @throws OpenException
143 151
     * @deprecated use {@link #MultiFileProvider(URI)}, this constructor will be removed in gvSIG 2.5
144 152
	 */
145 153
	public MultiFileProvider(String params) throws NotSupportedExtensionException, OpenException {
......
164 172

  
165 173
	 /**
166 174
     * Opens the dataset.
175
	 * @param uri
167 176
     * @param proj Projection
168 177
     * @param fName File name
169 178
     * @throws NotSupportedExtensionException
179
	 * @throws OpenException
170 180
     */
171 181
    public MultiFileProvider(URI uri) throws NotSupportedExtensionException, OpenException {
172 182
        super(uri);
......
180 190
        init(p, null);
181 191
    }
182 192

  
193
    /**
194
     * @param params
195
     * @param storeServices
196
     * @throws NotSupportedExtensionException
197
     * @throws OpenException
198
     */
183 199
    public MultiFileProvider(MultiFileDataParametersImpl params,
184 200
			DataStoreProviderServices storeServices) throws NotSupportedExtensionException, OpenException {
185 201
		super(params, storeServices, ToolsLocator.getDynObjectManager()
......
191 207

  
192 208
	/**
193 209
	 * Build file references
210
	 * @param params
211
	 * @param storeServices
194 212
	 * @param proj Projection
195 213
	 * @param param Load parameters
196 214
	 * @throws NotSupportedExtensionException
215
	 * @throws OpenException
197 216
	 */
198 217
	public void init(MultiFileDataParameters params,
199 218
			DataStoreProviderServices storeServices) throws NotSupportedExtensionException, OpenException {
......
353 372
		return true;
354 373
	}
355 374

  
375
	/**
376
	 * @return MultiFileDataParameters
377
	 */
356 378
	public MultiFileDataParameters getParameters() {
357 379
		try {
358 380
			return (MultiFileDataParameters)parameters;
......
790 812
		return prov.getURIOfFirstProvider();
791 813
	}
792 814

  
815
	/**
816
	 * @param file
817
	 * @throws InvalidSourceException
818
	 */
793 819
	public void addFile(String file) throws InvalidSourceException {
794 820
		ProviderServices provServ = RasterLocator.getManager().getProviderServices();
795 821
		DataManagerProviderServices dataManager = (DataManagerProviderServices)DALLocator.getDataManager();
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorFileList.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.multifile.app.panel;
23 23

  
......
40 40
 * Panel que contiene la lista de ficheros cargados desde donde se leen las
41 41
 * bandas visualizadas. Contiene controles para a?adir y eliminar los ficheros,
42 42
 * as? como un control para seleccionar el n?mero de bandas a visualizar.
43
 * 
43
 *
44 44
 * @author Nacho Brodin (nachobrodin@gmail.com)
45 45
 */
46 46
public class BandSelectorFileList extends JPanel {
......
70 70
		add(getJScrollPane(), BorderLayout.CENTER);
71 71
		add(getButtonsPanel(), BorderLayout.EAST);
72 72
	}
73
	
73

  
74 74
	/**
75 75
	 * This method initializes jScrollPane
76
	 * 
76
	 *
77 77
	 * @return javax.swing.JScrollPane
78 78
	 */
79 79
	private JScrollPane getJScrollPane() {
......
110 110

  
111 111
	/**
112 112
	 * This method initializes jList
113
	 * 
113
	 *
114 114
	 * @return javax.swing.JList
115 115
	 */
116 116
	public JList getJList() {
......
124 124

  
125 125
	/**
126 126
	 * This method initializes jPanel1
127
	 * 
127
	 *
128 128
	 * @return javax.swing.JPanel
129 129
	 */
130 130
	private JPanel getButtonsPanel() {
......
169 169

  
170 170
	/**
171 171
	 * Obtiene el n?mero de ficheros en la lista
172
	 * @return
172
	 * @return number of files
173 173
	 */
174 174
	public int getNFiles() {
175 175
		return listModel.size();
176 176
	}
177
	
177

  
178 178
	/**
179 179
	 * Obtiene el modelo de la lista
180 180
	 * @return DefaultListModel
......
182 182
	public DefaultListModel getModel() {
183 183
		return listModel;
184 184
	}
185
	
185

  
186 186
	/**
187 187
	 * Activa y desactiva el control
188 188
	 * @param enabled true para activar y false para desactivar
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorNewLayerListener.java
57 57
	/**
58 58
	 * Constructor
59 59
	 * @param bs Panel del selector de bandas
60
	 * @param lyr Capa raster
61 60
	 */
62 61
	public BandSelectorNewLayerListener(BandSelectorPanel bs) {
63 62
		super(bs);
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java
98 98

  
99 99
	/**
100 100
	 * This method initializes
101
	 * @param type
101 102
	 */
102 103
	public BandSelectorPanel(int type) {
103 104
		super();
......
108 109
		initialize();
109 110
	}
110 111

  
112
	/**
113
	 * @return AbstractBandSelectorListener
114
	 */
111 115
	public AbstractBandSelectorListener getListener() {
112 116
		return panelListener;
113 117
	}
114 118

  
115 119
	/**
116 120
	 * This method initializes this
117
	 *
118
	 * @return void
119 121
	 */
120 122
	protected void initialize() {
121 123
		GridBagConstraints gbc = new GridBagConstraints();
......
237 239

  
238 240
	/**
239 241
	 * A?ade la lista de georasterfiles a la tabla
240
	 *
241
	 * @param files
242
	 * @param dstore
242 243
	 * @throws NotInitializeException
243 244
	 */
244 245
	public void addFiles(RasterDataStore dstore) throws NotInitializeException {
......
406 407
	/**
407 408
	 * Obtiene el n?mero de bandas de la lista
408 409
	 *
409
	 * @return
410
	 * @return the number of bands
410 411
	 */
411 412
	public int getNBands() {
412 413
		return ((DefaultTableModel) getARGBTable().getModel()).getRowCount();
......
416 417
	 * Obtiene el nombre de la banda de la posici?n i de la tabla
417 418
	 *
418 419
	 * @param i
419
	 * @return
420
	 * @return the band name
420 421
	 */
421 422
	public String getBandName(int i) {
422 423
		String s = (String) ((DefaultTableModel) getARGBTable().getModel()).getValueAt(i, 3);
......
504 505
		return ColorInterpretation.UNDEF_BAND;
505 506
	}
506 507

  
508
	/**
509
	 * @return the color interpretation
510
	 */
507 511
	public ColorInterpretation getSelectedColorInterpretation() {
508 512
		try {
509 513
			String[] colorInter = new String[getARGBTable().getRowCount()];
......
544 548
		revalidate();
545 549
	}
546 550

  
551
	/**
552
	 * @return RasterDataStore
553
	 */
547 554
	public RasterDataStore getResult() {
548 555
		return panelListener.getResult();
549 556
	}
......
716 723
		((BandSelectorPropertiesListener)panelListener).init(fLayer);
717 724
	}
718 725

  
726
	/**
727
	 * @param e
728
	 */
719 729
	public void componentHidden(ComponentEvent e) {}
730
	/**
731
	 * @param e
732
	 */
720 733
	public void componentShown(ComponentEvent e) {}
734
	/**
735
	 * @param e
736
	 */
721 737
	public void componentMoved(ComponentEvent e) {}
722 738

  
723 739

  
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java
33 33
import org.gvsig.andami.PluginServices;
34 34
import org.gvsig.andami.ui.mdiManager.WindowInfo;
35 35
import org.gvsig.fmap.dal.DALLocator;
36
import org.gvsig.fmap.dal.coverage.RasterLibrary;
37 36
import org.gvsig.fmap.dal.coverage.RasterLocator;
38 37
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException;
39 38
import org.gvsig.fmap.dal.coverage.exception.RmfSerializerException;
......
47 46
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
48 47
import org.gvsig.fmap.dal.spi.DataStoreProvider;
49 48
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
50
import org.gvsig.fmap.mapcontext.exceptions.FileLayerException;
51 49
import org.gvsig.gui.beans.swing.JFileChooser;
52 50
import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
53 51
import org.gvsig.i18n.Messages;
......
75 73
	/**
76 74
	 * Constructor
77 75
	 * @param bs Panel del selector de bandas
78
	 * @param lyr Capa raster
79 76
	 */
80 77
	public BandSelectorPropertiesListener(BandSelectorPanel bs) {
81 78
		super(bs);
......
83 80

  
84 81
	/**
85 82
	 * Constructor
86
	 * @param bs Panel del selector de bandas
87 83
	 * @param lyr Capa raster
88 84
	 */
89 85
	public void init(FLyrRaster lyr) {
......
170 166

  
171 167
	/**
172 168
	 * A?ade una banda al raster
173
	 * @param e
174 169
	 */
175 170
	public void addFileBand() {
176 171
		fileChooser = createJFileChooser();
......
232 227
	 * Elimina una banda del raster. Si queda solo un fichero o no se ha
233 228
	 * seleccionado ninguna banda no hace nada.
234 229
	 *
235
	 * @param e
236 230
	 */
237 231
	public void delFileBand() {
238 232
		Object[] objects = bandSetupPanel.getFileList().getJList().getSelectedValues();
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/MainWindow.java
35 35

  
36 36

  
37 37
/**
38
 * Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons 
38
 * Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons
39 39
 * of Cancel, Accept and others.
40
 * 
40
 *
41 41
 * @author Nacho Brodin (nachobrodin@gmail.com)
42 42
 */
43 43
public class MainWindow extends AbstractButtonsPanel implements IWindow, ActionListener {
44
    
44

  
45 45
    private static final long  serialVersionUID = -4401123724140025094L;
46 46
    private ActionListener     listener         = null;
47 47
    private WindowInfo         info             = null;
48 48

  
49 49
    private Object profile = WindowInfo.EDITOR_PROFILE;
50 50

  
51
    /**
52
     * @param panel
53
     * @param title
54
     * @param w
55
     * @param h
56
     * @param actionListener
57
     */
51 58
    public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener) {
52 59
    	this.listener = actionListener;
53
    	
60

  
54 61
    	setLayout(new BorderLayout());
55 62
		add(panel, BorderLayout.CENTER);
56 63

  
57 64
		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
58 65
        getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
59 66
        getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this);
60
        
67

  
61 68
        info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE);
62 69
        info.setTitle(title);
63 70
        info.setWidth(w);
64 71
        info.setHeight(h);
65 72
    }
66
    
73

  
74
    /**
75
     * @param panel
76
     * @param title
77
     * @param w
78
     * @param h
79
     * @param actionListener
80
     * @param mainPanel
81
     */
67 82
    public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener, boolean mainPanel) {
68 83
    	this.listener = actionListener;
69
    	
84

  
70 85
    	setLayout(new BorderLayout());
71 86
		add(panel, BorderLayout.CENTER);
72 87

  
73 88
		getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY).setVisible(false);
74
		
89

  
75 90
		if(mainPanel) {
76 91
			getButtonsPanel().addButton(Messages.getText("load_layer"), IButtonsPanel.BUTTON_USR1);
77 92
			getButtonsPanel().addButton(Messages.getText("generate_file"), IButtonsPanel.BUTTON_USR2);
......
86 101
			getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
87 102
			getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL).addActionListener(this);
88 103
		}
89
        
104

  
90 105
        info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
91 106
        info.setTitle(title);
92 107
        info.setWidth(w);
......
106 121
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_USR1, e.getActionCommand()));
107 122
    		PluginServices.getMDIManager().closeWindow(this);
108 123
    	}
109
    	
124

  
110 125
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2)) {
111 126
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_USR2, e.getActionCommand()));
112 127
    		PluginServices.getMDIManager().closeWindow(this);
113 128
    	}
114
    	
129

  
115 130
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_ACCEPT)) {
116 131
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_ACCEPT, e.getActionCommand()));
117 132
    		PluginServices.getMDIManager().closeWindow(this);
118 133
    	}
119
    	
134

  
120 135
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_APPLY)) {
121 136
    		listener.actionPerformed(new ActionEvent(e.getSource(), IButtonsPanel.BUTTON_APPLY, e.getActionCommand()));
122 137
    	}
123
    	
138

  
124 139
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CANCEL)) {
125 140
    		PluginServices.getMDIManager().closeWindow(this);
126 141
    	}
127
    	
142

  
128 143
    	if(e.getSource() == getButtonsPanel().getButton(IButtonsPanel.BUTTON_CLOSE)) {
129 144
    		PluginServices.getMDIManager().closeWindow(this);
130 145
    	}
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/LayerNameDialog.java
38 38
import org.gvsig.raster.swing.basepanel.IButtonsPanel;
39 39

  
40 40
/**
41
 * <code>LayerNameDialog</code>. 
42
 * Window to introduce the name of the new layer 
41
 * <code>LayerNameDialog</code>.
42
 * Window to introduce the name of the new layer
43 43
 * @author Nacho Brodin (nachobrodin@gmail.com)
44 44
 */
45 45
public class LayerNameDialog extends AbstractButtonsPanel implements IWindow, ButtonsPanelListener {
......
47 47
	private JPanel                panel            = null;
48 48
	private String                layerName        = null;
49 49
	private JTextField            name             = null;
50
	private ButtonsPanelListener  listener         = null;  
50
	private ButtonsPanelListener  listener         = null;
51 51
	private Point2D               position         = null;
52 52

  
53 53
	/**
54 54
	 * Builds a new window.
55
	 * @param width 
56
	 * @param height 
55
	 * @param position
56
	 * @param width
57
	 * @param height
58
	 * @param listener
57 59
	 */
58 60
	public LayerNameDialog(Point2D position, int width, int height, ButtonsPanelListener listener) {
59 61
		super(IButtonsPanel.BUTTONS_ACCEPTCANCEL);
......
65 67
		this.add(getMainPanel(), java.awt.BorderLayout.CENTER);
66 68
		this.addButtonPressedListener(this);
67 69
	}
68
	
70

  
69 71
	/**
70 72
	 * Builds a new window.
71
	 * @param width 
72
	 * @param height 
73
	 * @param width
74
	 * @param height
75
	 * @param listener
73 76
	 */
74 77
	public LayerNameDialog(int width, int height, ButtonsPanelListener listener) {
75 78
		this(new Point2D.Double(), width, height, listener);
......
92 95
		}
93 96
		return panel;
94 97
	}
95
	
98

  
96 99
	private JTextField getNameField() {
97 100
		if(name == null) {
98 101
			name = new JTextField();
......
120 123
			//Si la ventana no se puede eliminar no hacemos nada
121 124
		}
122 125
	}
123
	
126

  
124 127
	/**
125 128
	 * Accept actions
126 129
	 */
......
130 133
			JOptionPane.showMessageDialog(null, Messages.getText("character_not_valid"), "", JOptionPane.ERROR_MESSAGE);
131 134
			return;
132 135
		}
133
		
136

  
134 137
		byte[] byteList = txt.getBytes();
135 138
		for (int i = 0; i < byteList.length; i++) {
136 139
			if(byteList[i] < 45 ||
......
144 147
				return;
145 148
			}
146 149
		}
147
		
150

  
148 151
		layerName = txt;
149 152
		close();
150 153
		listener.actionButtonPressed(new ButtonsPanelEvent(layerName, IButtonsPanel.BUTTON_ACCEPT));
......
154 157
		if (e.getButton() == IButtonsPanel.BUTTON_CANCEL) {
155 158
			close();
156 159
		}
157
		
160

  
158 161
		if (e.getButton() == IButtonsPanel.BUTTON_ACCEPT) {
159 162
			accept();
160 163
		}
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/AbstractBandSelectorListener.java
58 58
		bs.getNumBandSelectorCombo().addActionListener(this);
59 59
	}
60 60

  
61
	/**
62
	 * @param file
63
	 * @param folder
64
	 */
61 65
	public void setDestination(String file, String folder) {
62 66
		this.file = file;
63 67
		this.folder = folder;
......
65 69

  
66 70
	/**
67 71
	 * Enables or disables the panel action
72
	 * @param enabled
68 73
	 */
69 74
	public void setEnabledPanelAction(boolean enabled) {
70 75
		this.enabled = enabled;
......
76 81
	 */
77 82
	public abstract void setNewBandsPositionInRendering();
78 83

  
84
	/**
85
	 * @return RasterDataStore
86
	 */
79 87
	public abstract RasterDataStore getResult();
80 88

  
81 89
	/**
......
83 91
	 */
84 92
	public abstract void apply();
85 93

  
94
	/**
95
	 *
96
	 */
86 97
	public abstract void addFileBand();
87 98

  
99
	/**
100
	 *
101
	 */
88 102
	public abstract void delFileBand();
89 103

  
90 104
	/**
......
244 258
	 * @param layerName
245 259
	 * @param file
246 260
	 * @param uriList
261
	 * @return String
247 262
	 * @throws IOException
248 263
	 */
249 264
	protected String saveMultiFileLayer(String layerName, String file, ArrayList<File> uriList) throws IOException {
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MainDialogActions.java
29 29
import org.gvsig.raster.multifile.io.MultiFileFormat;
30 30
import org.gvsig.raster.swing.RasterSwingLibrary;
31 31

  
32
/**
33
 * @author gvSIG team
34
 *
35
 */
32 36
public class MainDialogActions implements IProcessActions {
33 37
	private String                          file                 = null;
34 38
	private String                          folder               = null;
35 39
	private BandSelectorPanel               panel                = null;
36 40
	private AbstractViewPanel               selectedView         = null;
37
	
41

  
42
	/**
43
	 * @param panel
44
	 * @param file
45
	 * @param folder
46
	 */
38 47
	public MainDialogActions(BandSelectorPanel panel, String file, String folder) {
39 48
		this.file = file;
40 49
		this.folder = folder;
41 50
		this.panel = panel;
42 51
	}
43
	
52

  
53
	/**
54
	 *
55
	 */
44 56
	public void buildOneLayer() {
45 57
		RasterDataStore mainRasterStore = panel.getResult();
46 58
		saveMetadata();
47
		
59

  
48 60
		DataProcess clippingProcess = null;
49 61
		try {
50 62
			clippingProcess = RasterBaseAlgorithmLibrary.getManager().createRasterTask("ClippingProcess");
......
58 70
		clippingProcess.addParam("resolution", new int[]{(int) mainRasterStore.getWidth(),
59 71
					 										 (int) mainRasterStore.getHeight()});
60 72
		clippingProcess.addParam("suffix", ".tif");
61
		
73

  
62 74
		clippingProcess.addParam("filename", folder + File.separator + file);
63 75
		clippingProcess.addParam("layer", mainRasterStore);
64 76
		int[] drawableBands = new int[mainRasterStore.getBandCount()];
......
76 88
		clippingProcess.addParam("driverparams", params);*/
77 89
		clippingProcess.start();
78 90
	}
79
	
91

  
92
	/**
93
	 *
94
	 */
80 95
	public void loadLayer() {
81 96
		RasterDataStore mainRasterStore = panel.getResult();
82 97
		if(mainRasterStore == null) {
83 98
			return;
84 99
		}
85
		
100

  
86 101
		saveMff(mainRasterStore);
87 102
		saveMetadata();
88 103
		try {
......
91 106
			RasterSwingLibrary.messageBoxError(Messages.getText("error_loading_layer"), panel, e);
92 107
		}
93 108
	}
94
	
109

  
95 110
	private void saveMff(RasterDataStore mainRasterStore) {
96 111
		MultiFileDataParameters params = (MultiFileDataParameters)mainRasterStore.getParameters();
97 112
		ArrayList<File> uriList = new ArrayList<File>();
......
105 120
			RasterSwingLibrary.messageBoxError(Messages.getText("error_salvando_mff"), panel, e);
106 121
		}
107 122
	}
108
	
123

  
109 124
	private void saveMetadata() {
110 125
		RasterDataStore mainRasterStore = panel.getResult();
111 126
		int rBand = panel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND);
......
142 157
			RasterSwingLibrary.messageBoxError(Messages.getText("table_not_initialize"), panel, exc);
143 158
		}
144 159
	}
145
	
160

  
146 161
	private void loadLayerInView(RasterDataStore mainRasterStore) throws LoadLayerException {
147 162
		MapContextManager mcm = MapContextLocator.getMapContextManager();
148 163
		FLyrRaster lyr = (FLyrRaster) mcm.createLayer(file, mainRasterStore);
......
153 168
		getView().getMapControl().getMapContext().invalidate();
154 169
		getView().getMapControl().getMapContext().endAtomicEvent();
155 170
	}
156
	
171

  
157 172
	private AbstractViewPanel getView() {
158 173
		if(selectedView == null) {
159 174
			IWindow[] wList = PluginServices.getMDIManager().getAllWindows();
......
164 179
		}
165 180
		return selectedView;
166 181
	}
167
	
182

  
168 183
	private boolean isCorrectAssignedBand(int r, int g, int b, int a) {
169 184
		// Si es gris es correcta la asignacion
170 185
		if ((r == g) && (r == b) && (r >= 0)) {
......
187 202

  
188 203
	public void interrupted() {
189 204
		// TODO Auto-generated method stub
190
		
205

  
191 206
	}
192 207

  
193 208
	public void end(Object param) {
194
		
209

  
195 210
	}
196 211

  
197 212
	public void updateProgress(int current, int total) {
198 213
		// TODO Auto-generated method stub
199
		
214

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

  
......
49 49
	private MainWindow                      layerNamewindow      = null;
50 50
	private MainWindow                      bandSelectorwindow   = null;
51 51
	private MainDialogActions               actions              = null;
52
	
52

  
53 53
	public void initialize() {
54 54
		ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
55 55

  
56 56
		ExtensionPoint point = extensionPoints.get("AplicationPreferences");
57 57
		point = extensionPoints.get("RasterSEPropertiesDialog");
58 58
		point.append("Bandas", "", BandSelectorPanel.class);
59
		
59

  
60 60
		point = extensionPoints.add("GenericToolBarMenu");
61 61
		point.append("Multifile", "", MultiFileCreatorTocMenuEntry.getSingleton());
62 62
		MultiFileCreatorTocMenuEntry.setExtension(this);
63
		
63

  
64 64
		if (!Messages.hasLocales()) {
65 65
			Messages.addLocale(Locale.getDefault());
66 66
		}
......
68 68
		Messages.addResourceFamily("org.gvsig.raster.multifile.app.i18n.text",
69 69
				MultifileClientExtension.class.getClassLoader(),
70 70
				MultifileClientExtension.class.getClass().getName());
71
		
71

  
72 72
		initilizeIcons();
73 73
	}
74 74

  
75 75
	public void execute(String actionCommand) {
76 76
		if (actionCommand.compareTo("MultifileCreator") == 0) {
77
			layerNamewindow = new MainWindow((JComponent)getNewLayerPanel(), 
77
			layerNamewindow = new MainWindow((JComponent)getNewLayerPanel(),
78 78
					Messages.getText("select_output_file"), 300, 150, this);
79 79
			PluginServices.getMDIManager().addCentredWindow(layerNamewindow);
80 80
    	}
81 81
	}
82
	
82

  
83 83
	private void initilizeIcons() {
84 84
		IconThemeHelper.registerIcon(null, "multifile-icon", this);
85 85
    }
......
92 92
		return true;
93 93
	}
94 94

  
95
	/**
96
	 * @return CreateNewLayerPanel
97
	 */
95 98
	public CreateNewLayerPanel getNewLayerPanel() {
96 99
		if(newLayerPanel == null) {
97 100
			newLayerPanel = RasterSwingLocator.getSwingManager().createNewLayerPanel();
......
110 113
			bandSelectorwindow = new MainWindow(panel, Messages.getText("add_files"), 500, 400, this, true);
111 114
			PluginServices.getMDIManager().addCentredWindow(bandSelectorwindow);
112 115
		}
113
		
116

  
114 117
		//Button of load layer in the main dialog
115 118
		if(e.getSource() == bandSelectorwindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR1)) {
116 119
			actions.loadLayer();
117 120
		}
118
		
121

  
119 122
		//Button of create one file with al files
120 123
		if(e.getSource() == bandSelectorwindow.getButtonsPanel().getButton(IButtonsPanel.BUTTON_USR2)) {
121 124
			actions.buildOneLayer();
122 125
		}
123
		
126

  
124 127
	}
125 128
}
org.gvsig.raster.multifile/trunk/org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/MultiFileCreatorTocMenuEntry.java
10 10
import org.gvsig.i18n.Messages;
11 11
import org.gvsig.raster.mainplugin.toolbar.IGenericToolBarMenuItem;
12 12

  
13
/**
14
 * @author gvSIG team
15
 *
16
 */
13 17
public class MultiFileCreatorTocMenuEntry extends AbstractTocContextMenuAction implements IGenericToolBarMenuItem {
14 18
	static private MultiFileCreatorTocMenuEntry     singleton  = null;
15 19
	private static Extension                     extension  = null;
16
	
17
	
20

  
21

  
22
	/**
23
	 * @param ext
24
	 */
18 25
	public static void setExtension(Extension ext) {
19 26
		extension = ext;
20 27
	}
21 28

  
22 29
	private MultiFileCreatorTocMenuEntry() {}
23 30

  
31
	/**
32
	 * @return MultiFileCreatorTocMenuEntry
33
	 */
24 34
	static public MultiFileCreatorTocMenuEntry getSingleton() {
25 35
		if (singleton == null)
26 36
			singleton = new MultiFileCreatorTocMenuEntry();
27 37
		return singleton;
28 38
	}
29
	
39

  
30 40
	public String getGroup() {
31 41
		return "Dataset";
32 42
	}
......
54 64
	public void execute(ITocItem item, FLayer[] selectedItems) {
55 65
		extension.execute("MultifileCreator");
56 66
	}
57
	
67

  
58 68
	public Icon getIcon() {
59 69
		return IconThemeHelper.getImageIcon("multifile-icon");
60 70
	}
61
	
71

  
62 72
}

Also available in: Unified diff