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 10:32:04 GMT
Hi Scott,

The test code you attached works for me -- I get the "Not supported yet."
exceptions in the console:

java.lang.UnsupportedOperationException: Not supported yet.
    at testRowEditor.edit(testRowEditor.java:7)
    at
org.apache.pivot.wtk.skin.terra.TerraTableViewSkin.mouseClick(TerraTableViewSkin.java:933)
    at
org.apache.pivot.wtk.Component$ComponentMouseButtonListenerList.mouseClick(Component.java:514)
    at org.apache.pivot.wtk.Component.mouseClick(Component.java:2580)
    at org.apache.pivot.wtk.Container.mouseUp(Container.java:793)
    at org.apache.pivot.wtk.Container.mouseUp(Container.java:778)
    at org.apache.pivot.wtk.Container.mouseUp(Container.java:778)
    at
org.apache.pivot.wtk.ApplicationContext$DisplayHost.processMouseEvent(ApplicationContext.java:864)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

There haven't been any updates to this part of the codebase in the past few
days, but just in case, you can try updating from SVN.  Is it possible that
your setup is sending System.err somewhere else, so you're just not seeing
the exceptions?

-T

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

> Attached is some test code that doesn't invoke an editor from a double
> click.
> All my code uses a database as the data source so I didn't know what to do
> other than use JSON table data. Hopefully that isn't stopping the editor
> from
> being invoked in this case. I have implemented a basic row editor just to
> see
> if it is being called, which it isn't.
>
> I haven't updated from SVN for a couple of days.
>
> On Tue, 8 Sep 2009 11:47:11 am Todd Volkert wrote:
> > 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