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.

Bug 118638 - PropertySheetView.setNodes is asynchronous
Summary: PropertySheetView.setNodes is asynchronous
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: REGRESSION
Depends on:
Blocks: 105525
  Show dependency tree
 
Reported: 2007-10-12 00:15 UTC by Thomas Preisler
Modified: 2008-12-22 11:49 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
test code (3.02 KB, application/octet-stream)
2007-10-12 00:21 UTC, Thomas Preisler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2007-10-12 00:15:35 UTC
I'm having trouble with PropertySheetView.setNodes. We have property sheets that are dynamically created and they often display empty. Our code follows the following pattern:

        PropertySheetView propertySheetView = new PropertySheetView();
        propertySheetView.setNodes(nodes);
        //try {Thread.currentThread().sleep(200);}catch(Exception e){;};
        JPanel panel = new JPanel();        panel.add(propertySheetView);
        panel.add(new JLabel("yes, this is the correct panel..."));
        Display panel...

If I enable the sleep in the code, the properties display fine.

See attached code for more details.

I believe the problem I'm having is due to the asynchronous nature of setNodes. setNodes ads the node asynchronously after a delay of 70ms (why 70ms?) but returns immediately. 
And I cannot find a way to check when the panel is actually ready to display.

Questions:
Am I correct my evaluation?
Is the sleep work-around a reasonable work-around?
Is there a better work-around I can implement and avoid the hard-coded sleep.
Comment 1 Thomas Preisler 2007-10-12 00:21:02 UTC
Created attachment 50755 [details]
test code
Comment 2 Thomas Preisler 2007-10-12 02:57:01 UTC
See also http://www.netbeans.org/issues/show_bug.cgi?id=105525 Project Properties doesn't work with NB6.0
Comment 3 David Simonek 2007-10-12 12:25:11 UTC
Passing to property sheet owner...
Comment 4 Stanislav Aubrecht 2007-10-12 13:08:54 UTC
simply use PropertySheet instead of PropertySheetView - i've tried it on your test code and it works fine
Comment 5 David Simonek 2007-10-12 13:25:08 UTC
Thanks Stando.
Comment 6 Thomas Preisler 2007-10-12 16:49:25 UTC
It seems to work, thanks. But can you explain why it is better to use PropertySheet? It seems to be calling the same
setNodes().
Comment 7 Stanislav Aubrecht 2007-10-12 16:58:29 UTC
propertysheetview uses explorermanager to manage its nodes (i think)
Comment 8 Chihin Ko 2008-04-18 01:17:29 UTC
"Debug Executable" dialog in sunstudio has similar codes as cnd/project property

This issue is not revealed in 6.0 but come back again in 6.1, I'm using PropertySheet instead of PropertySheetView,
even if I increase sleep up to 1.2 seconds, situation does not get better.


Comment 9 Chihin Ko 2008-04-18 03:09:27 UTC
I compared source of src/org/openide/explorer/propertysheet/PropertySheet.java of NB6.0 and NB6.1, there are some
changes in NB6.1 related to how helperNodes was updated, which I think cause this regression. Because this is a
regression of NB6.0, I wish it can be fixed in NB6.1 patch, raised Priority to P1.
Comment 10 Stanislav Aubrecht 2008-04-18 09:56:03 UTC
i can't reproduce this issue in the latest release61 clone. when i use the sample code provided by thp, switch to
PropertySheet instead of PropertySheetView then it's all working fine, no timeout is needed. when a PropertySheetView is
used then no properties are displayed because ExplorerManager manages the nodes to be displayed then.

please provide a reproducible test case and/or file a new issue