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.
A simple program that creates a NetBeans property sheet using a BeanNode wrapper produces strange behavior when run independently from the IDE. 1. The editors like JFileCooser and String editor dialog cannot be closed with the cancel button 2. the editor dialog for indexed properties cannot be used at all (cannot create a new item) I haven't tried others like ColorChooser but I suppose there are problems with them too. I attach the sources for both the simple program (PTest2) and the bean (TestBean3). Execution environment is as follows: CLASSPATH: myclasses;openide-explorer.jar;openide-fs.jar;openide- nodes.jar;openide-util.jar;d:\java\netbeans\lib\core.jar; JDK=1.4.0 Sources: ////////////////////////////////////////////////// public class PTest2 extends JFrame { /** Creates a new instance of PTest2 */ public PTest2(String title) throws Exception { super(title); Container c = this.getContentPane(); TestBean3 testBean = new TestBean3(); final BeanNode bn = new BeanNode(testBean); final PropertySheet ps = new PropertySheet(); c.add(ps); this.setSize(300, 400); this.setVisible(true); SwingUtilities.invokeLater(new Runnable() { public void run() { ps.setNodes(new Node[] { bn } ); } }); } public static void main(String[] args) throws Exception { System.out.println("instantiate..."); java.beans.PropertyEditor pe = java.beans.PropertyEditorManager.findEditor (java.lang.Byte.TYPE); // this must be placed after the call to findEditor, otherwise // the primitive editors does not get loaded (oddly enough for me :) java.beans.PropertyEditorManager.setEditorSearchPath( new String[] { "org.netbeans.beaninfo.editors", // NOI18N "org.openide.explorer.propertysheet.editors" }); // NOI18N ///Class.forName ("org.netbeans.beaninfo.editors.ByteEditor").newInstance(); System.out.println("-ok"); new PTest2("Test"); } } //////////////////////////////////////////////// import java.beans.*; import java.io.*; /** * * @author jani */ public class TestBean3 extends Object implements java.io.Serializable { private static final String PROP_SAMPLE_PROPERTY = "SampleProperty"; private String sampleProperty; private PropertyChangeSupport propertySupport; /** Holds value of property freeTimeActivity. */ private String[] freeTimeActivity; /** Creates new TestBean3 */ public TestBean3() { propertySupport = new PropertyChangeSupport( this ); } public String getSampleProperty() { return sampleProperty; } public void setSampleProperty(String value) { String oldValue = sampleProperty; sampleProperty = value; propertySupport.firePropertyChange (PROP_SAMPLE_PROPERTY, oldValue, sampleProperty); } public void addPropertyChangeListener (PropertyChangeListener listener) { propertySupport.addPropertyChangeListener (listener); } public void removePropertyChangeListener (PropertyChangeListener listener) { propertySupport.removePropertyChangeListener (listener); } /** Indexed getter for property freeTimeActivity. * @param index Index of the property. * @return Value of the property at <CODE>index</CODE>. */ public String getFreeTimeActivity(int index) { return this.freeTimeActivity[index]; } /** Getter for property freeTimeActivity. * @return Value of property freeTimeActivity. */ public String[] getFreeTimeActivity() { return this.freeTimeActivity; } /** Indexed setter for property freeTimeActivity. * @param index Index of the property. * @param freeTimeActivity New value of the property at <CODE>index</CODE>. */ public void setFreeTimeActivity(int index, String freeTimeActivity) { this.freeTimeActivity[index] = freeTimeActivity; } /** Setter for property freeTimeActivity. * @param freeTimeActivity New value of property freeTimeActivity. */ public void setFreeTimeActivity(String[] freeTimeActivity) { this.freeTimeActivity = freeTimeActivity; } private File file; /** Holds value of property isPressed. */ private boolean isPressed; public File getFile() { return this.file; } public void setFile(File file) { this.file = file; } /** Getter for property isPressed. * @return Value of property isPressed. */ public boolean isIsPressed() { return this.isPressed; } /** Setter for property isPressed. * @param isPressed New value of property isPressed. */ public void setIsPressed(boolean isPressed) { this.isPressed = isPressed; } } ////////////////////////////////////////////////
*** Issue 26014 has been marked as a duplicate of this issue. ***
*** Issue 26015 has been marked as a duplicate of this issue. ***
A problem is in NodeTableModel class, there is a code is referenes out of explorer.jar and out of the dependent jars. This code have to be handled safer. I create new task 26086 blocks this issue.
IMHO this is INVALID - you cannot have core.jar in the classpath without also openide-remainder.jar, which would include the dialog classes.
I agree with Jesse, the core property editors expect to work with the rest of netbeans' infrastructure. If it's not there, things can break randomly. It might not be a bad idea to find a way to split out the some of the core property editors as its own binary lib - ones for common classes like String and Double. Or move the editors for more basic classes like these into openide. I imagine at least the propertysheet portion of the explorer library is not so useful without some of them, if people are putting core.jar on their classpath just to have access to them.
verified, closed
Well, what actually happened here? AFAICT if DialogDisplayer.getDefault() does something vaguely reasonable (i.e. pop an unparented JDialog, or one parented to Frame.getFrames()[0]) without the presence of an implementation, property editors should more or less work. Splitting the core property editors between editors for JDK classes and NetBeans classes is probably a necessary prerequisite to using core on the classpath in a standalone app and not having at least some pathological behavior, but I'm not completely convinced this should have been closed.