Added check for duplicate form submissions to dialog/wizard framework

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2736 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-05-02 11:27:17 +00:00
parent aa417e841f
commit 86134ca56f
2 changed files with 34 additions and 25 deletions

View File

@@ -23,6 +23,8 @@ import org.alfresco.web.ui.common.Utils;
*/
public abstract class BaseDialogBean implements IDialogBean
{
protected boolean isFinished = false;
// services common to most dialogs
protected BrowseBean browseBean;
protected NavigationBean navigator;
@@ -34,6 +36,9 @@ public abstract class BaseDialogBean implements IDialogBean
{
// tell any beans to update themselves so the UI gets refreshed
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
// reset the isFinished flag
this.isFinished = false;
}
public String cancel()
@@ -45,6 +50,11 @@ public abstract class BaseDialogBean implements IDialogBean
{
String outcome = getDefaultFinishOutcome();
// check the isFinished flag to stop the finish button
// being pressed multiple times
if (this.isFinished == false)
{
this.isFinished = true;
UserTransaction tx = null;
try
@@ -70,6 +80,7 @@ public abstract class BaseDialogBean implements IDialogBean
Utils.addErrorMessage(formatErrorMessage(e));
outcome = null;
}
}
return outcome;
}

View File

@@ -2,8 +2,6 @@ package org.alfresco.web.bean.wizard;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;