From 8653655681e7bc10e0b220d35de4280642931dcf Mon Sep 17 00:00:00 2001 From: Sogomn Date: Tue, 2 Feb 2016 16:24:52 +0100 Subject: [PATCH] Minor changes Cleaned up --- Ratty/src/de/sogomn/rat/ActiveClient.java | 2 +- Ratty/src/de/sogomn/rat/IClientObserver.java | 2 +- Ratty/src/de/sogomn/rat/Trojan.java | 2 +- Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java | 7 +++++++ .../de/sogomn/rat/server/gui/RattyGuiController.java | 11 +++++++++-- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Ratty/src/de/sogomn/rat/ActiveClient.java b/Ratty/src/de/sogomn/rat/ActiveClient.java index 17432ef..c748efc 100644 --- a/Ratty/src/de/sogomn/rat/ActiveClient.java +++ b/Ratty/src/de/sogomn/rat/ActiveClient.java @@ -87,7 +87,7 @@ public final class ActiveClient extends TCPConnection { } if (observer != null) { - observer.disconnected(this); + observer.clientDisconnected(this); } } diff --git a/Ratty/src/de/sogomn/rat/IClientObserver.java b/Ratty/src/de/sogomn/rat/IClientObserver.java index 2da5512..9cbd692 100644 --- a/Ratty/src/de/sogomn/rat/IClientObserver.java +++ b/Ratty/src/de/sogomn/rat/IClientObserver.java @@ -6,6 +6,6 @@ public interface IClientObserver { void packetReceived(final ActiveClient client, final IPacket packet); - void disconnected(final ActiveClient client); + void clientDisconnected(final ActiveClient client); } diff --git a/Ratty/src/de/sogomn/rat/Trojan.java b/Ratty/src/de/sogomn/rat/Trojan.java index 80c8982..4265e79 100644 --- a/Ratty/src/de/sogomn/rat/Trojan.java +++ b/Ratty/src/de/sogomn/rat/Trojan.java @@ -14,7 +14,7 @@ public final class Trojan implements IClientObserver { } @Override - public void disconnected(final ActiveClient client) { + public void clientDisconnected(final ActiveClient client) { final String address = client.getAddress(); final int port = client.getPort(); diff --git a/Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java b/Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java index 4b43155..9094367 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java +++ b/Ratty/src/de/sogomn/rat/server/gui/DisplayPanel.java @@ -29,6 +29,7 @@ public final class DisplayPanel { screen.setResizeBehavior(ResizeBehavior.KEEP_ASPECT_RATIO); screen.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); screen.setBackgroundColor(Color.BLACK); + screen.addKeyboardListener(this::keyEvent); screen.addListener(g -> { g.drawImage(image, 0, 0, null); }); @@ -36,6 +37,12 @@ public final class DisplayPanel { return screen; } + private void keyEvent(final int key, final boolean flag) { + if (controller != null) { + //TODO + } + } + private void drawToScreenImage(final BufferedImage imagePart, final int x, final int y) { final Graphics2D g = image.createGraphics(); diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java index 0fd73c2..df10d82 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java +++ b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java @@ -27,6 +27,11 @@ import de.sogomn.rat.server.ActiveServer; import de.sogomn.rat.server.IServerObserver; import de.sogomn.rat.util.FrameEncoder.IFrame; +/* + * THIS CLASS IS A MESS! + * I HAVE NO IDEA HOW ONE MAKES NON-MESSY CONTROLLER CLASSES + */ + public final class RattyGuiController implements IServerObserver, IClientObserver, IGuiController { private RattyGui gui; @@ -213,7 +218,7 @@ public final class RattyGuiController implements IServerObserver, IClientObserve } @Override - public void disconnected(final ActiveClient client) { + public void clientDisconnected(final ActiveClient client) { final ServerClient serverClient = getServerClient(client); final long id = serverClient.id; @@ -258,7 +263,9 @@ public final class RattyGuiController implements IServerObserver, IClientObserve serverClient.setStreamingDesktop(false); gui.setStreaming(lastIdClicked, false); } else if (command == RattyGui.FILES) { - serverClient.getTreePanel().setVisible(true); + final FileTreePanel treePanel = serverClient.getTreePanel(); + + treePanel.setVisible(true); } }