From db9b2bf3074672995ed488c9d9f123d1150c0efb Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Thu, 2 May 2013 16:29:39 +0000 Subject: [PATCH] Updates to GUI --- src/zutil/log/netlog/NLExceptionData.java | 50 ++++++++++ src/zutil/log/netlog/NLLogData.java | 39 ++++++++ src/zutil/log/netlog/NetLoggerClient.java | 23 ++++- .../log/netlog/NetLoggerClientInstance.css | 30 ++++++ .../log/netlog/NetLoggerClientInstance.fxml | 26 ++--- .../log/netlog/NetLoggerClientInstance.java | 94 +++++++++++-------- 6 files changed, 212 insertions(+), 50 deletions(-) create mode 100644 src/zutil/log/netlog/NLExceptionData.java create mode 100644 src/zutil/log/netlog/NLLogData.java create mode 100644 src/zutil/log/netlog/NetLoggerClientInstance.css diff --git a/src/zutil/log/netlog/NLExceptionData.java b/src/zutil/log/netlog/NLExceptionData.java new file mode 100644 index 0000000..6a4cc61 --- /dev/null +++ b/src/zutil/log/netlog/NLExceptionData.java @@ -0,0 +1,50 @@ +package zutil.log.netlog; + +public class NLExceptionData { + + private int count; + private String name; + private String message; + private String stackTrace; + + NLExceptionData(String name, String message, String stackTrace){ + this.count = 0; + this.name = name; + this.message = message; + this.stackTrace = stackTrace; + } + + + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getStackTrace() { + return stackTrace; + } + + public void setStackTrace(String stackTrace) { + this.stackTrace = stackTrace; + } +} diff --git a/src/zutil/log/netlog/NLLogData.java b/src/zutil/log/netlog/NLLogData.java new file mode 100644 index 0000000..abd5b41 --- /dev/null +++ b/src/zutil/log/netlog/NLLogData.java @@ -0,0 +1,39 @@ +package zutil.log.netlog; + +public class NLLogData { + + private String level; + private long timestamp; + private String log; + + NLLogData(String level, long timestamp, String log){ + this.level = level; + this.timestamp = timestamp; + this.log = log; + } + + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + public String getLog() { + return log; + } + + public void setLog(String log) { + this.log = log; + } +} diff --git a/src/zutil/log/netlog/NetLoggerClient.java b/src/zutil/log/netlog/NetLoggerClient.java index 4aac0b2..e292a3d 100644 --- a/src/zutil/log/netlog/NetLoggerClient.java +++ b/src/zutil/log/netlog/NetLoggerClient.java @@ -1,5 +1,7 @@ package zutil.log.netlog; +import java.io.IOException; + import javafx.application.Application; import javafx.event.ActionEvent; import javafx.fxml.FXML; @@ -7,7 +9,9 @@ import javafx.fxml.FXMLLoader; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.Parent; +import javafx.scene.control.Tab; import javafx.scene.control.TabPane; +import javafx.scene.layout.AnchorPane; public class NetLoggerClient extends Application{ public static final String VERSION = "0.1"; @@ -30,11 +34,11 @@ public class NetLoggerClient extends Application{ stage.show(); } - // Menu Actioins + // Menu Actions @FXML protected void handleConnectAction(ActionEvent event) { try{ - tabPane.getTabs().add(new NetLoggerClientInstance("koc.se", 8080)); + tabPane.getTabs().add(new NetLoggerClientTab("koc.se", 8080)); }catch(Exception e){ e.printStackTrace(); } @@ -49,4 +53,19 @@ public class NetLoggerClient extends Application{ protected void handleAboutAction(ActionEvent event) { } + + private class NetLoggerClientTab extends Tab{ + public NetLoggerClientTab(String host, int port) throws IOException{ + this.setText( host+":"+port ); + + Parent tabRoot = FXMLLoader.load(getClass().getResource("NetLoggerClientInstance.fxml")); + this.setContent(tabRoot); + AnchorPane.setRightAnchor(tabRoot, 0.0); + //this.setOnClosed(new EventHandler() { + // public void handle(Event e) { + // handleDisconnectAction(e); + // } + //}); + } + } } \ No newline at end of file diff --git a/src/zutil/log/netlog/NetLoggerClientInstance.css b/src/zutil/log/netlog/NetLoggerClientInstance.css new file mode 100644 index 0000000..37c1cf1 --- /dev/null +++ b/src/zutil/log/netlog/NetLoggerClientInstance.css @@ -0,0 +1,30 @@ + + +/* LOG LEVELS */ +.WARNING { + -fx-control-inner-background: paleyellow; + -fx-accent: derive(-fx-control-inner-background, -40%); + -fx-cell-hover-color: derive(-fx-control-inner-background, -20%); +} + +.FINE { + -fx-control-inner-background: skyblue; + -fx-accent: derive(-fx-control-inner-background, -40%); + -fx-cell-hover-color: derive(-fx-control-inner-background, -20%); +} +.FINER { + -fx-control-inner-background: skyblue; + -fx-accent: derive(-fx-control-inner-background, -25%); + -fx-cell-hover-color: derive(-fx-control-inner-background, -20%); +} +.FINEST { + -fx-control-inner-background: skyblue; + -fx-accent: derive(-fx-control-inner-background, -10%); + -fx-cell-hover-color: derive(-fx-control-inner-background, -20%); +} + +.ERROR { + -fx-control-inner-background: palevioletred; + -fx-accent: derive(-fx-control-inner-background, -40%); + -fx-cell-hover-color: derive(-fx-control-inner-background, -20%); +} \ No newline at end of file diff --git a/src/zutil/log/netlog/NetLoggerClientInstance.fxml b/src/zutil/log/netlog/NetLoggerClientInstance.fxml index b3782fa..8afb930 100644 --- a/src/zutil/log/netlog/NetLoggerClientInstance.fxml +++ b/src/zutil/log/netlog/NetLoggerClientInstance.fxml @@ -1,6 +1,7 @@ + @@ -15,7 +16,7 @@ -