mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
Allow setting the packetlogger always on top
Signed-off-by: Eduardo Alonso <edu@error404software.com>
This commit is contained in:
parent
21ea7ff70a
commit
cf4aa16148
@ -2,6 +2,7 @@ package gearth.ui.logger.loggerdisplays.uilogger;
|
||||
|
||||
import gearth.protocol.HPacket;
|
||||
import gearth.ui.logger.loggerdisplays.PacketLogger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.Event;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
@ -38,6 +39,8 @@ public class UiLogger implements PacketLogger {
|
||||
Scene scene = new Scene(root);
|
||||
scene.getStylesheets().add("/gearth/ui/bootstrap3.css");
|
||||
scene.getStylesheets().add("/gearth/ui/logger/uilogger/logger.css");
|
||||
UiLoggerController controller = (UiLoggerController) loader.getController();
|
||||
controller.setStage(stage);
|
||||
|
||||
// scene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
|
||||
// final KeyCombination keyCombIncoming = new KeyCodeCombination(KeyCode.I,
|
||||
|
@ -12,6 +12,7 @@ import javafx.scene.control.CheckMenuItem;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.stage.Stage;
|
||||
import org.fxmisc.flowless.VirtualizedScrollPane;
|
||||
import org.fxmisc.richtext.StyleClassedTextArea;
|
||||
import org.fxmisc.richtext.model.StyleSpansBuilder;
|
||||
@ -36,6 +37,8 @@ public class UiLoggerController implements Initializable {
|
||||
|
||||
private StyleClassedTextArea area;
|
||||
|
||||
private Stage stage;
|
||||
|
||||
private boolean viewIncoming = true;
|
||||
private boolean viewOutgoing = true;
|
||||
private boolean displayStructure = true;
|
||||
@ -43,6 +46,7 @@ public class UiLoggerController implements Initializable {
|
||||
private boolean skiphugepackets = true;
|
||||
private boolean viewMessageName = true;
|
||||
private boolean viewMessageHash = false;
|
||||
private boolean alwaysOnTop = false;
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private final List<Element> appendLater = new ArrayList<>();
|
||||
@ -181,6 +185,10 @@ public class UiLoggerController implements Initializable {
|
||||
});
|
||||
}
|
||||
|
||||
public void setStage(Stage stage) {
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
public void toggleViewIncoming() {
|
||||
viewIncoming = !viewIncoming;
|
||||
lblViewIncoming.setText("View Incoming: " + (viewIncoming ? "True" : "False"));
|
||||
@ -214,4 +222,9 @@ public class UiLoggerController implements Initializable {
|
||||
public void toggleMessageHash(ActionEvent actionEvent) {
|
||||
viewMessageHash = !viewMessageHash;
|
||||
}
|
||||
|
||||
public void toggleAlwaysOnTop(ActionEvent actionEvent) {
|
||||
stage.setAlwaysOnTop(!alwaysOnTop);
|
||||
alwaysOnTop = !alwaysOnTop;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.FlowPane?>
|
||||
|
||||
<BorderPane fx:id="borderPane" prefHeight="560.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.logger.loggerdisplays.uilogger.UiLoggerController">
|
||||
<BorderPane fx:id="borderPane" prefHeight="560.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.logger.loggerdisplays.uilogger.UiLoggerController">
|
||||
<top>
|
||||
<MenuBar BorderPane.alignment="CENTER">
|
||||
<Menu mnemonicParsing="false" text="View">
|
||||
@ -33,6 +33,7 @@
|
||||
<KeyCodeCombination alt="UP" code="L" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
|
||||
</accelerator></CheckMenuItem>
|
||||
<CheckMenuItem fx:id="chkSkipBigPackets" mnemonicParsing="false" onAction="#toggleSkipPackets" selected="true" text="Skip big packets" />
|
||||
<CheckMenuItem fx:id="chkAlwaysOnTop" mnemonicParsing="false" onAction="#toggleAlwaysOnTop" text="Always on top" />
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</top>
|
||||
|
Loading…
Reference in New Issue
Block a user