Revision 44531

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/featureform/swing/impl/DefaultJFeaturesForm.java
27 27
import java.awt.event.ActionEvent;
28 28
import java.awt.event.ComponentAdapter;
29 29
import java.awt.event.ComponentEvent;
30
import java.net.URL;
30 31
import java.util.ArrayList;
31 32
import java.util.Collection;
32 33
import java.util.List;
......
110 111

  
111 112
    private final String STARTEDITING_ACTION = "startEditing";
112 113
    private final String FINISHEDITING_ACTION = "finishEditing";
114
    private final String REFRESHFORM_ACTION = "refreshForm";
113 115

  
114 116

  
115 117
    public class DefaultFeaturesFormContext implements FeaturesFormContext {
......
222 224
        });
223 225
    }
224 226

  
227
public static void selfRegister() {
228
        String[][] iconNames = new String[][]{
229
            new String[]{"dalswing", "form-refresh-data"}
230
        };
231
        IconTheme theme = ToolsSwingLocator.getIconThemeManager().getCurrent();
232
        for (String[] icon : iconNames) {
233
            URL url = DefaultJFeaturesForm.class.getResource(icon[1] + ".png");
234
            theme.registerDefault("DALSwing", icon[0], icon[1], null, url);
235
        }
236
        
237
    }
225 238
    @Override
226 239
    public void setPreferredSize(Dimension dimension) {
227 240
//        panel.setPreferredSize(dimension);
......
319 332

  
320 333
            this.formset.addAction(new StartEditingAction());
321 334
            this.formset.addAction(new FinishEditingAction());
335
            this.formset.addAction(new RefreshAction());
322 336
            
323 337
            FormActionContext actionContext = new FormActionContext();
324 338
            Collection<DALActionFactory> factories = DALSwingLocator.getSwingManager().getStoreActions();
......
366 380
            return null;
367 381
        }
368 382
    }
383
    
384
    private class RefreshAction extends AbstractAction {
369 385

  
386
        @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
387
        public RefreshAction() {
388
            I18nManager i18nManager = ToolsLocator.getI18nManager();
389
            IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getDefault();
390

  
391
            this.putValue(NAME, null);
392
            this.putValue(SHORT_DESCRIPTION, i18nManager.getTranslation("_Refresh"));
393
            this.putValue(SMALL_ICON, iconTheme.get("form-refresh-data"));
394
            this.putValue(ACTION_COMMAND_KEY, REFRESHFORM_ACTION);
395
            this.setEnabled(!formset.isInNewState());
396
        }
397

  
398
        @Override
399
        public void actionPerformed(ActionEvent ae) {
400
            try {
401
                I18nManager i18n = ToolsLocator.getI18nManager();
402
                formset.message(i18n.getTranslation("_Form_refreshed"));
403
                updateForm();
404
            } catch (Exception ex) {
405
                LOGGER.warn("Can't refresh form", ex);
406
            }
407
        }
408
    }
409

  
410
       
370 411
    private class FinishEditingAction extends AbstractAction implements Observer {
371 412

  
372 413
        @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
......
411 452
            }
412 453
            updateButtonEnabledStatus();
413 454
        }
414

  
455
    
415 456
        @Override
416 457
        public void update(Observable observable, Object notification) {
417 458
            if( store == null || formset==null ) {
......
550 591
                feature = ((EditableFeature) feature).getNotEditableCopy();
551 592
            }
552 593
            features.delete(feature);
594
            
553 595
            this.formset.message(i18n.getTranslation("_Record_removed"));
596
            
597
            this.formset.setValues(features.asListOfDynObjects());
598
            if (features.getTotalSize()-1<index) {
599
                index = index-1;
600
            }
601
            this.formset.setCurrentIndex(index);
554 602

  
555 603
        } catch (Exception ex) {
556 604
            theFormSet.message(i18n.getTranslation("error_removing_data_will_not_remove"));
......
591 639
            formset.setActionEnabled(ACTION_CANCEL_NEW,false);
592 640
            formset.setActionEnabled(ACTION_SAVE,false);
593 641
            formset.setActionEnabled(ACTION_SEARCH,false);
642
            formset.setActionEnabled(REFRESHFORM_ACTION, true);
594 643
            return;
595 644
        }
