wood burning stoves*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Control scheme for the client GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Control scheme for the client GUI" Watch "Control scheme for the client GUI" New topic
Author

Control scheme for the client GUI

Geir Morten Hagen
Ranch Hand

Joined: Apr 05, 2002
Posts: 34
The requirements says that the user interface should establish a control scheme that will support future functionality enhancements with minimal disruption to the users.
The part about being extensible is pretty straight forward, but I don't understand what they mean with "control scheme".
Anyone? I'm lost
dean tomlinson
Ranch Hand

Joined: Jan 31, 2002
Posts: 94
this was one of the few specific requirments that really stood out as blatent in the requirments spec. so i want to definitely get this one right.
i intepret this as... allow for future functionality enhancements such as extra searching options, a reservation panel that can be enhanced to allow the customer's details to be entered etc.
i think the way to do this is to implement the reservation screen as a dialog that pop's up when the user selects a record. i would then just have the search form and jtable on the main form ?
however ihave read that most/many others on this forum have just had all 3 panels on the one frame and got top marks for the GUI .
Does anyone have any advise/comments on this ?
cheers, dean
Geir Morten Hagen
Ranch Hand

Joined: Apr 05, 2002
Posts: 34
I only have the content pane, and use gridbaglayout to lay out the components. This is maybe not a good idea, when taking future enhancements into account?
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Geir, You are right about the spec. I think it is left unclear for the reason that we have to figure out a way to code to the spec with out having any idea about what they mean in the spec?!
Anyway I think adding more search criteria in the future is a definite possibility. Also I thought about adding more search domains like passenger search and passenger details in the future. So I've come up with a generic way to add panels to my JTabbedPane for future enhancements.
As long as you use layout managers, future additions to the gui is always possible. Of course we have to write code to make use of the additional gui components.
dean tomlinson
Ranch Hand

Joined: Jan 31, 2002
Posts: 94
hi sai,
i'm trying to picture your tabbed panes. do you have the search form, the results, and the reservation forms all on seperate tabs ?
i personally think tabs are good for seperating distinct areas of functionality within an application - but in this assignment i think we only have the one. If later we were going to implement functionality for reserving accomodation, the flight and accomodation reservation applications could be placed on seperate tabs.
i've done a lot of web development but not a lot of swing. i would ideally like to have my search form and the results on the same panel, seperated vertically. and when the user double clicks on a row in the table it pop's open a reservation panel, currently which only displays the flight details, and provides a text field for the user to enter the number of seats. by using a seperate panel there is no limit to the amount of information i can capture relating ot the reservation.
is there such a thing as the double click event in swing? otherwise i am going to have a button beneath the results table, that when clicked, gets the selected row in the jtable and then pops up the reservation dialog.
any comments ?
Geir Morten Hagen
Ranch Hand

Joined: Apr 05, 2002
Posts: 34
That's what irritates me. The GUI is working perfectly, all the required functions are implemented and everything. The only problem I have is the part about extendability.
Another thing is that all my GUI code is in one large class, which keeps a private variable of type ClientFacade (which handles networking) and implements ActionListener. The actionPerformed() method sends requests to the ClientFacade. I'm no guru at gui programming, but this can't be very extendible?
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Dean,
Having the search criteria and the table to show the results in one screen (may be in more than one JPanel(s)) makes sense. This is what I have in one tab. I show the flight details in another tab. User can open as many flight details tab as they want but only one flight search tab(Singleton).
I have developed fairly complex Swing applications before and if I were to implement this system in a real life, I would go with JInternalFrame(s) and JTabbedPane inside the JInternalFrame.
I guess having a seperate tab for search and details in this assignment works out fine. It is simple and extensible.
Geir,
I am not used to putting all the information in one class and have a Facade with listeners. You don't have to it in the way I did with JTabbedPane. Search for gui related posts in this forum. I think people have passed the assignment with similar design like yours.
In order to implement the double clicking the row to bring the flight details, you need to use ListSelectionModel and ListSelectionListener. I wouldn't do it for this assignment. I have a simple button to bring the details.
Endre Moen
Greenhorn

Joined: Apr 25, 2002
Posts: 5
Geir,
back to the question about establishing a control scheme. I think you should not focus on how the layout managers are ordered. It is very difficult to predict how other programmers will want to organize additional components in the future.
I believe you should focus on how the classes are organized. I have a main class that starts the party, asks if the user wish to start in local or in network mode, then create a client facade with server side methods, and then the main class starts the GUI. This resembles the Control-model-view pattern, which is maybe what they mean by a control-scheme. I think it is ok to have all the gui in one class. I use a boarder layout, with multiple nested layout managers. This might seem cluttered, but I think the complexity adds up to that of using a gridbaglayout (“…<gridbaglayout> is pure evil.” –Complete Java 2 Certification)
I think having a threaded client facade with action listeners is a great idea. Then the gui will not hug waiting for the server.


Sun-to-be Certified Java Developer
Geir Morten Hagen
Ranch Hand

Joined: Apr 05, 2002
Posts: 34
That's pretty much what I've done. I have a main class that creates an instance of the client facade and an instance of the gui. The gui currently just consist of two classes, the main gui class and a datamodel class (+ a help dialog).
Maybe I should at least create a search panel and add the search components to that, so that only this panel have to be changed if the search functionality is to be enhanced. And possibly a dialog for booking. Now there's just a textfield and a button beneath the search components.
Comments?
GridBagLayout is not evil, by the way
dean tomlinson
Ranch Hand

Joined: Jan 31, 2002
Posts: 94
Hi Endre,
I'm interested in your threaded client facade.
so instead of having something like String[][] getFlights(searchString); which would obviuolsy block whilst the database was searched, and depending on the number of concurrent users could become a lengthy process, you have void getFlights(searchString); and then get notified when the results are complete.
Is that the gist of how it would work ?
Perhaps someone who's been around here a bit longer than me can comment on this, but I have read time and time again to be wary of doing things that aren't specifically asked for - as it can work against you.
cheers dean
Geir Morten Hagen
Ranch Hand

Joined: Apr 05, 2002
Posts: 34
Dean,
The way I did this was to implement ActionListener in the main gui class, and when the booking button or searching combos are clicked, I kick of an anonymous worker thread that calls the methods that will take a long time or block on the client facade (and ultimatly on the remote object). That way the gui never hangs.
[ May 03, 2002: Message edited by: Geir Morten Hagen ]
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
hi guys,
I am also having similar doubts regarding the control scheme in the gui. In my implementation I am using a menubar and toolbar for starting the researcation and serarch programs. All the panes are displayed as InternalFrames in the gui.
In this way the future programmers can simply add new functionality and keep adding new options into the menubar/toolbar and display the corresponding panes as InternalFrames in the desktoppane.
Any suggetions are welcome,
Thanks,
Vishal Sinha
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Vishal,
That is the way to do it. I opted for JTabbedPane instead of JInternalFrame.
Geir,
When you launch worker thread for search or booking flights in GUI, can the user click on those buttons again and again?
What do you do if the user clicks the button to book flights 2 times? How do you avoid double booking for the same person for the same flight?
[ May 03, 2002: Message edited by: Sai Prasad ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Control scheme for the client GUI