Revision 43534

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1284 1284
_move_up_the_selected_item_in_the_list=Mover hacia arriba en la lista el elemento seleccionado
1285 1285
_move_down_the_selected_item_in_the_list=Mover hacia abajo en la lista el elemento seleccionado
1286 1286
_Data_access_services=Servicios de acceso a datos
1287
_Change_view_projection=Cambiar proyecci\u00f3n de la vista
1288
_Change_view_projection_to_projection_of_the_selected_item_in_the_list=Cambia la proyecci\u00f3n de la vista a la proyecci\u00f3n del item seleccionado en la lista.
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1202 1202
_remove_the_selected_item_from_the_list=Remove the selected item from the list
1203 1203
_move_up_the_selected_item_in_the_list=Move up the selected item in the list
1204 1204
_move_down_the_selected_item_in_the_list=Move down the selected item in the list
1205
_Data_access_services=Data access services
1205
_Data_access_services=Data access services
1206
_Change_view_projection=Change view projection
1207
_Change_view_projection_to_projection_of_the_selected_item_in_the_list=Change view projection to the projection of the selected item in the list
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/filesystem/swing/FilesystemExplorerWizardPanelView.xml
74 74
             </object>
75 75
            </at>
76 76
            <at name="name">tableFiles</at>
77
            <at name="width">418</at>
77
            <at name="width">739</at>
78 78
            <at name="scollBars">
79 79
             <object classname="com.jeta.forms.store.properties.ScrollBarsProperty">
80 80
              <at name="name">scollBars</at>
......
127 127
         </at>
128 128
         <at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
129 129
        </super>
130
        <at name="id">embedded.707738535</at>
131
        <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0)</at>
130
        <at name="id">embedded.279458962</at>
131
        <at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0)</at>
132 132
        <at name="colspecs">FILL:DEFAULT:NONE</at>
133 133
        <at name="components">
134 134
         <object classname="java.util.LinkedList">
......
178 178
                 </at>
179 179
                 <at name="actionCommand">JButton</at>
180 180
                 <at name="name">btnAdd</at>
181
                 <at name="width">97</at>
181
                 <at name="width">174</at>
182 182
                 <at name="text">_add</at>
183 183
                 <at name="toolTipText">_select_a_file_to_add_to_the_list</at>
184 184
                 <at name="height">22</at>
......
235 235
                 </at>
236 236
                 <at name="actionCommand">JButton</at>
237 237
                 <at name="name">btnProperties</at>
238
                 <at name="width">97</at>
238
                 <at name="width">174</at>
239 239
                 <at name="text">_properties</at>
240 240
                 <at name="toolTipText">_change_default_properties_to_load_the_selected_item</at>
241 241
                 <at name="height">22</at>
......
292 292
                 </at>
293 293
                 <at name="actionCommand">JButton</at>
294 294
                 <at name="name">btnRemove</at>
295
                 <at name="width">97</at>
295
                 <at name="width">174</at>
296 296
                 <at name="text">_remove</at>
297 297
                 <at name="toolTipText">_remove_the_selected_item_from_the_list</at>
298 298
                 <at name="height">22</at>
......
349 349
                 </at>
350 350
                 <at name="actionCommand">JButton</at>
351 351
                 <at name="name">btnUp</at>
352
                 <at name="width">97</at>
352
                 <at name="width">174</at>
353 353
                 <at name="text">_up</at>
354 354
                 <at name="toolTipText">_move_up_the_selected_item_in_the_list</at>
355 355
                 <at name="height">22</at>
......
406 406
                 </at>
407 407
                 <at name="actionCommand">JButton</at>
408 408
                 <at name="name">btnDown</at>
409
                 <at name="width">97</at>
409
                 <at name="width">174</at>
410 410
                 <at name="text">_down</at>
411 411
                 <at name="toolTipText">_move_down_the_selected_item_in_the_list</at>
412 412
                 <at name="height">22</at>
