Revision 3458 org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/addToWorkspace/VCSGisJAddToWorkspaceImpl.java
VCSGisJAddToWorkspaceImpl.java | ||
---|---|---|
31 | 31 |
import javax.swing.JComponent; |
32 | 32 |
import javax.swing.JLabel; |
33 | 33 |
import javax.swing.JList; |
34 |
import javax.swing.JOptionPane; |
|
34 | 35 |
import javax.swing.JTree; |
35 | 36 |
import javax.swing.ListSelectionModel; |
36 | 37 |
import javax.swing.SwingUtilities; |
... | ... | |
55 | 56 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
56 | 57 |
import org.gvsig.tools.swing.api.task.TaskStatusController; |
57 | 58 |
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
59 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
58 | 60 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
59 | 61 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
60 | 62 |
import org.gvsig.tools.util.LabeledValue; |
61 | 63 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
64 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_AUTHENTICATION_EXPIRED; |
|
65 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_AUTHENTICATE_USER; |
|
66 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_INVALID_AUTHENTICATION_TOKEN; |
|
67 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_INVALID_USERCODE; |
|
62 | 68 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_OK; |
69 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_USER_NOT_AUTHORIZED; |
|
70 |
import org.gvsig.vcsgis.lib.VCSGisRuntimeException; |
|
63 | 71 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
64 | 72 |
import org.gvsig.vcsgis.swing.VCSGisJAddToWorkspace; |
65 | 73 |
import org.gvsig.vcsgis.swing.VCSGisSwingLocator; |
66 | 74 |
import org.gvsig.vcsgis.swing.VCSGisSwingManager; |
67 | 75 |
import org.gvsig.vcsgis.swing.VCSGisSwingServices; |
68 | 76 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.notInSwingThreadInvokeLater; |
77 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationsErrors; |
|
69 | 78 |
import org.slf4j.LoggerFactory; |
70 | 79 |
|
71 | 80 |
/** |
... | ... | |
250 | 259 |
} |
251 | 260 |
|
252 | 261 |
private void doUpdateComponents() { |
262 |
try { |
|
263 |
VCSGisWorkspace workspace = getWorkspace(); |
|
264 |
LabeledValue selectedView = (LabeledValue)cboView.getSelectedItem(); |
|
265 |
boolean enableComponents = !processing && workspace != null ; |
|
266 |
boolean enableInit = enableComponents && |
|
267 |
getFeatureStore() != null && |
|
268 |
StringUtils.isNotBlank(txtName.getText()) && |
|
269 |
workspace.getEntity(txtName.getText())==null ; |
|
270 |
|
|
271 |
if (tabAddToWorkspace.getSelectedIndex() == TAB_LAYERS_INDEX) { |
|
272 |
enableInit = enableInit && (!chkAddLayerToView.isSelected() |
|
273 |
|| (chkAddLayerToView.isSelected() && selectedView != null && selectedView.getValue() != null)); |
|
274 |
} |
|
253 | 275 |
|
254 |
VCSGisWorkspace workspace = getWorkspace(); |
|
255 |
LabeledValue selectedView = (LabeledValue)cboView.getSelectedItem(); |
|
256 |
boolean enableInit = !processing && workspace != null && |
|
257 |
getFeatureStore() != null && |
|
258 |
StringUtils.isNotBlank(txtName.getText()) && |
|
259 |
workspace.getEntity(txtName.getText())==null ; |
|
260 |
|
|
261 |
if (tabAddToWorkspace.getSelectedIndex() == TAB_LAYERS_INDEX) { |
|
262 |
enableInit = enableInit && (!chkAddLayerToView.isSelected() |
|
263 |
|| (chkAddLayerToView.isSelected() && selectedView != null && selectedView.getValue() != null)); |
|
276 |
this.workspacePicker.setEnabled( !processing ); |
|
277 |
this.tabAddToWorkspace.setEnabled(enableComponents); |
|
278 |
this.txtName.setEnabled(enableComponents); |
|
279 |
this.cboFieldForLabel.setEnabled(enableComponents); |
|
280 |
this.txtLabel.setEnabled(enableComponents); |
|
281 |
this.cboCategory.setEnabled(enableComponents); |
|
282 |
|
|
283 |
this.cboView.setEnabled(enableComponents); |
|
284 |
this.chkAddLayerToView.setEnabled(enableComponents); |
|
285 |
this.chkAddTableToProject.setEnabled(enableComponents); |
|
286 |
|
|
287 |
if (dialog != null) { |
|
288 |
this.dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, |
|
289 |
enableInit |
|
290 |
); |
|
291 |
} |
|
292 |
this.pbStatus.setVisible(processing); |
|
293 |
this.lblStatusTitle.setVisible(processing); |
|
294 |
} catch(VCSGisRuntimeException e1) { |
|
295 |
LOGGER.warn("Can't updating components.",e1); |
|
296 |
if( showAuthenticationsErrors("_VCS_Add_to_workspace",e1) ) { |
|
297 |
this.workspacePicker.set(null); |
|
298 |
doChangeWorkspace(); |
|
299 |
} |
|
300 |
} catch(Exception e2) { |
|
301 |
LOGGER.warn("Can't updating components.",e2); |
|
264 | 302 |
} |
265 |
|
|
266 |
this.tabAddToWorkspace.setEnabled(!processing); |
|
267 |
this.workspacePicker.setEnabled(!processing); |
|
268 |
this.txtName.setEnabled(!processing); |
|
269 |
this.cboFieldForLabel.setEnabled(!processing); |
|
270 |
this.txtLabel.setEnabled(!processing); |
|
271 |
this.cboCategory.setEnabled(!processing); |
|
272 |
|
|
273 |
this.cboView.setEnabled(!processing); |
|
274 |
this.chkAddLayerToView.setEnabled(!processing); |
|
275 |
this.chkAddTableToProject.setEnabled(!processing); |
|
276 |
|
|
277 |
if (dialog != null) { |
|
278 |
this.dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, |
|
279 |
enableInit |
|
280 |
); |
|
281 |
} |
|
282 |
this.pbStatus.setVisible(processing); |
|
283 |
this.lblStatusTitle.setVisible(processing); |
|
284 |
|
|
285 | 303 |
} |
286 | 304 |
|
287 | 305 |
private void translate() { |
Also available in: Unified diff