|
|
|
|
|
|
|
|
|
|
|
|
|
|
package ChatProgramm.controller; |
|
|
package ChatProgramm.controller; |
|
|
|
|
|
|
|
|
|
|
|
import ChatProgramm.controller.commands.CommandConnect; |
|
|
|
|
|
import ChatProgramm.controller.commands.CommandInvoker; |
|
|
|
|
|
import ChatProgramm.controller.commands.CommandSend; |
|
|
import java.awt.Point; |
|
|
import java.awt.Point; |
|
|
import java.awt.event.MouseAdapter; |
|
|
import java.awt.event.MouseAdapter; |
|
|
import java.awt.event.MouseEvent; |
|
|
import java.awt.event.MouseEvent; |
|
|
import java.awt.event.MouseMotionListener; |
|
|
import java.awt.event.MouseMotionListener; |
|
|
import ChatProgramm.model.GrafikModel; |
|
|
import ChatProgramm.model.GrafikModel; |
|
|
import ChatProgramm.view.GrafikView; |
|
|
import ChatProgramm.view.GrafikView; |
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
private GrafikView view; |
|
|
private GrafikView view; |
|
|
private GrafikModel model; |
|
|
private GrafikModel model; |
|
|
|
|
|
private CommandInvoker invoker; |
|
|
|
|
|
|
|
|
public GrafikController(GrafikView view, GrafikModel model) |
|
|
public GrafikController(GrafikView view, GrafikModel model) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
view.addMouseMotionListener(this); |
|
|
view.addMouseMotionListener(this); |
|
|
view.addMouseListener(this); |
|
|
view.addMouseListener(this); |
|
|
} |
|
|
} |
|
|
|
|
|
public void registerCommands(){ |
|
|
|
|
|
CommandSend commandSend = new CommandSend(view); |
|
|
|
|
|
invoker.addCommand(view.getTfNachricht(), commandSend); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void mouseDragged(MouseEvent evt) |
|
|
public void mouseDragged(MouseEvent evt) |
|
|
|
|
|
|
|
|
public void mouseReleased(MouseEvent evt) |
|
|
public void mouseReleased(MouseEvent evt) |
|
|
{ |
|
|
{ |
|
|
model.endShape(); |
|
|
model.endShape(); |
|
|
|
|
|
Component key = (Component)evt.getSource(); |
|
|
|
|
|
invoker.executeCommand(key); |
|
|
// if (evt.getButton() == MouseEvent.BUTTON3) |
|
|
// if (evt.getButton() == MouseEvent.BUTTON3) |
|
|
// { |
|
|
// { |
|
|
// view.doPrint(); |
|
|
// view.doPrint(); |