@Inject public AddElementPanel( final Dispatcher dispatcher, EditorProvider editorProvider, Provider<ElementDialog> dialogProvider) { this.editorProvider = editorProvider; this.dialogProvider = dialogProvider; HBoxLayout layout = new HBoxLayout(); layout.setHBoxLayoutAlign(HBoxLayoutAlign.STRETCHMAX); layout.setPack(BoxLayoutPack.CENTER); layout.setPadding(new Padding(15)); setLayout(layout); add( createAddButton( I18N.CONSTANTS.addChart(), IconImageBundle.ICONS.barChart(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { addElement(new ChartTemplate(dispatcher)); } })); add( createAddButton( I18N.CONSTANTS.addTable(), IconImageBundle.ICONS.table(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { addElement(new PivotTableTemplate(dispatcher)); } })); add( createAddButton( I18N.CONSTANTS.addMap(), IconImageBundle.ICONS.map(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { addElement(new MapTemplate(dispatcher)); } })); add( createAddButton( I18N.CONSTANTS.addText(), IconImageBundle.ICONS.text(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { addElement(new TextReportElement()); } })); }
private void validate(FormField field) { String value = (String) workingInstance.get(field.getId()); FieldContainer container = containers.get(field.getId()); if (field.isRequired() && Strings.isNullOrEmpty(value)) { container.setInvalid(I18N.CONSTANTS.requiredFieldMessage()); } else { container.setValid(); } }
public CommentSection(int width, int height) { getFormLayout().setLabelAlign(LabelAlign.TOP); commentField = new TextArea(); commentField.setName("comments"); commentField.setFieldLabel(I18N.CONSTANTS.comments()); if (width > 0) { getFormLayout().setDefaultWidth(width); commentField.setWidth(width); } if (height > 0) { commentField.setHeight(height); } add(commentField); }
public AttributeForm() { binding = new FormBinding(this); final NumberField idField = new NumberField(); idField.setFieldLabel("ID"); idField.setReadOnly(true); binding.addFieldBinding(new FieldBinding(idField, "id")); add(idField); TextField<String> nameField = new TextField<String>(); nameField.setFieldLabel(I18N.CONSTANTS.name()); nameField.setMaxLength(AttributeDTO.NAME_MAX_LENGTH); binding.addFieldBinding(new OnlyValidFieldBinding(nameField, "name")); add(nameField); hideFieldWhenNull(idField); }