summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/fhswf/in/inf')
-rw-r--r--src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegen.fxml13
-rw-r--r--src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegenController.java70
2 files changed, 83 insertions, 0 deletions
diff --git a/src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegen.fxml b/src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegen.fxml
new file mode 100644
index 0000000..028cf4e
--- /dev/null
+++ b/src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegen.fxml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.geometry.*?>
+<?import javafx.scene.control.*?>
+<?import java.lang.*?>
+<?import javafx.scene.layout.*?>
+<?import javafx.scene.layout.AnchorPane?>
+
+<AnchorPane xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
+ <children>
+ <TextArea fx:id="kommentarTextArea" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
+ </children>
+</AnchorPane>
diff --git a/src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegenController.java b/src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegenController.java
new file mode 100644
index 0000000..a88a6af
--- /dev/null
+++ b/src/de/fhswf/in/inf/se/projektthemenvergabe/view/KommentarHinzufuegenController.java
@@ -0,0 +1,70 @@
+package de.fhswf.in.inf.se.projektthemenvergabe.view;
+
+import java.io.IOException;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.control.ButtonType;
+import javafx.scene.control.Dialog;
+import javafx.scene.control.TextArea;
+import javafx.scene.layout.AnchorPane;
+
+public class KommentarHinzufuegenController extends Dialog<String>
+{
+ @FXML
+ private TextArea kommentarTextArea;
+
+ /**
+ * Create a {@link Dialog} with an empty {@link TextArea}.
+ *
+ */
+ public KommentarHinzufuegenController()
+ {
+ this("");
+ }
+
+ /**
+ * Create a {@link Dialog} with a {@link TextArea} and initialValue as
+ * text.
+ *
+ */
+ public KommentarHinzufuegenController(String initialValue)
+ {
+ setTitle("Projektkommentar hinzufügen");
+ setHeaderText("Geben Sie einen Kommentar zu dem Projekt ein.");
+
+ FXMLLoader fxmlLoader = new FXMLLoader(
+ getClass().getResource("KommentarHinzufuegen.fxml"));
+ fxmlLoader.setController(this);
+
+ try
+ {
+ getDialogPane().setContent((AnchorPane) fxmlLoader.load());
+ }
+ catch (IOException e)
+ {
+ // Ignoriert, da die FXML Datei immer da sein sollte :-P
+ e.printStackTrace();
+ }
+
+ kommentarTextArea.setText(initialValue);
+
+ // Setze die Button Typen für den Dialog
+ getDialogPane().getButtonTypes().addAll(ButtonType.OK,
+ ButtonType.CANCEL);
+
+ // Setze Focus auf TextArea
+ Platform.runLater(() -> kommentarTextArea.requestFocus());
+
+ // Wenn OK gedrückt wurde, gib ein den Kommentar zurück
+ setResultConverter(dialogButton -> {
+ if (dialogButton == ButtonType.OK)
+ {
+ return kommentarTextArea.getText();
+ }
+
+ return null;
+ });
+ }
+}