ClientSideView( int portNum, String host )
	{
		eventMapper = new EventMapper( new ClientActionConfigurator().getConfigurator());
		text = new JLabel( "Text to send over socket:" );
		textField = new JTextField( 20 );
		button = new JButton( "Click Me" );
		webSocketPortOpener = new JButton( "Open web-socket port" );
		webSocketPortOpener.addActionListener( new ActionListener()
		{
			public void actionPerformed( ActionEvent event )
			{
				Integer webSocketPort = 0;
				try
				{
					webSocketPort = Integer.parseInt( portNumberTextField.getText() );
				}
				catch( NumberFormatException ex )
				{
					ex.printStackTrace();
				}
				if( webSocketPort != 0 )
				{
					HashMap<String, Object> params = new HashMap<String, Object>();
					params.put("WEBSOCKET_PORT", webSocketPort);
					requestSender.sendToServer( new Message( "WS", params ) );
				}
			}
		} );
		portNumberTextField = new JTextField( 10 );

		button.addActionListener( this );
		panel = new JPanel();

		panel.setLayout( new BorderLayout() );
		panel.setBackground( Color.white );

		getContentPane().add( panel );
		panel.add( "South", text );
		panel.add( "West", textField );
		panel.add( "North", button );
		panel.add( "East", webSocketPortOpener );
		panel.add( "Center", portNumberTextField );

		newDataListenerPort = (int) (Math.random() * MAX_PORT_NUM);
		while( newDataListenerPort < 80 )
		{
			newDataListenerPort = (int) (Math.random() * MAX_PORT_NUM);
		}

//		serverState = new NewDataListener( newDataListenerPort );
//		Thread serverStateThread = new Thread( serverState );
//		serverStateThread.start();

		requestSender = new ClientSocketAdmin( actions, portNum, host, 10 );
		dispatcher = new Dispatcher( actions, eventMapper );
		Thread dispatcherThread = new Thread(dispatcher);
		dispatcherThread.start();
		Thread requestSenderThread = new Thread( requestSender );
		requestSenderThread.start();
		ClientComponentsRegister.addComponent( "SOCKET_ADMIN", requestSender);

//		NewDataListener newDataListener = new NewDataListener( 10045 );
//		Thread newDataListenerThread = new Thread( newDataListener );
//		newDataListenerThread.start();
//		System.out.println( "after initialisation" );
	}