Containment relationship for Custom Widgets

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Containment relationship for Custom Widgets

Postby myerramalli » Wed Sep 01, 2004 1:26 pm

I have two custom widgets TabFolder and TabItem, whose functionality is same as normal SWT widgets (but not directly derived from TabFolder and TabItem of SWT )

I placed the TabFolder on shell and try to place the TabItem under it. The designer would not allow me to do so.

I place the tabItem on the shell, go to the source change its parent to TabFolder. From now on the designer allows me to place the TabItems inside TabFolder.

Why does the desginer recognize the containment relationship after changing the source??
myerramalli
 
Posts: 16
Joined: Thu Aug 26, 2004 4:32 pm

Re: Containment relationship for Custom Widgets

Postby Eric Clayberg » Wed Sep 01, 2004 4:45 pm

myerramalli wrote:I have two custom widgets TabFolder and TabItem, whose functionality is same as normal SWT widgets (but not directly derived from TabFolder and TabItem of SWT )
I placed the TabFolder on shell and try to place the TabItem under it. The designer would not allow me to do so.
I place the tabItem on the shell, go to the source change its parent to TabFolder. From now on the designer allows me to place the TabItems inside TabFolder.
Why does the desginer recognize the containment relationship after changing the source??

When adding a custom Composite subclass (which I assume your TabFolder is), Designer treats any class that defines its own children as a self-contained custom panel which may not have additional children added to it outside of its own class definition (this is certainly the general case). A custom Composite subclass that does not define its own children can be used as a custom container.

Once you modify the source code to change the parent/child relationships, Designer re-parses the code and identifies the custom Composite as a valid container (because it has child). From that point on, you add additional children to it.

BTW, if you want to create a custom TabFolder that will behave like a TabFolder in Designer, you should subclass the TabFolder (or CTabFolder) class rather than the Composite class.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby myerramalli » Thu Sep 02, 2004 4:49 pm

I created Custom TabFolder and TabItem Extending from the Standard SWT TabFolder and TabItem.
I could add the TabFolder to Custom Controls tab, but could not add TabItem. This bean does not show up in the list of bean available when did the following windows->preference->Designer->SWT->Custom Controls and clicked on add button.


Here is my code:

public class TabItem extends org.eclipse.swt.widgets.TabItem{
public TabItem(Composite parent,int style){
super((TabFolder)parent, style)
}
}

what is wrong with the above code?? Why does not it show up in the add list of beans?? what is the criteria of showing up in the add list??
myerramalli
 
Posts: 16
Joined: Thu Aug 26, 2004 4:32 pm

Postby Eric Clayberg » Thu Sep 02, 2004 7:13 pm

myerramalli wrote:I created Custom TabFolder and TabItem Extending from the Standard SWT TabFolder and TabItem.
I could add the TabFolder to Custom Controls tab, but could not add TabItem. This bean does not show up in the list of bean available when did the following windows->preference->Designer->SWT->Custom Controls and clicked on add button.

Here is my code:

public class TabItem extends org.eclipse.swt.widgets.TabItem{
public TabItem(Composite parent,int style){
super((TabFolder)parent, style)
}
}

what is wrong with the above code?? Why does not it show up in the add list of beans?? what is the criteria of showing up in the add list??

Nothing is wrong with the code. The issue here is that TabItem (and any class derived from TabItem) is not a Control (e.g., it isn't in the SWT Control hierarchy). It actually happens to be an SWT "Item" rather than a "Control". That said, we might be able to broaden our interpretation of what constitutes a Control to include SWT Item classes as well.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby myerramalli » Fri Sep 03, 2004 10:07 am

Is this planned for near future ? When can this functionality be in the build?
myerramalli
 
Posts: 16
Joined: Thu Aug 26, 2004 4:32 pm

Postby Eric Clayberg » Fri Sep 03, 2004 1:38 pm

myerramalli wrote:Is this planned for near future ? When can this functionality be in the build?

It has been added to the latest v2.1.1 build (available soon). Here is a screen shot of a custom TabFolder containing a custom TabItem. The custom TabItem defines one custom int proiperty.

Image
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby myerramalli » Tue Sep 07, 2004 9:52 am

Can you please let me know when the build is available?(may be through email, my email-id is myerramalli@hotmail.com)
-thank you,
-Madhuri
myerramalli
 
Posts: 16
Joined: Thu Aug 26, 2004 4:32 pm

Postby Eric Clayberg » Tue Sep 07, 2004 2:17 pm

myerramalli wrote:Can you please let me know when the build is available

It's available now.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby myerramalli » Tue Sep 07, 2004 2:19 pm

Can I use the already available lincense number to activate it after install it
myerramalli
 
Posts: 16
Joined: Thu Aug 26, 2004 4:32 pm

Postby Eric Clayberg » Tue Sep 07, 2004 6:20 pm

myerramalli wrote:Can I use the already available lincense number to activate it after install it

If you have a valid serial number, it shoudl work with the new version.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest