Ticket #1355 (closed defect: fixed)

Opened 12 months ago

Last modified 11 months ago

Table fires false ValueChangeEvents when contained properties are changed

Reported by: Matti Tahvonen Owned by: Joonas Lehtinen
Priority: blocker Milestone: User Interface Library 5.1.0 RC
Component: Server-side framework Version: 5.0.0-pre
Keywords: Cc: joonas.lehtinen@…
Known Issue description:
Hours estimate: Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: no
Known Issue workaround:
Affects release notes: yes Contract:

Description (last modified by Matti Tahvonen) (diff)

Table's valueChange(Property.ValueChangeEvent? event) function overrides the one in select. It is there to fire repaint when container property has changed (in action it is a column in table). The one in select notifies listeners that are interested in changes in selection and receive excessive amount of false value changes.

valueChange method should check if source is table itself or from container.

Tree and Select has similar problem.

Joonas, please review the becoming change.

Change History

Changed 12 months ago by Matti Tahvonen

Test case code:

        final Window main = new Window("Hello window");
        setMainWindow(main);

        final Table t = TestForTablesInitialColumnWidthLogicRendering
                .getTestTable(3, 3);

        t.setSelectable(true);

        t.addListener(new Table.ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                System.out.println("Value change");
                System.out.println(event.getProperty().getClass().toString());

            }
        });

        main.addComponent(t);

        main
                .addComponent(new Button(
                        "change (should update table content, but not fire value change from table)",
                        new ClickListener() {
                            public void buttonClick(ClickEvent event) {
                                IndexedContainer c = (IndexedContainer) t
                                        .getContainerDataSource();
                                Item i = c.getItem(c.getIdByIndex(0));
                                Iterator it = i.getItemPropertyIds().iterator();
                                it.next();
                                Object id = it.next();
                                i.getItemProperty(id).setValue("muutos");
                            }
                        }));

        main.addComponent(new Button("select first", new ClickListener() {
            public void buttonClick(ClickEvent event) {
                IndexedContainer c = (IndexedContainer) t
                        .getContainerDataSource();
                t.select(c.getIdByIndex(0));
                // t.setValue(c.getIdByIndex(0));
            }
        }));

        main.addComponent(new Button("restart", new ClickListener() {
            public void buttonClick(ClickEvent event) {
                close();
            }
        }));

Changed 12 months ago by Matti Tahvonen

  • owner changed from Matti Tahvonen to Joonas Lehtinen

fixed in [3664], joonas please review

Changed 12 months ago by Matti Tahvonen

  • description modified (diff)

not only fixed for table

Changed 11 months ago by Matti Tahvonen

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.