David, Around a year ago there were a number of changes made to TableViewRowEditor its usage. It went through a few different designs in a short period of time in order to accommodate use cases like yours. From memory I couldn't tell you where the design ended up or whether it should actually be considered a final design, but it wouldn't surprise me if the changes were not mirrored to the ListView & TreeView components. In general, a change to any one of TableView, ListView or TreeView might need to be repeated for the other two in order to maintain consistency, so your observations sound plausible.
This is one old thread that might be relevant http://apache-pivot-users.399431.n3.nabble.com/TableView-selectedRowChanged-tp1992938p1992938.html Chris On 21 December 2011 06:48, David Keen <[email protected]> wrote: > Hi, > > > > I have implemented a subclass of TableViewRowEditor which doesn’t allow the > user to close the editor if the input is not valid (along the lines of > http://apache-pivot-users.399431.n3.nabble.com/TextInput-and-Validator-issues-tp2641141p2648160.html). > > > > I have been attempting to do the same with a ListViewItemEditor and found > what looks like a bug. I didn’t subclass the editor as it would require me > to override nearly every method, so I just copied the code into my own > class. > > > > The issue is that I can open the item for editing but can’t stop the editor > from closing if the input is invalid. Pressing enter or escape is fine – > the editor remains open and focussed, but I’m not prevented from clicking > anywhere else with the mouse (editor still remains open, but not focussed). > > > > Having a look at the code, I believe the issue is in the mouseDown method of > displayMouseHandler. When I changed the code there to mirror that of > TableViewRowEditor, the issue is resolved for me. It looks like the mouse > click is not consumed when it should be. > > > > As an aside, there were 2 commits (revisions 1041913 and 1079009) which > changed this code in TableViewRowEditor to the current code. Looking > briefly at TreeViewNodeEditor leads me to suspect that it too would benefit > from this fix (although I haven’t used it so can’t confirm that). > > > > So the fix that I did was to change this: > > > > @Override > > public boolean mouseDown(Container container, Mouse.Button button, > int x, int y) { > > Display display = (Display)container; > > Window window = (Window)display.getComponentAt(x, y); > > > > if (window != ListViewItemEditor.this) { > > endEdit(true); > > } > > > > return false; > > } > > > > To this: > > > > @Override > > public boolean mouseDown(Container container, Mouse.Button button, > int x, int y) { > > Display display = (Display)container; > > Window window = (Window)display.getComponentAt(x, y); > > > > boolean consumed; > > if (window != ListViewItemEditor.this > > && (window == null || !isOwner(window))) { > > endEdit(true); > > consumed = true; > > } else { > > consumed = false; > > } > > > > return consumed; > > } > > > > Regards, > > David
