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 97272 - form connections between components not working
Summary: form connections between components not working
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker with 1 vote (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-06 12:45 UTC by pepeio
Modified: 2008-02-14 06:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sources of a project showing the behavior (6.87 KB, application/octet-stream)
2007-03-06 12:46 UTC, pepeio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pepeio 2007-03-06 12:45:04 UTC
Note: bug has been tested as valid in 5.5 and 6.0.

Form connection, let it be getting parameter through call or property sends null
to the setter, while getter can only return an object, not null.

Create a new 'java application' project, paste attached sources into the project.
Open the DataModelCustomizer form, go in the 'design' tab.
Select the dataView1 component of the form and have a look at the 'data'
property  in properties tab. You can see that it is linked to dataModel1, which
is a non visual component of the form.
DataView overrides paintComponent() and paints a String and
System.currentTimemillis(), in order to be sure that things change and get
updated. The String can be of two kinds "null" if the data property is null and
"yeah" if not. If you read "nullxxxxxxx", that is because view is not filled
with data. (which, in current case, is abnormal due to form binding )
Open the DataModel java file and see that the data property can only be non-null.
Open MainFrame form, go in the 'design' tab. The frame has an instance of
DataModelCustomizer added and as you can see, the binding is correct.
Comment 1 pepeio 2007-03-06 12:46:23 UTC
Created attachment 39203 [details]
sources of a project showing the behavior
Comment 2 pepeio 2007-03-07 05:58:41 UTC
by "Note: bug has been tested as valid in 5.5 and 6.0.", i meant that the bug
exists in 5.5, 5.5.1 and 6.0.

Just in case...
Comment 3 Tomas Pavek 2007-03-12 14:24:45 UTC
Thanks for the test case. Seems there are some problems in reading 
the "connected" value when the form is opened and then when cloning the value 
for the designer. For the latter it might help to make your Data class 
serializable - please try. The GUI builder needs a copied property value for 
the view, however in this case it should take it from the cloned DataModel 
instance. (It is probably not working correctly for non-visual components.)
Comment 4 pepeio 2007-03-13 06:37:40 UTC
Hello Tomas.
First, thanks for checking the issue.
Making the Data serializable enables correct behavior of matisse. Unfortunatly,
my data is not serializable.
Is there anything i can do to that issue? Would you guide me for a quickstart?
Comment 5 Tomas Pavek 2007-03-13 14:23:30 UTC
I'm not sure how your real case is close to the test case you provided, so it's
hard to advise a good workaround. I'd say that in some way you need to let the
GUI builder copy the components and their properties. If the GUI builder can't
copy certain property value, it does not set it to the bean used in the design
view. (It is not safe in general to use the same property value instance.) But
even if your data class is not serializable directly, you could perhaps do some
tricks by using writeExternal and readResolve methods. But as I said - it
depends on your concrete case I don't know about...

If your data model bean provided the data via a read only property - just like
your sample test case, then the GUI builder should be able to get the data just
from a newly created instance of the model bean, but this is failing due to a
bug (the GUI builder does not created the cloned bean instances for non-visual
components not directly needed for the design view). If you took the data from a
visual object it would likely work. But again - this is all true only if the
data property is not set by the user. Once set, the GUI builder needs to copy
the property value.

We have some enhancements requests for better handling of properties persistence
- e.g. support XML bean persistence or interpret the java init string from the
property editor. We could perhaps also let the GUI builder use the same property
value instances from non-visual components. These things could ease the tasks
for the future. So would be nice if you could describe your real use case here
so we can take it into consideration when we are doing something in this area.
Comment 6 pepeio 2007-03-14 13:41:46 UTC
The case comes from one of my API (which had a new milestone today. :) )
It is an API to animate in swing, with flash in mind and heading. It animates
and interacts within swing applications, and it does also animate within matisse. 
see https://swash.dev.java.net for a webstart permission-free demo.
I want to make the flow as easy as possible for programmers and graphists and
for that i want to be able to integrate it as closely as possible with netbeans.
Swash works as flash. It has a timeline, can handle objets, events, actions,
scripts, ... An editor within netbeans is in preparation (to be like flash's),
but this is not what causes me problems actually.
I have two kinds of objects to be added to matisse: an objects that holds a
context to the timeline (the model) and the displayer (the view). The goal is to
be able to add the timeline to the form, add the displayer, link them through
the visual editor and immediately see the result without coding anything.
Actually, result is only visible within a component that would import the one
containing the displayers. If display would work, that would be a fantastic step
ahead for people that want to make nice and graphical UIs.
Comment 7 pepeio 2008-01-28 05:56:51 UTC
Hello.

Can you please tell me what made this bug to be demoted to P4? This issue is pretty important to me.
Tomas is talking about a related bug, which imho should be linked to this issue. Can we get its ID?

If possible, i would like to investigate this problem, but i need directions.
Comment 8 Tomas Pavek 2008-01-29 18:11:35 UTC
I've tried to fix this. Changed the GUI builder to take "connected" properties correctly from the cloned objects of the
design view. Also non-visual beans are cloned for the view. This might be enough for your case - at least the example
you attached works now.

In some other cases I mentioned there still might be problems if a property value can't be copied via serialization. But
that's a different issue.

Fixed in 6.1 trunk:
changeset e0d629c3237a in main
details: http://hg.netbeans.org/main?cmd=changeset;node=e0d629c3237a
Comment 9 pepeio 2008-02-14 06:41:47 UTC
That works !!!
Thank you.

See here for what the fix enabled:
http://weblogs.java.net/blog/pepe/archive/2008/02/realtime_animat.html