Permalink
Browse files

FXML and controller of the LogPanel has been updated

Signed-off-by: Victor Hertel <victor.hertel@web.de>
  • Loading branch information...
vhertel committed Aug 8, 2017
1 parent cc83149 commit 85f215a30e30247142ef3fed43f3c5cbc233640f
@@ -157,6 +157,7 @@ public static void chartBuilder(String filePath, String configPath) throws IOExc
Properties config = ConfigHandler.getAllValues(configPath);
int numberOfCharts = ConfigHandler.countItems("chartTitle", configPath);
int numberOfRows;
boolean GNSS3dView = Boolean.parseBoolean(config.getProperty("GNSS3dView"));
String path = "src/main/resources/";
// Initializes number of rows depending on required number of charts
@@ -169,7 +170,16 @@ public static void chartBuilder(String filePath, String configPath) throws IOExc
// Writes data in ChartPanel.fxml file
PrintWriter writer = new PrintWriter(path + filePath);
writer.println("<?import javafx.scene.chart.*?> \n"
+ "<?import javafx.scene.control.*?> \n"
+ "<?import javafx.scene.layout.*?> \n");
if (GNSS3dView) {
writer.println("<TabPane xmlns=\"http://javafx.com/javafx/8\" xmlns:fx=\"http://javafx.com/fxml/1\" fx:controller = \"com.ksatstuttgart.usoc.gui.controller.LogController\" prefHeight=\"200.0\" prefWidth=\"200.0\" tabClosingPolicy=\"UNAVAILABLE\" BorderPane.alignment=\"CENTER\"> \n"
+ " <tabs> \n"
+ " <Tab text=\"Graphs\"> \n"
+ " <content> \n");
}
writer.println("<GridPane> \n"
+ " <columnConstraints> \n"
+ " <ColumnConstraints hgrow=\"SOMETIMES\" minWidth=\"10.0\" prefWidth=\"100.0\" /> \n"
@@ -198,6 +208,18 @@ public static void chartBuilder(String filePath, String configPath) throws IOExc
}
writer.println(" </children> \n"
+ "</GridPane>");
if (GNSS3dView) {
writer.println(" </content> \n"
+ " </Tab> \n"
+ " <Tab text=\"GNSS 3D View\"> \n"
+ " <content> \n"
+ " </content> \n"
+ " </Tab> \n"
+ " </tabs> \n"
+ "</TabPane> \n");
}
writer.close();
// Prints status update
@@ -225,7 +247,9 @@ public static void logBuilder(String filePath, String configPath) throws FileNot
// Writes data in LogPanel.fxml file
PrintWriter writer = new PrintWriter(path + filePath);
writer.println("<?import javafx.geometry.*?> \n"
writer.println("<?import java.lang.*?> \n"
+ "<?import javafx.geometry.*?> \n"
+ "<?import javafx.collections.*?> \n"
+ "<?import javafx.scene.*?> \n"
+ "<?import javafx.scene.control.*?> \n"
+ "<?import javafx.scene.layout.*?> \n");
@@ -402,25 +426,52 @@ public static void logControlBuilder(String filePath, String configPath) throws
+ "import java.util.ResourceBundle; \n"
+ "import javafx.event.ActionEvent; \n"
+ "import javafx.fxml.FXML; \n"
+ "import javafx.fxml.Initializable; \n");
+ "import javafx.fxml.Initializable; \n"
+ "import javafx.scene.control.ComboBox; \n");
writer.println("/** \n"
+ " * \n"
+ " * @author Victor \n"
+ " */ \n");
writer.println("public class LogController implements Initializable { \n");
if (Boolean.parseBoolean(config.getProperty("serialPanel"))) {
writer.println(" @FXML private ComboBox comboBox1; \n"
+ " @FXML private ComboBox comboBox2; \n"
+ " @FXML private ComboBox comboBox3; \n\n"
+ " public void setData() { \n"
+ " comboBox1.getItems().clear(); \n"
+ " comboBox2.getItems().clear(); \n"
+ " comboBox3.getItems().clear(); \n"
+ " comboBox1.getItems().addAll(\"H\", \"Ha\", \"Hal\", \"Hall\", \"Hallo\"); \n"
+ " comboBox2.getItems().addAll(\"T\", \"Te\", \"Tes\", \"Test\"); \n"
+ " comboBox3.getItems().addAll(\"A\", \"B\", \"C\"); \n"
+ " } \n");
writer.println(" @FXML \n"
+ " private void serialConnect(ActionEvent event) { \n"
+ " System.out.println(\"Connect button in serial log has been pressed!\"); \n"
+ " } \n\n"
+ " @FXML \n"
+ " setData(); \n"
+ " } \n");
writer.println(" @FXML \n"
+ " private void serialSendCommand(ActionEvent event) { \n"
+ " System.out.println(\"Send Command button in serial log has been pressed!\"); \n"
+ " String output = comboBox1.getSelectionModel().getSelectedItem().toString(); \n"
+ " System.out.println(output); \n"
+ " } \n");
}
if (Boolean.parseBoolean(config.getProperty("iridiumPanel"))) {
writer.println(" @FXML \n"
+ " private void iridiumOpen(ActionEvent event) { \n"
+ " System.out.println(\"Open button in iridium log has been pressed!\"); \n"
+ " } \n");
writer.println(" @FXML \n"
+ " private void iridiumClearData(ActionEvent event) { \n"
+ " System.out.println(\"Clear Data button in iridium log has been pressed!\"); \n"
+ " } \n");
writer.println(" @FXML \n"
+ " private void iridiumExportCSV(ActionEvent event) { \n"
+ " System.out.println(\"Export CSV button in iridium log has been pressed!\"); \n"
+ " } \n");
writer.println(" @FXML \n"
+ " private void iridiumReconnect(ActionEvent event) { \n"
+ " System.out.println(\"Reconnect button in iridium log has been pressed!\"); \n"
@@ -5,6 +5,7 @@
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ComboBox;
/**
*
@@ -13,43 +14,50 @@
public class LogController implements Initializable {
@FXML private ComboBox comboBox1;
@FXML private ComboBox comboBox2;
@FXML private ComboBox comboBox3;
public void setData() {
comboBox1.getItems().clear();
comboBox2.getItems().clear();
comboBox3.getItems().clear();
comboBox1.getItems().addAll("H", "Ha", "Hal", "Hall", "Hallo");
comboBox2.getItems().addAll("T", "Te", "Tes", "Test");
comboBox3.getItems().addAll("A", "B", "C");
}
@FXML
private void serialConnect(ActionEvent event) {
System.out.println("Connect button in serial log has been pressed!");
setData();
}
@FXML
private void serialSendCommand(ActionEvent event) {
System.out.println("Send Command button in serial log has been pressed!");
String output = comboBox1.getSelectionModel().getSelectedItem().toString();
System.out.println(output);
}
@FXML
private void iridiumReconnect(ActionEvent event) {
System.out.println("Reconnect button in iridium log has been pressed!");
}
@FXML
private void button11(ActionEvent event) {
// Automatically generated method button11()
System.out.println("Button11 was pressed!");
private void iridiumOpen(ActionEvent event) {
System.out.println("Open button in iridium log has been pressed!");
}
@FXML
private void button14(ActionEvent event) {
// Automatically generated method button14()
System.out.println("Button14 was pressed!");
private void iridiumClearData(ActionEvent event) {
System.out.println("Clear Data button in iridium log has been pressed!");
}
@FXML
private void button21(ActionEvent event) {
// Automatically generated method button21()
System.out.println("Button21 was pressed!");
private void iridiumExportCSV(ActionEvent event) {
System.out.println("Export CSV button in iridium log has been pressed!");
}
@FXML
private void button26(ActionEvent event) {
// Automatically generated method button26()
System.out.println("Button26 was pressed!");
private void iridiumReconnect(ActionEvent event) {
System.out.println("Reconnect button in iridium log has been pressed!");
}
@Override
@@ -111,8 +111,8 @@ iridiumPanel = true
# promptText[i][j] = testText
#
# Mandatory: YES
tabTitle[1] = Tab 3
tabTitle[2] = Tab 4
#tabTitle[1] = Tab 3
#tabTitle[2] = Tab 4
#
# Textarea
# Mandatory: YES
@@ -1,6 +1,12 @@
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<TabPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller = "com.ksatstuttgart.usoc.gui.controller.LogController" prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
<tabs>
<Tab text="Graphs">
<content>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
@@ -62,3 +68,12 @@
</LineChart>
</children>
</GridPane>
</content>
</Tab>
<Tab text="GNSS 3D View">
<content>
</content>
</Tab>
</tabs>
</TabPane>
@@ -1,4 +1,6 @@
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.collections.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
@@ -25,9 +27,24 @@
<children>
<Button text="Connect" onAction="#serialConnect" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<Button text="Send Command" onAction="#serialSendCommand" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="0" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox fx:id="comboBox1" prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="0" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<items>
<FXCollections fx:factory="observableArrayList">
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="comboBox2" prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<items>
<FXCollections fx:factory="observableArrayList">
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="comboBox3" prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<items>
<FXCollections fx:factory="observableArrayList">
</FXCollections>
</items>
</ComboBox>
</children>
</GridPane>
</top>
@@ -76,7 +93,7 @@
<Label text="" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Button text="Open" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<TextField GridPane.columnIndex="1" GridPane.rowIndex="6" />
<TextField text="0" GridPane.columnIndex="1" GridPane.rowIndex="6" />
<Button text="Reconnect" onAction="#iridiumReconnect" GridPane.columnIndex="1" GridPane.rowIndex="7" />
</children>
@@ -89,61 +106,5 @@
</content>
</Tab>
<Tab text="Tab 3">
<content>
<BorderPane>
<padding><Insets top="5" right="5" bottom="5" left="5"/></padding>
<top>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button text="Button 1" onAction="#button11" mnemonicParsing="false" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Label text="Label 1" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<TextField promptText="Prompt Text 1" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<Button text="Button 2" onAction="#button14" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="1" />
</children>
</GridPane>
</top>
<center>
<TextArea prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</content>
</Tab>
<Tab text="Tab 4">
<content>
<BorderPane>
<padding><Insets top="5" right="5" bottom="5" left="5"/></padding>
<top>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button text="Button 3" onAction="#button21" mnemonicParsing="false" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Label text="Label 2" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<TextField promptText="Prompt Text 2" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<Label text="Label 2" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<TextField promptText="Prompt Text 3" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<Button text="Text" onAction="#button26" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
</children>
</GridPane>
</top>
</BorderPane>
</content>
</Tab>
</tabs>
</TabPane>
@@ -33,7 +33,7 @@
<Label text="" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Button text="Open" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<TextField GridPane.columnIndex="1" GridPane.rowIndex="6" />
<TextField text="0" GridPane.columnIndex="1" GridPane.rowIndex="6" />
<Button text="Reconnect" onAction="#iridiumReconnect" GridPane.columnIndex="1" GridPane.rowIndex="7" />
</children>
@@ -15,9 +15,24 @@
<children>
<Button text="Connect" onAction="#serialConnect" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<Button text="Send Command" onAction="#serialSendCommand" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="0" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
<ComboBox fx:id="comboBox1" prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="0" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<items>
<FXCollections fx:factory="observableArrayList">
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="comboBox2" prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<items>
<FXCollections fx:factory="observableArrayList">
</FXCollections>
</items>
</ComboBox>
<ComboBox fx:id="comboBox3" prefWidth="150.0" GridPane.halignment="LEFT" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS">
<items>
<FXCollections fx:factory="observableArrayList">
</FXCollections>
</items>
</ComboBox>
</children>
</GridPane>
</top>
@@ -1,4 +1,5 @@
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane>
Oops, something went wrong.

0 comments on commit 85f215a

Please sign in to comment.