vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

Grid Editor opens crashes for new items in multi-select #7906

Open vaadin-bot opened 8 years ago

vaadin-bot commented 8 years ago

Originally by fgrazi


The problem occurs when client code adds an item to the container and immediately edits it but only if the grid is in multi-select mode (took some time to understand bug conditions). To reproduce simply try the class below:


package com.fga-software.mypackage.views;

import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.Button;
import com.vaadin.ui.Grid;
import com.vaadin.ui.VerticalLayout;

public class TestView extends VerticalLayout implements View {

  public static final String VIEW_NAME = "test";

  private final BeanItemContainer<Person> container;
  private final Grid grid;

  public TestView() {
    setSpacing(true);
    setMargin(true);
    addComponent(new InsertButton());
    container = new BeanItemContainer<>(Person.class);
    grid = new Grid(container);

    //NOTE if you change to single selection mode works fine
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.setFrozenColumnCount(1);
    addComponent(grid);
    grid.setSizeFull();
    grid.setEditorEnabled(true);
  }

  @Override
  public void enter(ViewChangeListener.ViewChangeEvent event) {
  }

  private class InsertButton extends Button {

    public InsertButton() {
      super("Add a person");
      addClickListener((ClickEvent event) -> {
        Person p = new Person();
        container.addBean(p);
        grid.editItem(p);
      });
    }

  }

  public static class Person {

    String FirstName # "Richard", lastName"Nixon";

    public String getFirstName() {
      return FirstName;
    }

    public void setFirstName(String FirstName) {
      this.FirstName = FirstName;
    }

    public String getLastName() {
      return lastName;
    }

    public void setLastName(String lastName) {
      this.lastName = lastName;
    }

  }

}

then change selection mode to single and everything works fine.


Imported from https://dev.vaadin.com/ issue #20452

stale[bot] commented 6 years ago

A lot of tickets have been left hanging in the issue tracker through the years. Some of them are still relevant, some of them have been fixed a long time ago and some are no longer valid. To get a better look on what is important and still relevant, we are closing old tickets which have not been touched in a long time. No further work will be done on this ticket. If the ticket seems to be still actual, please verify the problem existence over latest framework version and then open a new ticket in vaadin/framework with all the suitable information.

stale[bot] commented 4 years ago

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!