Re: MVC/MVP swing GUI



Thomas Weidenfeller wrote:

I would be surprised if you find a "clean" one (of course depending on your criteria for "clean"), for a couple of reasons (in no particular order, this is an endless subject):

I should have said "give me some best practice advice or something like that".

- Scaling/scope, more particular, matching the real world to the pattern is also an issue with Swing (or applications based on similar toolkits). E.g. take a simple form-type entry dialog with a couple of text fields for data entry. How should the Model(s) look like? What are they? Where are they? Each text field has an own Model, or should the sum of the text entries (some kind of data set) be the Model? But what if that set of data from that particular dialog window is just an excerpt from some larger data set? Wouldn't it be good to treat that large data set as the Model? But if you do that, what do you provide as input/output to the dialog? All this is solvable and is solved in practice, but it dilutes a "clean" application of MVC.
- Expanding further on the above dialog example, when you implement something like this, you will soon figure out that you need some kind of transactions. Not something which is defined in MVC or MVP. E.g. you don't want that each single keystroke changing data in a text field is immediately applied to the Model. You want that all changes at once (and typically either all changes or non, probably with a chance to undo them, too) are applied to the Model. So where do you hold the intermediate changes? From the GUI widget's point of view, there should be some Model holding this data, but that Model is not the "real" Model which is finally changed from an application's point of view. Again, all this can and is solved in practice, but you won't find anything of this in "clean" MVC or MVP.

This is a great, very understandable description of the problem, thanks. I hate to add a sentence or two to a whole block of text, but this is just so well written with obvious crystal clear understanding of the issues involved. Wow. :)

Back to the problem at hand: is there a best (or just "very good") practice on building swing MDI GUIs? Again, an example would be great.

My problem's a bit complicated because it has to do with swing, but also with Netbeans Matisse (which is an important decision factor to try to implement a java rich client) and finally with application design theory and recommendations. This is not a nice place to be without a *lot* of specific experience, I can tell you. :)

No hints as to what I can look at? I've tried JRubik as I think it sports a state-of-the-art interface, but it's internal plugin architecture drove me off...I'm looking for something simpler, more relevant to my problem (a database oriented GUI), easier to understand etc.

TIA,
Tomislav
.



Relevant Pages

  • Re: MVC/MVP swing GUI
    ... open source project so I can look at more than just the GUI) written following the MVP pattern. ... - Swing's own architecture isn't modeled as "pure" MVC or MVP, ... Each text field has an own Model, or should the sum of the text entries (some kind of data set) be the Model? ...
    (comp.lang.java.gui)
  • comp.lang.java.gui FAQ
    ... Q1.3 There are so many Java FAQs. ... Q1.4 Does Sun support or endorse this FAQ? ... Q3.2 How do I update the GUI from another thread? ... Q4.2 What is the Swing single-threading issue? ...
    (comp.lang.java.gui)
  • comp.lang.java.gui FAQ
    ... Q1.3 There are so many Java FAQs. ... Q1.4 Does Sun support or endorse this FAQ? ... Q3.2 How do I update the GUI from another thread? ... Q4.2 What is the Swing single-threading issue? ...
    (comp.lang.java.programmer)
  • Re: Frustrated by AWT..need some help
    ... every confidence that Matisse can use normal J2SE layouts, so it should be possible to write this code* using Matisse ... between Swing and AWT yet, and the replies to this thread have done little to help. ... AWT based GUI Development, come from the AWT. ... The major difference is in the set of *GUI* components offered by each. ...
    (comp.lang.java.help)
  • Re: Swing vs. SWT
    ... SWT/JFace for developing GUIs. ... SWT is easier to learn + allows for both traditional development as the ... if Swing would have been at least 'good enough', ... > I am about to start a new job, developing and maintaining Java GUI ...
    (comp.lang.java.gui)