Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Add WindowBuilder TabItem at Runtime
Add WindowBuilder TabItem at Runtime [message #781142] Fri, 20 January 2012 17:08 Go to next message
Mark Rowe is currently offline Mark RoweFriend
Messages: 23
Registered: January 2012
Junior Member
Excuse my explanation, I am new to Java / SWT. I am attempting to convert a legacy application from Qt.

My application has a number of consists of many 'pages'. Each 'page' holds a variety of controls (tables, buttons, checkboxes etc.).

At startup only a welcome page is shown as TabItem1 of a TabFolder, but by clicking on a list at the left of the screen new pages (TabItems) are added.

To help me organise my code, I would like each page (TabItem) to live in its own pair of files - one is created by WindowBuilder, the other contains the business logic for that page.

I am stuck with two problems:


  1. How can I separate the WindowBuilder generated code from the business logic? In WindowBuilder when I link an event it just dumps the code in the same class as the code that sets up all the widgets.
  2. How can I create just a TabItem in WindowBuilder and add it to the TabFolder (and raise it and remove it) from the TabFolder at runtime?


Thanks for any help!

[Updated on: Fri, 20 January 2012 17:09]

Report message to a moderator

Re: Add WindowBuilder TabItem at Runtime [message #781638 is a reply to message #781142] Sat, 21 January 2012 22:10 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 886
Registered: July 2009
Location: Boston, MA
Senior Member
Mark Rowe wrote on Fri, 20 January 2012 12:08
How can I separate the WindowBuilder generated code from the business logic? In WindowBuilder when I link an event it just dumps the code in the same class as the code that sets up all the widgets.

WindowBuilder does not create your business logic, so you can put that in any class that you want. WindowBuilder only creates the empty event handler for you. What code you call in the event handler or where you put that code is entirely up to you.

Mark Rowe wrote on Fri, 20 January 2012 12:08
How can I create just a TabItem in WindowBuilder and add it to the TabFolder (and raise it and remove it) from the TabFolder at runtime?

I would create each tab as a separate Composite subclass. Each composite instance forms the control managed by the tab item. Tab items are then added and removed dynamically at runtime.
Re: Add WindowBuilder TabItem at Runtime [message #781995 is a reply to message #781638] Sun, 22 January 2012 23:29 Go to previous message
Mark Rowe is currently offline Mark RoweFriend
Messages: 23
Registered: January 2012
Junior Member
Thank you for your answers.

Quote:
WindowBuilder only creates the empty event handler for you. What code you call in the event handler or where you put that code is entirely up to you.


Okay, this is quite clear. I will just place a single call to the "business logic" class method in each event handler. I was thinking that it might be possible (in WindowBuilder) to bind an event to a method in another class without editing the autogenerated code, but its not a problem.

Quote:
Tab items are then added and removed dynamically at runtime.


This I can understand by creating a new TabItem and parenting it to the TabFolder.

Quote:
Each composite instance forms the control managed by the tab item


Thanks for the hint. For anyone who hits upon this thread during a search, I think that what Eric is referring to is "17. 72. 3. Pass the Composite to the tab's setControl() method" (sorry can't add the link as I didn't post enough times yet!)






Previous Topic:resizing problems
Next Topic:WindowBuider gives java.lang.NoClassDefFoundError: org/eclipse/jdt/core/dom/AnonymousTypeDeclaration
Goto Forum:
  


Current Time: Fri Nov 28 19:33:36 GMT 2014

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

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