Vaadin 7 to Vaadin 8 issues

Hi Aleksander!

I’ve made this quick and dirty example that shows how to use Binder with ComboBox, you could do something similar with TwinColSelect:

    public static class City {
        private Integer id;
        private String name;
        public City() {
            id = new Double(Math.random()*100).intValue();
            name = new Double(Math.random()*100).toString();
        }
        public Integer getId() {
            return id;
        }
        public void setId(Integer id) {
            this.id = id;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }
    
    public static class Customer {
        private String name;
        private City city;
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public City getCity() {
            return city;
        }
        public void setCity(City city) {
            this.city = city;
        }
    }

    private void addBinderWithCombo(VerticalLayout vl) {
        Binder<Customer> binder = new Binder<>(Customer.class);
        ComboBox<City> cities = new ComboBox<>("Select City");
        cities.setItems(new City(),new City(),new City());
        cities.setItemCaptionGenerator(city->"City " + city.getName());
        binder.bind(cities, "city");
        Customer c = new Customer();
        binder.setBean(c);
        Button b = new Button("Show city");
        b.addClickListener(e->Notification.show("Selected City: " + c.getCity().getName()));
        vl.addComponents(cities,b);
    }

Regarding point 2), what do you mean with “without ValoTheme internal calculations”? … you should use the method
addStyleName()
and then just create a css class and style the panel with properties such as color and background color.
Regarding your issue 4), I think you’re referring to 3) (
“issues 1) and 4) had been resolved. Thanks”
). It’s strange that the indicator is shown different than other fields, can you try upgrading to a newer Vaadin version? … maybe that’s resolved …
Regards!

Hi Martin,


thanks for your answer. Let’s go to the issues. By the way, I now use the latest version of Vaadin, 8.3.0.

  1. I revisited yor code (and tried also) and, if I understand it the right way, it is not what I need or do.
    I need Binder to work with Validator

[code]

[code]
Now I use hidden TextField as "workaround" to be able to pass the "missing
[/code][font=Arial]
[code]
 
[/code]field" situation from ComboGroup to Binder/Validator and .forField  excepts only TextField.
[/font]
[/code]

permissionBinder.forField(txtGroupHidden)
 .withValidator(
 group -> !group.equals(""),
 setMessageError("Name of the Group", MessageError.FIELD_MANDATORY))
 .bind(Security::getGroup, Security::setGroup);
[/code]

.
.
[code]
BinderValidationStatus status = permissionBinder.validate();
[/code]
.  

 
2) If I understand the Valo Theme documentation,Valo maintain the contrast ration in panel's caption.
    if I put the caption font darker, the background become more clearer. 
    I was able to do only this like I wanted.

.[code]
v-panel-caption-mypanelstyle {   
    font-weight: bold;
    text-align: center;              
  }

Panel panel = new Panel("Title");
panel.addStyleName("mypanelstyle");
  1. Here I refer my self to 3) CheckBox Component where “RequiredIndicatorVisible(true)” has
    no efect. I don’t know, why. Therefore I added my style (::after …)

That’s all for now. I hope you understand what I want to achieve.

Regards,
Aleksander

Hi Aleksander!

  1. It seems that there was a problem with the markup, and I don’t understand this part. You “need Binder to work with Validator”, but Binder indeed works correctly with validator. I don’t understand what you want to achieve in this part.
  2. Yes, you’re right in this, there are some Valo calculations taking place, but you should be able to overwrite that by creating a custom css class, and using addStyleName(). It’s not clear to me if you were able to overcome this.
  3. This could be a bug, the best would be to
    create an issue
    with a snippet or simple test project that reproduces the problem so it could be fixed.

Regards!

Java 8
Vaadin 8.3.1

Hi Martin,

  1. As you can see in the attached snapshot (formPermisosInit) I made a simple Permition Form where
    every field is disabled if no “Usuario” is selected. When I choose one, appear the situation like
    shown in the snapshot (formPermisosUserNoPermitions).
    If, for example, the chosen user does not have any permition, clicking “Guardar” Button the error
    message appears (snapshot “formPermisosErrorMessage”). But as Binder only works with Field
    types, I did it a “workaround” using hidden textfield fox each combobox and TwinColSelect which I pass it to the Binder. I hope that now is clearer what I want to do.

1b) And I have another problem with Binder. When the user is saved or I select “No user”, the form is being cleaned. The side efect I get is that Binder is triggered and of course the textfields are marked as if there wouldn’t be any data, what is true, but I don’t want the evaluation to ocurr at this point. Only when I want to save the data. (see “formPermisosErrorIndicatorNoData”)

  1. I posponed this for now, first I want to finish the programm.
  2. I made a test in another small Vaadin project and I can confirm that the “Indicator” does not appear.
    It works with CheckBoxGroup where the Caption and the items are separated.

Regards,
Aleksander

42601.jpg
42602.jpg
42603.jpg
42604.jpg