Revision 3519
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/java/org/gvsig/vcsgis/app/VCSGisExtension.java | ||
---|---|---|
455 | 455 |
swingManager.createLogoutPanel(), |
456 | 456 |
"_VCS_Logout", |
457 | 457 |
"_Logout_the_current_user_from_a_VCSGis_working_copy", |
458 |
"_Accept",
|
|
458 |
"_VCS_Logout",
|
|
459 | 459 |
() -> { |
460 | 460 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
461 | 461 |
VCSGisJLogout panel = (VCSGisJLogout) this.dialogsHelper.getDialog("Logout").getPanel(); |
... | ... | |
470 | 470 |
VCSGisSwingManager swingManager = VCSGisSwingLocator.getVCSGisSwingManager(); |
471 | 471 |
|
472 | 472 |
VCSGisDialogInfo dialog = this.dialogsHelper.getOrCreateDialog( |
473 |
"CheckoutDataModel",
|
|
473 |
"ConnectDataModel",
|
|
474 | 474 |
swingManager.createCheckoutDataModelPanel(), |
475 |
"_VCS_Checkout_DataModel",
|
|
476 |
"_VCS_Checkout_DataModel",
|
|
477 |
"_VCS_Checkout_DataModel",
|
|
475 |
"_VCS_Connect_to_datamodel",
|
|
476 |
"_VCS_Connect_to_datamodel",
|
|
477 |
"_VCS_Connect_to_datamodel",
|
|
478 | 478 |
() -> { |
479 | 479 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
480 | 480 |
ThreadSafeDialogsManager dialogsManager = ToolsSwingLocator.getThreadSafeDialogsManager(); |
481 |
VCSGisJCheckoutDataModel checkoutDataModelPanel = (VCSGisJCheckoutDataModel) this.dialogsHelper.getDialog("CheckoutDataModel").getPanel();
|
|
481 |
VCSGisJCheckoutDataModel checkoutDataModelPanel = (VCSGisJCheckoutDataModel) this.dialogsHelper.getDialog("ConnectDataModel").getPanel();
|
|
482 | 482 |
int r = checkoutDataModelPanel.checkout(); |
483 | 483 |
if (r != 0) { |
484 | 484 |
String dataModel = checkoutDataModelPanel.getDataModel(); |
485 | 485 |
dialogsManager.messageDialog( |
486 | 486 |
i18n.getTranslation( |
487 |
"_Failed_checkout_of_{0}",
|
|
487 |
"_Failed_connect_to_{0}",
|
|
488 | 488 |
new String[]{dataModel} |
489 | 489 |
), |
490 |
i18n.getTranslation("_CheckoutDataModel"),
|
|
490 |
i18n.getTranslation("_VCS_Connect_to_datamodel"),
|
|
491 | 491 |
JOptionPane.WARNING_MESSAGE |
492 | 492 |
); |
493 | 493 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
104 | 104 |
|
105 | 105 |
<action |
106 | 106 |
name="tools-vcsgis-checkout-datamodel" |
107 |
label="_VCS_checkout_datamodel"
|
|
108 |
tooltip="_Checkout_datamodel_from_VCS_repository"
|
|
107 |
label="_VCS_Connect_to_datamodel"
|
|
108 |
tooltip="_VCS_Connect_to_datamodel"
|
|
109 | 109 |
position="900700450" |
110 | 110 |
action-command="tools-vcsgis-checkout-datamodel" |
111 | 111 |
icon="tools-vcsgis-checkout-datamodel" |
... | ... | |
203 | 203 |
<menu text="tools/_VCSGis/_VCS_Export" name="tools-vcsgis-export" /> |
204 | 204 |
<menu text="tools/_VCSGis/_VCS_Import_history" name="tools-vcsgis-import-history" /> |
205 | 205 |
<menu text="tools/_VCSGis/_VCS_Show_revisions" name="tools-vcsgis-show-revisions" /> |
206 |
<menu text="tools/_VCSGis/_VCS_logout" name="tools-vcsgis-logout" />
|
|
206 |
<menu text="tools/_VCSGis/_VCS_Logout" name="tools-vcsgis-logout" />
|
|
207 | 207 |
<menu text="tools/_VCSGis/_VCS_Show_changes" name="tools-vcsgis-showchanges" /> |
208 |
<menu text="tools/_VCSGis/_VCS_Checkout_DataModel" name="tools-vcsgis-checkout-datamodel" />
|
|
208 |
<menu text="tools/_VCSGis/_VCS_Connect_to_datamodel" name="tools-vcsgis-checkout-datamodel" />
|
|
209 | 209 |
|
210 | 210 |
<tool-bar name="vcsgis" position="900700300"> |
211 | 211 |
<!--<action-tool name="tools-vcsgis-init-server" />--> |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
148 | 148 |
_Enter_the_identifier_and_password_of_a_user_with_permissions_to_perform_the_requested_operation=Enter the identifier and password of a user with permissions to perform the requested operation |
149 | 149 |
_Authorization_required_for_this_operation=Authorization required for this operation |
150 | 150 |
_VCS_Checkout_DataModel=Checkout data model |
151 |
_Checkout_datamodel_from_VCS_repository=Checkout datamodel from VCS repository |
|
152 |
_Data_models=Data models |
|
151 |
_VCS_Connect_to_datamodel=Connect to datamodel |
|
152 |
_Data_models=Data models |
|
153 |
_Failed_connect_to_{0}=Failed connect to ''{0}'' |
|
154 |
_Overwrite_existing_tables=Overwrite existing tables |
|
155 |
_Delete_existing_tables_in_workspace_and_then_checkout_them_from_repository=Delete existing tables in workspace and then checkout them from repository |
|
156 |
_VCS_Logout=Logout |
|
157 |
_Logout_the_current_user_from_a_VCSGis_working_copy=Logout the current user from a VCSGis working copy |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
160 | 160 |
_Enter_the_identifier_and_password_of_a_user_with_permissions_to_perform_the_requested_operation=Introduzca identificador y contrase\u00f1a de un usuario con permisos para realizar la operaci\u00f3n solicitada |
161 | 161 |
_Authorization_required_for_this_operation=Autorizaci\u00f3n necesaria para esta operaci\u00f3n |
162 | 162 |
_VCS_Checkout_DataModel=Obtener copia local del modelo de datos |
163 |
_Checkout_datamodel_from_VCS_repository=Obtener las tablas de un modelo de datos desde un repositorio VCSGis |
|
164 |
_Data_models=Modelos de datos |
|
163 |
_VCS_Connect_to_datamodel=Conectar a modelo de datos |
|
164 |
_Data_models=Modelos de datos |
|
165 |
_Failed_connect_to_{0}=Ha fallado la conexi\u00f3n con ''{0}'' |
|
166 |
_Overwrite_existing_tables=Sobreescribir las tablas existentes |
|
167 |
_Delete_existing_tables_in_workspace_and_then_checkout_them_from_repository=Elimina las tablas existentes en la copia de trabajo y las vuelve a obtener del repositorio. |
|
168 |
_VCS_Logout=Cerrar sesi\u00f3n |
|
169 |
_Logout_the_current_user_from_a_VCSGis_working_copy=Cierra la sesi\u00f3n de usuario en una copia de trabajo |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/workspace/VCSGisWorkspaceImpl.java | ||
---|---|---|
71 | 71 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_ADD_CHANGE; |
72 | 72 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_AUTHENTICATE_USER; |
73 | 73 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_COMMIT; |
74 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_EXECUTE_REQUEST; |
|
75 | 74 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_INSERT_CHANGE; |
76 | 75 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_INSERT_FEATURES; |
77 | 76 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_OPEN_CHANGES; |
... | ... | |
3532 | 3531 |
List<String> dataModelsEntity = entity.getDataModelsAsList(); |
3533 | 3532 |
dataModels.addAll(dataModelsEntity); |
3534 | 3533 |
} |
3535 |
return new ArrayList<>(dataModels); |
|
3534 |
ArrayList<String> list = new ArrayList<>(dataModels); |
|
3535 |
Collections.sort(list); |
|
3536 |
return list; |
|
3536 | 3537 |
} |
3537 | 3538 |
|
3538 | 3539 |
@Override |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/checkout/VCSGisJCheckoutImpl.java | ||
---|---|---|
35 | 35 |
import org.gvsig.tools.swing.api.Component; |
36 | 36 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
37 | 37 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
38 |
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
|
39 | 38 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
40 | 39 |
import org.gvsig.tools.swing.api.task.TaskStatusController; |
41 | 40 |
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
... | ... | |
57 | 56 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.notInSwingThreadInvokeLater; |
58 | 57 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.refreshDocument; |
59 | 58 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationErrors; |
59 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationRequiredMessage; |
|
60 | 60 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_GROUP_NAME; |
61 | 61 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_PROVIDER_NAME; |
62 | 62 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.registerIcons; |
63 | 63 |
import org.gvsig.vcsgis.swing.impl.revisions.VCSGisRevisionPickerControllerImpl; |
64 | 64 |
import org.slf4j.LoggerFactory; |
65 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationRequiredMessage; |
|
66 | 65 |
|
67 | 66 |
/** |
68 | 67 |
* |
... | ... | |
257 | 256 |
this.workspacePicker.setEnabled(!isProcessing); |
258 | 257 |
this.entitySelector.setEnabled(!isProcessing && workspace!=null ); |
259 | 258 |
|
260 |
this.pbStatus.setVisible(isProcessing); |
|
261 |
this.lblStatusTitle.setVisible(isProcessing); |
|
262 |
|
|
263 | 259 |
if (dialog != null) { |
264 | 260 |
LabeledValue selectedView = (LabeledValue) cboView.getSelectedItem(); |
265 | 261 |
boolean dontAddNothing = rdbDontAddToProject.isSelected(); |
... | ... | |
288 | 284 |
@Override |
289 | 285 |
public int checkout() { |
290 | 286 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
287 |
setVisibleStatus(true); |
|
291 | 288 |
|
292 | 289 |
VCSGisEntity entity = entitySelector.getSelectedEntity(); |
293 | 290 |
final VCSGisWorkspace workspace = this.getWorkspace(); |
... | ... | |
309 | 306 |
(revision == null) ? null : revision.getRevisionCode() |
310 | 307 |
); |
311 | 308 |
VCSGisEntity lEntity = workspace.getEntity(entity.getEntityCode()); |
312 |
workspace.getExplorer().setCustomResources(entity.getEntityName(), lEntity.getResources()); //"solapada_resources"); |
|
313 |
// workspace.getExplorer().setCustomResources(entity.getEntityName(), "solapada_resources"); |
|
309 |
if(StringUtils.isNotBlank(lEntity.getResources())){ |
|
310 |
workspace.getExplorer().setCustomResources(entity.getEntityName(), lEntity.getResources()); |
|
311 |
} |
|
314 | 312 |
postCheckout(res, entity); |
315 | 313 |
} |
316 | 314 |
showMessage(i18n.getTranslation("_Ended_process"), null); |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/logout/VCSGisJLogoutImpl.java | ||
---|---|---|
74 | 74 |
doChangeWorkspace(); |
75 | 75 |
}); |
76 | 76 |
|
77 |
this.setPreferredSize(new Dimension(300, 300));
|
|
77 |
this.setPreferredSize(new Dimension(300, 60));
|
|
78 | 78 |
|
79 | 79 |
} |
80 | 80 |
|
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/VCSGisEntitySelectorControllerJTree.java | ||
---|---|---|
27 | 27 |
import java.awt.event.ActionEvent; |
28 | 28 |
import java.awt.event.ActionListener; |
29 | 29 |
import java.util.ArrayList; |
30 |
import java.util.Collection; |
|
30 | 31 |
import java.util.Collections; |
31 | 32 |
import java.util.HashMap; |
32 | 33 |
import java.util.HashSet; |
... | ... | |
400 | 401 |
private void reloadEntities(VCSGisWorkspace workspace) { |
401 | 402 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
402 | 403 |
try { |
404 |
fireActionEvent(new ActionEvent(this, ACTION_BEGIN_PROCESSING_ID, ACTION_BEGIN_PROCESSING)); |
|
403 | 405 |
this.processing = true; |
404 | 406 |
this.doUpdateComponents(); |
405 | 407 |
workspace.reloadRepositoryEntities(null); |
... | ... | |
484 | 486 |
} finally { |
485 | 487 |
this.processing = false; |
486 | 488 |
this.doUpdateComponents(); |
489 |
fireActionEvent(new ActionEvent(this, ACTION_END_PROCESSING_ID, ACTION_END_PROCESSING)); |
|
487 | 490 |
} |
488 | 491 |
|
489 | 492 |
} |
490 | 493 |
|
494 |
@Override |
|
495 |
public Collection<VCSGisEntity> getEntities() { |
|
496 |
return this.entities.values(); |
|
497 |
} |
|
498 |
|
|
491 | 499 |
private void addNodeEntity(Map<String, DefaultMutableTreeNode> theEntityNodes, String category, LabeledValue entry) { |
492 | 500 |
DefaultMutableTreeNode branch = theEntityNodes.get(category); |
493 | 501 |
if (branch == null) { |
... | ... | |
506 | 514 |
filteredTree.setModel(new DefaultTreeModel(entities)); |
507 | 515 |
this.expandAllNodes(treeEntities); |
508 | 516 |
this.processing = false; |
509 |
this.changeListeners.fireEvent();
|
|
517 |
fireActionEvent(new ActionEvent(this, ACTION_RELOAD_ID, ACTION_RELOAD));
|
|
510 | 518 |
} |
511 | 519 |
|
512 | 520 |
private void doUpdateComponents() { |
... | ... | |
608 | 616 |
public void check(VCSGisEntity entity) { |
609 | 617 |
this.checkedEntityCodes.add(entity.getEntityCode()); |
610 | 618 |
this.treeEntities.repaint(); |
619 |
fireActionEvent(new ActionEvent(this, ACTION_CHECK_ID, ACTION_CHECK)); |
|
611 | 620 |
} |
612 | 621 |
|
613 | 622 |
@Override |
... | ... | |
616 | 625 |
this.checkedEntityCodes.add(entry.getValue().getEntityCode()); |
617 | 626 |
} |
618 | 627 |
this.treeEntities.repaint(); |
628 |
fireActionEvent(new ActionEvent(this, ACTION_CHECK_ID, ACTION_CHECK)); |
|
619 | 629 |
} |
620 | 630 |
|
621 | 631 |
@Override |
622 | 632 |
public void clearChecks() { |
623 | 633 |
this.checkedEntityCodes.clear(); |
624 | 634 |
this.treeEntities.repaint(); |
635 |
fireActionEvent(new ActionEvent(this, ACTION_CHECK_ID, ACTION_CHECK)); |
|
625 | 636 |
} |
626 | 637 |
|
627 | 638 |
private void expandAllNodes(JTree tree) { |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/checkoutDataModel/VCSGisJCheckoutDataModelImpl.java | ||
---|---|---|
26 | 26 |
import java.awt.event.ActionEvent; |
27 | 27 |
import java.awt.event.ItemEvent; |
28 | 28 |
import java.util.ArrayList; |
29 |
import java.util.Collection; |
|
29 | 30 |
import java.util.HashSet; |
30 | 31 |
import java.util.List; |
31 | 32 |
import java.util.Set; |
... | ... | |
57 | 58 |
import static org.gvsig.tools.util.ContainerUtils.EQUALS_IGNORECASE_COMPARATOR; |
58 | 59 |
import org.gvsig.tools.util.LabeledValue; |
59 | 60 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
60 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_CHECKOUT; |
|
61 | 61 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_OK; |
62 | 62 |
import org.gvsig.vcsgis.lib.VCSGisRuntimeException; |
63 | 63 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
... | ... | |
66 | 66 |
import org.gvsig.vcsgis.swing.VCSGisSwingManager; |
67 | 67 |
import org.gvsig.vcsgis.swing.VCSGisSwingServices; |
68 | 68 |
import org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController; |
69 |
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.ACTION_BEGIN_PROCESSING_ID; |
|
70 |
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.ACTION_CHECK_ID; |
|
71 |
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.ACTION_END_PROCESSING_ID; |
|
72 |
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.ACTION_RELOAD_ID; |
|
69 | 73 |
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.ALL_ENTITIES; |
70 | 74 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.notInSwingThreadInvokeLater; |
71 | 75 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.refreshDocument; |
... | ... | |
93 | 97 |
private PickerController<VCSGisWorkspace> workspacePicker; |
94 | 98 |
private TaskStatusController taskStatusController; |
95 | 99 |
private VCSGisEntitySelectorController entitySelector; |
96 |
|
|
100 |
|
|
97 | 101 |
public VCSGisJCheckoutDataModelImpl() { |
98 | 102 |
processing = false; |
99 | 103 |
initComponents(); |
... | ... | |
114 | 118 |
this.entitySelector.setFilter(ALL_ENTITIES); |
115 | 119 |
this.entitySelector.setViewFilter(ALL_ENTITIES); |
116 | 120 |
this.entitySelector.setChecksEnabled(true); |
117 |
// this.entitySelector.addActionListener((ActionEvent e) -> { |
|
118 |
// doChangeTable(); |
|
119 |
// }); |
|
120 | 121 |
this.entitySelector.addChangeListener((ChangeEvent e) -> { |
121 | 122 |
doUpdateComponents(); |
122 | 123 |
}); |
124 |
this.entitySelector.addActionListener((ActionEvent e) -> { |
|
125 |
switch(e.getID()){ |
|
126 |
case ACTION_RELOAD_ID: |
|
127 |
doCheckDefaultEntities(); |
|
128 |
break; |
|
129 |
case ACTION_BEGIN_PROCESSING_ID: |
|
130 |
doUpdateComponents(); |
|
131 |
break; |
|
132 |
case ACTION_END_PROCESSING_ID: |
|
133 |
doUpdateComponents(); |
|
134 |
break; |
|
135 |
case ACTION_CHECK_ID: |
|
136 |
doChangeCheckedEntities(); |
|
137 |
break; |
|
138 |
} |
|
139 |
}); |
|
123 | 140 |
|
124 | 141 |
this.taskStatusController = taskStatusManager.createTaskStatusController( |
125 | 142 |
this.lblStatusTitle, |
... | ... | |
153 | 170 |
|
154 | 171 |
showMessage(" ", null); |
155 | 172 |
|
156 |
this.setPreferredSize(new Dimension(520, 400));
|
|
173 |
this.setPreferredSize(new Dimension(520, 300));
|
|
157 | 174 |
|
158 | 175 |
} |
159 | 176 |
|
... | ... | |
225 | 242 |
VCSGisWorkspace workspace = getWorkspace(); |
226 | 243 |
List<VCSGisEntity> checkedEntities = this.entitySelector.getCheckedEntities(); |
227 | 244 |
|
228 |
this.btnCheckAllEntities.setEnabled(!isProcessing); |
|
229 |
this.btnUnCheckAllEntities.setEnabled(!isProcessing); |
|
245 |
this.chkOverwriteExistingTables.setEnabled(!isProcessing && this.thereAreCheckedEntitiesInWorkspace()); |
|
230 | 246 |
|
231 |
this.chkOverwriteExistingTables.setEnabled(!isProcessing); |
|
232 |
|
|
233 | 247 |
boolean canCheckout = !isProcessing && |
234 | 248 |
workspace!=null && |
235 | 249 |
checkedEntities.size() > 0; |
... | ... | |
237 | 251 |
this.workspacePicker.setEnabled(!isProcessing); |
238 | 252 |
this.entitySelector.setEnabled(!isProcessing && workspace!=null ); |
239 | 253 |
|
240 |
this.pbStatus.setVisible(isProcessing); |
|
241 |
this.lblStatusTitle.setVisible(isProcessing); |
|
242 |
|
|
243 | 254 |
if (dialog != null) { |
244 | 255 |
this.dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, |
245 | 256 |
canCheckout |
... | ... | |
255 | 266 |
public int checkout() { |
256 | 267 |
|
257 | 268 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
269 |
setVisibleStatus(true); |
|
258 | 270 |
|
259 |
List<VCSGisEntity> entities = entitySelector.getCheckedEntities();
|
|
271 |
List<VCSGisEntity> checkedEntities = entitySelector.getCheckedEntities();
|
|
260 | 272 |
final VCSGisWorkspace workspace = this.getWorkspace(); |
261 | 273 |
final String dataModelName = this.getDataModel(); |
262 | 274 |
|
263 |
if (workspace != null && entities != null && entities.size()>0) { |
|
264 |
List<String> entityCodes = new ArrayList<>(); |
|
265 |
for (VCSGisEntity entity : entities) { |
|
266 |
entityCodes.add(entity.getEntityCode()); |
|
275 |
if (workspace == null) { |
|
276 |
return ERR_OK; |
|
277 |
} |
|
278 |
if (checkedEntities == null || checkedEntities.isEmpty()) { |
|
279 |
registerStoresRepository(workspace, dataModelName, this.entitySelector.getEntities()); |
|
280 |
return ERR_OK; |
|
281 |
} |
|
282 |
List<String> entityNames = new ArrayList<>(); |
|
283 |
for (VCSGisEntity entity : checkedEntities) { |
|
284 |
entityNames.add(entity.getEntityName()); |
|
285 |
} |
|
286 |
|
|
287 |
try { |
|
288 |
processing = true; |
|
289 |
doUpdateComponents(); |
|
290 |
|
|
291 |
showMessage(i18n.getTranslation("_Processing"), null); |
|
292 |
int res = ERR_OK; |
|
293 |
if(chkOverwriteExistingTables.isSelected()){ |
|
294 |
res = workspace.removeEntities(entityNames); |
|
267 | 295 |
} |
268 |
|
|
269 |
try { |
|
270 |
processing = true; |
|
271 |
doUpdateComponents(); |
|
272 |
|
|
273 |
showMessage(i18n.getTranslation("_Processing"), null); |
|
274 |
int res = ERR_OK; |
|
275 |
if(chkOverwriteExistingTables.isSelected()){ |
|
276 |
res = workspace.removeEntities(entityCodes); |
|
277 |
} |
|
296 |
if(res == ERR_OK){ |
|
297 |
res = workspace.checkout( |
|
298 |
entityNames, |
|
299 |
null |
|
300 |
); |
|
278 | 301 |
if(res == ERR_OK){ |
279 |
res = workspace.checkout( |
|
280 |
entityCodes, |
|
281 |
null |
|
282 |
); |
|
283 |
for (VCSGisEntity entity : entities) { |
|
302 |
for (VCSGisEntity entity : checkedEntities) { |
|
284 | 303 |
VCSGisEntity lEntity = workspace.getEntity(entity.getEntityCode()); |
285 |
workspace.getExplorer().setCustomResources(entity.getEntityName(), lEntity.getResources()); |
|
304 |
if(StringUtils.isNotBlank(lEntity.getResources())){ |
|
305 |
workspace.getExplorer().setCustomResources(entity.getEntityName(), lEntity.getResources()); |
|
306 |
} |
|
286 | 307 |
} |
287 |
registerStoresRepository(workspace, dataModelName, entities);
|
|
288 |
postCheckout(res, entities);
|
|
308 |
registerStoresRepository(workspace, dataModelName, this.entitySelector.getEntities());
|
|
309 |
postCheckout(res, checkedEntities);
|
|
289 | 310 |
} |
290 |
showMessage(i18n.getTranslation("_Ended_process"), null); |
|
291 |
return res; |
|
292 |
} finally { |
|
293 |
processing = false; |
|
294 |
doUpdateComponents(); |
|
295 | 311 |
} |
312 |
return res; |
|
313 |
} finally { |
|
314 |
processing = false; |
|
315 |
doUpdateComponents(); |
|
296 | 316 |
} |
297 |
return ERR_CANT_CHECKOUT; |
|
298 | 317 |
} |
299 | 318 |
|
300 | 319 |
private void postCheckout(int checkoutStatus, List<VCSGisEntity> entities) { |
... | ... | |
323 | 342 |
} else { |
324 | 343 |
this.setVisibleStatus(true); |
325 | 344 |
} |
345 |
this.processing = false; |
|
326 | 346 |
this.doUpdateComponents(); |
327 | 347 |
} |
328 | 348 |
|
329 |
private void registerStoresRepository(VCSGisWorkspace workspace, String name, List<VCSGisEntity> entities) {
|
|
349 |
private void registerStoresRepository(VCSGisWorkspace workspace, String name, Collection<VCSGisEntity> entities) {
|
|
330 | 350 |
DataManager dataManager = DALLocator.getDataManager(); |
331 | 351 |
BaseStoresRepository modelRepository = new BaseStoresRepository(name); |
332 | 352 |
for (VCSGisEntity entity : entities) { |
... | ... | |
350 | 370 |
swingManager.translate(this.lblWorkspace); |
351 | 371 |
swingManager.translate(this.lblDataModel); |
352 | 372 |
swingManager.translate(this.chkOverwriteExistingTables); |
373 |
swingManager.translate(this.btnCheckAllEntities); |
|
374 |
swingManager.translate(this.btnUnCheckAllEntities); |
|
353 | 375 |
} |
354 | 376 |
|
355 | 377 |
@Override |
... | ... | |
382 | 404 |
|
383 | 405 |
private void doChangeDataModel() { |
384 | 406 |
String selectedDataModel = getDataModel(); |
407 |
this.entitySelector.clearChecks(); |
|
385 | 408 |
this.entitySelector.setViewFilter( |
386 | 409 |
(VCSGisEntity t) -> (ContainerUtils.contains( |
387 | 410 |
t.getDataModelsAsList(), |
388 | 411 |
selectedDataModel, |
389 | 412 |
EQUALS_IGNORECASE_COMPARATOR)) |
390 | 413 |
); |
391 |
|
|
392 | 414 |
} |
393 | 415 |
|
394 | 416 |
@Override |
... | ... | |
396 | 418 |
return VCSGisSwingManagerImpl.loadImage(imageName); |
397 | 419 |
} |
398 | 420 |
|
421 |
private void doCheckDefaultEntities() { |
|
422 |
VCSGisWorkspace ws = getWorkspace(); |
|
423 |
if(ws == null){ |
|
424 |
doUpdateComponents(); |
|
425 |
return; |
|
426 |
} |
|
427 |
this.entitySelector.clearChecks(); |
|
428 |
Collection<VCSGisEntity> entities = this.entitySelector.getEntities(); |
|
429 |
for (VCSGisEntity entity : entities) { |
|
430 |
if(!ws.existsInWorkspace(entity)){ |
|
431 |
this.entitySelector.check(entity); |
|
432 |
} |
|
433 |
} |
|
434 |
doUpdateComponents(); |
|
435 |
} |
|
399 | 436 |
|
437 |
private boolean thereAreCheckedEntitiesInWorkspace() { |
|
438 |
boolean res = false; |
|
439 |
VCSGisWorkspace ws = this.getWorkspace(); |
|
440 |
if(ws == null){ |
|
441 |
return false; |
|
442 |
} |
|
443 |
List<VCSGisEntity> checkedEntities = this.entitySelector.getCheckedEntities(); |
|
444 |
for (VCSGisEntity checkedEntity : checkedEntities) { |
|
445 |
if(ws.existsInWorkspace(checkedEntity)){ |
|
446 |
return true; |
|
447 |
} |
|
448 |
} |
|
449 |
return false; |
|
450 |
} |
|
451 |
|
|
452 |
private void doChangeCheckedEntities() { |
|
453 |
if(!thereAreCheckedEntitiesInWorkspace()){ |
|
454 |
this.chkOverwriteExistingTables.setSelected(false); |
|
455 |
} |
|
456 |
doUpdateComponents(); |
|
457 |
} |
|
458 |
|
|
459 |
|
|
400 | 460 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/VCSGisEntitySelectorController.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.vcsgis.swing.impl; |
23 | 23 |
|
24 |
import java.util.Collection; |
|
24 | 25 |
import java.util.List; |
25 | 26 |
import java.util.function.Predicate; |
26 | 27 |
import javax.swing.JButton; |
... | ... | |
45 | 46 |
|
46 | 47 |
public static final int ACTION_SELECT_ID = 0; |
47 | 48 |
public static final int ACTION_CHECK_ID = 1; |
49 |
public static final int ACTION_RELOAD_ID = 2; |
|
50 |
public static final int ACTION_BEGIN_PROCESSING_ID = 3; |
|
51 |
public static final int ACTION_END_PROCESSING_ID = 4; |
|
48 | 52 |
|
49 | 53 |
public static final String ACTION_SELECT = "select"; |
50 | 54 |
public static final String ACTION_CHECK = "check"; |
55 |
public static final String ACTION_RELOAD = "reload"; |
|
56 |
public static final String ACTION_BEGIN_PROCESSING = "begin_processing"; |
|
57 |
public static final String ACTION_END_PROCESSING = "end_processing"; |
|
51 | 58 |
|
52 | 59 |
public static VCSGisEntitySelectorController create(JList lstTables, JTextField txtFilter, JButton btnTable, JButton btnCheckAll, JButton btnUnCheckAll) { |
53 | 60 |
return new VCSGisEntitySelectorControllerJList(lstTables, txtFilter, btnTable, btnCheckAll, btnUnCheckAll); |
... | ... | |
77 | 84 |
|
78 | 85 |
public List<VCSGisEntity> getCheckedEntities(); |
79 | 86 |
|
87 |
public Collection<VCSGisEntity> getEntities(); |
|
88 |
|
|
80 | 89 |
public VCSGisWorkspace getWorkspace(); |
81 | 90 |
|
82 | 91 |
public boolean isProcessing(); |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/VCSGisEntitySelectorControllerJList.java | ||
---|---|---|
26 | 26 |
import java.awt.event.ActionEvent; |
27 | 27 |
import java.awt.event.ActionListener; |
28 | 28 |
import java.util.ArrayList; |
29 |
import java.util.Collection; |
|
29 | 30 |
import java.util.Collections; |
30 | 31 |
import java.util.HashSet; |
31 | 32 |
import java.util.List; |
... | ... | |
84 | 85 |
private Predicate<VCSGisEntity> filter; |
85 | 86 |
private JButton btnCheckAll; |
86 | 87 |
private JButton btnUnCheckAll; |
88 |
private ArrayList<VCSGisEntity> entities; |
|
87 | 89 |
|
88 | 90 |
public VCSGisEntitySelectorControllerJList(JList lstTables) { |
89 | 91 |
this(lstTables, null, null, null, null); |
... | ... | |
113 | 115 |
if( btnUnCheckAll==null ) { |
114 | 116 |
this.btnUnCheckAll = new JButton(); |
115 | 117 |
} else { |
116 |
this.btnUnCheckAll = btnCheckAll; |
|
118 |
this.btnUnCheckAll = btnUnCheckAll;
|
|
117 | 119 |
} |
118 | 120 |
|
119 | 121 |
this.processing = false; |
... | ... | |
201 | 203 |
this.filteredList.getModel().clear(); |
202 | 204 |
return; |
203 | 205 |
} |
204 |
// this.filteredList.getModel().clear(); |
|
205 | 206 |
Thread task = new Thread(() -> {reloadTables(this.workspace);}, "VCSGisEntitySelectorReloadEntities"); |
206 | 207 |
task.start(); |
207 | 208 |
} |
... | ... | |
214 | 215 |
private void reloadTables(VCSGisWorkspace workspace) { |
215 | 216 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
216 | 217 |
try { |
218 |
fireActionEvent(new ActionEvent(this, ACTION_BEGIN_PROCESSING_ID, ACTION_BEGIN_PROCESSING)); |
|
217 | 219 |
this.processing = true; |
218 | 220 |
this.doUpdateComponents(); |
219 | 221 |
workspace.reloadRepositoryEntities(null); |
... | ... | |
271 | 273 |
} finally { |
272 | 274 |
this.processing = false; |
273 | 275 |
this.doUpdateComponents(); |
276 |
fireActionEvent(new ActionEvent(this, ACTION_END_PROCESSING_ID, ACTION_END_PROCESSING)); |
|
274 | 277 |
} |
275 | 278 |
|
276 | 279 |
} |
... | ... | |
279 | 282 |
if( notInSwingThreadInvokeLater(() -> { postReloadTables(entities); }) ) { |
280 | 283 |
return; |
281 | 284 |
} |
285 |
this.entities = new ArrayList<>(); |
|
282 | 286 |
FilteredListModel model = this.filteredList.getModel(); |
283 | 287 |
Set<String> checkeds = new HashSet<>(); |
284 | 288 |
ListSelectionModel checkedModel = null; |
... | ... | |
295 | 299 |
this.lstTables.getSelectionModel().clearSelection(); |
296 | 300 |
for (LabeledValue<VCSGisEntity> entity : entities) { |
297 | 301 |
if(entity != null){ |
302 |
this.entities.add(entity.getValue()); |
|
298 | 303 |
this.filteredList.getModel().addElement(entity); |
299 | 304 |
} |
300 | 305 |
} |
... | ... | |
309 | 314 |
} |
310 | 315 |
|
311 | 316 |
this.processing = false; |
312 |
this.changeListeners.fireEvent();
|
|
317 |
fireActionEvent(new ActionEvent(this, ACTION_RELOAD_ID, ACTION_RELOAD));
|
|
313 | 318 |
} |
314 | 319 |
|
320 |
@Override |
|
321 |
public Collection<VCSGisEntity> getEntities() { |
|
322 |
return this.entities; |
|
323 |
} |
|
324 |
|
|
325 |
|
|
315 | 326 |
private void doUpdateComponents() { |
316 | 327 |
if( notInSwingThreadInvokeLater(this::doUpdateComponents) ) { |
317 | 328 |
return; |
... | ... | |
412 | 423 |
this.viewFilter = viewFilter; |
413 | 424 |
VCSGisWorkspace ws = getWorkspace(); |
414 | 425 |
if (ws != null) { |
415 |
reloadTables(getWorkspace()); |
|
426 |
Thread task = new Thread(() -> {reloadTables(this.workspace);}, "VCSGisEntitySelectorReloadEntities"); |
|
427 |
task.start(); |
|
416 | 428 |
} |
417 | 429 |
} |
418 | 430 |
|
... | ... | |
437 | 449 |
entity.getEntityCode() |
438 | 450 |
)) { |
439 | 451 |
lstTablesWithCheckbox.getCheckedModel().addSelectionInterval(i, i); |
452 |
fireActionEvent(new ActionEvent(this, ACTION_CHECK_ID, ACTION_CHECK)); |
|
440 | 453 |
return; |
441 | 454 |
} |
442 | 455 |
} |
... | ... | |
447 | 460 |
public void clearChecks() { |
448 | 461 |
if(lstTablesWithCheckbox != null){ |
449 | 462 |
lstTablesWithCheckbox.getCheckedModel().clearSelection(); |
463 |
fireActionEvent(new ActionEvent(this, ACTION_CHECK_ID, ACTION_CHECK)); |
|
450 | 464 |
} |
451 | 465 |
} |
452 | 466 |
|
453 | 467 |
@Override |
454 | 468 |
public void checkAll() { |
455 | 469 |
lstTablesWithCheckbox.getCheckedModel().setSelectionInterval(0, lstTablesWithCheckbox.getModel().getSize()); |
470 |
fireActionEvent(new ActionEvent(this, ACTION_CHECK_ID, ACTION_CHECK)); |
|
471 |
|
|
456 | 472 |
} |
457 | 473 |
|
458 | 474 |
} |
Also available in: Unified diff