55: Add TabPane to EMC
This commit is contained in:
@@ -3,7 +3,9 @@ package com.r35157.evelyn.emc.impl.ref;
|
|||||||
import com.r35157.evelyn.emc.EvelynMissionControl;
|
import com.r35157.evelyn.emc.EvelynMissionControl;
|
||||||
import com.r35157.libs.javafx.JavaFxRuntime;
|
import com.r35157.libs.javafx.JavaFxRuntime;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public final class EvelynMissionControlImpl/*<T>*/ implements EvelynMissionControl {
|
public final class EvelynMissionControlImpl/*<T>*/ implements EvelynMissionControl {
|
||||||
@@ -18,19 +20,57 @@ public final class EvelynMissionControlImpl/*<T>*/ implements EvelynMissionContr
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showWindow() {
|
private void showWindow() {
|
||||||
TextArea text = new TextArea("""
|
|
||||||
Evelyn Mission Control
|
|
||||||
|
|
||||||
Evelyn is running.
|
|
||||||
Connected to: %s
|
|
||||||
""".formatted("Test123"/*evelyn.getClass().getName())*/));
|
|
||||||
text.setEditable(false);
|
|
||||||
|
|
||||||
Stage window = new Stage();
|
Stage window = new Stage();
|
||||||
window.setTitle("Evelyn Mission Control");
|
window.setTitle("Evelyn Mission Control");
|
||||||
window.setScene(new Scene(text, 600, 400));
|
window.setScene(new Scene(createRootTabs(), 600, 400));
|
||||||
window.show();
|
window.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
//private final T evelyn;
|
private TabPane createMissionControlTabs(String color) {
|
||||||
|
TabPane tabs = new TabPane(
|
||||||
|
createMissionControlTab("Overview", color),
|
||||||
|
createMissionControlTab("Portfolio", color),
|
||||||
|
createMissionControlTab("Perps", color),
|
||||||
|
createMissionControlTab("Spot", color),
|
||||||
|
createMissionControlTab("Liquidity Pools", color),
|
||||||
|
createMissionControlTab("Alarms", color),
|
||||||
|
createMissionControlTab("Status", color),
|
||||||
|
createMissionControlTab("Logs", color)
|
||||||
|
);
|
||||||
|
|
||||||
|
tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
|
||||||
|
return tabs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tab createMissionControlTab(String title, String color) {
|
||||||
|
StackPane content = new StackPane();
|
||||||
|
content.setStyle("-fx-background-color: " + color + ";");
|
||||||
|
|
||||||
|
Tab tab = new Tab(title, content);
|
||||||
|
tab.setStyle("-fx-background-color: " + color + ";");
|
||||||
|
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TabPane createRootTabs() {
|
||||||
|
Tab productionTab = new Tab(
|
||||||
|
"Production",
|
||||||
|
createMissionControlTabs(PRODUCTION_COLOR)
|
||||||
|
);
|
||||||
|
productionTab.setStyle("-fx-background-color: " + PRODUCTION_COLOR + ";");
|
||||||
|
|
||||||
|
Tab testTab = new Tab(
|
||||||
|
"Test",
|
||||||
|
createMissionControlTabs(TEST_COLOR)
|
||||||
|
);
|
||||||
|
testTab.setStyle("-fx-background-color: " + TEST_COLOR + ";");
|
||||||
|
|
||||||
|
TabPane rootTabs = new TabPane(productionTab, testTab);
|
||||||
|
rootTabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
|
||||||
|
|
||||||
|
return rootTabs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String PRODUCTION_COLOR = "#ffd6d6";
|
||||||
|
private static final String TEST_COLOR = "#d8f3dc";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user