Versuch SendCommand mit invoker zu implementieren

This commit is contained in:
Jens Schuhmann 2023-12-18 14:00:26 +01:00
parent 19fd23c638
commit 1aa5b51e78
2 changed files with 8 additions and 8 deletions

View File

@ -25,11 +25,14 @@ public class Start
ChatView view = new ChatView(); ChatView view = new ChatView();
GrafikView zeichenflaeche = view.getGvZeichenflaeche(); GrafikView zeichenflaeche = view.getGvZeichenflaeche();
zeichenflaeche.setModel(model); zeichenflaeche.setModel(model);
GrafikController controller = new GrafikController(zeichenflaeche, model);
controller.registerEvents();
CommandController controller_commands = new CommandController(view); CommandController controller_commands = new CommandController(view);
controller_commands.registerEvents(); controller_commands.registerEvents();
controller_commands.registerCommands(); controller_commands.registerCommands();
GrafikController controller = new GrafikController(zeichenflaeche, model, controller_commands);
controller.registerEvents();
view.setVisible(true); view.setVisible(true);
} }

View File

@ -24,9 +24,9 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene
{ {
private GrafikView view; private GrafikView view;
private GrafikModel model; private GrafikModel model;
private CommandInvoker invoker; private CommandControler commandController;
public GrafikController(GrafikView view, GrafikModel model) public GrafikController(GrafikView view, GrafikModel model, CommandController controller_commands)
{ {
this.view = view; this.view = view;
this.model = model; this.model = model;
@ -37,10 +37,7 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene
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