• Post Reply Bookmark Topic Watch Topic
  • New Topic

SWT/Jface Architecture Questions

 
Ken Egervari
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'm pretty new when it comes to developing rich clients. I'm getting more and more familiar with SWT and JFace, but I'm not sure I like the code that is resulting. I was wondering a few things.

1. Could anyone point me to a few articles describing architecture best practices and patterns?

2. What is the best way to keep your GUI code short and clean? There are tons of examples, application samples, etc. where GUI classes have hundreds of lines of code. Quite frankly, it's a mess in my opinion. What is the right way to do it?

3. What is the best to tie widgets to an underlying model, like with an observer pattern? For example, let's say one widget modifies a value in the model, and another widget also points to this value. Is there anything in JFace so I can specify this relationship... so I don't have to update both widgets in both locations?

4. Is interacting with the model directly a good idea? Or is it better to develop a service layer like in web-based architectures?

Thanks!
 
Ken Egervari
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and one other small question. How do set the width or size of a label within a GridLayout and GridData? I don't mean the code... I write the code that should work... and it doesn't work. The problem I'm running into is that the default value for a label is "Hey", and when I update the label to "Hello", the "lo" gets cut off because the size of the label is already determined. I find this kind of annoying...
 
Campbell Ritchie
Marshal
Posts: 52531
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that in GridLayout all the Components are laid out the same size as one another.

Try GridBag (look here, and search for Horstmann's "helper class to tame the GridBagLayout" which makes it easier to use).
Try setting a preferred size on the label, or even a HORIZONTAL fill.
That might work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!