Revision 659 org.gvsig.projection.jcrs/trunk/org.gvsig.projection.jcrs/org.gvsig.projection.app.jcrs/org.gvsig.projection.app.jcrs.common/src/main/java/org/gvsig/crs/preferences/JCRSPreferencesPage.java

View differences:

JCRSPreferencesPage.java
9 9
import java.io.File;
10 10
import java.util.Collection;
11 11
import java.util.Iterator;
12
import javax.swing.ComboBoxModel;
13
import javax.swing.DefaultComboBoxModel;
12 14
import javax.swing.DefaultListModel;
13 15
import javax.swing.ImageIcon;
14 16
import javax.swing.JPanel;
......
41 43
    private static final Logger logger = LoggerFactory.getLogger(JCRSPreferencesPage.class);
42 44
    private static final long serialVersionUID = -7838901334080793221L;
43 45
            
44
    private JCRSPreferencesPanel preferences;
46
    private JCRSPreferencesPageView preferences;
45 47
    private DynObject pluginProperties;
46 48
    private PluginServices plugin;
47 49

  
......
74 76
    }
75 77

  
76 78
    private void initComponents() {
77
        I18nManager i18nManager = ToolsLocator.getI18nManager();
79
        I18nManager i18n = ToolsLocator.getI18nManager();
78 80
        PluginsManager pluginManager = PluginsLocator.getManager();
79 81
        this.plugin = pluginManager.getPlugin(this);
80 82
        this.pluginProperties = this.plugin.getPluginProperties();
81 83
        
82
        this.preferences = new JCRSPreferencesPanel();
84
        this.preferences = new JCRSPreferencesPageView();
83 85
        this.preferences.lblHeader.setText( 
84
                i18nManager.getTranslation("_Select_the_EPSG_data_base_to_use")
86
                i18n.getTranslation("_Select_the_EPSG_data_base_to_use")
85 87
        );
86 88
        this.preferences.chkUseMomoryChacheForCRSs.setText(
87
       		i18nManager.getTranslation("_Use_cache_for_CRSs")
89
       		i18n.getTranslation("_Use_cache_for_CRSs")
88 90
        );        
89 91
        this.setLayout(new BorderLayout());
90 92
        this.add(this.preferences, BorderLayout.NORTH);
93
        
94
        this.preferences.lblDatabaseInitializationMode.setText( 
95
                i18n.getTranslation("_When_initializing_the_EPSG_database")
96
        );
97
        DefaultComboBoxModel modelCombo = new DefaultComboBoxModel();
98
        modelCombo.addElement(i18n.getTranslation("_On_start_in_background"));
99
        modelCombo.addElement(i18n.getTranslation("_On_start_in_foreground"));
100
        modelCombo.addElement(i18n.getTranslation("_On_first_use"));
101
        this.preferences.cboDatabaseInitializationMode.setModel(modelCombo);
102

  
91 103
        initializeValues();
92 104
    }
93 105

  
......
98 110
        }
99 111
        this.pluginProperties.setDynValue("epsgDatabase", item.getEPSGFile());
100 112
        this.pluginProperties.setDynValue("useMemoryCacheForCRSs", 
101
                new Boolean(this.preferences.chkUseMomoryChacheForCRSs.isSelected())
113
                this.preferences.chkUseMomoryChacheForCRSs.isSelected()
102 114
        );
115
        this.pluginProperties.setDynValue(
116
            "databaseInitializationMode", 
117
            this.preferences.cboDatabaseInitializationMode.getSelectedIndex()
118
        );
103 119
        this.plugin.savePluginProperties();
104 120
    }
105 121

  
......
121 137
        return this;
122 138
    }
123 139

  
140
    @Override
124 141
    public void initializeValues() {
125 142
        PackageManager pkgManager = ToolsLocator.getPackageManager();
126 143
        
......
158 175
                (Boolean) this.pluginProperties.getDynValue("useMemoryCacheForCRSs")
159 176
        );
160 177
        this.preferences.chkUseMomoryChacheForCRSs.setSelected(currentUseChacheForCRSs);
178
        
179
        this.preferences.cboDatabaseInitializationMode.setSelectedIndex( 
180
            (Integer)this.pluginProperties.getDynValue("databaseInitializationMode")
181
        );
161 182
    }
162 183
    
163 184
    private File makeRelative(File parent, File file) {
......
208 229
                changed = true;
209 230
            }
210 231
        }
232
        if( !changed ) {
233
            int n = this.preferences.cboDatabaseInitializationMode.getSelectedIndex();
234
            changed = n!=(Integer)this.pluginProperties.getDynValue("databaseInitializationMode");
235
        }
211 236
        return changed;
212 237
    }
213 238

  

Also available in: Unified diff