cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie. Is possible to use xforms with Activiti

ruospalo
Champ in-the-making
Champ in-the-making
We wanted to know if it's possible to use xforms in the user interface of Activiti Explorer and in other case if it will be integrated in a future version.


Thanks.
24 REPLIES 24

jbarrez
Star Contributor
Star Contributor
Nothing currently planned for that; The forms are pluggable in the engine though.

smirzai
Champ on-the-rise
Champ on-the-rise
Hi
It is not that simple. In our requirement we want to be able to have some other kind of forms, like JSP, Tepestry and probabely xforms.
It seems using some kind of form renderer in org.activiti.explorer.ui.form.FormPropertiesForm.setFormProperties using vaadin CustomLayout, it is possible to generate and show the form.
But the problem is reading the values. It seems there is no easy way to access value of fields in gernerated HTML form using vaadin.
Window. com.vaadin.ui.Windows.executeJavaScript  helps to execute some javascript in client but nothing for reading values from client HTML form inputs.

Any idea how can one implement it ?

Thanks
Saeid

frederikherema1
Star Contributor
Star Contributor
Why using the HTML generated by Vaadin? Why not just use the API for getting the FormProperties and render it the way you like?

smirzai
Champ on-the-rise
Champ on-the-rise
Hi
I don't want to rewrite every thing from scratch.
Ideally it would be great if could reuse general features like  process list, process creation, inbox and stuff like that from what is already written and just add another form of form rendering.
but as current implementation uses vaadin for all of those stuff, it is not easiy to  plug html based form generators like xforms or even forms in JSP.

So what I could do till now is render my form in FormPropertiesForm.setFormProperties function and show the form in a CustomLayout component.
But the problem is how to get the values from form. the only solution that I have found till now is to create a javascript callback function or a servlet in the server side and call the function using client side javascript with vaadin's mainWindow.executeJavaScript function.
This solution is advised by  Joonas lehtinen in https://vaadin.com/forum/-/message_boards/view_message/77379.

or maybe I have totally misundrestood ! where shall I get formProperties and render form ?

frederikherema1
Star Contributor
Star Contributor
Look how the component that renders the form is used… It gets a list of FormProperties passed somewhere. Trace back where that is called and you'll see how the properties are fethed from the API and passed on to the component rendering the properties.

smirzai
Champ on-the-rise
Champ on-the-rise
Hi
I have done that.
Form properties are read and put in a local variables in org.activiti.explorer.ui.process.ProcessDefinitionDetailPane.initProcessDefinitionInfo function for initial task and org.activiti.explorer.ui.task.TaskDetailPanel.initTaskForm  for the next tasks. Something like this:

    processDefinitionStartForm.setFormProperties(startFormData.getFormProperties());

The form rendering happens in org.activiti.explorer.ui.form.FormPropertiesComponent.setFormProperties function. here is the rendering:
public void setFormProperties(List<FormProperty> formProperties) {
    this.formProperties = formProperties;
   
    form.removeAllProperties();
   
    // Clear current components in the grid
    if(formProperties != null) {
      for(FormProperty formProperty : formProperties) {
        FormPropertyRenderer renderer = getRenderer(formProperty);
      
        Field editorComponent = renderer.getPropertyField(formProperty);
        if(editorComponent != null) {
          // Get label for editor component.
          form.addField(formProperty.getId(), editorComponent);
        }
      }
    }

renderer interface provides
Field getPropertyField(FormProperty formProperty)

it returns com.vaadin.ui.Field which is a vaadin component. So rendering is done by creating some vaadin components and add them to the form. The form is dynamically rendered using javascript by GWT.
so html generation could not be done directly. 
One workaround could be to generate the form somehow and put it in a CustomLayout vaadin component and send it to client to be rendered in client.

frederikherema1
Star Contributor
Star Contributor
There is really nothing I can think of, if you don't want to use vaadin for rendering your forms, but want to use vaading for everything else…

smirzai
Champ on-the-rise
Champ on-the-rise
back to title of the topic, It might be good to use more standard and already implemented way of form rendering like XForms.
The problem is that I cannot find an implementation of Xforms using Vaadin, on the other side there are lots of mature open source products that are able to render Xforms in server using HTML or render it in client using javascript or XSLT . Just an example Http://chiba.sourceforge.net

An XForm implementation in vaadin is what is lacking.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
don't use chiba, it is old, not realy maintained anymore etc… use its successor, http://www.betterform.de