FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
Wizard wizardObject = (Wizard) application.createValueBinding(controller).getValue(facesContext);
List<WizardStep> course = wizardObject.getCourse();
PanelTag panel = new PanelTag();
panel.setPageContext(pageContext);
panel.setParent(getParent());
panel.doStartTag();
FacetTag facetTag = new FacetTag();
facetTag.setPageContext(pageContext);
facetTag.setName(FACET_LAYOUT);
facetTag.setParent(panel);
facetTag.doStartTag();
GridLayoutTag gridLayoutTag = new GridLayoutTag();
gridLayoutTag.setPageContext(pageContext);
StringBuilder columns = new StringBuilder();
for (WizardStep info : course) {
columns.append("fixed;");
}
gridLayoutTag.setColumns(columns + "*");
gridLayoutTag.setParent(facetTag);
gridLayoutTag.doStartTag();
gridLayoutTag.doEndTag();
facetTag.doEndTag();
for (WizardStep info : course) {
ButtonTag button = new ButtonTag();
button.setPageContext(pageContext);
button.setParent(panel);
button.setAction(info.getOutcome());
button.setActionListener("#{" + wizard + ".gotoStep}");
button.setLabel(info.getTitle());
button.doStartTag();
AttributeTag step = new AttributeTag();
step.setPageContext(pageContext);
step.setParent(button);
step.setName("step");
step.setValue("" + info.getIndex());
step.doStartTag();
step.doEndTag();
button.doEndTag();
}
OutTag spacer = new OutTag();
spacer.setPageContext(pageContext);
spacer.setParent(panel);
spacer.setValue("#{" + wizard + ".index}");
spacer.doStartTag();
spacer.doEndTag();
panel.doEndTag();
return result;
}