I'm currently trying to implement an "import wizard" for an application using JFace Wizard.
目前,我正在尝试使用JFace向导为应用程序实现“导入向导”。
Basically I have to add the next page "just in time" based upon the input from the user, as each "step" within the wizard is depends upon the previous ones.
基本上,我必须根据用户的输入添加下一页“及时”,因为向导中的每个“步骤”都取决于前面的内容。
So, in the constructor of WizardImport I would add the first page, using:
因此,在向导的构造函数中,我将添加第一个页面,使用:
addPage(new WizardImportSourcePage(data));
Within this page (WizardImportSourcePage) I would then like to add the next page, depending upon the chosen source, e.g.:
在这个页面中,我想添加下一个页面,这取决于所选的源,例如:
btnCsv.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
data.getWizard().addPage(new WizardImportSourcePage(data));
setPageComplete(true);
}
});
As you can see all of this happens in the appropriate Listener. Unfortunately this doesn't work. The Wizard is missing the "Next" button, but only shows the "Finish" button, as it doesn't know anything about the next page until the button is actually being pressed. I've already tried to invoke updateButtons()
, but it didn't change anything.
正如您所看到的,所有这些都发生在适当的侦听器中。不幸的是,这是行不通的。向导正在丢失“Next”按钮,但只显示“Finish”按钮,因为它不知道下一页的任何内容,直到按钮被按下。我已经尝试调用updateButtons(),但是它没有改变任何东西。
So, any suggestions how to make it work? What would be the right way to build the wizard pages dynamically? Most tutorials seem to assume that the pages are created in the beginning and only the ordering is changed using getNextPage()
.
那么,有什么建议吗?怎样才能动态地构建向导页面?大多数教程似乎假定页面是在开始时创建的,并且只有使用getNextPage()更改排序。
1 个解决方案
#1
0
In your code extending Wizard
you can override
在您的代码扩展向导中,您可以重写。
public IWizardPage getNextPage(IWizardPage page)
which lets you decide which page to return next given the current wizard page (there is also a getPreviousPage
.
它允许您决定在当前的向导页面(也有getPreviousPage)下返回哪个页面。
#1
0
In your code extending Wizard
you can override
在您的代码扩展向导中,您可以重写。
public IWizardPage getNextPage(IWizardPage page)
which lets you decide which page to return next given the current wizard page (there is also a getPreviousPage
.
它允许您决定在当前的向导页面(也有getPreviousPage)下返回哪个页面。