Zwischenstand vor Praktikum

This commit is contained in:
2023-12-19 11:48:40 +01:00
parent a4a45ed5f2
commit 5117ecdb6f
10 changed files with 74 additions and 52 deletions
@@ -10,6 +10,7 @@ import ChatProgramm.controller.commands.CommandInvoker;
import ChatProgramm.controller.commands.CommandSend;
import ChatProgramm.model.GrafikModel;
import ChatProgramm.view.ChatView;
import ChatProgramm.view.GrafikView;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -22,12 +23,16 @@ public class CommandController implements ActionListener{
private ChatView view;
private GrafikModel model;
private GrafikView gView;
private CommandInvoker invoker;
private GrafikController controller;
public CommandController(ChatView view, GrafikModel model){
public CommandController(ChatView view, GrafikModel model, GrafikController controller, GrafikView gView){
this.view = view;
this.model = model;
this.gView = gView;
this.invoker = new CommandInvoker();
this.controller = controller;
}
public void registerEvents(){
@@ -38,8 +43,8 @@ public class CommandController implements ActionListener{
public void registerCommands(){
CommandSend commandSend = new CommandSend(view.getGvZeichenflaeche(), model);
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view, commandSend));
//invoker.addCommand(view.getTfNachricht(), commandSend);
invoker.addCommand(view.getBtnConnect(), new CommandConnect(view, commandSend, model, gView));
this.controller.setCommand(commandSend);
}
/**
@@ -50,9 +55,7 @@ public class CommandController implements ActionListener{
public void actionPerformed(ActionEvent e) {
Component key = (Component)e.getSource();
invoker.executeCommand(key);
// if(key == view.getBtnOpen()|| key==view.getMiOpen())
// invoker.deleteStack();
// }
}
}