......
417 417
            </object>
418 418
           </at>
419 419
          </item>
420
          <item >
421
           <at name="value">
422
            <object classname="com.jeta.forms.store.memento.BeanMemento">
423
             <super classname="com.jeta.forms.store.memento.ComponentMemento">
424
              <at name="cellconstraints">
425
               <object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
426
                <at name="column">1</at>
427
                <at name="row">11</at>
428
                <at name="colspan">1</at>
429
                <at name="rowspan">1</at>
430
                <at name="halign">default</at>
431
                <at name="valign">default</at>
432
                <at name="insets" object="insets">0,0,0,0</at>
433
               </object>
434
              </at>
435
              <at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
436
             </super>
437
             <at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
438
             <at name="beanclass">javax.swing.JButton</at>
439
             <at name="beanproperties">
440
              <object classname="com.jeta.forms.store.memento.PropertiesMemento">
441
               <at name="classname">javax.swing.JButton</at>
442
               <at name="properties">
443
                <object classname="com.jeta.forms.store.support.PropertyMap">
444
                 <at name="border">
445
                  <object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
446
                   <super classname="com.jeta.forms.store.properties.BorderProperty">
447
                    <at name="name">border</at>
448
                   </super>
449
                   <at name="borders">
450
                    <object classname="java.util.LinkedList">
451
                     <item >
452
                      <at name="value">
453
                       <object classname="com.jeta.forms.store.properties.DefaultBorderProperty">
454
                        <super classname="com.jeta.forms.store.properties.BorderProperty">
455
                         <at name="name">border</at>
456
                        </super>
457
                       </object>
458
                      </at>
459
                     </item>
460
                    </object>
461
                   </at>
462
                  </object>
463
                 </at>
464
                 <at name="actionCommand">_Change_view_projection</at>
465
                 <at name="name">btnChangeViewProjection</at>
466
                 <at name="width">174</at>
467
                 <at name="text">_Change_view_projection</at>
468
                 <at name="toolTipText">_Change_view_projection_to_projection_of_the_selected_item_in_the_list
469
</at>
470
                 <at name="height">22</at>
471
                </object>
472
               </at>
473
              </object>
474
             </at>
475
            </object>
476
           </at>
477
          </item>
420 478
         </object>
421 479
        </at>
422 480
        <at name="properties">
......
474 532
        <at name="cellpainters">
475 533
         <object classname="com.jeta.forms.store.support.Matrix">
476 534
          <at name="rows">
477
           <object classname="[Ljava.lang.Object;" size="10">
535
           <object classname="[Ljava.lang.Object;" size="12">
478 536
            <at name="item" index="0">
479 537
             <object classname="[Ljava.lang.Object;" size="1"/>
480 538
            </at>
......
505 563
            <at name="item" index="9">
506 564
             <object classname="[Ljava.lang.Object;" size="1"/>
507 565
            </at>
566
            <at name="item" index="10">
567
             <object classname="[Ljava.lang.Object;" size="1"/>
568
            </at>
569
            <at name="item" index="11">
570
             <object classname="[Ljava.lang.Object;" size="1"/>
571
            </at>
508 572
           </object>
509 573
          </at>
510 574
         </object>
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/filesystem/swing/FilesystemExplorerWizardPanelView.java
24 24
   JButton btnRemove = new JButton();
25 25
   JButton btnUp = new JButton();
26 26
   JButton btnDown = new JButton();
27
   JButton btnChangeViewProjection = new JButton();
