Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Binding to custom SWT widget properties
Binding to custom SWT widget properties [message #674091] Wed, 25 May 2011 19:56 Go to next message
Jim Mayer is currently offline Jim MayerFriend
Messages: 18
Registered: July 2009
Junior Member
We are developing some custom SWT widgets for our project. Some of our fields are non-traditional (e.g., "banana" as opposed to "text", "enabled", etc.).

We can see the custom properties in design view, but they don't show up in the "Widgets" properties pane in the binding view (we do see them as "Beans" properties). Is there any way to do this, or are the "Widgets" properties limited to the standard SWT set?

Thanks!

-- Jim
Re: Binding to custom SWT widget properties [message #674126 is a reply to message #674091] Wed, 25 May 2011 22:04 Go to previous messageGo to next message
Jim Mayer is currently offline Jim MayerFriend
Messages: 18
Registered: July 2009
Junior Member
OK... I re-read the documentation and answered my own question:

"Only the following predefined SWT control properties may be observed: enabled, visible, toolTipText, selection, min, max, text, items, selectionIndex, foreground, background, font and editable."

-- Jim
Re: Binding to custom SWT widget properties [message #674381 is a reply to message #674126] Thu, 26 May 2011 17:16 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
That aspect of it is baked into the DB API itself.

Accessing custom properties as Bean properties is the correct approach.
Re: Binding to custom SWT widget properties [message #675473 is a reply to message #674381] Tue, 31 May 2011 16:05 Go to previous messageGo to next message
Jim Mayer is currently offline Jim MayerFriend
Messages: 18
Registered: July 2009
Junior Member
Thanks Eric... that's the conclusion I'd come to, and we can work with it. Did you consider having a unified view of properties that showed both SWT and Bean properties in a single presentation where the type (i.e., SWT or bean) was a displayed property? I'm curious because I think that would be easier for developers to work with.
Re: Binding to custom SWT widget properties [message #675520 is a reply to message #675473] Tue, 31 May 2011 18:09 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
We considered and rejected that idea as it still may be useful to access SWT properties as bean properties. We also wanted to expose the DB API to the user completely and faithfully (warts and all). The DB API is quite complex, and we wanted to make all of it accessible to the user through the UI (rather than try to simplify it through some artificial meta layer). Even as it is, we often get complaints for not taking it even further in terms of complexity because there are places in the DB API where you can hook in even more complex behavior.

Now that all of this is open source, we would be happy if folks wanted to revisit this and add a simplifying layer to it. That is not something that the current committer team has on its plate though.
Re: Binding to custom SWT widget properties [message #675554 is a reply to message #675520] Tue, 31 May 2011 20:30 Go to previous message
Jim Mayer is currently offline Jim MayerFriend
Messages: 18
Registered: July 2009
Junior Member
Thanks. That makes sense.

Your last comment leads into another question I was going to ask the forum. Since it's related to the above, I'll ask it here.

The controls that we are creating have substantially richer behavior than the standard SWT widgets, but many of them do not look like tables or lists. We would like to avoid the repetitive binding of sets of properties for each control. Both JFace viewers and Swing models supply mechanisms that would meet our needs.

We've been playing around with WindowBuilder custom JFace Viewers and have found that we can easily build simple viewers that inherit directly from "org.eclipse.jface.viewers.Viewer" successfully. We can bind bean properties on the widget using data binding. Although our objects do have an "input" property, we cannot bind to it because WindowBuilder's JFace data binding seems to be highly specific to tables and lists. This isn't a problem, but I wanted to check to see if using primitive JFace viewers in this way is a "really bad idea" (e.g., likely to cause trouble in the future).

Another approach to adapting complex widgets would look more like Swing's models. We would give our widgets a "model" property and bind that to a bean property in our logic. The widget would then register itself with the model, which would add event listeners, set properties, etc.

In both cases, we would continue to expose the behavior of the control through a low level API in the style of other SWT widgets. This gives us better testability and, when necessary, low level control.

Any thoughts as to which of these two approaches is likely to work better with WindowBuilder? Is there a different approach that's proven successful in other applications?

Thanks.

-- Jim
Previous Topic:Property editor instanceObject
Next Topic:Using alternate resource manager for images, fonts, and colors
Goto Forum:
  


Current Time: Thu Apr 18 22:51:10 GMT 2024

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

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

Back to the top