use of com.extjs.gxt.ui.client.binding.FieldBinding in project activityinfo by bedatadriven.
the class DbEditor method showNewForm.
private FormDialogTether showNewForm(EntityDTO entity, FormDialogCallback callback) {
AbstractDesignForm form = createForm(entity);
form.getBinding().bind(entity);
form.getBinding().setStore(tree.getStore());
for (FieldBinding field : form.getBinding().getBindings()) {
field.getField().clearInvalid();
}
FormDialogImpl dlg = new FormDialogImpl(form);
dlg.setWidth(form.getPreferredDialogWidth());
dlg.setHeight(form.getPreferredDialogHeight());
dlg.setScrollMode(Style.Scroll.AUTOY);
if (entity instanceof IsActivityDTO) {
dlg.setHeadingText(I18N.CONSTANTS.newActivity());
} else if (entity instanceof AttributeGroupDTO) {
dlg.setHeadingText(I18N.CONSTANTS.newAttributeGroup());
} else if (entity instanceof AttributeDTO) {
dlg.setHeadingText(I18N.CONSTANTS.newAttribute());
} else if (entity instanceof IndicatorDTO) {
dlg.setHeadingText(I18N.CONSTANTS.newIndicator());
} else if (entity instanceof LocationTypeDTO) {
dlg.setHeadingText(I18N.CONSTANTS.newLocationType());
}
dlg.show(callback);
return dlg;
}
use of com.extjs.gxt.ui.client.binding.FieldBinding in project activityinfo by bedatadriven.
the class LocalDateBinding method create.
public static FieldBinding create(DateField dateField, String datePropertyName) {
FieldBinding binding = new FieldBinding(dateField, datePropertyName);
binding.setConverter(new Converter() {
@Override
public Object convertModelValue(Object value) {
if (value == null) {
return null;
} else {
return ((LocalDate) value).atMidnightInMyTimezone();
}
}
@Override
public Object convertFieldValue(Object value) {
if (value == null) {
return null;
} else {
Date dateValue = (Date) value;
return new LocalDate(dateValue);
}
}
});
return binding;
}
Aggregations