This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 113200 [details] editable combobox in outline view If you use an editable combobox as an inplace editor in an outlineview,the combobox doesn't appear to "accept" the changes unless the tab key is pressed. I tried debugging this but ran into some discrepancies in the documentation and the tutorials. For instance the javadocs (http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/propertysheet/InplaceEditor.html) for InplaceEditor state that: "In no cases should an instance of InplaceEditor attempt to directly update the value of the represented property or property editor. If the property should be updated, ensure that getValue() will return the correct value, and fire the action command COMMAND_SUCCESS. Implementations should also not assume that because one of these events has been fired, that therefore the property editor has been updated with the new value. Components that display inplace editors are responsible for the timing of and policy for updates to the represented properties. Inplace editors merely display the contents of a property editor, provide a way for the user to edit that value, and notify the infrastructure when the user has made a change." However all tutorials/examples that use an inplace editor, specifically the combobox edit the value directly. In any case, I thought there'd be some way to trigger a commit or issue that COMMAND_SUCCESS from the action listener attached to the combobox but I couldn't get it to work (most of that API is hidden in the EditableDisplayer class). Am I missing something here? Seems like hitting the "enter" key (or selecting something from the combobox, should accept the value and issue "commit". Is that not the case? I've attached a project that opens an OutlineView with a combobox editor in the "City" column. It demonstrates that manipulating the property in this column is not accepted unless the tab key is pressed.
I'm sorry, but I do not probably understand what this issue is really about. The ComboBox is editable, therefore you see the cursor as long as it has the focus. Try to create a JComboBox component and you'll see it. As soon as you pick some value, it's immediately propagated as a property change. I've verified that.
Created attachment 113270 [details] updated project which demonstrates issue/descrepancy in inplaceeditor javadocs Note that this example doesn't set the values on the underlying property as per the javadocs for the inplaceeditor.
Comment on attachment 113270 [details] updated project which demonstrates issue/descrepancy in inplaceeditor javadocs Correct. The bug is that there is a descrepancy in the inplaceeditor javadocs and the examples/tutorials on how to implement an inplaceeditor. According to the javadocs, an inplaceeditor should not set the values for the underlying property. I changed the example module to behave this way and the value is not accepted unless the tab button is pressed.
Martin, did you get a chance to reproduce the bug with the updated project I attached?
I am looking at your project right now. But I don't understand the problem. Can you explain the discrepancy between the docs you're referring to? And then also what the problem is with the sample you attached?
Does this help you: http://forums.netbeans.org/post-79653.html
(In reply to comment #5) > I am looking at your project right now. But I don't understand the problem. Can > you explain the discrepancy between the docs you're referring to? And then also > what the problem is with the sample you attached? Basically, what is the proper way to update the value represented by the property? The docs say that : "In no cases should an instance of InplaceEditor attempt to directly update the value of the represented property or property editor. If the property should be updated, ensure that getValue() will return the correct value, and fire the action command COMMAND_SUCCESS. Implementations should also not assume that because one of these events has been fired, that therefore the property editor has been updated with the new value. Components that display inplace editors are responsible for the timing of and policy for updates to the represented properties. Inplace editors merely display the contents of a property editor, provide a way for the user to edit that value, and notify the infrastructure when the user has made a change." This a about the fifth a paragraph down on the javadoc for the inplace editor. The problem is, if I implement things as the javadocs say, the combobox never accepts the value and propagates changes because the COMMAND_SUCCESS action command isn't fired. The current workaround is to do exactly what the javadocs say not to do, ie set the value of the underlying property directly.
This shows that we must set the value directly to get things to work [code] protected void processKeyEvent(KeyEvent e) { if (e.getKeyCode() == 10 || e.getKeyCode() == 9) { try { myProperty.setValue(getText()); } catch (Exception ex) { } } super.processKeyEvent(e); } [/code] (In reply to comment #6) > Does this help you: > > http://forums.netbeans.org/post-79653.html