Changes and new tags for the task forms designer
dmlloyd Nov 13, 2006 10:56 AMEL variables
Task forms should use the following EL variables to access form data:
#{comment}This variable will be checked for a new comment to add to a task instance when a transition or save action is taken.
#{var['name']}This is where all the process variables will be kept.
#{taskName}Read-only variable; name of the current task.
Layout changes
Currently the task forms are formatted something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
...>
<head>
<title>userForm</title>
<link rel="stylesheet" type="text/css" href="../css/jbpm.css" />
</head>
<body>
<ui:composition>
<h:form id="taskform">
<h:inputHidden id="taskInstanceId" value="#{taskInstanceBean.id}" />
...content here...
</h:form>
</ui:composition>
</body>
</html>
This should be simplified to exclude the head, body, ui:composition, h:form, and h:inputHidden tags, to look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" ... xmlns:tf="http://jbpm.org/jsf/tf" xmlns:jbpm="http://jbpm.org/jsf"> ...content here... </html>
The "nuts and bolts" tags will be generated by the task form renderer.
New tags
I'm specifying a prefix of "tf" for tags that are specific to task forms, assuming you will have the following attribute in your html element:
xmlns:tf="http://jbpm.org/jsf/tf"
Here's the tf tags:
<tf:transitionButton>
Save the task form and take a transition. Accepts all attributes that "h:commandButton" does, with the exception of the "action" attribute. Also, there is a new optional attribute called "to", whose value is the name of the transition to take. If no value is given, take the only transition available.
<tf:saveButton>
Save the task form, but do not take a transition. Accepts all attributes that "h:commandButton" does, with the exception of the "action" attribute.
<tf:cancelButton>
Cancel the task form without saving anything. The user doesn't really have to click on this button to cancel though; (s)he can just choose a different menu item. Accepts all attributes that "h:commandButton" does, with the exception of the "action" attribute.
This tag is not really a tf tag but it's one that you can use nonetheless:
<jbpm:dataform> / <jbpm:datacell>
This tag allows a nice way to lay out form data. Definitely not required to use it, especially if the form is used outside of the console. Here's an example of a task form that might use these tags:
<jbpm:dataform>
<f:facet name="header">
<h:outputText value="#{taskName}"/>
</f:facet>
<jbpm:datacell>
<f:facet name="header">
<h:outputText value="Item"/>
</f:facet>
<h:inputText value="#{var['item']}"/>
</jbpm:datacell>
<jbpm:datacell>
<f:facet name="header">
<h:outputText value="Quantity"/>
</f:facet>
<h:inputText value="#{var['quantity']}"/>
</jbpm:datacell>
<jbpm:datacell>
<f:facet name="header">
<h:outputText value="Address"/>
</f:facet>
<h:inputText value="#{var['address']}"/>
</jbpm:datacell>
<jbpm:datacell>
<f:facet name="header">
<h:outputText value="Actions"/>
</f:facet>
<tf:transitionButton value="Save and Close"/>
<tf:saveButton value="Save"/>
<tf:cancelButton value="Cancel"/>
</jbpm:datacell>
</jbpm:dataform>Let me know if something doesn't make sense, or if you have more ideas to simplify task forms.