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 66051 - [50cat] Customizer should be read-only for read-only properties
Summary: [50cat] Customizer should be read-only for read-only properties
Status: RESOLVED WONTFIX
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-05 20:02 UTC by misterm
Modified: 2006-01-18 21:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2005-10-05 20:02:15 UTC
[ BUILD # : 5.0 beta ]
[ JDK VERSION : 1.4.2_xx ]

Steps to reproduce:

1. Create a new form with a JPanel;
2. Use GridBagLayout
3. Try to set Insets for this component. It does not work.
Comment 1 Jan Stola 2005-10-06 09:10:57 UTC
Could you, please, be more specific? What exactly does not work?
It seems to work correctly on my machine. What would you like to achieve?
Make the JPanel bigger? If so, then it is misunderstanding - inset constraints
make space around the component. If you want to affect the size of the component
you should use internal paddings.
Comment 2 misterm 2005-10-06 15:24:47 UTC
>> ------- Additional comments from jstola Thu Oct 6 08:10:57 +0000 2005 -------

>> Could you, please, be more specific? What exactly does not work?

Well, I think the summary is clear enough:

"Not possible to set Insets for JPanel"

No matter what I type in the Insets editor panel (event if I try to create if 
with a bean, whatever), it keeps the old values (0,0,0,0, meaning unset/default 
value) in the properties for this panel. So I cannot set Insets for a JPanel. 
Note I'm using NB 5.0 Beta.
Comment 3 Jan Stola 2005-10-06 17:21:19 UTC
I guess that you attemp to change 'insets' property of the JPanel,
not the 'Insets' property of the GridBagConstraints. They are both
in the Properties tab of the Properties window, but the first
one is in Other Properties section, but the second one is in Layout
section. Is that correct? If so, then it is as designed - the 'insets'
property of the JPanel is read-only - its value is calculated
based on the attached border.

If the above is not where is the problem then, please, describe
exactly what 'insets' do you change and how.

> Well, I think the summary is clear enough:
> "Not possible to set Insets for JPanel"

As you can see, it is not so obvious what this sentece mean.
It would be helpful to provide all details you can.
Comment 4 misterm 2005-10-08 04:04:39 UTC
>> ------- Additional comments from jstola Thu Oct 6 16:21:19 +0000 2005 -----

>> I guess that you attemp to change 'insets' property of the JPanel,
>> not the 'Insets' property of the GridBagConstraints.
... 

>> If so, then it is as designed - the 'insets'
>> property of the JPanel is read-only - its value is calculated
>> based on the attached border.

I think we have a UI problem here then. If the property is read-only, the 
editor shouldn't allow values to be edited and then lost when the user closes 
the window. I mean, it's possible to open an editor for the property and to 
change values, they are just not persisted - by design, as you said - but the 
UI does not indicate that.

Reassigning it to the ui subcomponent and its owner.
Comment 5 Jan Stola 2005-10-10 09:13:34 UTC
> If the property is read-only, the editor shouldn't allow values to be edited
> and then lost when the user closes the window.

I agree that it would be nice to have this behaviour. Unfortunately
it is not possible by now. The whole form designer is based on JavaBeans
specification. This specification also says how the properties and
the corresponding property editors are derived from the beans/components.
The property editors then can provide property customizers (e.g. the panel
where you can see and edit the insets). Unfortunately the specification
doesn't have a notion of read-only property customizer.

Note that it is not as bad as it seems - the read-only properties are greyed
out and the customizer dialog doesn't have OK/Cancel buttons, but just Close
button.
Comment 6 misterm 2005-10-10 15:09:04 UTC
>> ------- Additional comments from jstola Mon Oct 10 08:13:34 +0000 2005 ------
>> Note that it is not as bad as it seems - the read-only properties are greyed
>> out and the customizer dialog doesn't have OK/Cancel buttons, but just Close
>> button.

Even though there is no OK button, it is not clear to a user these properties 
cannot be edited.

Could you please explain how it it possible to prevent OK/Cancel buttons to 
show when properties are read-only but why it is not possible to make the 
controls not editable?
Comment 7 Jan Stola 2005-10-10 15:38:23 UTC
> Could you please explain how it it possible to prevent OK/Cancel buttons to 
> show when properties are read-only but why it is not possible to make the 
> controls not editable?

The 'property customizer' is only the inner pane of the dialog. The openide/
property sheet module (that is responsible for the dialog) can recognize
that some property is not editable and can change buttons in the dialog.
On the other hand it takes the inner pane through
java.awt.Component java.beans.PropertyEditor.getCustomEditor()
method. So, it knows nothing about internal structure of this component.
Comment 8 misterm 2005-10-10 16:00:46 UTC
Sorry for insisting on this:

> ------- Additional comments from jstola Mon Oct 10 14:38:23 +0000 2005 -----
...
> The openide/property sheet module (that is responsible for the dialog) can 
> recognize that some property is not editable and can change buttons in the 
> dialog.

Shouldn't this "outer panel" display some sort of message indicating that, 
although the panel may make it look like the property is editable, it's 
actually read-only and any change made to its value will be lost?
Comment 9 rrochat 2006-01-18 21:04:50 UTC
I got caught by the same problem.  If you can't change the panel to make it be
clear to the user, at least put a Help button on it and explain it in the help,
please.