aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Server Side GUI Implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Server Side GUI Implementation" Watch "Server Side GUI Implementation" New topic
Author

Server Side GUI Implementation

David Sham
Ranch Hand

Joined: Apr 19, 2005
Posts: 61
I'd like some opinions on what it takes to start and stop the server. Right now I've got a JDialog I launch to prompt the user to choose a database file location and specify a port to use for the server. They can then click "ok" to start the server and the JDialog disappears and the server is then running. Any and all updates/exceptions to the user from the server are then posted via System.out.println. This is the simple approach.

My other consideration was to change the JDialog to a JFrame and replace the OK and Cancel buttons with "Start", "Stop", and "Quit" buttons to start, stop, and quit the server. But then I would have to add a label to specify which database file is in use and also implement error controls for starting the server without a database file selected, quitting the server app without stopping the server first, and other things. The point is that the GUI frame initially meant for just launching the server would become another application in itself - which is not required by the assignment at all. I don't know if it is worth the effort, and it could introduce many other failure points or potential loss of points due to unforseen bugs during examination.

Any opinions on which way to implement the server-side launch? I'm leaning towards the more simple approach.
Wei-ju Wu
Ranch Hand

Joined: Feb 16, 2005
Posts: 147
I did my server pretty much like you did and not planning to change this. As the name says, it is a server (my System.out.println() are replaced by calls to the Logging API). Many real world servers do not offer GUI's (not even a configuration dialog), but are controlled via a separate port for administration. But that would definitely be out of scope :-)


"The UrlyBird catches the certificate. And he's gonna FlyByNight"<br /> <br />SCJP 1.2/5.0, SCJD, SCBCD, SCWCD, SCEA
Ed Villamizar
Ranch Hand

Joined: Sep 02, 2004
Posts: 47
David,

My server GUI has three buttons (JButton), one text field (JTextField), a couple of informational labels (JLabel) about the status of the server and a server statistics section that keeps track of requests served.

The buttons are Start, Select File and Exit. I don't have a Stop button. To "serve" clients out of another data file you'd have to exit the application and select the new file.

The text field is to select the Port.

Once the server is started it cannot be stopped. The port field and start button are disabled and an informational field changes from a big red "DOWN" to a big green "SERVER UP".

The statistics section, which is totally optional, reports the number of requests served, total number of records returned, number of bookings made and a couple more that I don't remember right now.


MBA, PMP<br />SCJP, SCJD<br />ITIL Foundations Certified.
David Sham
Ranch Hand

Joined: Apr 19, 2005
Posts: 61
Wow, that sounds like quite a GUI implementation of your server. Sounds good. I have decided to go the simple route and just implement a JDialog that pops up before starting the server. It contains a list of available database files to choose with the option to browse for additional database files. The port can be specified in a JTextField. Database files can also be removed from the list via a "Remove" button I have. All database file locations are stored in a properties file along with the ports specified. But, the JDialog disappears when the "OK" button is pressed with a database file selected. Then the server is started with update messages sent to System.out. The user must press Ctrl-c to stop the server.

I use a similar dialog for starting the standalone client and network client.

It's a more simple approach only using the GUI JDialog for starting the server. All error messages are sent to System.out, with appropriate JOptionPane dialogs showing up if server startup errors occur (like invalid database file chosen, etc.).

I did not want to go too in-depth or beyond the requirements as more things could go wrong during evaluation, and you get no extra credit anyway.
Ed Villamizar
Ranch Hand

Joined: Sep 02, 2004
Posts: 47
Yes, I gave them more than what was required but I also wanted to build-up some experience.
Ken Boyd
Ranch Hand

Joined: Dec 10, 2003
Posts: 329
Agree with David. Even Max book has done same thing. I am leaning towards simple approach.
[ May 02, 2005: Message edited by: Nehul Nalekar ]

SCJP, SCWCD, SCBCD, SCJD, BB Java2 and JSP1.1
 
 
subject: Server Side GUI Implementation