The stack trace suggests that the row editor is still being launched (via
the TableViewRowEditor.beginEdit() method) before the row editor window has
removed the ContainerMouseListener which is added in
TableViewRowEditor.open().

Are you using edit effects?  If so, do you still see the issue if you
disable the effects?  (My guess is it might still occur, but much less
frequently)

Can you please try to post a simple, complete example demonstrating the
problem? (Please refer to http://sscce.org for some useful guidelines.)
Just a simple GUI such as a Window containing a TableView and any relevant
custom code.  Feel free to base your example on any example or test code
from Pivot's own codebase.

Chris

On 1 December 2010 15:50, lello <[email protected]> wrote:

>
> Well...kind of working, I needed to press twice the down key, so I rewrote
> the keyPressed as
>
>
> public class MyRowEditor extends TableViewRowEditor {
>
>        @Override
>        public boolean keyPressed(int keyCode, Keyboard.KeyLocation kl) {
>                boolean consumed = false;
>                System.out.println("key pressed");
>                //if (keyCode == Keyboard.KeyCode.KEYPAD_DOWN || keyCode ==
> Keyboard.KeyCode.KEYPAD_UP) {
>                 if (keyCode == Keyboard.KeyCode.DOWN) {
>                        System.out.println("Down pressed");
>                        close(true);
>                        consumed = true;
>                        int index = getTableView().getSelectedIndex();
>                        getTableView().setSelectedIndex(index+1);
>                } else if (keyCode == Keyboard.KeyCode.UP) {
>                        System.out.println("UP pressed");
>                        close(true);
>                        consumed = true;
>                        int index = getTableView().getSelectedIndex();
>                        getTableView().setSelectedIndex(index-1);
>                }
>                return consumed;
>        }
> }
>
> I have also overridden the selectedRowChanged() method to check for
> isEditing and endEdit(), however, I still get the initial error:
>
> Duplicate listener
> org.apache.pivot.wtk.content.tableviewrowedito...@10ade7e
> added to org.apache.pivot.wtk.container$containermouselistenerl...@956254
> 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:301)
>         at org.apache.pivot.wtk.Window.open(Window.java:585)
>        at
>
> org.apache.pivot.wtk.content.TableViewRowEditor.beginEdit(TableViewRowEditor.java:182)
>
>
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/TableView-selectedRowChanged-tp1992938p1997773.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>

Reply via email to