Browse Source

Versuch SendCommand mit invoker zu implementieren

Jens
Jens Schuhmann 1 year ago
parent
commit
1aa5b51e78

+ 5
- 2
src/ChatProgramm/Start.java View File

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);
} }



+ 3
- 6
src/ChatProgramm/controller/GrafikController.java View File

{ {
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;
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

Loading…
Cancel
Save