|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wizard4j.engine.SessionManager
org.wizard4j.wrapper.HtmlWrapper
public class HtmlWrapper
This class provides an html wrapper around the
FlowchartSession API. After creating a managed session,
an application will receive a html form from the wrapper and it can return a
parameter map to obtain the next html form.
An application using the wrapper will typically contain code similar to the following excerpt:
WizardValidator validator = WizardFactory.newWizardValidator(); Flowchart flowchart = validator.validateFlowchart(flowchartSource); HtmlWrapper htmlWrapper = WizardFactory.newHtmlWrapper(timeout, servletPath, false); String flowchartSessionId = htmlWrapper.createManagedSession(flowchart); String htmlCode = htmlWrapper.first(flowchartSessionId); ...
or in case a ticket is used:
WizardValidator validator = WizardFactory.newWizardValidator(); Flowchart flowchart = validator.validateFlowchart(flowchartSource); HtmlWrapper htmlWrapper = WizardFactory.newHtmlWrapper(timeout, servletPath, true); String flowchartSessionId = htmlWrapper.createManagedSession(flowchart); String ticket = htmlWrapper.first(flowchartSessionId); ... String htmlCode = htmlWrapper.getHtml(ticket); ...
A typical parsing of the user input looks like this:
String htmlCode = htmlWrapper.request(httpServletRequest.getParameterMap());
This method constructs a html table based on the provided
FlowchartResponse which has following structure:
<div id="wizard">
<table>
<tr><td><table><tr><td><input class="wizard_button_default"><input class="wizard_button"></td> ... </tr></table></tr><!-- navigation buttons -->
<tr><td><table>
list of presentations
</table></td></tr>
OR
<tr><td><table>
<tr><td colspan="3" class="validation_error">Potential Error Message</td></tr>
<tr><td>label1</td><td>input field1</td><td>(help1)</td></tr>
<tr><td colspan="2">info description</td><td>help</td></tr>
...
<tr><td>labelN</td><td>input fieldN</td><td>(helpN)</td></tr>
</table></td></tr>
<tr><td><table><tr><td><input class="wizard_button"></td> ... </tr></table></td></tr><!-- progress buttons -->
</table>
<div>
Note that the form is surrounded by a div with id 'wizard'. There are also a number of classes defined. Both can be used by a custom css to apply a specific layout.
| Constructor Summary | |
|---|---|
HtmlWrapper(int sessionTimeout,
java.lang.String servletPath,
boolean useTicket)
Constructor of the HtmlWrapper. |
|
| Method Summary | |
|---|---|
void |
addPresentationHtml(java.lang.String sessionId,
java.lang.String presentationHtml)
An application can add html fragments to be shown when the flowchart is executed. |
java.lang.String |
createManagedSession(Flowchart flowchart)
Create a managed session. |
java.lang.String |
first(java.lang.String sessionId)
|
java.lang.String |
getHtml(java.lang.String ticket)
Get the html code corresponding to this ticket |
boolean |
isPostFlowchartHtml()
|
void |
putActionLabel(java.lang.String sessionId,
EUserAction action,
java.lang.String label)
Change the label of an action button. |
void |
putHelpLabel(java.lang.String sessionId,
java.lang.String helpLabel)
Change the label of the help button. |
java.lang.String |
request(java.util.Map<java.lang.String,java.lang.String[]> parameterMap)
|
void |
setPostFlowchartHtml(boolean postFlowchartHtml)
If this parameter is set, the wrapper will return an overview of presentations at the end of the flowchart execution. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HtmlWrapper(int sessionTimeout,
java.lang.String servletPath,
boolean useTicket)
sessionTimeout - time after which an inactive session is removedservletPath - the servlet which will handle the form submissionuseTicket - when true the methods first(String) and
request(Map) return a ticket instead of the html
code. This is useful in case one wants to do a http redirect
after the form submission. With the ticket the html code can
be obtained later on with getHtml(String).| Method Detail |
|---|
public java.lang.String createManagedSession(Flowchart flowchart)
flowchart -
public java.lang.String getHtml(java.lang.String ticket)
throws NonExistingSessionException
ticket -
NonExistingSessionException - if session does not exist anymore
public java.lang.String first(java.lang.String sessionId)
throws NonExistingSessionException,
UnexpectedRequestException
sessionId -
NonExistingSessionException
UnexpectedRequestException
public java.lang.String request(java.util.Map<java.lang.String,java.lang.String[]> parameterMap)
throws NonExistingSessionException,
UnexpectedRequestException,
InvalidValueException
parameterMap -
NonExistingSessionException
UnexpectedRequestException
InvalidValueExceptionpublic boolean isPostFlowchartHtml()
public void setPostFlowchartHtml(boolean postFlowchartHtml)
addPresentationHtml(String, String).
postFlowchartHtml -
public void addPresentationHtml(java.lang.String sessionId,
java.lang.String presentationHtml)
sessionId - presentationHtml -
public void putHelpLabel(java.lang.String sessionId,
java.lang.String helpLabel)
sessionId - helpLabel -
public void putActionLabel(java.lang.String sessionId,
EUserAction action,
java.lang.String label)
sessionId - action - label -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||