private static List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) { final List<AbstractField<?>> components = new ArrayList<>(); final Iterator<Component> iterate = abstractLayout.iterator(); while (iterate.hasNext()) { final Component c = iterate.next(); if (c instanceof AbstractLayout) { components.addAll(getAllComponents((AbstractLayout) c)); } if (c instanceof AbstractField) { components.add((AbstractField<?>) c); } if (c instanceof FlexibleOptionGroupItemComponent) { components.add(((FlexibleOptionGroupItemComponent) c).getOwner()); } if (c instanceof TabSheet) { final TabSheet tabSheet = (TabSheet) c; components.addAll(getAllComponentsFromTabSheet(tabSheet)); } } return components; }
protected AbstractPrototypeComponent(final AbstractPrototypeComponent component, final AbstractLayout container) { super(); if (null == component) { this.parent = this; } else { this.parent = component; } this.layout = container; ComponentOperations.establishLayout(this, this.layout); setCompositionRoot(this.layout); }
public static void establishLayout(final AbstractPrototypeComponent component, final AbstractLayout layout) { assert null != layout : "Parameter 'layout' of method 'establishLayout' must not be null"; assert null != layout : "Parameter 'layout' of method 'establishLayout' must not be null"; layout.setSizeFull(); if (layout instanceof GridLayout) { ((GridLayout) layout).setSpacing(true); //NOPMD ((GridLayout) layout).setMargin(true); //NOPMD } component.setSizeFull(); if (layout instanceof AbstractOrderedLayout) { ((AbstractOrderedLayout) layout).setMargin(new MarginInfo(true, false, false, false)); ((AbstractOrderedLayout) layout).setSpacing(true); //NOPMD component.setSizeUndefined(); } }
protected AbstractLayout buildUploadLayout() { FormLayout layout = new FormLayout(); layout.setMargin(true); groupField = new TextField("Group"); groupField.setWidth(100, Unit.PERCENTAGE); groupField.setRequired(true); layout.addComponent(groupField); nameField = new TextField("Name"); nameField.setWidth(100, Unit.PERCENTAGE); nameField.setRequired(true); layout.addComponent(nameField); versionField = new TextField("Version"); versionField.setWidth(100, Unit.PERCENTAGE); versionField.setRequired(true); layout.addComponent(versionField); return layout; }
public AbstractLayout buildEditor(ValidatingFieldGroup<TblExample> validatingFieldGroup) { VerticalLayout main = new VerticalLayout(); MultiColumnFormLayout<TblExample> layout = new MultiColumnFormLayout<TblExample>(1, validatingFieldGroup); layout.setColumnFieldWidth(0, 250); TopVerticalLayout wrapper = new TopVerticalLayout(); wrapper.addComponent(layout); main.addComponent(wrapper); layout.bindTextField("Name", "name"); layout.bindTextField("Host", "host"); layout.bindTextField("Schema", "schema"); layout.bindTextField("Username", "username"); layout.bindPasswordField("Password", "password"); return main; }
public TextField bindTextFieldWithButton(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, String fieldName, Button button) { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); TextField field = new SplitTextField(fieldLabel); field.setWidth("100%"); field.setImmediate(true); field.setNullRepresentation(""); field.setNullSettingAllowed(false); field.setId(fieldLabel.replace(" ", "")); addValueChangeListeners(field); doBinding(group, fieldName, field); layout.addComponent(field); layout.addComponent(button); layout.setExpandRatio(field, 2); form.addComponent(layout); return field; }
public ComboBox bindEnumField(ComboBox comboBox, AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, String fieldName, Class<?> clazz) { ComboBox field = comboBox; field.setCaption(fieldLabel); field.setContainerDataSource(createContainerFromEnumClass(fieldName, clazz)); field.setItemCaptionPropertyId(fieldName); // field.setCaption(fieldLabel); field.setNewItemsAllowed(false); field.setNullSelectionAllowed(false); field.setTextInputAllowed(true); field.setWidth(STANDARD_COMBO_WIDTH); field.setPopupWidth("100%"); field.setImmediate(true); field.setId(fieldLabel.replace(" ", "")); addValueChangeListeners(field); doBinding(group, fieldName, field); form.addComponent(field); return field; }
@Override protected AbstractLayout buildEditor(final ValidatingFieldGroup<LoginAttempt> fieldGroup2) { final VerticalLayout layout = new VerticalLayout(); final SMMultiColumnFormLayout<LoginAttempt> overviewForm = new SMMultiColumnFormLayout<LoginAttempt>(1, this.fieldGroup); overviewForm.setColumnLabelWidth(0, 120); overviewForm.setColumnFieldWidth(0, 280); overviewForm.setSizeFull(); overviewForm.getFieldGroup().setReadOnly(true); overviewForm.bindTextField("User", new Path(LoginAttempt_.user, User_.username).getName()); overviewForm.newLine(); overviewForm.bindDateField("Attempt Time", LoginAttempt_.dateOfAttempt, "yyyy-MM-dd hh:mm", Resolution.MINUTE); overviewForm.newLine(); overviewForm.bindBooleanField("Succeeded", LoginAttempt_.succeeded); overviewForm.newLine(); layout.addComponent(overviewForm); return layout; }
@Override protected AbstractLayout buildEditor(final ValidatingFieldGroup<SessionHistory> fieldGroup2) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); final SMMultiColumnFormLayout<SessionHistory> overviewForm = new SMMultiColumnFormLayout<SessionHistory>(1, this.fieldGroup); overviewForm.setColumnLabelWidth(0, 70); overviewForm.setColumnFieldWidth(0, 280); overviewForm.setSizeFull(); overviewForm.getFieldGroup().setReadOnly(true); overviewForm.bindTextField("User", new Path(SessionHistory_.user, User_.username).getName()); overviewForm.newLine(); overviewForm.bindDateField("Start Time", SessionHistory_.start, "yyyy-MM-dd hh:mm", Resolution.MINUTE); overviewForm.newLine(); overviewForm.bindDateField("End Time", SessionHistory_.end, "yyyy-MM-dd hh:mm", Resolution.MINUTE); overviewForm.newLine(); layout.addComponent(overviewForm); return layout; }
@Override protected AbstractLayout buildEditor(final ValidatingFieldGroup<TaskStatus> fieldGroup2) { final VerticalLayout layout = new VerticalLayout(); this.overviewForm = new SMMultiColumnFormLayout<TaskStatus>(2, this.fieldGroup); this.overviewForm.setColumnFieldWidth(0, 280); this.overviewForm.setColumnLabelWidth(0, 70); this.overviewForm.setSizeFull(); this.overviewForm.bindTextField("Nanme", TaskStatus_.name); this.overviewForm.newLine(); this.overviewForm.bindTextField("Description", TaskStatus_.description); this.overviewForm.newLine(); layout.addComponent(this.overviewForm); return layout; }
private AbstractLayout buildExistingRaffleLayout(final Raffle raffle) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); final RaffleDao daoRaffle = new DaoFactory().getRaffleDao(); this.raffleField = new ComboBox(); this.raffleField.setContainerDataSource(daoRaffle.createVaadinContainer()); // raffleField.setConverter(Raffle.class); this.raffleField.setItemCaptionPropertyId(Raffle_.name.getName()); this.raffleField.setRequired(true); this.raffleField.setNullSelectionAllowed(false); this.raffleField.setValue(raffle.getId()); layout.addComponent(this.raffleField); return layout; }
@Override protected AbstractLayout buildEditor(final ValidatingFieldGroup<TaskType> fieldGroup2) { final VerticalLayout layout = new VerticalLayout(); this.overviewForm = new SMMultiColumnFormLayout<TaskType>(2, this.fieldGroup); this.overviewForm.setColumnFieldWidth(0, 280); this.overviewForm.setColumnLabelWidth(0, 70); this.overviewForm.setSizeFull(); this.overviewForm.bindTextField("Name", TaskType_.name); this.overviewForm.newLine(); this.overviewForm.bindTextField("Description", TaskType_.description); this.overviewForm.newLine(); layout.addComponent(this.overviewForm); return layout; }
@Override protected AbstractLayout buildEditor(final ValidatingFieldGroup<Tag> fieldGroup2) { final VerticalLayout layout = new VerticalLayout(); this.overviewForm = new SMMultiColumnFormLayout<Tag>(2, this.fieldGroup); this.overviewForm.setColumnFieldWidth(0, 280); this.overviewForm.setColumnLabelWidth(0, 80); this.overviewForm.setSizeFull(); this.overviewForm.getFieldGroup().setReadOnly(true); this.overviewForm.bindTextField("Nanme", Tag_.name); this.overviewForm.newLine(); this.overviewForm.bindTextField("Description", Tag_.description); this.overviewForm.newLine(); this.builtin = this.overviewForm.bindBooleanField("Built In", Tag_.builtin); this.builtin.setReadOnly(true); this.overviewForm.newLine(); this.detachable = this.overviewForm.bindBooleanField("Detachable", Tag_.detachable.getName()); this.overviewForm.newLine(); layout.addComponent(this.overviewForm); return layout; }
public <T extends BaseEntity, L> TokenField bindTagField(final AbstractLayout form, final FieldGroup group, final Selected<T> selected, final String fieldLabel, final String fieldName) { final TokenField field = new SplitTagField<T>(fieldLabel, false); field.setWidth("100%"); // width... field.setInputWidth("100%"); // and input width separately field.setFilteringMode(FilteringMode.CONTAINS); // suggest field.setTokenCaptionPropertyId(Tag_.name.getName()); field.setInputPrompt("Enter one or more comma separated tags"); field.setRememberNewTokens(false); // we can opt to do this ourselves field.setImmediate(true); if (group != null) { group.bind(field, fieldName); } form.addComponent(field); return field; }
private static List<AbstractField<?>> getAllComponentsFromTabSheet(final TabSheet tabSheet) { final List<AbstractField<?>> components = new ArrayList<>(); for (final Iterator<Component> i = tabSheet.iterator(); i.hasNext();) { final Component component = i.next(); if (component instanceof AbstractLayout) { components.addAll(getAllComponents((AbstractLayout) component)); } } return components; }
@Override protected void defineWithin(final AbstractLayout container) { ComponentOperations.addComponents(container, this.progressor, this.status); //NOPMD this.progressor.setSizeFull(); this.status.setValue(Constants.HAS_NOT_STARTED); }
@Override protected void defineWithin(final AbstractLayout container) { if (container instanceof HorizontalLayout) { ((HorizontalLayout) container).setSpacing(true); //NOPMD ((HorizontalLayout) container).setMargin(new MarginInfo(true, false, true, false)); } ComponentOperations.addComponents(container, this.labelUpperBound, this.txtfUBound); //NOPMD }
@Override protected void defineWithin(final AbstractLayout container) { super.defineWithin(container); ComponentOperations.addComponents(container, this.inUserStory, this.userStoryToolbar, this.outcomeUserStory, new EnvironmentStatusbar(this)); }
@Override protected void defineWithin(final AbstractLayout container) { this.txta4Result.setEnabled(false); this.txta4Result.setSizeFull(); setSizeFull(); ComponentOperations.addComponents(container, this.txta4Result); //NOPMD }
public static void addComponents(final AbstractLayout layout, final AbstractComponent... components) { if (null == layout || null == components) { LoggerFactory.getLogger(ComponentOperations.class).warn("'layout' and 'components' both should not be null"); //NOPMD return; } layout.addComponents(components); }
@Override protected void defineWithin(final AbstractLayout container) { assert null != container : "Parameter 'container' of method 'defineWithin' must not be null"; ComponentOperations.addComponents(container, (UIWorkProgressTracker) this.tracker); //NOPMD }
public EmailDetailPanel(Attachment attachment) { setSizeFull(); ((AbstractLayout) getContent()).setMargin(true); ((SpacingHandler) getContent()).setSpacing(true); addStyleName(Reindeer.PANEL_LIGHT); this.attachment = attachment; this.i18nManager = ExplorerApp.get().getI18nManager(); this.taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); gridLayout = new GridLayout(2, 4); gridLayout.setSpacing(true); addComponent(gridLayout); InputStream contentStream = taskService.getAttachmentContent(attachment.getId()); // TODO: Error handling JSONObject emailJson = new JSONObject(new JSONTokener(new InputStreamReader(contentStream))); String html = emailJson.getString(Constants.EMAIL_HTML_CONTENT); String subject = emailJson.getString(Constants.EMAIL_SUBJECT); String recipients = emailJson.getString(Constants.EMAIL_RECIPIENT); String sentDate = emailJson.getString(Constants.EMAIL_SENT_DATE); String receivedDate = emailJson.getString(Constants.EMAIL_RECEIVED_DATE); // Add subject addSimpleRow(Messages.EMAIL_SUBJECT, subject); addSimpleRow(Messages.EMAIL_RECIPIENTS, recipients); addSimpleRow(Messages.EMAIL_SENT_DATE, sentDate); addSimpleRow(Messages.EMAIL_RECEIVED_DATE, receivedDate); // Add HTML content addHtmlContent(html); }
private void initLayout(){ setMargin(true); setSpacing(true); // vaadin table grid = new Grid<Customer>(Customer.class); grid.setDataProvider(mongodbContainer); // set columns grid.setColumnOrder(mongodbContainer.PROPERTIES); grid.setSelectionMode(SelectionMode.SINGLE); grid.setWidth("100%"); grid.setHeight("300px"); // table select listener grid.addSelectionListener(event -> { selectedCustomer = event.getFirstSelectedItem().get(); selectedId = selectedCustomer.getId(); LOG.info("Selected item id {"+ selectedId+"}"); }); // button bar final AbstractLayout buttonBar = initButtonBar(); buttonBar.setWidth("100%"); // edit Form editForm.setVisible(false); addComponent(grid); addComponent(buttonBar); addComponent(editForm); }
private AbstractLayout initButtonBar() { final HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.setSpacing(true); final Button addButton = new Button("Add entry", event -> editForm.setVisible(true)); editButton = new Button("Edit Entry", event -> editSelectedEntry()); ConfirmDialogListener confirmDialogListener = new ConfirmDialogListener() { @Override public void yes() { removeSelectedEntry(); } @Override public void no() { // do nothing } }; deleteButton = new Button("Delete entry", event -> { ConfirmDialog confirmDialog = new ConfirmDialog("Delete Entry?", true, confirmDialogListener); UI.getCurrent().addWindow(confirmDialog); }); buttonBar.addComponent(addButton); buttonBar.addComponent(editButton); buttonBar.addComponent(deleteButton); buttonBar.setComponentAlignment(addButton, Alignment.MIDDLE_LEFT); buttonBar.setComponentAlignment(editButton, Alignment.MIDDLE_CENTER); buttonBar.setComponentAlignment(deleteButton, Alignment.MIDDLE_RIGHT); return buttonBar; }
protected void addHeader(String caption) { HorizontalLayout componentHeaderWrapper = new HorizontalLayout(); componentHeaderWrapper.setMargin(new MarginInfo(false, false, false, true)); Label componentHeader = new Label(caption); componentHeader.addStyleName(ValoTheme.LABEL_H3); componentHeader.addStyleName(ValoTheme.LABEL_COLORED); componentHeaderWrapper.addComponent(componentHeader); ((AbstractLayout)getContent()).addComponent(componentHeaderWrapper); }
public AbstractLayout createTabData(Table table) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSizeFull(); layout.addComponent(table); layout.setExpandRatio(table, 1); return layout; }
protected AbstractLayout createButtonLayout() { Button saveButton = CommonUiUtils.createPrimaryButton("Save", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { save(); UI.getCurrent().removeWindow(SettingsDialog.this); } }); return buildButtonFooter(new Button("Cancel", new CloseButtonListener()), saveButton); }
protected AbstractLayout create(AbstractMetaDataTableCreator creator) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSizeFull(); layout.setData(creator); return layout; }
public FormHelper(AbstractLayout form, ValidatingFieldGroup<E> group) { // I'm actually using this without a field group. // need to makes some modifications so that we formally support // non-group usage. // Preconditions.checkNotNull(group, // "ValidatingFieldGroup can not be null"); this.form = form; this.group = group; }
public <M> TextField bindTextField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, SingularAttribute<E, M> member) { TextField field = bindTextField(form, group, fieldLabel, member.getName()); this.fieldList.add(field); return field; }
public TextField bindTextField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, String fieldName) { TextField field = new SplitTextField(fieldLabel); field.setWidth("100%"); field.setImmediate(true); field.setNullRepresentation(""); field.setNullSettingAllowed(false); field.setId(fieldLabel.replace(" ", "")); addValueChangeListeners(field); doBinding(group, fieldName, field); form.addComponent(field); return field; }
public <M> PasswordField bindPasswordField(AbstractLayout form, FieldGroup group, String fieldLabel, SingularAttribute<E, M> member) { PasswordField field = bindPasswordField(form, group, fieldLabel, (member != null ? member.getName() : null)); this.fieldList.add(field); return field; }
public PasswordField bindPasswordField(AbstractLayout form, FieldGroup group, String fieldLabel, String fieldName) { PasswordField field = new SplitPasswordField(fieldLabel); field.setWidth("100%"); field.setImmediate(true); field.setNullRepresentation(""); field.setNullSettingAllowed(false); field.setId(fieldLabel.replace(" ", "")); addValueChangeListeners(field); doBinding(group, fieldName, field); form.addComponent(field); return field; }
public <M> TextArea bindTextAreaField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, SingularAttribute<E, M> member, int rows) { TextArea field = bindTextAreaField(form, group, fieldLabel, member.getName(), rows); this.fieldList.add(field); return field; }
public TextArea bindTextAreaField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, String fieldName, int rows) { TextArea field = new SplitTextArea(fieldLabel); field.setRows(rows); field.setWidth("100%"); field.setImmediate(true); field.setNullRepresentation(""); addValueChangeListeners(field); doBinding(group, fieldName, field); form.addComponent(field); return field; }
public <M> DateField bindDateField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, SingularAttribute<E, M> member, String dateFormat, Resolution resolution) { DateField field = bindDateField(form, group, fieldLabel, member.getName(), dateFormat, resolution); this.fieldList.add(field); return field; }
public DateField bindDateField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, String fieldName, String dateFormat, Resolution resolution) { DateField field = new SplitDateField(fieldLabel); field.setDateFormat(dateFormat); field.setResolution(resolution); field.setImmediate(true); field.setWidth("100%"); addValueChangeListeners(field); doBinding(group, fieldName, field); form.addComponent(field); return field; }
public Label bindLabel(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel) { Label field = new SplitLabel(fieldLabel); field.setWidth("100%"); form.addComponent(field); return field; }
public <M> ComboBox bindEnumField(AbstractLayout form, ValidatingFieldGroup<E> group, String fieldLabel, SingularAttribute<E, M> member, Class<?> clazz) { ComboBox field = bindEnumField(form, group, fieldLabel, member.getName(), clazz); this.fieldList.add(field); return field; }