|
| 1 | +package us.house.admin; |
| 2 | + |
| 3 | +import javafx.application.Application; |
| 4 | +import javafx.geometry.Insets; |
| 5 | +import javafx.geometry.Pos; |
| 6 | +import javafx.scene.Scene; |
| 7 | +import javafx.scene.control.*; |
| 8 | +import javafx.scene.layout.*; |
| 9 | +import javafx.scene.paint.Color; |
| 10 | +import javafx.scene.text.Font; |
| 11 | +import javafx.scene.text.FontWeight; |
| 12 | +import javafx.stage.Stage; |
| 13 | + |
| 14 | +/** JWSTF white local administration console. */ |
| 15 | +public final class LocalAdmin extends Application { |
| 16 | + private final Label status = new Label("Healthy"); |
| 17 | + private final TextArea activity = new TextArea(); |
| 18 | + |
| 19 | + @Override |
| 20 | + public void start(Stage stage) { |
| 21 | + BorderPane root = new BorderPane(); |
| 22 | + root.setPadding(new Insets(24)); |
| 23 | + root.setStyle("-fx-background-color:#f7f8fa;"); |
| 24 | + |
| 25 | + VBox header = new VBox(4); |
| 26 | + Label eyebrow = label("JWSTF / LOCAL ADMINISTRATION", 12, true); |
| 27 | + eyebrow.setTextFill(Color.web("#5d6670")); |
| 28 | + Label title = label("Administration", 30, true); |
| 29 | + Label subtitle = label("A calm, local view of your Java 21 system.", 15, false); |
| 30 | + subtitle.setTextFill(Color.web("#59636d")); |
| 31 | + header.getChildren().addAll(eyebrow, title, subtitle); |
| 32 | + root.setTop(header); |
| 33 | + |
| 34 | + VBox nav = new VBox(8); |
| 35 | + nav.setPadding(new Insets(28, 24, 0, 0)); |
| 36 | + for (String item : new String[]{"Overview","Services","Software","Modules","Configuration","Evidence","Maintenance"}) { |
| 37 | + Button b = new Button(item); |
| 38 | + b.setMaxWidth(Double.MAX_VALUE); |
| 39 | + b.setAlignment(Pos.CENTER_LEFT); |
| 40 | + b.setPrefHeight(40); |
| 41 | + b.setStyle("-fx-background-color:white;-fx-background-radius:8;-fx-border-color:#e1e5e9;-fx-border-radius:8;-fx-padding:0 14;"); |
| 42 | + nav.getChildren().add(b); |
| 43 | + } |
| 44 | + root.setLeft(nav); |
| 45 | + |
| 46 | + VBox content = new VBox(18); |
| 47 | + content.setPadding(new Insets(28, 0, 0, 0)); |
| 48 | + |
| 49 | + HBox health = card(); |
| 50 | + VBox healthText = new VBox(3); |
| 51 | + Label healthTitle = label("System health", 17, true); |
| 52 | + status.setTextFill(Color.web("#277447")); |
| 53 | + status.setFont(Font.font("System", FontWeight.BOLD, 14)); |
| 54 | + healthText.getChildren().addAll(healthTitle, status); |
| 55 | + Region spacer = new Region(); |
| 56 | + HBox.setHgrow(spacer, Priority.ALWAYS); |
| 57 | + Label java = label("Java 21", 14, false); |
| 58 | + java.setTextFill(Color.web("#5d6670")); |
| 59 | + health.getChildren().addAll(healthText, spacer, java); |
| 60 | + |
| 61 | + HBox services = card(); |
| 62 | + services.getChildren().addAll(metric("Web Server","Ready"), metric("Telnet Frontend","Ready"), metric("Modules","Managed")); |
| 63 | + |
| 64 | + HBox actions = new HBox(10); |
| 65 | + actions.getChildren().addAll(action("Install / Repair","install"), action("Update","update"), action("Verify","verify"), action("Remove","remove")); |
| 66 | + |
| 67 | + VBox logCard = new VBox(8); |
| 68 | + logCard.setPadding(new Insets(18)); |
| 69 | + logCard.setStyle("-fx-background-color:white;-fx-background-radius:10;-fx-border-color:#e1e5e9;-fx-border-radius:10;"); |
| 70 | + Label logTitle = label("Activity", 16, true); |
| 71 | + activity.setEditable(false); |
| 72 | + activity.setPrefRowCount(7); |
| 73 | + activity.setText("Ready. No privileged operation has been requested.\n"); |
| 74 | + activity.setStyle("-fx-control-inner-background:white;-fx-border-color:#edf0f2;"); |
| 75 | + logCard.getChildren().addAll(logTitle, activity); |
| 76 | + |
| 77 | + content.getChildren().addAll(health, services, actions, logCard); |
| 78 | + root.setCenter(content); |
| 79 | + |
| 80 | + stage.setTitle("JWSTF Local Administration"); |
| 81 | + stage.setScene(new Scene(root, 1040, 700)); |
| 82 | + stage.setMinWidth(900); |
| 83 | + stage.setMinHeight(620); |
| 84 | + stage.show(); |
| 85 | + } |
| 86 | + |
| 87 | + private static Label label(String text, double size, boolean bold) { |
| 88 | + Label l = new Label(text); |
| 89 | + l.setFont(Font.font("System", bold ? FontWeight.BOLD : FontWeight.NORMAL, size)); |
| 90 | + return l; |
| 91 | + } |
| 92 | + |
| 93 | + private static HBox card() { |
| 94 | + HBox box = new HBox(18); |
| 95 | + box.setAlignment(Pos.CENTER_LEFT); |
| 96 | + box.setPadding(new Insets(18)); |
| 97 | + box.setStyle("-fx-background-color:white;-fx-background-radius:10;-fx-border-color:#e1e5e9;-fx-border-radius:10;"); |
| 98 | + return box; |
| 99 | + } |
| 100 | + |
| 101 | + private static VBox metric(String name, String value) { |
| 102 | + VBox box = new VBox(3); |
| 103 | + Label n = label(name, 13, false); |
| 104 | + n.setTextFill(Color.web("#66717b")); |
| 105 | + Label v = label(value, 16, true); |
| 106 | + box.getChildren().addAll(n, v); |
| 107 | + HBox.setHgrow(box, Priority.ALWAYS); |
| 108 | + return box; |
| 109 | + } |
| 110 | + |
| 111 | + private Button action(String name, String operation) { |
| 112 | + Button b = new Button(name); |
| 113 | + b.setPrefHeight(42); |
| 114 | + b.setStyle("-fx-background-color:white;-fx-border-color:#d7dce1;-fx-border-radius:8;-fx-background-radius:8;-fx-padding:0 16;"); |
| 115 | + b.setOnAction(e -> activity.appendText("Requested: " + operation + " — review required before execution.\n")); |
| 116 | + return b; |
| 117 | + } |
| 118 | + |
| 119 | + public static void main(String[] args) { launch(args); } |
| 120 | +} |
0 commit comments