Aufgeräumt
This commit is contained in:
parent
a5b238fe4f
commit
928e6ae1af
@ -5,13 +5,12 @@
|
||||
|
||||
package ChatProgramm;
|
||||
|
||||
//import ChatProgramm.controller.CommandController;
|
||||
import ChatProgramm.controller.GrafikController;
|
||||
import ChatProgramm.controller.commands.CommandConnectV2;
|
||||
import ChatProgramm.controller.commands.CommandSendV2;
|
||||
import ChatProgramm.model.ChatModel;
|
||||
import ChatProgramm.model.GrafikDaten;
|
||||
import ChatProgramm.model.ReceiveAdapter;
|
||||
import ChatProgramm.controller.ReceiveAdapter;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import ChatProgramm.view.GrafikView;
|
||||
import javax.swing.JOptionPane;
|
||||
@ -41,24 +40,9 @@ public class Start
|
||||
CommandSendV2 cSend = new CommandSendV2(view, model);
|
||||
cSend.registerEvents();
|
||||
|
||||
|
||||
|
||||
ReceiveAdapter rAdapter = new ReceiveAdapter(view, model);
|
||||
model.addSubscription(rAdapter);
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// GrafikController controller = new GrafikController(zeichenflaeche, model);
|
||||
// controller.registerEvents();
|
||||
//
|
||||
// CommandController controller_commands = new CommandController(view, model, controller, zeichenflaeche);
|
||||
// controller_commands.registerEvents();
|
||||
// controller_commands.registerCommands();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
view.setVisible(true);
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
///*
|
||||
// * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
// * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
// */
|
||||
//
|
||||
//package ChatProgramm.controller;
|
||||
//
|
||||
//import ChatProgramm.controller.commands.CommandConnect;
|
||||
//import ChatProgramm.controller.commands.CommandInvoker;
|
||||
//import ChatProgramm.controller.commands.CommandSend;
|
||||
//import ChatProgramm.model.GrafikDaten;
|
||||
//import ChatProgramm.view.ChatView;
|
||||
//import ChatProgramm.view.GrafikView;
|
||||
//import java.awt.Component;
|
||||
//import java.awt.event.ActionEvent;
|
||||
//import java.awt.event.ActionListener;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author ahren
|
||||
// */
|
||||
//public class CommandController implements ActionListener{
|
||||
//
|
||||
// private ChatView view;
|
||||
// private GrafikDaten model;
|
||||
// private GrafikView gView;
|
||||
// private CommandInvoker invoker;
|
||||
// private GrafikController controller;
|
||||
//
|
||||
//public CommandController(ChatView view, GrafikDaten model, GrafikController controller, GrafikView gView){
|
||||
// this.view = view;
|
||||
// this.model = model;
|
||||
// this.gView = gView;
|
||||
// this.invoker = new CommandInvoker();
|
||||
// this.controller = controller;
|
||||
// }
|
||||
//
|
||||
// public void registerEvents(){
|
||||
// view.getBtnConnect().addActionListener(this);
|
||||
// }
|
||||
//
|
||||
// public void registerCommands(){
|
||||
// CommandSend commandSend = new CommandSend(view.getGvZeichenflaeche(), model);
|
||||
// invoker.addCommand(view.getBtnConnect(), new CommandConnect(view, commandSend, model, gView));
|
||||
// this.controller.setCommand(commandSend);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Ausführen des jeweiligen Kommandos
|
||||
// * @param e Referenz auf das Event
|
||||
// */
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// Component key = (Component)e.getSource();
|
||||
// invoker.executeCommand(key);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//
|
@ -5,19 +5,17 @@
|
||||
|
||||
package ChatProgramm.controller;
|
||||
|
||||
//import ChatProgramm.controller.commands.CommandSend;
|
||||
import java.awt.Point;
|
||||
|
||||
import ChatProgramm.model.ChatModel;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import ChatProgramm.model.ChatModel;
|
||||
import ChatProgramm.model.GrafikDaten;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import ChatProgramm.view.GrafikView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author le
|
||||
@ -27,7 +25,6 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene
|
||||
private static Logger lg = OhmLogger.getLogger();
|
||||
private ChatView view;
|
||||
private ChatModel model;
|
||||
// private CommandSend commandSend;
|
||||
|
||||
public GrafikController(ChatView view, ChatModel model)
|
||||
{
|
||||
@ -42,8 +39,6 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene
|
||||
view.getGvZeichenflaeche().addMouseListener(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent evt)
|
||||
{
|
||||
@ -53,11 +48,6 @@ public class GrafikController extends MouseAdapter implements MouseMotionListene
|
||||
view.getGvZeichenflaeche().drawPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent evt)
|
||||
{
|
||||
|
@ -2,8 +2,10 @@
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
package ChatProgramm.controller;
|
||||
|
||||
import ChatProgramm.model.ChatModel;
|
||||
import ChatProgramm.model.Figur;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import ChatProgramm.view.GrafikView;
|
@ -1,82 +0,0 @@
|
||||
///*
|
||||
// * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
// * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
// */
|
||||
//
|
||||
//package ChatProgramm.controller.commands;
|
||||
//
|
||||
//import ChatProgramm.model.Client;
|
||||
//import ChatProgramm.model.GrafikDaten;
|
||||
//import ChatProgramm.model.Server;
|
||||
//import ChatProgramm.util.OhmLogger;
|
||||
//import ChatProgramm.view.ChatView;
|
||||
//import ChatProgramm.view.GrafikView;
|
||||
//import java.io.IOException;
|
||||
//import java.util.logging.Logger;
|
||||
//import javax.swing.JDialog;
|
||||
//import javax.swing.JRadioButton;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author ahren
|
||||
// */
|
||||
//public class CommandConnect implements CommandInterface
|
||||
//{
|
||||
// private JRadioButton rBtnServer;
|
||||
// private JRadioButton rBtnClient;
|
||||
// private JDialog dialogFenster;
|
||||
// private static Logger lg = OhmLogger.getLogger();
|
||||
// private CommandSend commandSend;
|
||||
// private ChatView view;
|
||||
// private GrafikDaten model;
|
||||
// private GrafikView gView;
|
||||
//
|
||||
// public CommandConnect(ChatView view, CommandInterface value, GrafikDaten model, GrafikView gView)
|
||||
// {
|
||||
// rBtnServer = view.getBtnServer();
|
||||
// rBtnClient = view.getBtnClient();
|
||||
// dialogFenster = view.getjDialog1();
|
||||
//
|
||||
// commandSend = (CommandSend) value;
|
||||
//
|
||||
// this.view = view;
|
||||
// this.model = model;
|
||||
// this.gView = gView;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void execute()
|
||||
// {
|
||||
// if(rBtnServer.isSelected()){
|
||||
// lg.info("Server ausgewählt");
|
||||
// try {
|
||||
// commandSend.setTransmitter(new Server(view, model, gView));
|
||||
// } catch (IOException ex) {
|
||||
// lg.info("Die Verbindung zum Server ist Fehlgeschlagen");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(rBtnClient.isSelected()){
|
||||
// lg.info("Client ausgewählt");
|
||||
// try {
|
||||
// commandSend.setTransmitter(new Client(view, model, gView));
|
||||
// } catch (IOException ex) {
|
||||
// lg.info("Die Verbindung zum Client ist Fehlgeschlagen");
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// dialogFenster.setVisible(false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isUndoable()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void undo()
|
||||
// {
|
||||
// }
|
||||
//}
|
@ -9,6 +9,7 @@ import ChatProgramm.model.Client;
|
||||
import ChatProgramm.model.Server;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
package ChatProgramm.controller.commands;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public interface CommandInterface
|
||||
{
|
||||
public void execute();
|
||||
public void undo();
|
||||
public boolean isUndoable();
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
package ChatProgramm.controller.commands;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.HashMap;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public class CommandInvoker {
|
||||
|
||||
private HashMap<Component, CommandInterface> commands;
|
||||
private Stack <CommandInterface> undoStack;
|
||||
|
||||
public CommandInvoker(){
|
||||
commands = new HashMap<>();
|
||||
undoStack = new Stack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt ein Kommando zur Kommando-"Datenbank" = HashMap hinzu
|
||||
* @param key Quelle des Events
|
||||
* @param value Referenz auf das zugehörige Kommando-Objekt
|
||||
*/
|
||||
public void addCommand(Component key, CommandInterface value){
|
||||
commands.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Führt Kommando der Eventquelle "key" aus und legt die Referenz
|
||||
* des Kommando in den Undo-Stack
|
||||
* @param key Referenz auf die Eventquelle
|
||||
*/
|
||||
public void executeCommand(Component key){
|
||||
CommandInterface command = commands.get(key);
|
||||
command.execute();
|
||||
if (command.isUndoable())
|
||||
{
|
||||
undoStack.push(command);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Falls der Stack Elemente enthält, wird das oberste Element geholt
|
||||
* und die Methode "undo" des Commands aufgerufen
|
||||
*/
|
||||
public void undoCommand()
|
||||
{
|
||||
if (!undoStack.isEmpty())
|
||||
{
|
||||
undoStack.pop().undo();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht bei Öffnen einer neuen Datei den Stack
|
||||
*/
|
||||
public void deleteStack()
|
||||
{
|
||||
while(!undoStack.isEmpty())
|
||||
undoStack.pop();
|
||||
}
|
||||
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
///*
|
||||
// * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
// * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
// */
|
||||
//
|
||||
//package ChatProgramm.controller.commands;
|
||||
//
|
||||
//import ChatProgramm.model.*;
|
||||
//import ChatProgramm.util.OhmLogger;
|
||||
//import ChatProgramm.view.ChatView;
|
||||
//
|
||||
//import java.awt.event.MouseAdapter;
|
||||
//import java.awt.event.MouseMotionListener;
|
||||
//import java.util.logging.Logger;
|
||||
//import javax.swing.JTextField;
|
||||
//import ChatProgramm.view.GrafikView;
|
||||
//
|
||||
///**
|
||||
// *
|
||||
// * @author ahren
|
||||
// */
|
||||
//public class CommandSend extends MouseAdapter implements MouseMotionListener
|
||||
//{
|
||||
// private static Logger lg = OhmLogger.getLogger();
|
||||
//
|
||||
// private ChatView view;
|
||||
// private ChatModel model;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// public CommandSend(ChatView view, ChatModel model)
|
||||
// {
|
||||
// this.view = view;
|
||||
// this.model = model;
|
||||
// //ToDo: Hier muss auch der gFrame referenziert werden
|
||||
// //this.eingabeFeld = view.getTfNachricht();
|
||||
// transmitterInterface = null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void execute()
|
||||
// {
|
||||
// Figur aktuelleFigur = model.getFiguren().getLast();
|
||||
// try
|
||||
// {
|
||||
// transmitterInterface.send(aktuelleFigur);
|
||||
//
|
||||
// }
|
||||
// catch(Exception NullPointerExeption)
|
||||
// {
|
||||
// lg.info("Der Transmitter ist null");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public boolean isUndoable()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void undo()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void setTransmitter(TransmitterInterface transmitter) {
|
||||
// lg.info("Transmitter wird gesetzt");
|
||||
// if(transmitter != null){
|
||||
// this.transmitterInterface = transmitter;
|
||||
//
|
||||
// }
|
||||
// else{
|
||||
// lg.info("der transmitter kommt hier als null an");
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -5,13 +5,12 @@
|
||||
package ChatProgramm.controller.commands;
|
||||
|
||||
import ChatProgramm.model.ChatModel;
|
||||
import ChatProgramm.model.Client;
|
||||
import ChatProgramm.model.Server;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.io.IOException;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
|
@ -4,11 +4,6 @@
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.controller.GrafikController;
|
||||
//import ChatProgramm.controller.commands.CommandConnect;
|
||||
import ChatProgramm.controller.commands.CommandConnectV2;
|
||||
//import ChatProgramm.controller.commands.CommandSend;
|
||||
import ChatProgramm.controller.commands.CommandSendV2;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
|
||||
import java.util.concurrent.Flow;
|
||||
|
@ -6,10 +6,10 @@ package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import ChatProgramm.view.GrafikView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.logging.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Builder Class
|
||||
|
@ -4,21 +4,14 @@
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.prefs.Preferences;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -7,10 +7,10 @@ package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import ChatProgramm.view.GrafikView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.logging.*;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Builder Class
|
||||
|
@ -4,26 +4,14 @@
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
import ChatProgramm.controller.ReceiveAdapter;
|
||||
import ChatProgramm.util.OhmLogger;
|
||||
import ChatProgramm.view.ChatView;
|
||||
import ChatProgramm.view.GrafikView;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.Flow.Subscriber;
|
||||
import java.util.concurrent.SubmissionPublisher;
|
||||
import java.util.logging.Level;
|
||||
@ -83,8 +71,6 @@ public abstract class Transmitter implements Runnable {
|
||||
lg.info("Reader / Writer Initialisierung abgeschlossen");
|
||||
startempfangen();
|
||||
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Transmitter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
||||
*/
|
||||
package ChatProgramm.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
*/
|
||||
public interface TransmitterInterface
|
||||
{
|
||||
public void send(Figur figur);
|
||||
public Figur receive();
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user