CVSServer.java :  » IDE » Schmortopf » CVS_Server » Java Open Source

Java Open Source » IDE » Schmortopf 
Schmortopf » CVS_Server » CVSServer.java
package CVS_Server;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import Schmortopf.Utility.gui.JSenseButton;
import CVS_Server.Network.ConnectionListener;
import CVS_Server.Projects.ProjectManager;



public class CVSServer extends JFrame
{
  private final static String FrameTitle = "CVS Server";

  private ConnectionListener connectionListener;

                                                                          

  // The manager, which handles all project file stuff and has a view too.
  // There is ONE projectmanager and ONE projectmanagerview in this server.
  private ProjectManager projectManager;
                                                                          


  public CVSServer()
  {
    // Create the ClientProcessorThread. This one will call
    // methods in this object, when there is work to do.
    this.connectionListener = new ConnectionListener( this );

    this.projectManager = new ProjectManager();

    // UI stuff temporary: [can be changed completely...]
    this.setTitle( FrameTitle );
    this.setSize(700,600);
    this.setLocation(200,100);
    this.getContentPane().setLayout( new BorderLayout() );
    
    // Locate the projectmanager's view centered:                                                         
    this.getContentPane().add( this.projectManager.getView(), BorderLayout.CENTER );

    // Locate the button panel on the bottom:
    JSenseButton exitButton = new JSenseButton("     Exit     ",true,null);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(exitButton);
    this.getContentPane().add(buttonPanel,BorderLayout.SOUTH );
    exitButton.addActionListener( new ActionListener()
     {
       public void actionPerformed( ActionEvent e )
       {
         connectionListener.terminate();
         System.exit(0);
       }
     });
  } // Constructor





 /**
  *  Called after all has been constructed, GUI inclusively.
  *  It starts the thread, which listens on the server port.
  */
  public void startListening()
  {
    this.connectionListener.start();
  }





 /**
  *  Starts the CVS Server.
  */
  public static void main( String[] arguments )
  {
    CVSServer s = new CVSServer();
    s.setVisible(true);
    s.startListening();
  }


} // CVSServer



java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.