01: package CVS_Server;
02:
03: import java.awt.*;
04: import java.awt.event.*;
05: import javax.swing.*;
06:
07: import Schmortopf.Utility.gui.JSenseButton;
08: import CVS_Server.Network.ConnectionListener;
09: import CVS_Server.Projects.ProjectManager;
10:
11: public class CVSServer extends JFrame {
12: private final static String FrameTitle = "CVS Server";
13:
14: private ConnectionListener connectionListener;
15:
16: // The manager, which handles all project file stuff and has a view too.
17: // There is ONE projectmanager and ONE projectmanagerview in this server.
18: private ProjectManager projectManager;
19:
20: public CVSServer() {
21: // Create the ClientProcessorThread. This one will call
22: // methods in this object, when there is work to do.
23: this .connectionListener = new ConnectionListener(this );
24:
25: this .projectManager = new ProjectManager();
26:
27: // UI stuff temporary: [can be changed completely...]
28: this .setTitle(FrameTitle);
29: this .setSize(700, 600);
30: this .setLocation(200, 100);
31: this .getContentPane().setLayout(new BorderLayout());
32:
33: // Locate the projectmanager's view centered:
34: this .getContentPane().add(this .projectManager.getView(),
35: BorderLayout.CENTER);
36:
37: // Locate the button panel on the bottom:
38: JSenseButton exitButton = new JSenseButton(" Exit ",
39: true, null);
40: JPanel buttonPanel = new JPanel();
41: buttonPanel.add(exitButton);
42: this .getContentPane().add(buttonPanel, BorderLayout.SOUTH);
43: exitButton.addActionListener(new ActionListener() {
44: public void actionPerformed(ActionEvent e) {
45: connectionListener.terminate();
46: System.exit(0);
47: }
48: });
49: } // Constructor
50:
51: /**
52: * Called after all has been constructed, GUI inclusively.
53: * It starts the thread, which listens on the server port.
54: */
55: public void startListening() {
56: this .connectionListener.start();
57: }
58:
59: /**
60: * Starts the CVS Server.
61: */
62: public static void main(String[] arguments) {
63: CVSServer s = new CVSServer();
64: s.setVisible(true);
65: s.startListening();
66: }
67:
68: } // CVSServer
|