02-17-2009 07:29 AM
02-18-2009 04:35 AM
<step …>
<condition if="#{'true' == 'true'}">
<page path="…" … />
</condition>
</step>
<condition if="#{'true' == 'true'}">
<step …>
<page path="…" … />
</step>
</condition>
02-18-2009 10:23 AM
02-18-2009 10:58 AM
02-23-2009 04:47 AM
<config>
<wizards>
<wizard name="customWizard" managed-bean="CustomWizard"
title-id="custom_create_content_wizard_title" description-id="create_content_desc"
icon="/images/icons/new_content_large.gif">
<step name="step1" title="Step 1" description="…">
<page path="/jsp/wcm/create-web-content-wizard/create-xml.jsp"
title="Step 1" description="…" instruction="…" />
</step>
<step name="step2" title="Step 2" description="…">
<page path="/jsp/wcm/create-web-content-wizard/create-xml.jsp"
title="Step 2" description="…" instruction="…" />
</step>
…
</wizard>
</wizards>
</config>
The important thing to note here is thate we make use of the /jsp/wcm/create-web-content-wizard/create-xml.jsp page. This is the jsp that's responsible to generate the webform from an XSD file.
public class CustomWizard extends CreateWebContentWizard {
…
private int currentStep = 0;
@Override
public void init(Map<String, String> parameters) {
super.init(parameters);
setWebForm(); // Make sure the first webForm name has been set…
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception {
super.finishImpl(context, outcome);
…
return outcome;
}
@Override
public String next() {
this.currentStep++;
setWebForm();
return super.next();
}
@Override
public String back() {
this.currentStep–;
setWebForm();
return super.back();
}
private void setWebForm() {
switch (currentStep) {
case 0 : this.setFormName("custom-step-1"); break;
case 1 : this.setFormName("custom-step-2"); break;
}
}
…
}
Things to note here are:02-23-2009 05:17 AM
02-24-2009 09:14 AM
<h:inputText id="name" value="#{WizardManager.bean.someProperty}" size="50" maxlength="1024" required="true"/>
02-26-2009 04:20 AM
private void storeCurrentForm() {
FacesContext context = FacesContext.getCurrentInstance();
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context);
RetryingTransactionCallback<String> callback =
new RetryingTransactionCallback<String>() {
public String execute() throws Throwable {
// call the actual implementation
saveContent();
return null;
}
};
try {
// Execute the callback in a transaction
txnHelper.doInTransaction(callback);
} catch (Exception e) {
// ….
}
}
With the saveContent() method being:
@Override
protected void saveContent() throws Exception {
System.out.println("Saving content for Wizard Step :: " + this.currentStep);
final Form form = this.getForm();
if (form != null) {
Document instanceDataDocument = this.getInstanceDataDocument();
// Make sure the super's variable is already set correctly, as it will be used further on…
this.content = XMLUtil.toString(instanceDataDocument, false);
contents[currentStep] = this.content;
instanceDataDocuments[currentStep] = instanceDataDocument;
}
}
private void preloadWebForm() {
this.content = contents[currentStep];
this.formInstanceData = dataInstances[currentStep];
this.formProcessorSession = formProcessorSessions[currentStep];
}
@Override
public String next() {
storeCurrentForm();
this.currentStep++;
preloadWebForm();
return super.next();
}
@Override
public String back() {
storeCurrentForm();
this.currentStep–;
preloadWebForm();
return super.back();
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.