use of org.activityinfo.ui.client.input.view.field.FieldView in project activityinfo by bedatadriven.
the class FormPanel method updateView.
public void updateView(FormInputViewModel viewModel) {
this.viewModel = viewModel;
deleteButton.setEnabled(!viewModel.isLocked());
// Update Field Views
for (FieldView fieldView : fieldViews) {
fieldView.updateView(viewModel);
}
// Update Subforms
for (RepeatingSubFormPanel subFormView : repeatingSubForms) {
subFormView.updateView(viewModel.getSubForm(subFormView.getFieldId()));
}
for (KeyedSubFormPanel subFormView : keyedSubFormPanels) {
subFormView.updateView(viewModel.getSubForm(subFormView.getFieldId()));
}
}
use of org.activityinfo.ui.client.input.view.field.FieldView in project activityinfo by bedatadriven.
the class FormPanel method addField.
private void addField(FormTree.Node node, FieldWidget fieldWidget) {
Label fieldLabel = new Label(node.getField().getLabel());
fieldLabel.addStyleName(InputResources.INSTANCE.style().fieldLabel());
HTML validationMessage = new HTML();
validationMessage.setVisible(false);
CssFloatLayoutContainer fieldPanel = new CssFloatLayoutContainer();
fieldPanel.setStyleName(InputResources.INSTANCE.style().field());
fieldPanel.add(fieldLabel, new CssFloatLayoutContainer.CssFloatData(1));
fieldPanel.add(fieldWidget, new CssFloatLayoutContainer.CssFloatData(1, new Margins(5, horizontalPadding, 5, horizontalPadding)));
if (!Strings.isNullOrEmpty(node.getField().getDescription())) {
Label descriptionLabel = new Label(node.getField().getDescription());
descriptionLabel.addStyleName(InputResources.INSTANCE.style().fieldDescription());
fieldPanel.add(descriptionLabel, new CssFloatLayoutContainer.CssFloatData(1));
}
fieldPanel.add(validationMessage, new CssFloatLayoutContainer.CssFloatData(1));
panel.add(fieldPanel, new CssFloatLayoutContainer.CssFloatData(1, new Margins(10, horizontalPadding, 10, horizontalPadding)));
fieldViews.add(new FieldView(node.getFieldId(), fieldWidget, validationMessage));
}
Aggregations