[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Tips for GUI Code Organization
|
Well I use different things to keep my UI-Code clean (as possible).
1. I use the Databinding-Framework => No Model/UI-Sync-Listener-crowed
2. I use the Part-Concept Eclipse in my lower-level componenents (I
simply named it FormPart)
Take a look at the following ASCII-Art
---------------------------------------------
| PersonDataFormPart |
| |
| |
| |
---------------------------------------------
| AddressPart | ContractsPart | .... | <=== CTabFolder
---------------------------------------------
| ContentArea |
| |
| |
| |
---------------------------------------------
I have an interal lib that abstracts all those things it even allows me
to make use of Extension Points to contribute (e.g. AddressPart, ...)
this way I have a completely plug-able. I'm making heavy use of
Extension Points (e.g. to contribute ContextMenus, ...) and the
CommandsFramework which leads to code really clean and
JUnit-Testable-Code :-)
The next logical step is to define my UI not in Java-Code but in
XML-Markup but because of time constraints I had no time to go further
on this road but the current sources work quite well. See
http://publicsvn.bestsolution.at/repos/java/at.bestsolution.exswt/
Tom
Anthony Rosequist schrieb:
Right now I'm working on my first big GUI project (with SWT, naturally),
and I'm finding that the code gets very cluttered very quickly.
It's easy to get pages and pages of purely procedural code without
hardly trying. I've been grouping many of the common tasks into arrays
and such, but there's still so much. Is there a good way to apply OOP
principles (or anything) to clean up tons of GUI code?
For example, I've got right-click menus that open property windows. I
had tried to abstract the right-click menus into a separate class.
However, I found that I eventually needed a Display, Shell, etc., so I
had to pass these things into the objects when they were instantiated,
and it just seemed to add to the confusion without helping the clutter.
My backend is pretty well-organized (IMO), but my GUI code is just
horrendous. I was just wondering if anyone had any tips on how the pros
do it.
Thanks,
Anthony Rosequist
--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl JFace-Committer
--------------------------------------------------------------------