Yet another newcomer question about Buffered interface and Table component

First of all, let me say that in case of all previous issues forum search was enough…but not with this one. So I need a little push :slight_smile:

I’m having big time issues trying to understand and use commit, discard, setReadOnly and setWriteThrough methods (I digged through relevant chapters in
Book of Vaadi
n and
Learning Vadin
, just to mention that).

Thing is that I’m using Table / Bean Container / extended DefaultFieldFactory stack combined with excellent Wizards for Vaadin add-on
http://vaadin.com/directory#addon/wizards-for-vaadin
.

Typically, I want to keep my data selected in table after I navigate back and forth wizard steps…unfortunately, It is not the case now (see snapshots below ).

Relevant parts of code:

Now, these are my thoghts:

  1. I must be doing something wrong with Buffered methods commit / discard / setReadOnly / setWriteThrough,
    or

  2. Buffered interface can’t be used for this purposes, and I need to find different way to solve my issue (create some helper / memo class in order to hold data from table, etc).

Any help will be appreciated :smiley:


http://imageshack.us/photo/my-images/42/snapshot1qj.png


http://imageshack.us/photo/my-images/214/snapshot2ja.png


http://imageshack.us/photo/my-images/412/snapshot3b.png

When setWriteThrough(true) has been called the changes are reflected to underlying data source without commit i.e. the field is in auto commit mode. Are you perhaps initializing your data source by accident or doing something else strange in WizardStep.getContent().

Are you by any chance instantiating the Table inside the
getContent()
method? That would explain why it is always reset when you navigate back. Instead you should store a reference to the Table and always return the same instance from the
getContent()
method.

See for example the
LastStep.java
from the demo application sources. The
layout
instance variable is initialized the first time the
getContent()
method is called and after that the same instance is always returned.

Exactly…It was so obvious, but I overlooked. Shame on me :*)

Mental note to myself: always try to put few breakpoints in Eclipse and debug
prior
posting new thread to forum :what:

Thanks Teemu and Johannes !
Much appreciated !