Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Log Fenster #16

Merged
merged 2 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<dependency>
<groupId>com.github.weichware10</groupId>
<artifactId>util</artifactId>
<version>v1.1</version>
<version>c2f1b79</version>
</dependency>
</dependencies>

Expand Down
54 changes: 0 additions & 54 deletions src/main/java/github/weichware10/toolbox/Console.java

This file was deleted.

13 changes: 6 additions & 7 deletions src/main/java/github/weichware10/toolbox/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import github.weichware10.toolbox.gui.App;
import github.weichware10.toolbox.gui.dialogs.ConfirmDialog;
import github.weichware10.toolbox.gui.util.Log;
import github.weichware10.util.Logger;
import io.github.cdimascio.dotenv.Dotenv;
import java.io.PrintStream;
import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.image.Image;
Expand All @@ -26,12 +27,7 @@ public static void main(String[] args) {
// in Datei und Konsole loggen
String logfile = String.format(
Dotenv.load().get("LOGS") + "/%s.log", DateTime.now().toString("yMMdd-HHmmss"));
Console.setLogfile(logfile);
Console.setOut(System.out);
PrintStream ps = new PrintStream(new Console(), true);
System.setOut(ps);
System.setErr(ps);

Logger.setLogfile(logfile);
launch(args);
}

Expand All @@ -43,6 +39,8 @@ public static void main(String[] args) {
@Override
public void start(Stage primaryStage) {

Log.start();

// ICON und TITLE
primaryStage.getIcons().add(new Image("app-icon.png"));

Expand Down Expand Up @@ -77,5 +75,6 @@ private void closeRequestFilter(WindowEvent event) {
if (!confirmation) {
event.consume();
}
Log.close();
}
}
26 changes: 11 additions & 15 deletions src/main/java/github/weichware10/toolbox/gui/App.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package github.weichware10.toolbox.gui;

import github.weichware10.toolbox.gui.dialogs.DataBaseDialog;
import github.weichware10.toolbox.gui.dialogs.LogDialog;
import github.weichware10.util.Logger;
import github.weichware10.util.config.CodeChartsConfiguration;
import github.weichware10.util.config.ConfigClient;
Expand Down Expand Up @@ -149,15 +148,17 @@ protected void createZoomMapsTestTrial(TextField trialIdInput) {
}

ZoomMapsConfiguration zoomMapsConfiguration = new ZoomMapsConfiguration(
4.2f,
true,
Arrays.asList(
"https://media.discordapp.net/attachments/707505654218358818/836645130417078282/TBY5IslL.png",
"url2", "url3"));
4.2,
600,
600,
true);

createTestTrial(new Configuration(
"dunno yet",
"Test Question?",
"https://media.discordapp.net/attachments/707505654218358818/927231793348894822/iu.png",
"I wish you a warm welcome to a wonderful ZoomMaps Trial",
"Thank you for partaking in this Trial!",
zoomMapsConfiguration),
trialIdInput);
}
Expand All @@ -178,14 +179,14 @@ protected void createCodeChartsTestTrial(TextField trialIdInput) {
Arrays.asList("string1", "string2"),
new int[] { 10, 10 },
new long[] { 100, 100 },
true,
Arrays.asList(
"https://media.discordapp.net/attachments/707505654218358818/836645130417078282/TBY5IslL.png",
"url2", "url3"));
true);

createTestTrial(new Configuration(
"dunno yet",
"Test Question?",
"https://media.discordapp.net/attachments/707505654218358818/836645130417078282/TBY5IslL.png",
"Welcome to this magnificent CodeCharts Trial",
"Thanks for participating in this extraordinary CodeCharts Trial!",
codeChartsConfiguration),
trialIdInput);
}
Expand Down Expand Up @@ -278,9 +279,4 @@ private void setPermissionAccess() {
controller.setAdminMenuVisibile(false);
controller.setTrialInputDisable(false);
}

protected void showLogs() {
new LogDialog();
}

}
27 changes: 24 additions & 3 deletions src/main/java/github/weichware10/toolbox/gui/AppController.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package github.weichware10.toolbox.gui;

import github.weichware10.toolbox.gui.util.Log;
import github.weichware10.util.Logger;
import javafx.beans.value.ObservableBooleanValue;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
Expand All @@ -24,6 +27,8 @@ public class AppController {
private TextField trialIdField;
@FXML
private Text warnText;
@FXML
private MenuItem logsMenu;

protected void setApp(App app) {
this.app = app;
Expand Down Expand Up @@ -98,9 +103,21 @@ void createCodeChartsTestTrial() {
}

@FXML
void showLogs() {
Logger.info("app:menu Showing logs");
app.showLogs();
void toggleLogs() {
Logger.info("app:menu Toggling logs");
if (Log.visible.get()) {
Log.hide();
} else {
Log.show();
}
}

void setLogText(ObservableBooleanValue visible) {
if (visible.get()) {
logsMenu.setText("hide logs");
} else {
logsMenu.setText("show logs");
}
}

@FXML
Expand All @@ -113,6 +130,10 @@ void initialize() {
: "fx:id=\"adminMenu\" not injected: check 'App.fxml'.";
assert startButton != null
: "fx:id=\"startButton\" not injected: check 'App.fxml'.";
assert logsMenu != null
: "fx:id=\"logsMenu\" not injected: check 'App.fxml'.";

Log.visible.addListener(obs -> setLogText((ObservableBooleanValue) obs));
}

}
2 changes: 2 additions & 0 deletions src/main/java/github/weichware10/toolbox/gui/End.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package github.weichware10.toolbox.gui;

import github.weichware10.toolbox.gui.util.Log;
import github.weichware10.util.Logger;
import github.weichware10.util.data.TrialData;
import github.weichware10.util.db.DataBaseClient;
Expand Down Expand Up @@ -52,6 +53,7 @@ public End(Stage primaryStage, DataBaseClient dataBaseClient, TrialData trialDat
*/
protected void closeProgramm() {
primaryStage.close();
Log.close();
}

/**
Expand Down

This file was deleted.

This file was deleted.

Loading