Hi Bora get ready for a long email,
currently there's no documentation yet... that's ongoing but I can help you if you want.
We tried to simplify some parts on the new form engine to make it easy for users (the field bindings is one of them).
First change is that new forms must know the source what type of model they are are going to handle. The existing ones are:
- Data Object
- Process
- Task
This model is going to provide the properties which can be binded to fields (on Data Objects are the fields, on Process are the process variables and on Task Forms are the task variables) easy guess ;)
This change might look restrictive but it makes the forms engine safe in the sense that you cannot use by error a form for a wrong purpose (a DO form on a process or a Task form for a DO for example). That was possible on the old forms. Also that makes easy to handle any model change on the Form Editor, you can edit the DO and when opening the form on the Editor it will sync up your form with your model so the widgets present on the form are correct.
If you create a new Form (Preview) from the new button you'll see that appears a wizzard where you have to choose what is the model for the form DO (ant then select any DO on the project) or Business Process (and then choose any process on project and then if you want to use it as the starting form or a task form).
About the binding, we also simplified the binding strategy. The old forms had input and output bindings for each field, the reason for that is because they were basically used on jBPM. The problem is that having this kind of in/out for a DO form was kind of weird and it was possible to have wrong configurations. On the new forms engine each field has only one binding setting (no in/out) and you can select any of the model properties available that suits the field type (for example a variable which is a String could be binded to a TextBox but not to a DatePicker). This way the binding settings are far easy to configure and we can avoid problems at runtime.
In the case of a task form when a task has ins and outs, a field can only be binded to one variable, that means that if you want a field use it for input and output at same time, on the task settings, you should name both input and output with the same name, so no need to have something like "in_name" "out_name" on the task settings, using only the "name" on both in/out will be enough.
The forms engine can differenciate on runtime what fields are used for inputs/outpus/both in order to update the right values on the jBPM runtime.
Just mention that you can generate the process / task forms from the jBPM Designer selecting the Graphical Editor (Preview) on the popup and it will generate all the forms required (also nested forms if needed) with the right bindings, so you don't have to worry.
When editing a form on the editor, on the palette you'll see two groups of components you can drop to the form:
- Model fields: this are the properties available on the form model. When dropping them onto the form, they have a binding and some default values already filled. The form engine will choose the right widget for them based on the property type, but you can change it editing the field properties ;)
- Components Palette: here you can see all the form widgets available on the forms engine. If you drop them on the form they won't be binded to any property, but you can bind them by editing the field properties and changing the binding manually.
A nice feature here is that for Data Object forms on the field properties window the binding is a dropdown that lets the user choose only one of the available properties on the model. But for Task & Process forms the binding on the field properties window is a textbox where you can type any of the variables from the process/task or a non existing one, so the jBPM runtime will create dinamically a new variable for that field.
I'd like to say that at this stage the forms engine still doesn't have any formulas or validations engine (that's an ongoing development) but the good news is that forms do support Bean Validation to validate models (
http://beanvalidation.org/1.0/spec/) that means that if your project has the right dependencies to javax.validation & hibernate-validation modules you can use validation annotations on your Data Object fields like @NotEmpty, @NotNull, @Min, @Max... so the form will validate them before submit.
The new forms engine nowadays is more simple than old forms, but it's more robust, has a better UI and we made an effor to make it easy to use for non technical users and also make it hard to have wrong configurations on it so forms are always consitent. Or at least we tried ;)
We are also working on a migration tool to move old forms to new ones, but since there are still no parity of features we still have to guess how we can migrate some stuff. Probably we'll be providing incremental merges but depends on the demand.
If you have more doubts, issues, just let me know and I'll try to help as much as I can.
Well, sorry for this long email, if you readed it until the end just let me know and you'll have a free beer if you ever come to Barcelona ;)
Regards,
Pere
El dl., 20 de nov. 2017 a les 10:46, Bora (<
bo...@post.cz>) va escriure: