dba33e: #i107623# allow finishWizard to return a success flag, and re-enable the finish button in case of failure
This commit is contained in:
parent
61aa2ad16c
commit
1b78e405c0
11 changed files with 42 additions and 25 deletions
|
@ -459,7 +459,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
|
|||
running = false;
|
||||
}
|
||||
|
||||
public void finishWizard() {
|
||||
public boolean finishWizard() {
|
||||
boolean bSaveSuccess = false; // pesimistic :(
|
||||
XTextDocument xTextDocument;
|
||||
|
||||
|
@ -480,7 +480,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
|
|||
|
||||
int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resFileExists);
|
||||
if (answer == 3) // user said: no, do not overwrite....
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
agendaTemplate.xTextDocument.lockControllers();
|
||||
|
@ -550,10 +550,11 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
|
|||
}
|
||||
} else {
|
||||
agendaTemplate.xTextDocument.unlockControllers();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
xDialog.endExecute();
|
||||
running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void closeDocument() {
|
||||
|
|
|
@ -292,7 +292,7 @@ public class SQLQueryComposer
|
|||
return sFromClause;
|
||||
}
|
||||
|
||||
public boolean setQueryCommand(String QueryName, XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames)
|
||||
public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -212,7 +212,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
|
|||
running = false;
|
||||
}
|
||||
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
switchToStep(getCurrentStep(), getMaxStep());
|
||||
myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription);
|
||||
|
@ -239,7 +239,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
|
|||
int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning);
|
||||
if (answer == 3) // user said: no, do not overwrite....
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
|
|||
xDialog.endExecute();
|
||||
running = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void closeDocument()
|
||||
|
|
|
@ -308,7 +308,7 @@ public class FormWizard extends WizardDialog
|
|||
}
|
||||
|
||||
// @Override
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
int ncurStep = getCurrentStep();
|
||||
if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE))
|
||||
|
@ -326,6 +326,7 @@ public class FormWizard extends WizardDialog
|
|||
{
|
||||
bcreateForm = true;
|
||||
xDialog.endExecute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,6 +336,7 @@ public class FormWizard extends WizardDialog
|
|||
showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
|
|
@ -253,7 +253,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
|
|||
running = false;
|
||||
}
|
||||
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
switchToStep(getCurrentStep(), getMaxStep());
|
||||
try
|
||||
|
@ -279,7 +279,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
|
|||
int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning);
|
||||
if (answer == 3) // user said: no, do not overwrite....
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
|
|||
xDialog.endExecute();
|
||||
running = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void closeDocument()
|
||||
|
|
|
@ -177,7 +177,7 @@ public class Finalizer
|
|||
{
|
||||
CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData);
|
||||
String queryname = getTitle();
|
||||
boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true);
|
||||
boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(CurUnoDialog.xWindow, true, true);
|
||||
if (bsuccess)
|
||||
{
|
||||
bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname);
|
||||
|
|
|
@ -292,17 +292,16 @@ public class QueryWizard extends WizardDialog
|
|||
}
|
||||
}
|
||||
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
int ncurStep = getCurrentStep();
|
||||
if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE))
|
||||
if ( ( ncurStep == SOSUMMARY_PAGE )
|
||||
|| ( switchToStep( ncurStep, SOSUMMARY_PAGE ) )
|
||||
)
|
||||
{
|
||||
components = CurFinalizer.finish();
|
||||
if ( components == null )
|
||||
{
|
||||
setControlProperty("btnWizardFinish", "Enabled", false);
|
||||
}
|
||||
}
|
||||
return ( components != null );
|
||||
}
|
||||
|
||||
protected void enterStep(int nOldStep, int nNewStep)
|
||||
|
|
|
@ -329,7 +329,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
|
|||
boolean bQueryCreated = false;
|
||||
if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
|
||||
{
|
||||
bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false);
|
||||
bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(this.xWindow, false, false);
|
||||
|
||||
CurReportDocument.setCommandType(CommandType.COMMAND);
|
||||
String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery();
|
||||
|
@ -520,7 +520,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
|
|||
enableNavigationButtons(false, false, false);
|
||||
}
|
||||
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
final int ncurStep = getCurrentStep();
|
||||
if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE))
|
||||
|
@ -532,9 +532,11 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
|
|||
nReportMode = CurReportFinalizer.getReportOpenMode();
|
||||
m_sReportName = CurReportFinalizer.getStoreName();
|
||||
xDialog.endExecute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void cancelWizard()
|
||||
|
|
|
@ -289,7 +289,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
|
|||
return bIsSuccessfull;
|
||||
}
|
||||
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
super.switchToStep(super.getCurrentStep(), SOFINALPAGE);
|
||||
tablename = curFinalizer.getTableName(curScenarioSelector.getFirstTableName());
|
||||
|
@ -314,6 +314,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
|
|||
components = curTableDescriptor.switchtoDataViewmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame);
|
||||
}
|
||||
super.xDialog.endExecute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -323,6 +324,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
|
|||
curFinalizer.setFocusToTableNameControl();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void callFormWizard()
|
||||
|
|
|
@ -685,7 +685,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
|
|||
}
|
||||
}
|
||||
|
||||
public abstract void finishWizard();
|
||||
public abstract boolean finishWizard();
|
||||
|
||||
/**
|
||||
* This function will call if the finish button is pressed on the UI.
|
||||
|
@ -693,8 +693,18 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
|
|||
public void finishWizard_1()
|
||||
{
|
||||
enableFinishButton(false);
|
||||
finishWizard();
|
||||
removeTerminateListener();
|
||||
boolean success = false;
|
||||
try
|
||||
{
|
||||
success = finishWizard();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( !success )
|
||||
enableFinishButton( true );
|
||||
}
|
||||
if ( success )
|
||||
removeTerminateListener();
|
||||
}
|
||||
|
||||
public int getMaximalStep()
|
||||
|
|
|
@ -942,9 +942,10 @@ public abstract class WWD_Events extends WWD_Startup
|
|||
/**
|
||||
* the user clicks the finish/create button.
|
||||
*/
|
||||
public void finishWizard()
|
||||
public boolean finishWizard()
|
||||
{
|
||||
finishWizard(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue