pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gk_br...@verizon.net>
Subject Re: TableView selectedRowChanged
Date Tue, 30 Nov 2010 15:49:58 GMT
Sounds about right. We can probably fix this by restoring the boolean isEditing() method to
the editor interfaces. We might also need to add an endEdit() method that takes a boolean
(representing whether the operation was cancelled or not). In that case, we might want to
rename edit() to beginEdit().

On Nov 30, 2010, at 10:41 AM, Chris Bartlett wrote:

> Firstly, I must state that I have only briefly examined the recent row editing changes,
so apologies if any of the below text is inaccurate.
> A quick look suggests that the problem is due to the row editor being open when another
call to RowEditor#edit(TableView, int, int) is made.
> That attempts to open the TableViewRowEditor and add a ContainerMouseListener, but one
is already there.
> The pre-existing ContainerMouseListeners would normally be removed in the TableViewRowEditor#close(boolean)
> I imagine that you are more likely to see this problem if you are using an edit effect
as this will prolong the time taken for the row editor window to close.
> I assume that you are using the provided org.apache.pivot.wtk.content.TableViewRowEditor
class for your RowEditor? 
> This extends Window, so you if you have a reference to it, you should be able to call
Window#isOpen() to first check to see if the editor is still open, and avoid opening another
> You could also explicitly call the Window#close() or Window#close(boolean)  methods and
wait for the window to close before opening the row editor on another row.
> You may find it useful to register a WindowStateListener on the TableViewRowEditor to
better track and control window closing.
> When trying to replicate this with the (unchanged) org.apache.pivot.tests.TableViewTest2
class from trunk, I was also able to produce another exception by rapidly left-clicking in
the TableView.
> java.lang.IndexOutOfBoundsException: index -1 out of bounds.
> at org.apache.pivot.collections.ArrayList.verifyIndexBounds(ArrayList.java:577)
> at org.apache.pivot.collections.ArrayList.get(ArrayList.java:346)
> at org.apache.pivot.wtk.TablePane$Row.get(TablePane.java:263)
> at org.apache.pivot.wtk.content.TableViewRowEditor$3.selectedIndexChanged(TableViewRowEditor.java:134)
> at org.apache.pivot.wtk.CardPane$CardPaneListenerList.selectedIndexChanged(CardPane.java:52)
> at org.apache.pivot.wtk.CardPane.setSelectedIndex(CardPane.java:93)
> at org.apache.pivot.wtk.skin.CardPaneSkin$1.transitionCompleted(CardPaneSkin.java:717)
> at org.apache.pivot.wtk.effects.Transition$1.run(Transition.java:52)
> at org.apache.pivot.wtk.ApplicationContext$QueuedCallback.run(ApplicationContext.java:1474)
> at java.awt.event.InvocationEvent.dispatch(Unknown Source)
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
> Regards,
> Chris
> On 30 November 2010 21:33, lello <rborrelli@gmail.com> wrote:
> Hi all,
> I have been trying to implement a tableview in which the row editor is
> called every time a row is selected (no need for a double click).
> The code I used is the following:
> myTableView.getTableViewSelectionListeners().add(new
> TableViewSelectionListener.Adapter() {
>                        @Override
>                        public void selectedRowChanged(TableView tv, Object o) {
>                                int row = tv.getSelectedIndex();
>                                tv.getRowEditor().edit(tv, row, 0);
>                        }
>                }
>                );
> The code seems to work. Indeed the row editor is called when I move with the
> cursor on the row.
> However, when I move "too fast", i get the following error:
> Duplicate listener org.apache.pivot.wtk.content.TableViewRowEditor$1@d2f5f1
> added to org.apache.pivot.wtk.Container$ContainerMouseListenerList@10c276
> java.lang.IllegalArgumentException: Component already has a parent.
>        at org.apache.pivot.wtk.TablePane$Row.insert(TablePane.java:199)
>        at org.apache.pivot.wtk.TablePane$Row.add(TablePane.java:187)
>        at
> org.apache.pivot.wtk.content.TableViewRowEditor.open(TableViewRowEditor.java:291)
>        at org.apache.pivot.wtk.Window.open(Window.java:585)
>        at
> org.apache.pivot.wtk.content.TableViewRowEditor.edit(TableViewRowEditor.java:182)
> Any help is appreciated,
> Lello
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/TableView-selectedRowChanged-tp1992938p1992938.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

View raw message