27 28

  
28 29
   /**
29 30
    * Default constructor
......
134 135
   public JPanel createPanel1()
135 136
   {
136 137
      JPanel jpanel1 = new JPanel();
137
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0)");
138
      FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0)");
138 139
      CellConstraints cc = new CellConstraints();
139 140
      jpanel1.setLayout(formlayout1);
140 141

  
......
168 169
      btnDown.setToolTipText("_move_down_the_selected_item_in_the_list");
169 170
      jpanel1.add(btnDown,cc.xy(1,9));
170 171

  
171
      addFillComponents(jpanel1,new int[0],new int[]{ 2,4,6,8,10 });
172
      btnChangeViewProjection.setActionCommand("_Change_view_projection");
173
      btnChangeViewProjection.setName("btnChangeViewProjection");
174
      btnChangeViewProjection.setText("_Change_view_projection");
175
      btnChangeViewProjection.setToolTipText("_Change_view_projection_to_projection_of_the_selected_item_in_the_list\n");
176
      jpanel1.add(btnChangeViewProjection,cc.xy(1,11));
177

  
178
      addFillComponents(jpanel1,new int[0],new int[]{ 2,4,6,8,10,12 });
172 179
      return jpanel1;
173 180
   }
174 181

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/filesystem/swing/FilesystemExplorerWizardPanel.java
74 74

  
75 75
    private static String lastPath = null;
76 76
    private FilesystemExplorerWizardPanelController panel = null;
77

  
77
    private boolean tabularOnly;
78 78
    /**
79 79
     *
80 80
     */
81 81
    public FilesystemExplorerWizardPanel() {
82
        this(false);
83
    }
84
    
