pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: TableView In Place Editing
Date Tue, 08 Sep 2009 01:47:11 GMT
I know the table view's select mode must *not* beTableView.SelectMode.NONE.
Other than that, it should work out of the box.  If it still doesn't work,
can you post a simple test case so we can have a look?

Oh, one other thing that should have been in the previous email:
TableViewRowEditor uses data binding to populate the individual cell editor
components.  It defaults them all to text inputs and sets their text key to
the column name.  But you can change any cell's editor by putting the
desired editor component into the cell editors dictionary
(TableViewRowEditor.getCellEditors()).  It's then your responsibility to set
that component's bind key so it gets populated correctly when the editor
opens.  This is done in the row editor demo.

Thanks,
-T

On Mon, Sep 7, 2009 at 9:14 PM, Scott Lanham <lists@sael.com.au> wrote:

> Thanks Todd thats excellent.
>
> I can't get the TableView to go into edit mode using double click. I have
> set
> rowEditor with a TableViewRowEditor but nothing happens. Do I need to set a
> property somewhere to get it to work?
>
> On Tue, 8 Sep 2009 11:00:39 am Todd Volkert wrote:
> > Yep - this type of behavior is supported via the TableView.RowEditor
> > interface.  There are two stock editors available for you to use, or you
> > can implement your own.  The two stock ones are
> > org.apache.pivot.wtk.content.TableViewRowEditor and
> > org.apache.pivot.wtk.content.TableViewCellEditor.
> >
> > This isn't covered in the tutorials yet, so I'll do my best to describe
> how
> > it works here...
> >
> > You set a row editor on a table view using TableView.setRowEditor().
>  When
> > a row editor has been set, the table view's skin will respond to "edit
> > gestures" by invoking the edit() method of the editor.  Right now, the
> skin
> > responds to a double-click on the row.  Once the editor has been called
> to
> > edit, it is responsible for knowing when it should save() or cancel().
> > Note that you can register key press listeners on the table view and call
> > into the editor yourself if you want keyboard gestures to invoke the
> editor
> > as well.
> >
> > Now as to what the editor does behind the scenes...
> >
> > The table view isn't a container, so it can't contain list buttons or the
> > like -- and renderer's don't receive input.  So generally, editors will
> > open a popup over an individual cell or the entire row that makes it look
> > like the content of the row changed to input components.  Then when the
> > user finishes their edit, the editor closes the popup and updates the
> model
> > of the table view (tableView.getTableData().update(...)).
> >
> > The stock TableViewRowEditor opens a popup over the entire row in which
> the
> > user can edit all the cells before saving.  Each cell's editor component
> is
> > configurable (you can use a ListButton in one, a Spinner in another,
> etc.).
> > In fact, you can even set up some cells to use Labels (or disabled
> > TextInputs) if you don't want them to be editable.  You can see an
> example
> > of this editor in action by running the table view row editor demo
> > (org.apache.pivot.demos.roweditor.RowEditorDemo).
> >
> > The stock TableViewCellEditor opens a popup over an individual cell, and
> > that popup always contains a TextInput.  It's not as versatile as
> > TableViewRowEditor, but it's lighter and satisfies the common use case of
> > simple TextInput-based edits.
> >
> > If neither of these satisfied your needs and you had to write your own,
> I'd
> > study the two stock editors, because a lot of what you'd have to do would
> > be copy/paste from them :)
> >
> > Let me know if you have any more questions,
> > -T
> >
> > On Mon, Sep 7, 2009 at 8:37 PM, Scott Lanham <lists@sael.com.au> wrote:
> > > Hi,
> > >
> > > I am getting a little lost in how to do in place editing in a
> TableView.
> > > When
> > > a row is selected I need a ListButton to appear in some of the cells in
> > > place
> > > of the text that was being displayed. The ListButton is used to edit
> the
> > > cell.
> > > Is this possible?
> > >
> > > Thanks,
> > >
> > > Scott.
>
>

Mime
View raw message