596 645
        if( store.isEditing() ) {
......
605 654
                formset.setActionEnabled(ACTION_NEW,false);
606 655
                formset.setActionEnabled(ACTION_CANCEL_NEW,true);
607 656
                formset.setActionEnabled(ACTION_SAVE,true);
657
                formset.setActionEnabled(REFRESHFORM_ACTION, false);
608 658
                
609 659
            } else if( this.features!=null && this.features.isEmpty() ) {
610 660
                formset.setActionEnabled(ACTION_DELETE, false);
......
612 662
                formset.setActionEnabled(ACTION_NEW,true);
613 663
                formset.setActionEnabled(ACTION_CANCEL_NEW,true);
614 664
                formset.setActionEnabled(ACTION_SAVE,false);
665
                formset.setActionEnabled(REFRESHFORM_ACTION, true);
615 666

  
616 667
            } else if( formset.getForm().isModified() ) {
617 668
                formset.setActionEnabled(ACTION_DELETE, true);
......
619 670
                formset.setActionEnabled(ACTION_NEW,true);
620 671
                formset.setActionEnabled(ACTION_CANCEL_NEW,false);
621 672
                formset.setActionEnabled(ACTION_SAVE,true);
673
                formset.setActionEnabled(REFRESHFORM_ACTION, true);
622 674

  
623 675
            } else {
624 676
                formset.setActionEnabled(ACTION_DELETE, true);
......
626 678
                formset.setActionEnabled(ACTION_NEW,true);
627 679
                formset.setActionEnabled(ACTION_CANCEL_NEW,false);
628 680
                formset.setActionEnabled(ACTION_SAVE,true); //false);
681
                formset.setActionEnabled(REFRESHFORM_ACTION, true);
629 682
            }
630 683

  
631 684
            return;
......
640 693
        formset.setActionEnabled(ACTION_CANCEL_NEW,false);
641 694
        formset.setActionEnabled(ACTION_SAVE,false);
642 695
        formset.setActionEnabled(ACTION_SEARCH,true);
696
        formset.setActionEnabled(REFRESHFORM_ACTION,true);
643 697
    }
644 698
        
645 699
    @Override
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/DefaultDALSwingLibrary.java
22 22
 */
23 23
package org.gvsig.fmap.dal.swing.impl;
24 24

  
25
import org.gvsig.featureform.swing.impl.DefaultJFeaturesForm;
25 26
import org.gvsig.featureform.swing.impl.dynformfield.ImageByteArray.JDynFormFieldImageByteArrayFactory;
26 27
import org.gvsig.featureform.swing.impl.dynformfield.ImageFile.JDynFormFieldImageFileFactory;
27
import org.gvsig.featureform.swing.impl.dynformfield.ImageURL.JDynFormFieldImageURL;
28 28
import org.gvsig.featureform.swing.impl.dynformfield.ImageURL.JDynFormFieldImageURLFactory;
29 29
import org.gvsig.featureform.swing.impl.dynformfield.features.JDynFormFieldRelatedFeaturesFactory;
30 30
import org.gvsig.featureform.swing.impl.dynformfield.linkedentity.JDynFormFieldFeatureLinkFactory;
......
85 85
            JDynFormFieldRelatedFeaturesFactory.selfRegister();
86 86
            
87 87
            DefaultSearchPanel.selfRegister();
88
            DefaultJFeaturesForm.selfRegister();
88 89

  
89 90
            DynObjectManager dynObjectmanager = ToolsLocator.getDynObjectManager();
90 91
            dynObjectmanager.registerDynMethod(new CreateComboModelFromTable("DAL.createComboModelFromTable", "XXXXXXXXXXXXXXXXXXXX."));
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/dalactions/ViewZoomAction.java
73 73
    @Override
74 74
    public void actionPerformed(ActionEvent ae) {
75 75
        ApplicationManager application = ApplicationLocator.getManager();
76
        ViewDocument view = (ViewDocument) application.getActiveDocument(ViewManager.TYPENAME);
76
        ViewDocument view = (ViewDocument) application.getActiveDocument(ViewDocument.class);
77 77
        if( view == null ) {
78 78
            return;
79 79
        }
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ShowLayerAsForm.java
52 52
    @Override
53 53
    public void initialize() {
54 54
        IconThemeHelper.registerIcon("action", "layer-show-form", this);
55
        IconThemeHelper.registerIcon("action", "layer-selectforediting", this);
55 56
    }
56 57

  
57 58
    @Override
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1385 1385
_Documents=Documentos
1386 1386
_Search_by_attributes=Busqueda por atributos
1387 1387
_Already_existed_a_field_named_XfieldnameX_but_with_different_data_type=Ya existe un campo llamado "{0}" pero con otro tipo de dato
1388
_Values_of_data_will_try_to_coerce_to_this_type=Los valores intentar\u00e1n transformarse a este nuevo tipo de dato.
1388
_Values_of_data_will_try_to_coerce_to_this_type=Los valores intentar\u00e1n transformarse a este nuevo tipo de dato.
1389
_Select_feature_in_the_View=Seleccionar entidad en la Vista
1390
_Form_refreshed=Formulario actualizado
1391
_Export=Exportar
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1306 1306
_Search_by_attributes=Search by attributes
1307 1307
_Already_existed_a_field_named_XfieldnameX_but_with_different_data_type=Already existed a field named "{0}" but with different data type
1308 1308
_Values_of_data_will_try_to_coerce_to_this_type=Values of data will try to coerce to this type
1309
_Select_feature_in_the_View=Select feature in the View
1310
_Form_refreshed=Form refreshed
1311
_Export=Export

Also available in: Unified diff