• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

GUI Question?

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I have som edouts with the GUI implementations of mine,can some one help me in this.-
What i plan to have:
Gui class(this class will encapsulate all the controls for the display of controls ,JTable ,menu etc.
Controller class,implements listeners for GUI class,have a reference to FBNTableModel(extebds AbstractTableModel) and FBNDataFacade(Facade for DataClient).
Controller has a main method which initialises a frame to take in client choice regarding mode of access.
As per client choice connection to data services is made,then through main method GUI class's makeGui method is called to make the GUI,with two combos having destinations nad origins preloaded into them.
Based on client criteria information is retrived from the data services and JTable is filled up with data.
For Booking of seats double click a row of table and enter the number of seats required into the pop up dialogs text field.
Controller will be having reference to to all three of them(GUI,TableMOdel&Facade).It receives events from the GUI,on the bases of that it works with Facade and retrives relevent data updataes table model which in turn updates JTable in GUI.
Am i right with my MVC implementation.
Please comment.
VikasSood
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're infected by the deadly OO blather virus.
The best, and currently most often overlooked, principle of software engineering is KISS (not to be confused with KISS).
Classes should be well focused, but don't throw out the baby with the bath water. All your GUI component action listeners should be in your GUI class, though they may in fact just be skeletons that call a method in some other class to do the real work.
The OO "Model" in the case of FBN is that class/classes that deals with the Oracle/relational-database like "data model," the "View" of which will be created by your GUI. The Model shouldn't be concerned with- or particularly even aware of- the View, and vice-versa.
To realize this isolation, you of course need some "Controller" glue in-between, which is where the real work is done on behalf of your GUI(when you click on your Search button, for example).
In your Model, you'll do database-oriented "business logic" stuff like checking to see if there are enough seats available for fulfill the client's request. If not, you throw an OhHellException, which will be caught, and dealt with appropriately, by your Controller.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Controller will be having reference to to all three of them(GUI,TableMOdel&Facade).It receives events from the GUI,on the bases of that it works with Facade and retrives relevent data updataes table model which in turn updates JTable in GUI.


You have the right idea, but it looks to me that you are missing the Model component in your MVC design. TableMOdel class is a model for JTable view, not the application view. In other words, JTable-TableModel implement its own MV pattern, but you should be building AppModel-AppView-AppController relationship.
Eugene.
 
Vikas Sood
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am going to have DataFacade which will be acting as Model for My GUI.
VikasSood
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic