Revision 119 org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.gui/src/main/java/es/unex/sextante/gui/settings/SextanteRSettingsPanel.java
SextanteRSettingsPanel.java | ||
---|---|---|
41 | 41 |
|
42 | 42 |
@Override |
43 | 43 |
protected void initGUI() { |
44 |
|
|
44 |
|
|
45 | 45 |
final TableLayout thisLayout = new TableLayout(new double[][] { |
46 | 46 |
{ SextanteConfigurationDialog.SPACER_SMALL, |
47 | 47 |
TableLayoutConstants.FILL, |
... | ... | |
61 | 61 |
thisLayout.setHGap(5); |
62 | 62 |
thisLayout.setVGap(5); |
63 | 63 |
this.setLayout(thisLayout); |
64 |
|
|
64 |
|
|
65 | 65 |
jActivateCheckBox = new JCheckBox(Sextante.getText("ActivateProvider") + " \"R\"" ); |
66 | 66 |
final String sActivate = SextanteGUI.getSettingParameterValue(SextanteRSettings.R_ACTIVATE); |
67 | 67 |
final boolean bActivate = Boolean.parseBoolean(sActivate); |
68 | 68 |
jActivateCheckBox.setSelected(bActivate); |
69 |
this.add(jActivateCheckBox, "1,1");
|
|
70 |
|
|
69 |
this.add(jActivateCheckBox, "1,1"); |
|
70 |
|
|
71 | 71 |
this.add(new JSeparator(SwingConstants.HORIZONTAL), "1, 2, 2, 2"); |
72 |
/* -----------------------------------------------------------*/
|
|
73 |
|
|
72 |
/* -----------------------------------------------------------*/ |
|
73 |
|
|
74 | 74 |
jPortableCheckBox = new JCheckBox(Sextante.getText("Portable")); |
75 | 75 |
final String sActivatePortable = SextanteGUI.getSettingParameterValue(SextanteRSettings.R_PORTABLE); |
76 | 76 |
final boolean bActivatePortable = Boolean.parseBoolean(sActivatePortable); |
77 | 77 |
jPortableCheckBox.setEnabled(bActivate); |
78 |
jPortableCheckBox.setSelected(bActivatePortable);
|
|
78 |
jPortableCheckBox.setSelected(bActivatePortable); |
|
79 | 79 |
this.add(jPortableCheckBox, "1,3"); |
80 |
|
|
80 |
|
|
81 | 81 |
jLabelFolder = new JLabel(); |
82 | 82 |
jLabelFolder.setEnabled(bActivate); |
83 | 83 |
if ( bActivatePortable == true ) { |
... | ... | |
90 | 90 |
jRFolder.getButton().setEnabled(bActivate); |
91 | 91 |
if ( bActivatePortable == true ) { |
92 | 92 |
jRFolder.getTextField().setEnabled(false); |
93 |
jRFolder.getButton().setEnabled(false);
|
|
93 |
jRFolder.getButton().setEnabled(false); |
|
94 | 94 |
} |
95 | 95 |
final String sFolder = SextanteGUI.getSettingParameterValue(SextanteRSettings.R_FOLDER); |
96 | 96 |
jRFolder.setFilepath(sFolder); |
97 | 97 |
this.add(jRFolder, "2, 4"); |
98 |
|
|
98 |
|
|
99 | 99 |
jLabelScriptsFolder = new JLabel(); |
100 | 100 |
jLabelScriptsFolder.setEnabled(bActivate); |
101 | 101 |
if ( bActivatePortable == true ) { |
... | ... | |
113 | 113 |
final String sScriptsFolder = SextanteGUI.getSettingParameterValue(SextanteRSettings.R_SCRIPTS_FOLDER); |
114 | 114 |
jRScriptsFolder.setFilepath(sScriptsFolder); |
115 | 115 |
this.add(jRScriptsFolder, "2, 5"); |
116 |
|
|
116 |
|
|
117 | 117 |
this.add(new JSeparator(SwingConstants.HORIZONTAL), "1, 6, 2, 6"); |
118 |
/* -----------------------------------------------------------*/
|
|
119 |
|
|
118 |
/* -----------------------------------------------------------*/ |
|
119 |
|
|
120 | 120 |
jLabelLoadRScripts = new JLabel(); |
121 | 121 |
jLabelLoadRScripts.setText( Sextante.getText("update_library") ); |
122 | 122 |
jLabelLoadRScripts.setEnabled(bActivate); |
123 |
this.add(jLabelLoadRScripts, "1, 7");
|
|
123 |
this.add(jLabelLoadRScripts, "1, 7"); |
|
124 | 124 |
jButton = new JButton(Sextante.getText("load_R_scripts")); |
125 | 125 |
jButton.setEnabled(bActivate); |
126 | 126 |
this.add(jButton, "2, 7"); |
... | ... | |
134 | 134 |
logoLabel.setVerticalTextPosition(SwingConstants.BOTTOM); |
135 | 135 |
logoLabel.setText("<html><i><a href=http://www.r-project.org/>http://www.r-project.org/</a></i></html>"); |
136 | 136 |
this.add(logoLabel,"1, 9, 2, 9"); |
137 |
}
|
|
137 |
} |
|
138 | 138 |
|
139 |
|
|
139 |
|
|
140 | 140 |
/* Action listeners for widgets */ |
141 |
|
|
141 |
|
|
142 | 142 |
jActivateCheckBox.addActionListener(new ActionListener() { |
143 |
public void actionPerformed(final ActionEvent arg0) {
|
|
143 |
public void actionPerformed(final ActionEvent arg0) { |
|
144 | 144 |
setCursor(new Cursor(Cursor.WAIT_CURSOR)); |
145 | 145 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_ACTIVATE, |
146 |
new Boolean(jActivateCheckBox.isSelected()).toString());
|
|
147 |
SextanteGUI.updateAlgorithmProvider(RAlgorithmProvider.class);
|
|
146 |
new Boolean(jActivateCheckBox.isSelected()).toString()); |
|
147 |
SextanteGUI.updateAlgorithmProvider(RAlgorithmProvider.class); |
|
148 | 148 |
//Activate/deactivate the remaining widgets on this page |
149 | 149 |
boolean active = jActivateCheckBox.isSelected(); |
150 | 150 |
jPortableCheckBox.setEnabled(active); |
... | ... | |
165 | 165 |
jLabelScriptsFolder.setEnabled(false); |
166 | 166 |
jRScriptsFolder.getTextField().setEnabled(false); |
167 | 167 |
jRScriptsFolder.getButton().setEnabled(false); |
168 |
}
|
|
168 |
} |
|
169 | 169 |
setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); |
170 | 170 |
} |
171 | 171 |
}); |
172 |
|
|
172 |
|
|
173 | 173 |
jPortableCheckBox.addActionListener(new ActionListener() { |
174 |
public void actionPerformed(final ActionEvent arg0) {
|
|
174 |
public void actionPerformed(final ActionEvent arg0) { |
|
175 | 175 |
setCursor(new Cursor(Cursor.WAIT_CURSOR)); |
176 | 176 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_PORTABLE, |
177 |
new Boolean(jPortableCheckBox.isSelected()).toString());
|
|
177 |
new Boolean(jPortableCheckBox.isSelected()).toString()); |
|
178 | 178 |
//Set portable R bin dir |
179 | 179 |
SextanteGUI.checkDir ( Sextante.PORTABLE_R_FOLDER, true, "R" ); |
180 |
String sPath = new String (SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_R_FOLDER);
|
|
180 |
String sPath = new String (SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_R_FOLDER);
|
|
181 | 181 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_FOLDER, sPath); |
182 | 182 |
jRFolder.setFilepath(sPath); |
183 | 183 |
//Set portable scripts dir |
184 | 184 |
SextanteGUI.checkDir ( Sextante.PORTABLE_R_SCRIPTS_FOLDER, false, "R user scripts" ); |
185 |
sPath = SextanteGUI.getSextantePath() + File.separator + Sextante.PORTABLE_R_SCRIPTS_FOLDER; |
|
185 |
sPath = SextanteGUI.getSextanteInstallPath() + File.separator + Sextante.PORTABLE_R_SCRIPTS_FOLDER;
|
|
186 | 186 |
SextanteGUI.setSettingParameterValue(SextanteRSettings.R_SCRIPTS_FOLDER, sPath); |
187 | 187 |
jRScriptsFolder.setFilepath(sPath); |
188 | 188 |
//Activate/deactivate the remaining widgets on this page |
... | ... | |
200 | 200 |
jRFolder.getButton().setEnabled(true); |
201 | 201 |
jLabelScriptsFolder.setEnabled(true); |
202 | 202 |
jRScriptsFolder.getTextField().setEnabled(true); |
203 |
jRScriptsFolder.getButton().setEnabled(true);
|
|
203 |
jRScriptsFolder.getButton().setEnabled(true); |
|
204 | 204 |
} |
205 | 205 |
setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); |
206 | 206 |
} |
... | ... | |
216 | 216 |
Sextante.getText("Scripts"), JOptionPane.INFORMATION_MESSAGE); |
217 | 217 |
} |
218 | 218 |
}); |
219 |
|
|
219 |
|
|
220 | 220 |
} |
221 | 221 |
|
222 | 222 |
|
Also available in: Unified diff