85
    public FilesystemExplorerWizardPanel(boolean tabularOnly) {
82 86
        super();
87
        this.tabularOnly = tabularOnly;
83 88
        this.addAncestorListener(new AncestorListener() {
84 89
            public void ancestorAdded(AncestorEvent ae) {
85 90
                initExplorer();
......
121 126
        gridBagConstraints.weighty = 1.0;
122 127

  
123 128
        panel = new FilesystemExplorerWizardPanelController(getMapContext(),explorer, filters);
129
        panel.setTabularOnly(this.tabularOnly);
124 130
        this.add(panel, gridBagConstraints);
125 131

  
126 132
    }
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/filesystem/swing/FilesystemExplorerWizardPanelController.java
29 29
import org.gvsig.app.ApplicationManager;
30 30
import org.gvsig.app.prepareAction.PrepareContext;
31 31
import org.gvsig.filedialogchooser.FileDialogChooser;
32
import org.gvsig.fmap.dal.DataStore;
32 33
import org.gvsig.fmap.dal.DataStoreParameters;
33 34
import org.gvsig.fmap.dal.exception.DataException;
34 35
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
......
70 71
    protected MapContext mapContext;
71 72
    protected int selectedIndex;
72 73
    private static MyFileFilter lastFilter = null;
74
    private boolean tabularOnly;
73 75

  
74 76
    /**
75 77
     * @param mapContext
......
100 102
        btnUp.setToolTipText(i18nManager.getTranslation(btnUp.getToolTipText()));
101 103
        btnDown.setToolTipText(i18nManager.getTranslation(btnDown.getToolTipText()));
102 104
        
105
        btnChangeViewProjection.setText(i18nManager.getTranslation(btnChangeViewProjection.getText()));
106
        btnChangeViewProjection.setToolTipText(i18nManager.getTranslation(btnChangeViewProjection.getToolTipText()));
103 107
    }
104 108

  
105 109
    /**
......
117 121
    private void initComponents() {
118 122

  
119 123
        this.btnAdd.addActionListener(new ActionListener() {
124
            @Override
120 125
            public void actionPerformed(ActionEvent e) {
121 126
                doAdd();
122 127
            }
123 128
        });
124 129

  
125 130
        this.btnProperties.addActionListener(new ActionListener() {
131
            @Override
126 132
            public void actionPerformed(ActionEvent e) {
127 133
                doOpenProperties();
128 134
            }
129 135
        });
130 136

  
131 137
        this.btnRemove.addActionListener(new ActionListener() {
138
            @Override
132 139
            public void actionPerformed(ActionEvent e) {
133 140
                doRemove();
134 141
            }
135 142
        });
136 143

  
137 144
        this.btnUp.addActionListener(new ActionListener() {
145
            @Override
138 146
            public void actionPerformed(ActionEvent e) {
139 147
                doUp();
140 148
            }
141 149
        });
142 150

  
143 151
        this.btnDown.addActionListener(new ActionListener() {
152
            @Override
144 153
            public void actionPerformed(ActionEvent e) {
145 154
                doDown();
146 155
            }
147 156
        });
148 157

  
158
        this.btnChangeViewProjection.addActionListener(new ActionListener() {
159
            @Override
160
            public void actionPerformed(ActionEvent e) {
161
                doChangeViewProjection();
162
            }
163
        });
164
        
149 165
        I18nManager i18nManager = ToolsLocator.getI18nManager();
150 166

  
151 167
        this.tableFiles.setModel(new FilesystemExplorerWizardTableModel());
......
159 175
        this.tableFiles.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
160 176
        this.tableFiles.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
161 177

  
178
            @Override
162 179
            public void valueChanged(ListSelectionEvent e) {
163 180
                handleSelectionEvent(e);
164 181
            }
165 182
        });
183
        this.btnChangeViewProjection.setEnabled(false);
166 184
    }
167 185

  
168 186

  
......
174 192
    }
175 193

  
176 194
    protected void handleSelectionEvent(ListSelectionEvent e){
177
        if (e.getValueIsAdjusting())
195
        if (e.getValueIsAdjusting()) {
178 196
            return;
179

  
197
        }
180 198
        final DefaultListSelectionModel target = (DefaultListSelectionModel)e.getSource();
181 199
        selectedIndex = target.getAnchorSelectionIndex();
182 200

  
......
194 212
            int index = model.getRowCount()-1;
195 213
            this.tableFiles.getSelectionModel().setSelectionInterval(index, index);
196 214
        }
215
        updateChangeViewProjection();
197 216
    }
198 217

  
199 218
    protected void doRemove() {
......
206 225
                index = model.getRowCount()-1;
207 226
            };
208 227
            this.tableFiles.getSelectionModel().setSelectionInterval(index, index);
228
            updateChangeViewProjection();
209 229
        }
210 230
    }
211 231

  
......
217 237
            showPropertiesDialog((DynObject) parameters);
218 238
            updateTable();
219 239
            this.tableFiles.getSelectionModel().setSelectionInterval(index, index);
240
            updateChangeViewProjection();
220 241
        }
221 242
    }
222 243

  
......
226 247
            int index = selectedIndex;
227 248
            model.up(index);
228 249
            updateTable();
229

  
230 250
            this.tableFiles.getSelectionModel().setSelectionInterval(index-1, index-1);
251
            updateChangeViewProjection();
231 252
        }
232 253
    }
233 254

  
......
238 259
            model.down(index);
239 260
            updateTable();
240 261
            this.tableFiles.getSelectionModel().setSelectionInterval(index+1, index+1);
262
            updateChangeViewProjection();
241 263
        }
242 264
    }
243 265

  
......
251 273
    private void updateTable(){
252 274
        ((FilesystemExplorerWizardTableModel)this.tableFiles.getModel()).fireTableDataChanged();
253 275
        updateRowHeights();
276
        this.tableFiles.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex);
254 277
    }
255 278

  
256 279
    private void updateRowHeights() {
......
299 322

  
300 323
        int result = fileChooser.showOpenDialog(this);
301 324

  
302
        List<FilesystemStoreParameters> toAdd =
303
            new ArrayList<FilesystemStoreParameters>();
325
        List<FilesystemStoreParameters> toAdd = new ArrayList<>();
304 326

  
305 327
        if (result == JFileChooser.APPROVE_OPTION) {
306 328
            lastFilter = (MyFileFilter) fileChooser.getFileFilter();
......
325 347

  
326 348
        PrepareContext context = this.getPrepareDataStoreContext();
327 349

  
328
        List<DataStoreParameters> params = new ArrayList<DataStoreParameters>();
350
        List<DataStoreParameters> params = new ArrayList<>();
329 351
        List<DataStoreParameters> preparedParams = null;
330
        List<FilesystemStoreParameters> returnParams = new ArrayList<FilesystemStoreParameters>();
352
        List<FilesystemStoreParameters> returnParams = new ArrayList<>();
331 353

  
332 354
        for ( File aFile : files ) {
333 355
            String currentProvider = providerName;
......
418 440
        }
419 441
        FilesystemExplorerWizardTableModel model = (FilesystemExplorerWizardTableModel)this.tableFiles.getModel();
420 442
        model.add(filesParams);
443
        updateChangeViewProjection();
421 444
    }
422 445

  
423 446
    /**
......
457 480
        }
458 481
    }
459 482

  
483
    private void updateChangeViewProjection() {
484
        FilesystemExplorerWizardTableModel model = (FilesystemExplorerWizardTableModel) this.tableFiles.getModel();
485
        if (selectedIndex < 0 && selectedIndex >= model.getRowCount()) {
486
            this.btnChangeViewProjection.setEnabled(false);
487
        }
488
        IProjection projection;
489
        DynObject parameters = (DynObject) model.getParams(0);
490
        if( parameters.getDynClass().getDynField(DataStore.METADATA_CRS) != null ) {
491
            projection = (IProjection) parameters.getDynValue(DataStore.METADATA_CRS);
492
            if( mapContext == null || mapContext.getLayers().isEmpty() ) {
493
                if( projection == null ) {
494
                    this.btnChangeViewProjection.setEnabled(false);
495
                } else if( projection.equals(mapContext.getProjection()) ) {
496
                    this.btnChangeViewProjection.setEnabled(false);
497
                } else {
498
                    for( DataStoreParameters p : model.getParameters()) {
499
                        projection = (IProjection) p.getDynValue(DataStore.METADATA_CRS);
500
                        if( projection != null ) {
501
                            String s = projection.getFullCode();
502
                            if( s.contains("@") ) {
503
                                this.btnChangeViewProjection.setEnabled(false);
504
                                return;
505
                            }
506
                        }
507
                    }
508
                    this.btnChangeViewProjection.setEnabled(true);
509
                }
510
            }
511
        }
512
    }
513
    
514
    private void doChangeViewProjection() {
515
        FilesystemExplorerWizardTableModel model = (FilesystemExplorerWizardTableModel) this.tableFiles.getModel();
516
        if( model.getRowCount() <= 0 || 
517
            (selectedIndex < 0 && selectedIndex >= model.getRowCount()) ) {
518
            this.btnChangeViewProjection.setEnabled(false);
519
            return;
520
        }
521
        IProjection projection;
522
        DynObject parameters = (DynObject) model.getParams(selectedIndex);
523
        if( parameters.getDynClass().getDynField(DataStore.METADATA_CRS) != null ) {
524
            projection = (IProjection) parameters.getDynValue(DataStore.METADATA_CRS);
525
            if( mapContext == null || mapContext.getLayers().isEmpty() ) {
526
                mapContext.setProjection(projection);
527
                updateTable();
528
            }
529
        }            
530
    }
460 531

  
532
    void setTabularOnly(boolean tabularOnly) {
533
        this.tabularOnly = tabularOnly;
534
        this.btnChangeViewProjection.setVisible(!tabularOnly);
535
    }
461 536
}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/fmap/dal/serverexplorer/filesystem/swing/FilesystemExplorerTableWizardPanel.java
67 67

  
68 68
    private PrepareContext prepareDSContext = null;
69 69

  
70
    public FilesystemExplorerTableWizardPanel() {
71
        super(true);
72
    }
73
    
70 74
    @Override
71 75
    public void execute() {
72 76
        executeWizard();

Also available in: Unified diff