Skip to content

Commit

Permalink
Lax phase checking
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-forms@419821 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cziegeler committed Jul 7, 2006
1 parent 448c5bc commit 607a858
Showing 1 changed file with 8 additions and 20 deletions.
Expand Up @@ -182,48 +182,36 @@ private void fireEvents() {
* Inform the form that the values will be loaded.
*/
public void informStartLoadingModel() {
if (this.phase != ProcessingPhase.LOAD_MODEL) {
throw new IllegalStateException("Cannot load form in phase " + this.phase);
}
// nothing to do here
// TODO - we could remove this method?
}

/**
* Inform the form that the values are loaded.
*/
public void informEndLoadingModel() {
// Notify the end of the current phase
// Notify the end of the load phase
if (this.listener != null) {
this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase));
this.listener.phaseEnded(new ProcessingPhaseEvent(this, ProcessingPhase.LOAD_MODEL));
}
// TODO - Should we change the phase?
}

/**
* Inform the form that the values will be saved.
*/
public void informStartSavingModel() {
if (this.phase != ProcessingPhase.VALIDATE) {
throw new IllegalStateException("Cannot save model in phase " + this.phase);
}
if (!isValid()) {
throw new IllegalStateException("Cannot save an invalid form.");
}
this.phase = ProcessingPhase.SAVE_MODEL;
// nothing to do here
// TODO - we could remove this method?
}

/**
* Inform the form that the values are saved.
*/
public void informEndSavingModel() {
if (this.phase != ProcessingPhase.SAVE_MODEL) {
throw new IllegalStateException("Cannot save model in phase " + this.phase);
}
// Notify the end of the current phase
// Notify the end of the save phase
if (this.listener != null) {
this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase));
this.listener.phaseEnded(new ProcessingPhaseEvent(this, ProcessingPhase.SAVE_MODEL));
}
// go back to initial phase
this.phase = ProcessingPhase.LOAD_MODEL;
}

/**
Expand Down

0 comments on commit 607a858

Please sign in to comment.