Wicket Wizard 在方法 isComplete() 中给出错误信息; [英] Wicket Wizard gives false information in method isComplete();
问题描述
除了上一个问题,我正在尝试做我自己实现的带有步骤概述的 Wicket 向导.现在的问题是,即使该步骤尚未完成, isComplete();
似乎也返回 true.我做了3个向导步骤,然后我运行了这段代码:
in addition to a previous question, I'm trying to do my own implementation of a Wicket Wizard with a step overview. Now the problem is, that isComplete();
seems to return true, even if the step hasn't been finished. I made 3 wizardsteps and then I'm running this code:
public class MainWizard extends Wizard{
private static final long serialVersionUID = 1L;
private List<IWizardStep> steps = new ArrayList<IWizardStep>();
private Component overview = newOverviewBar("overview");
private IWizardModel wizardModel;
public MainWizard(String id, IWizardModel wizardModel, boolean addDefaultCssStyle) {
super(id, wizardModel, addDefaultCssStyle);
this.wizardModel = wizardModel;
fillList();
getIndex();
this.add(overview);
}
public void getIndex(){
for(IWizardStep step : steps){
System.out.println(step.getClass());
if(step.equals(wizardModel.getActiveStep())){
System.out.println("Active");
} else if(!step.isComplete()){
System.out.println("Pending");
} else if(step.isComplete()){
System.out.println("Finished");
}
}
}
public void fillList(){
Iterator<IWizardStep> iterator = wizardModel.stepIterator();
while(iterator.hasNext()){
steps.add(iterator.next());
}
}
@Override
public void onActiveStepChanged(IWizardStep newStep) {
try{
getIndex();
} catch (Exception e){
e.getMessage();
}
super.onActiveStepChanged(newStep);
}
}
第一步在控制台的输出是:
The output in the console for the first step is:
class {package}.StepOne > Active
class {package}.StepTwo > 完成
class {package}.StepThree > 完成
class {package}.StepOne > Active
class {package}.StepTwo > Finished
class {package}.StepThree > Finished
进入下一步:
class {package}.StepOne > 完成
class {package}.StepTwo > Active
class {package}.StepThree > 完成
class {package}.StepOne > Finished
class {package}.StepTwo > Active
class {package}.StepThree > Finished
最后一步:
class {package}.StepOne > 完成
class {package}.StepTwo > 完成
class {package}.StepThree > Active
class {package}.StepOne > Finished
class {package}.StepTwo > Finished
class {package}.StepThree > Active
我无法解释这种行为.正如我上面链接的帖子所建议的那样,如果它最终有效,我想分享这个组件.提前致谢.
I can't explain this behaviour. As in the post I linked above suggested, I would like to share this component if it works at the end. Thanks in advance.
是否有问题,我实施的步骤还没有真正的目标?我是否必须手动设置 setComplete();
或我的面板代码中的任何内容?
Is it a problem, that the steps I implemented don't have a real goal yet? Do I have to manually set setComplete();
or whatever it is in my code for the panels?
推荐答案
IWizardStep#isComplete() 的意思不是你想的那样:
The meaning of IWizardStep#isComplete() is not what you think it is:
/**
* Checks if this step is complete. This method should return {@code true} if the wizard can
* proceed to the next step.
*
* @return {@code true} if the wizard can proceed from this step, {@code false} otherwise.
*/
boolean isComplete();
注意如果向导可以进行下一步".
Take note of "if the wizard can proceed to the next step".
这篇关于Wicket Wizard 在方法 isComplete() 中给出错误信息;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!