09-09-2012 04:44 AM
http://www.activiti.org/userguide/index.html#forms
http://forums.activiti.org/en/viewtopic.php?f=6&t=2366&p=10188&hilit=rendering#p10188
http://forums.activiti.org/en/viewtopic.php?f=9&t=1386&p=9332&hilit=rendering#p9332
https://vaadin.com/wiki/-/wiki/Main/Building%20Vaadin%20Applications%20on%20top%20of%20Activiti
http://forums.activiti.org/en/viewtopic.php?f=6&t=857&hilit=rendering
09-09-2012 02:44 PM
package org.activiti.explorer.ui.form;
….
public class LongFormPropertyRenderer extends AbstractFormPropertyRenderer {
public LongFormPropertyRenderer() {
super(LongFormType.class);
}
@Override
public Field getPropertyField(FormProperty formProperty) {
final TextField textField = new TextField(getPropertyLabel(formProperty));
textField.setRequired(formProperty.isRequired());
textField.setEnabled(formProperty.isWritable());
textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
if (formProperty.getValue() != null) {
textField.setValue(formProperty.getValue());
}
// Add validation of numeric value
textField.addValidator(new LongValidator("Value must be a long"));
textField.setImmediate(true);
return textField;
}
….
The validator:package org.activiti.explorer.ui.validator;
import com.vaadin.data.validator.AbstractStringValidator;
/**
* @author Frederik Heremans
*/
public class LongValidator extends AbstractStringValidator {
private static final long serialVersionUID = 8306001395582004472L;
public LongValidator(String errorMessage) {
super(errorMessage);
}
@Override
protected boolean isValidString(String value) {
try {
Long.parseLong(value);
return true;
} catch (Exception e) {
return false;
}
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.