view rep/SessionManagerGUI.java @ 105:9c97532b9851

*** empty log message ***
author pin
date Sat, 22 Dec 2007 21:22:36 +0900
parents 57a16534ba5a
children 790c8dd42a7b
line wrap: on
line source

package rep;

import java.awt.BorderLayout;
import java.awt.Container;
import java.nio.channels.SocketChannel;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import rep.gui.ConnectionPanel;

public class SessionManagerGUI implements Runnable{
	public static void main(String[] args) {
		SessionManagerGUI gui = new SessionManagerGUI();
		Thread th = new Thread( gui ); 
		th.start();
	}

	private RPanel rp;
	//private ConnectionPanel rp;
	private JFrame frame;

	public void run() {
		frame = new JFrame("SessionManager");
		frame.setBounds(100, 100, 600, 300);
		//rp =  new ConnectionPanel();
		rp = new RPanel();
		Container cont = frame.getContentPane();
		cont.add(rp);

		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//frame.pack();
		frame.setVisible(true);
	}

	public void addConnectionListener(ConnectionListener listener) {
		//System.out.println(rp.toString());
		System.out.print("waiting for launching GUI.");
		while(rp == null){
			System.out.print(".");
			try {
				Thread.sleep(200);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		System.out.println("");
		rp.addConnectionListener(listener);
	}

	public void setComboEditor(int eid, SocketChannel channel) {
		// TODO Auto-generated method stub
		rp.setComboEditor(eid, channel);
		rp.setTableEditor(eid, channel);
	}

	public void addREPActionListener(REPActionListener listener) {
		// TODO Auto-generated method stub
		rp.REPActionListener(listener);
	}

	public void setComboSession(int sessionID, String string) {
		// TODO Auto-generated method stub
		rp.setComboSession(sessionID, string);
		rp.setTableSession(sessionID, string);
	}
}