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 34998 - using CardLayout: layout of subcomponents is too simple
Summary: using CardLayout: layout of subcomponents is too simple
Status: RESOLVED DUPLICATE of bug 32367
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 90077 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-18 14:37 UTC by fnisol
Modified: 2006-11-27 19:19 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fnisol 2003-07-18 14:37:08 UTC
When using the CardLayout, subcomponents "layout"
tab is too simple.

You can only insert plain text here. It should be
possible to enter any code (like a reference to a
constant or a method call)

This property should be editable as any other
property (Mode =   StringEditor, Form Connection...)
Comment 1 Tomas Pavek 2003-07-22 14:59:22 UTC
The reason why the layout constraints properties are just simple and
not "full" form properties is the compatibility of the .form file
format - the format is still kept compatible for several NB version
and it was originally designed to store only simple layout properties.
I'm not sure if the benefit of "full" properties in this case is worth
the implementation efforts to solve this problem compatibly (I
remember the hacks done for JTabbedPane for the same reason).
Comment 2 Tomas Pavek 2003-07-22 15:01:34 UTC

*** This issue has been marked as a duplicate of 32367 ***
Comment 3 fnisol 2003-07-23 03:08:59 UTC
this leads into a design problem into application. It should at least
be possible to add our own source code... 

Annoying...

Comment 4 fnisol 2003-07-23 03:23:58 UTC
The real problem I see here is the duplication of the keys used to
refere to the CardLayout elements...

I want netbeans to be able to do a
layout.addLayoutComponent(A_COMPONENT_NAME, aComponent) instead of
layout.addLayoutComponent("a_component_name",aComponent), so  I can
call layout.show(theParent, A_COMPONENT_NAME) which really better

I understand this is not needed by the language, but it is the way to
do things the best we can... If netbeans prevents us to do code like
this, it can be defined as a limitation.

The only workaround here is to let netbeans add its component with a
string, and duplicate the key manually in the code in a constant....
Quite a bad way to do things!

This leads me to the fix:

I'm not sure this is so difficult to patch. Netbeans could generate
the code using a constant instead of hardcoding the value into the
initComponents() method

THIS can easily be implemented without any problem, could solve this
issue in a beautifull way and would be entirely compatible with the
form (there would be no difference in the form, only in the generated
code)

Please, don't say this is not feasible, because I'm sure it is!
Comment 5 Tomas Pavek 2003-07-23 09:18:25 UTC
This would be certainly technically possible, but it is not a correct
solution. The card name is a String type property, so you should be
able to edit it as a String directly, not as a constant. If the value
you write in the property sheet would be generated as constant, then
the form editor would have to generate further code for defining the
constant, like

static final String A_COPMPONENT_NAME = "a_component_name";

and would let the user to edit the constant value additioanally (so
you have two things to edit: constant name and constant value).

I think it is better to have the card name property full featured
property allowing you to enter your custom code if needed.
Theoretically, the approach you suggested could be then implemented as
special String type property editor (allowing to define String
constants; similarly as we have special String property editor
allowing to use .properties files). So I think this is the same thing
as issue 32367, making it duplicate again.

*** This issue has been marked as a duplicate of 32367 ***
Comment 6 Tomas Pavek 2003-07-23 09:23:11 UTC
> this leads into a design problem into application. It should
> at least be possible to add our own source code...

Please note I'm not arguing with you this should not be possible or
that it is not a problem (it surely is). I've just explained how I
think it should be solved and why it is not so easy to implement. It
is just normal bug evaluation.
Comment 7 fnisol 2003-07-23 11:41:34 UTC
You are totaly right, it is definitely a duplicate of issue 32367, and
your last proposed solution is exactly what we asked...

Hope to see it corrected soon :)
Comment 8 fnisol 2003-07-23 12:33:05 UTC
It was late at night and It was difficult for me to understand that ;)

Sorry if we misunderstood ! :)

Comment 9 Tomas Pavek 2006-11-27 19:19:25 UTC
*** Issue 90077 has been marked as a duplicate of this issue. ***