private void savePublicWorkingSet(final WorkingSetData currentWorkingSet, final int saveMode) { final String name = currentWorkingSet.getWorkingSetName(); currentWorkingSet.setFilter(filterPanel.getFilter()); if (id == null) { WorkingSetCache.impl.addToPublicWorkingSets( currentWorkingSet, new GenericCallback<String>() { public void onFailure(Throwable caught) { Info.display( "ERROR", "Error saving working set " + name + ".", "Please" + " try saving again."); } public void onSuccess(String arg0) { id = currentWorkingSet.getId(); WSStore.getStore().update(); ClientUIContainer.bodyContainer.tabManager.panelManager.workingSetHierarchy .setCurrentlySelected(id); if (saveMode == SAVE) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); manager.workingSetBrowser.setEditWorkingSetTab(); } else if (saveMode == SAVEANDEXIT) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); manager.workingSetBrowser.setManagerTab(); } else { manager.workingSetBrowser.setEditTaxaTab(); manager.workingSetOptionsPanel.forceRefreshTaxaList( WorkingSetOptionsPanel.ADDBROWSE); } enableSaveButtons(true); } }); } else if (AuthorizationCache.impl.hasRight( SimpleSISClient.currentUser, AuthorizableObject.WRITE, WorkingSetCache.impl.getCurrentWorkingSet())) { WorkingSetCache.impl.editWorkingSet( currentWorkingSet, new GenericCallback<String>() { public void onFailure(Throwable caught) { Info.display( "ERROR", "Error saving working set " + name + ".", "Please" + " try saving again."); } public void onSuccess(String arg0) { WSStore.getStore().update(); ClientUIContainer.bodyContainer.tabManager.panelManager.workingSetHierarchy .setCurrentlySelected(id); if (saveMode == SAVE) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); } else if (saveMode == SAVEANDEXIT) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); manager.workingSetBrowser.setManagerTab(); } else { manager.workingSetBrowser.setEditTaxaTab(); manager.workingSetOptionsPanel.forceRefreshTaxaList( WorkingSetOptionsPanel.ADDBROWSE); } enableSaveButtons(true); } }); } else { WindowUtils.errorAlert("You do not have permissions to edit this working set."); enableSaveButtons(true); } }
private void savePrivateWorkingSet(final WorkingSetData currentWorkingSet, final int saveMode) { final String name = currentWorkingSet.getWorkingSetName(); AssessmentFilter filter = filterPanel.getFilter(); currentWorkingSet.setFilter(filter); if (id == null) { WorkingSetCache.impl.addToPrivateWorkingSets( currentWorkingSet, new GenericCallback<String>() { public void onFailure(Throwable caught) { Info.display( "ERROR", "Error saving working set " + name + ".", "Please" + " try saving again."); enableSaveButtons(true); } public void onSuccess(String arg0) { id = currentWorkingSet.getId(); WSStore.getStore().update(); ClientUIContainer.bodyContainer.tabManager.panelManager.workingSetHierarchy .setCurrentlySelected(id); if (saveMode == SAVE) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); manager.workingSetBrowser.setEditWorkingSetTab(); } else if (saveMode == SAVEANDEXIT) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); manager.workingSetBrowser.setManagerTab(); } else { manager.workingSetBrowser.setEditTaxaTab(); manager.workingSetOptionsPanel.forceRefreshTaxaList( WorkingSetOptionsPanel.ADDBROWSE); } enableSaveButtons(true); } }); } else { WorkingSetCache.impl.editWorkingSet( currentWorkingSet, new GenericCallback<String>() { public void onFailure(Throwable caught) { Info.display( "ERROR", "Error saving working set " + name + ".", "Please" + " try saving again."); enableSaveButtons(true); } public void onSuccess(String arg0) { id = currentWorkingSet.getId(); WSStore.getStore().update(); ClientUIContainer.bodyContainer.tabManager.panelManager.workingSetHierarchy .setCurrentlySelected(id); if (saveMode == SAVE) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); } else if (saveMode == SAVEANDEXIT) { Info.display( new InfoConfig("Successful Save", "Successfully saved working set " + name)); manager.workingSetBrowser.setManagerTab(); } else { manager.workingSetBrowser.setEditTaxaTab(); manager.workingSetOptionsPanel.forceRefreshTaxaList( WorkingSetOptionsPanel.ADDBROWSE); } enableSaveButtons(true); } }); } }