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.
The data object property editor should accept only single selection by default. If desired, multiple selection support can be added with another property environment hint.
Until issue 11928 is fixed, this is not available to set on the BeanTreeView, but a workaround is possible: BeanTreeView tree = new SingleSelectionBeanTreeView(); static class SingleSelectionBeanTreeView extends BeanTreeView { SingleSelectionBeanTreeView () { super(); tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION); } }
I apologize but I am marking this as worksforme. According to cvs this has always (at least since May 2001) been the case in the DataObject editor's tree. Do you request the possibility to select more nodes? Or? This is currect code in the property editor: expPanel.getExplorerManager().addVetoableChangeListener( new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if (evt.getPropertyName().equals (ExplorerManager.PROP_SELECTED_NODES)) { Node [] nodes = (Node []) evt.getNewValue(); if ((nodes != null) && (nodes.length > 1)) { throw new PropertyVetoException("Only one node can be selected here", evt); // NOI18N } } } }); Seems to work for me. Could you please be more specific as to what does not work? If there is something please reopen this issue. Thanks.
A cleaner solution would be to fix issue 11928 and use that instead of the vetoable listener. That would also enable adding a hint for this property editor to allow for multiple selection (which might be useful as long as it's not the default) and a clean implementation of that.
Sorry, but I have to insist that what is there works fine. If you want a possibility to select more DataObjects at once we have to create a new property editor for array of data objects - there is no way how could the existing editor return the selection array. The editor cannot be enhanced to handle arrays - there has to be a new one (they can share code of course but the PropertyEditor class has to be created). If this is what you want please comment on this a request for enhancement - if you think it should be there give it a high priority and vote for the issue. Meanwhile I am changing the issue type to enhancement since I don't see any defect here. And also I am changing the description to match the requirement. As for 11928 - I don't think that the API change is necessary. The listener solution works (not very nice but works fine). The opinions on this can differ - you can bring the issue to openide-dev, vote, argument etc. Please add comments directly to the #11928.
Ooops. I forgot to clear the dependency - these are separate issues IMHO.
As you can see in my update to issue 11928 - the user experience is different based on whether the treeview enforces single selection by a vetoable listener or directly setting on the tree. The user experience should be consistent with other single selection trees. I'll file a separate cleanup issue for this (for the data object editor). Right now I have no need for an array of data object property editor, so for me, this enhancement is low priority.
Low priority --> P4.
Target milestone was changed from '3.4' to TBD.
reassigne to Tim, new owner of property editors.
Since it appears that DataObjects will go away with the DataSystems redesign, marking as wontfix.
Will there be a property editor for nodes/file objects/whatever the replacement is? If so, please consider also providing an editor for an array of those objects.
Resolved for 3.4.x or earlier, no new info since then -> verified
Resolved for 3.4.x or earlier, no new info since then -> closing.
Reopening as an enhancement for after datasystems redesign.
One thing I don't understand: How is this request for enhancement not satisfied by org.netbeans.beaninfo.editors.DataObjectArrayEditor? It sure looks like there's a property editor for this already. Please close if so.
It looks like that should do the trick, but I have never used it. Is there an example or test case? I looked at the code a bit and it calls setMultiSelection(true) on the panel, but I can't see where that is used to do anything to the tree view.
I haven't the foggiest. Adding David to cc in case he can shed some light.
1. DataObjects are being replaced by something else. So this whole issue is IMHO Wontfix. 2. The problem with DataObjectArrayEditor is IMHO that you cannot reference the class from a module that does not depend on core. And if it is not picked up automatically (if you specify in BeanInfo of your class that the property uses java.beans.IndexedPropertyDescriptor) you are out of luck unless you are able to refer to the editor by specifying class name as a string. If I remember corretly this class is used from core so the core classes can access its class. I am not sure - the last thing I would try before giving up would be to try to use setPropertyEditorClass() in Node.Property(Support) (or wherever this method is) with parameter being a class obtained using the classloader obtained as Lookup.getDefault().lookup(ClassLoader.class).
Passing property editor issues to new owner, Jirka
Obsolete I think. Closed as WONTFIX