package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import model.Message;
import view.MessageBoard;

public class MessageBoardController implements ActionListener{
	private Controller controller;
	
	public MessageBoardController(Controller controller) {
		this.controller = controller;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		MessageBoard messageBoard =(MessageBoard)((JButton)e.getSource()).getParent();
		//System.out.println("Send this message: "+messageBoard.getMessage()+" to: "+messageBoard.getUser().getUserName());
		String mess = messageBoard.getMessage();
		System.out.println("in controller "+mess);
		Message messageToServet = new Message(messageBoard.getUser().getUserName(),mess);
		Message messageToDoc = new Message(controller.getModel().getAuthUser().getUserName(),mess);
		messageToDoc.printMessage(messageBoard.getUser().getDoc());
		controller.getServerHandler().sendMessage(messageToServet);
	}

}

@@ -655,16 +655,41 @@
 sage();%0A
+%09%09if(!mess.equals(%22%22))%7B%0A%09
 %09%09System
@@ -719,32 +719,33 @@
 ller %22+mess);%0A%09%09
+%09
 Message messageT
@@ -810,16 +810,17 @@
 ,mess);%0A
+%09
 %09%09Messag
@@ -907,16 +907,17 @@
 ess);%0A%09%09
+%09
 messageT
@@ -968,16 +968,17 @@
 Doc());%0A
+%09
 %09%09contro
@@ -1031,14 +1031,18 @@
 ervet);%0A
+%09%09%7D%0A
 %09%7D%0A%0A%7D%0A

Fix Client Send Empty message