Skip to main content



      Home
Home » Archived » Visual Editor (VE) » Custom container beans with editable children?
Custom container beans with editable children? [message #85996] Fri, 08 April 2005 06:13 Go to next message
Eclipse UserFriend
Hi all,

we are planning a new application. The idea we have is to provide the
dialog developers with a set of custom beans which serve as building
blocks to construct the dialogs with. Some of the custom beans are
containers (derived from JPanel) which already contain some child
components (Labels, TestFields, etc.). The developer then can choose a
container with "Choose Bean", then he gets it with the most important
children already in it, and then he can add other children he might need.

This all works OK, but the problem I have is that VE does not allow me
to edit the child components which were added by the custom container
bean (in it's initialize method). The custom container bean is
recognized to be a container and can have new children added and the
children created by the container bean are rendered OK, but they can't
be selected.

I fiddled around with some things (added public getters for the children
in the custom container bean, created an initialize method for it,
created a BeanInfo for it, created it new with VE's "Create new JPanel
visual class"), still I can't get VE to recognize that there are Beans
in the container which have properties that could be set.

Is there (or will there be) a way to do this ?

Thanks in advance,
Carsten
Re: Custom container beans with editable children? [message #86015 is a reply to message #85996] Fri, 08 April 2005 08:36 Go to previous messageGo to next message
Eclipse UserFriend
Carsten Lergenmüller wrote:
> Hi all,
>
> we are planning a new application. The idea we have is to provide the
> dialog developers with a set of custom beans which serve as building
> blocks to construct the dialogs with. Some of the custom beans are
> containers (derived from JPanel) which already contain some child
> components (Labels, TestFields, etc.). The developer then can choose a
> container with "Choose Bean", then he gets it with the most important
> children already in it, and then he can add other children he might need.
>
> This all works OK, but the problem I have is that VE does not allow me
> to edit the child components which were added by the custom container
> bean (in it's initialize method). The custom container bean is
> recognized to be a container and can have new children added and the
> children created by the container bean are rendered OK, but they can't
> be selected.
>
> I fiddled around with some things (added public getters for the children
> in the custom container bean, created an initialize method for it,
> created a BeanInfo for it, created it new with VE's "Create new JPanel
> visual class"), still I can't get VE to recognize that there are Beans
> in the container which have properties that could be set.
>
> Is there (or will there be) a way to do this ?

The short answer is no.

The longer answer is that VE views a control as a black box. So if you
need to set properties on controls inside your main control, you are
going to have to create new properties on your main control that
delegate to the inner controls and get/set them.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Custom container beans with editable children? [message #86030 is a reply to message #85996] Fri, 08 April 2005 09:09 Go to previous messageGo to next message
Eclipse UserFriend
"Carsten Lergenm
Re: Custom container beans with editable children? [message #86488 is a reply to message #85996] Mon, 11 April 2005 08:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi Carsten,

> we are planning a new application. The idea we have is to provide the
> dialog developers with a set of custom beans which serve as building
> blocks to construct the dialogs with. Some of the custom beans are
> containers (derived from JPanel) which already contain some child
> components (Labels, TestFields, etc.). The developer then can choose a
> container with "Choose Bean", then he gets it with the most important
> children already in it, and then he can add other children he might need.
>
> This all works OK, but the problem I have is that VE does not allow me
> to edit the child components which were added by the custom container
> bean (in it's initialize method). The custom container bean is
> recognized to be a container and can have new children added and the
> children created by the container bean are rendered OK, but they can't
> be selected.
>
> I fiddled around with some things (added public getters for the children
> in the custom container bean, created an initialize method for it,
> created a BeanInfo for it, created it new with VE's "Create new JPanel
> visual class"), still I can't get VE to recognize that there are Beans
> in the container which have properties that could be set.
>
> Is there (or will there be) a way to do this ?

If you add a getter and setter for the child properties this would
expose them on the property sheet. For example, if your children were
getChildA() you could expand the + on the property sheet and modify the
child properties. However the problem is the code we generate would not be

myComponent.getChildA().setProperty("Foo");

and instead we'd try to fluff up a new instance of the childA(). This
is something we need to fix via support for implicit properties and we
are working on this for RCP, however could you please open a bugzilla
feature request for this so we can track its progress and we can discuss
how to implement it. We've got some ideas that I've outlined below.

In a general way we could expose all child components and have code like

myComponent.getComponent(3).setProperty("Foo");

or we could instead have you specify the controls you wanted to be
exposed via explicit getter and setter methods, e.g.

myComponent.getMyChild().setProperty("Foo");

We could find all of these type of child properties by looking at the
API methods on the Container and seeing which were typed to
java.awt.Component, or we could have some kind of custom BeanInfo
extension where the properties were explicitly identified via a
key/value pair we recognized during introspection.

What do you think would make the most sense for an implementation ?

Best regards,

Joe Winchester
Re: Custom container beans with editable children? [message #86795 is a reply to message #86488] Tue, 12 April 2005 07:59 Go to previous message
Eclipse UserFriend
Joe Winchester wrote:

> and instead we'd try to fluff up a new instance of the childA(). This
> is something we need to fix via support for implicit properties and we
> are working on this for RCP, however could you please open a bugzilla
> feature request for this so we can track its progress and we can discuss
> how to implement it. We've got some ideas that I've outlined below.

> What do you think would make the most sense for an implementation ?

Opened Bug 91101, answered there.

Ciao,
Carsten
Re: Custom container beans with editable children? [message #607059 is a reply to message #85996] Fri, 08 April 2005 08:36 Go to previous message
Eclipse UserFriend
Carsten Lergenmüller wrote:
> Hi all,
>
> we are planning a new application. The idea we have is to provide the
> dialog developers with a set of custom beans which serve as building
> blocks to construct the dialogs with. Some of the custom beans are
> containers (derived from JPanel) which already contain some child
> components (Labels, TestFields, etc.). The developer then can choose a
> container with "Choose Bean", then he gets it with the most important
> children already in it, and then he can add other children he might need.
>
> This all works OK, but the problem I have is that VE does not allow me
> to edit the child components which were added by the custom container
> bean (in it's initialize method). The custom container bean is
> recognized to be a container and can have new children added and the
> children created by the container bean are rendered OK, but they can't
> be selected.
>
> I fiddled around with some things (added public getters for the children
> in the custom container bean, created an initialize method for it,
> created a BeanInfo for it, created it new with VE's "Create new JPanel
> visual class"), still I can't get VE to recognize that there are Beans
> in the container which have properties that could be set.
>
> Is there (or will there be) a way to do this ?

The short answer is no.

The longer answer is that VE views a control as a black box. So if you
need to set properties on controls inside your main control, you are
going to have to create new properties on your main control that
delegate to the inner controls and get/set them.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Custom container beans with editable children? [message #607060 is a reply to message #85996] Fri, 08 April 2005 09:09 Go to previous message
Eclipse UserFriend
"Carsten Lergenm
Re: Custom container beans with editable children? [message #607099 is a reply to message #85996] Mon, 11 April 2005 08:33 Go to previous message
Eclipse UserFriend
Hi Carsten,

> we are planning a new application. The idea we have is to provide the
> dialog developers with a set of custom beans which serve as building
> blocks to construct the dialogs with. Some of the custom beans are
> containers (derived from JPanel) which already contain some child
> components (Labels, TestFields, etc.). The developer then can choose a
> container with "Choose Bean", then he gets it with the most important
> children already in it, and then he can add other children he might need.
>
> This all works OK, but the problem I have is that VE does not allow me
> to edit the child components which were added by the custom container
> bean (in it's initialize method). The custom container bean is
> recognized to be a container and can have new children added and the
> children created by the container bean are rendered OK, but they can't
> be selected.
>
> I fiddled around with some things (added public getters for the children
> in the custom container bean, created an initialize method for it,
> created a BeanInfo for it, created it new with VE's "Create new JPanel
> visual class"), still I can't get VE to recognize that there are Beans
> in the container which have properties that could be set.
>
> Is there (or will there be) a way to do this ?

If you add a getter and setter for the child properties this would
expose them on the property sheet. For example, if your children were
getChildA() you could expand the + on the property sheet and modify the
child properties. However the problem is the code we generate would not be

myComponent.getChildA().setProperty("Foo");

and instead we'd try to fluff up a new instance of the childA(). This
is something we need to fix via support for implicit properties and we
are working on this for RCP, however could you please open a bugzilla
feature request for this so we can track its progress and we can discuss
how to implement it. We've got some ideas that I've outlined below.

In a general way we could expose all child components and have code like

myComponent.getComponent(3).setProperty("Foo");

or we could instead have you specify the controls you wanted to be
exposed via explicit getter and setter methods, e.g.

myComponent.getMyChild().setProperty("Foo");

We could find all of these type of child properties by looking at the
API methods on the Container and seeing which were typed to
java.awt.Component, or we could have some kind of custom BeanInfo
extension where the properties were explicitly identified via a
key/value pair we recognized during introspection.

What do you think would make the most sense for an implementation ?

Best regards,

Joe Winchester
Re: Custom container beans with editable children? [message #607116 is a reply to message #86488] Tue, 12 April 2005 07:59 Go to previous message
Eclipse UserFriend
Joe Winchester wrote:

> and instead we'd try to fluff up a new instance of the childA(). This
> is something we need to fix via support for implicit properties and we
> are working on this for RCP, however could you please open a bugzilla
> feature request for this so we can track its progress and we can discuss
> how to implement it. We've got some ideas that I've outlined below.

> What do you think would make the most sense for an implementation ?

Opened Bug 91101, answered there.

Ciao,
Carsten
Previous Topic:null pointer exception in VE while selecting a widget
Next Topic:Customized Templates
Goto Forum:
  


Current Time: Wed Jun 18 05:44:03 EDT 2025

Powered by FUDForum. Page generated in 0.04973 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top