You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kent Tong <ke...@cpttm.org.mo> on 2007/10/01 04:44:26 UTC

Re: How do I force evaluate in a Wizard steps condition to run?



lizz wrote:
> 
> A parameter in my wizard step decides whether the next step is valid or
> not.
> The end user can change this parameter and I therefore need to be able to
> reevaluate the next wizard steps when this is changed. I use ICondition
> and I guess there is a way for me to force the evaluate method to be
> called again. 
> How do I do that? 
> 

What do you mean? IConditions are evaluated dynamically. So they will always
return 
their current values.
-- 
View this message in context: http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12972600
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How do I force evaluate in a Wizard steps condition to run?

Posted by Matt Jensen <ma...@picasystems.com>.
You would probably have to subclass WizardModel, or come up with a new 
IWizardModel implementation completely.  The former will probably 
suffice, unless some strategic methods are declared final.

lizz wrote:
> I really dont want to add more steps that the ones I already have. for the
> case when step c is no longer valid I woild like the next button to be
> disabled and the finish button to be enabled. Isn't there a method for
> updating the button panel? 
>
>
>
> Kent Tong wrote:
>   
>> lizz wrote:
>>     
>>> I have three wizard steps A, B and C
>>> In step B I have a drop down choice. Whether step c is valid or not
>>> depends on the selection in the drop down choice in step B.
>>>
>>> Everytime the user changes the selection in the drop down choice the
>>> wizard must be updated (the evaluate method must be run) since for some
>>> selections the next button will be disabled since step b is the last
>>> step, while for other selections c is the last step and the next button
>>> is enabled.
>>>
>>>       
>> When I'd suggest you add an artificial step D as the final step saying
>> "You're completed the whole process".
>> This step is always enabled. Then no matter step C should be enabled or
>> not, the user will always see
>> a "Next" button.
>>
>> Another option is try enabling wantOnSelectionChangedNotifications() to
>> refresh the whole page.
>>
>>     
>
>   


Re: How do I force evaluate in a Wizard steps condition to run?

Posted by Kent Tong <ke...@cpttm.org.mo>.

lizz wrote:
> 
> I really dont want to add more steps that the ones I already have. for the
> case when step c is no longer valid I woild like the next button to be
> disabled and the finish button to be enabled. Isn't there a method for
> updating the button panel? 
> 

As I said, you can enable wantOnSelectionChangedNotifications() to refresh
the whole page. Here
is some sample code:

public class WizardTest extends WebPage {
	private String selected = "A";

	public WizardTest() {
		WizardModel wizardModel = new WizardModel();
		wizardModel.addListener(new IWizardModelListener() {
			public void onFinish() {
				setResponsePage(Completed.class);
			}
			public void onCancel() {
			}
			public void onActiveStepChanged(IWizardStep newStep) {
			}
		});
		wizardModel.add(new MyStep("a"));
		wizardModel.add(new MyStep2(new PropertyModel(this, "selected")));
		wizardModel.add(new MyStep("c"), new ICondition() {
			public boolean evaluate() {
				return "A".equals(selected);
			}
		});
		Wizard w = new Wizard("w", wizardModel);
		add(w);
	}
}

public class MyStep2 extends WizardStep {
	public MyStep2(IModel model) {
		List options = new ArrayList();
		options.add("A");
		options.add("B");
		add(new DropDownChoice("s", model, options) {
			protected boolean wantOnSelectionChangedNotifications() {
				return true;
			}
		});
	}
}

-- 
View this message in context: http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12991207
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How do I force evaluate in a Wizard steps condition to run?

Posted by lizz <el...@bouvet.no>.
I really dont want to add more steps that the ones I already have. for the
case when step c is no longer valid I woild like the next button to be
disabled and the finish button to be enabled. Isn't there a method for
updating the button panel? 



Kent Tong wrote:
> 
> 
> lizz wrote:
>> 
>> I have three wizard steps A, B and C
>> In step B I have a drop down choice. Whether step c is valid or not
>> depends on the selection in the drop down choice in step B.
>> 
>> Everytime the user changes the selection in the drop down choice the
>> wizard must be updated (the evaluate method must be run) since for some
>> selections the next button will be disabled since step b is the last
>> step, while for other selections c is the last step and the next button
>> is enabled.
>> 
> 
> When I'd suggest you add an artificial step D as the final step saying
> "You're completed the whole process".
> This step is always enabled. Then no matter step C should be enabled or
> not, the user will always see
> a "Next" button.
> 
> Another option is try enabling wantOnSelectionChangedNotifications() to
> refresh the whole page.
> 

-- 
View this message in context: http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12982889
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How do I force evaluate in a Wizard steps condition to run?

Posted by Kent Tong <ke...@cpttm.org.mo>.

lizz wrote:
> 
> I have three wizard steps A, B and C
> In step B I have a drop down choice. Whether step c is valid or not
> depends on the selection in the drop down choice in step B.
> 
> Everytime the user changes the selection in the drop down choice the
> wizard must be updated (the evaluate method must be run) since for some
> selections the next button will be disabled since step b is the last step,
> while for other selections c is the last step and the next button is
> enabled.
> 

When I'd suggest you add an artificial step D as the final step saying
"You're completed the whole process".
This step is always enabled. Then no matter step C should be enabled or not,
the user will always see
a "Next" button.

Another option is try enabling wantOnSelectionChangedNotifications() to
refresh the whole page.
-- 
View this message in context: http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12979454
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How do I force evaluate in a Wizard steps condition to run?

Posted by lizz <el...@bouvet.no>.
I have three wizard steps A, B and C
In step B I have a drop down choice. Whether step c is valid or not depends
on the selection in the drop down choice in step B.

Everytime the user changes the selection in the drop down choice the wizard
must be updated (the evaluate method must be run) since for some selections
the next button will be disabled since step b is the last step, while for
other selections c is the last step and the next button is enabled.


Kent Tong wrote:
> 
> 
> 
> lizz wrote:
>> 
>> A parameter in my wizard step decides whether the next step is valid or
>> not.
>> The end user can change this parameter and I therefore need to be able to
>> reevaluate the next wizard steps when this is changed. I use ICondition
>> and I guess there is a way for me to force the evaluate method to be
>> called again. 
>> How do I do that? 
>> 
> 
> What do you mean? IConditions are evaluated dynamically. So they will
> always return 
> their current values.
> 

-- 
View this message in context: http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12975317
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org