Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 26013 - property sheets behaving oddly when run outside the IDE
property sheets behaving oddly when run outside the IDE
Status: CLOSED INVALID
Product: platform
Classification: Unclassified
Component: Explorer
3.x
All All
: P3 (vote)
: 3.x
Assigned To: _ tboudreau
issues@platform
:
: 26014 26015 (view as bug list)
Depends on: 26086 29447
Blocks:
  Show dependency treegraph
 
Reported: 2002-07-25 13:41 UTC by jarecsni
Modified: 2008-12-22 09:48 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jarecsni 2002-07-25 13:41:28 UTC
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;
    }    
}
////////////////////////////////////////////////
Comment 1 Marian Mirilovic 2002-07-25 13:49:19 UTC
*** Issue 26014 has been marked as a duplicate of this issue. ***
Comment 2 Marian Mirilovic 2002-07-25 13:54:34 UTC
*** Issue 26014 has been marked as a duplicate of this issue. ***
Comment 3 Marian Mirilovic 2002-07-25 14:18:20 UTC
*** Issue 26014 has been marked as a duplicate of this issue. ***
Comment 4 Marian Mirilovic 2002-07-25 14:19:06 UTC
*** Issue 26015 has been marked as a duplicate of this issue. ***
Comment 5 Jiri Rechtacek 2002-07-29 14:53:22 UTC
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.
Comment 6 Jesse Glick 2003-02-28 18:10:48 UTC
IMHO this is INVALID - you cannot have core.jar in the classpath
without also openide-remainder.jar, which would include the dialog
classes.
Comment 7 _ tboudreau 2003-03-03 17:27:39 UTC
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.
Comment 8 Marian Mirilovic 2003-07-18 14:36:57 UTC
verified, closed
Comment 9 _ tboudreau 2007-03-14 11:40:51 UTC
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo