あなたが他のいくつかのページである場合、アプローチは正しいです
- 一つ一つ全く違う
- 前のページで行われた以前の選択に依存します
次に、次のページを動的に追加できます(ここでも説明されています) 。
ただし、動的コンテンツを含む次のページがある場合は、メソッドでそのコンテンツを作成できるはずですonEnterPage()
public void createControl(Composite parent)
{
//
// create the composite to hold the widgets
//
this.composite = new Composite(parent, SWT.NONE);
//
// create the desired layout for this wizard page
//
GridLayout layout = new GridLayout();
layout.numColumns = 4;
this.composite.setLayout(layout);
// set the composite as the control for this page
setControl(this.composite);
}
void onEnterPage()
{
final MacroModel model = ((MacroWizard) getWizard()).model;
String selectedKey = model.selectedKey;
String[] attrs = (String[]) model.macroMap.get(selectedKey);
for (int i = 0; i < attrs.length; i++)
{
String attr = attrs[i];
Label label = new Label(this.composite, SWT.NONE);
label.setText(attr + ":");
new Text(this.composite, SWT.NONE);
}
pack();
}
日食コーナーの記事「JFace ウィザードの作成」に示されているように:
任意のウィザード ページの getNextPage メソッドを上書きすることで、ウィザード ページの順序を変更できます。ページを離れる前に、ユーザーが選択した値をモデルに保存します。この例では、旅行の選択に応じて、ユーザーは次にフライトのページまたは車での旅行のページのいずれかを表示します。
public IWizardPage getNextPage(){
saveDataToModel();
if (planeButton.getSelection()) {
PlanePage page = ((HolidayWizard)getWizard()).planePage;
page.onEnterPage();
return page;
}
// Returns the next page depending on the selected button
if (carButton.getSelection()) {
return ((HolidayWizard)getWizard()).carPage;
}
return null;
}
に対してこの初期化を行うメソッドPlanePage
onEnterPage()
PlanePage
getNextPage()
を定義し、最初のページのメソッドにあるに移動するときにこのメソッドを呼び出します。