Hi,
Ok, this time I won't speak with empty hands, but I will also need some help. For this proposal, I am using Activiti 5-16-SNAPSHOT from the Git repository.
I think the best way to solve this problem is modifying the "org.activiti.explorer.ui.form.FormPropertyRenderer" interface. To enable each renderer to know in which form it is, and through the form enquire about any other field it needs. This way, sequential dependencies could be solved in a easy form.
<java>// Comments removed
public interface FormPropertyRenderer extends Serializable {
/// … … original interface code …. …. …
public com.vaadin.ui.Form getForm();
public void setForm(com.vaadin.ui.Form p_form);
}</java>
Of course, a modification in the implementing class (org.activiti.explorer.ui.form.AbstractFormPropertyRenderer) will be necessary:
<java>/// Coments removed
public abstract class AbstractFormPropertyRenderer implements FormPropertyRenderer {
/// … … original class code …. …. …
public com.vaadin.ui.Form getForm() {
return theForm;
}
public void setForm(com.vaadin.ui.Form p_form) {
theForm = p_form;
}
transient private com.vaadin.ui.Form theForm = null;
}</java>
I declared theForm transient to prevent any other modification.
Lastly, the only needed change that remains is where do we set the form, i think the right place is in the class org.activiti.explorer.ui.form.FormPropertiesComponent , in the method "setFormProperties", just after recovering the renderer:
<java>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);
/// Proposal
/// Be able to get the Form from any Renderer.
/// this enables widget interdependence programing (cascading comboboxes, for example)
renderer.setForm(form);
Field editorComponent = renderer.getPropertyField(formProperty);
if(editorComponent != null) {
// Get label for editor component.
form.addField(formProperty.getId(), editorComponent);
}
}
}
}</java>
Counting with that in the activiti-explorer jar library, a custom renderer could use its getForm() method, and then through this instance to use any of the Vaadin methods to enquire about other fields in the form.
Please let me know if you approve this as the owners of the product to submit the code.
Regards,
Eduardo Yánez.