Compare commits
20 Commits
Update_cre
...
7a119a8aed
Author | SHA1 | Date | |
---|---|---|---|
7a119a8aed | |||
22e7d30678 | |||
3c0ebd24d7 | |||
f649b618cf | |||
6e6183bf38 | |||
5dafdf08b4 | |||
cf960ff6d6 | |||
521b1cb2f7 | |||
a24addf6ec | |||
051000169e | |||
0893c4661e | |||
53b631678a | |||
07c27e84d8 | |||
0924625a0e | |||
947f31f20e | |||
7c8b1fefb7 | |||
b12de1cd2e | |||
097cce14e8 | |||
226255f75a | |||
d574849407 |
@@ -1,6 +1,6 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXTimePicker;
|
import com.jfoenix.controls.*;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
@@ -21,15 +21,15 @@ public class CreateEventController {
|
|||||||
@FXML
|
@FXML
|
||||||
public GridPane mainGrid;
|
public GridPane mainGrid;
|
||||||
@FXML
|
@FXML
|
||||||
public DatePicker datePickerDate;
|
public JFXDatePicker datePickerDate;
|
||||||
@FXML
|
@FXML
|
||||||
public TextField textName;
|
public JFXTextField textName;
|
||||||
@FXML
|
@FXML
|
||||||
public ComboBox<String> ComboBoxPriotity;
|
public JFXComboBox<String> ComboBoxPriotity;
|
||||||
@FXML
|
@FXML
|
||||||
public CheckBox checkBoxIsFullDay;
|
public JFXToggleButton toggleBtnIsFullDay;
|
||||||
@FXML
|
@FXML
|
||||||
public CheckBox checkBoxIsPrivate;
|
public JFXToggleButton toggleBtnIsPrivate;
|
||||||
@FXML
|
@FXML
|
||||||
public Label labelError;
|
public Label labelError;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -45,20 +45,11 @@ public class CreateEventController {
|
|||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
|
||||||
|
timeStart.set24HourView(true);
|
||||||
|
timeStart.setConverter(defaultConverter);
|
||||||
|
|
||||||
JFXTimePicker timePickerStart = new JFXTimePicker();
|
timeEnd.set24HourView(true);
|
||||||
timeStart = timePickerStart;
|
timeEnd.setConverter(defaultConverter);
|
||||||
timePickerStart.set24HourView(true);
|
|
||||||
timePickerStart.setConverter(defaultConverter);
|
|
||||||
timePickerStart.getStyleClass().add("timePicker");
|
|
||||||
mainGrid.add(timePickerStart, 1 , 3);
|
|
||||||
|
|
||||||
JFXTimePicker timePickerEnd = new JFXTimePicker();
|
|
||||||
timeEnd = timePickerEnd;
|
|
||||||
timePickerEnd.set24HourView(true);
|
|
||||||
timePickerEnd.setConverter(defaultConverter);
|
|
||||||
timePickerEnd.getStyleClass().add("timePicker");
|
|
||||||
mainGrid.add(timePickerEnd, 1 , 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,8 +63,8 @@ public class CreateEventController {
|
|||||||
Event event = new Event(
|
Event event = new Event(
|
||||||
textName.getText(),
|
textName.getText(),
|
||||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||||
checkBoxIsFullDay.isSelected(),
|
toggleBtnIsFullDay.isSelected(),
|
||||||
checkBoxIsPrivate.isSelected(),
|
toggleBtnIsPrivate.isSelected(),
|
||||||
timeStart.getValue().toString(),
|
timeStart.getValue().toString(),
|
||||||
timeEnd.getValue().toString(),
|
timeEnd.getValue().toString(),
|
||||||
datePickerDate.getValue().atStartOfDay(),
|
datePickerDate.getValue().atStartOfDay(),
|
||||||
|
@@ -12,10 +12,12 @@ import java.util.Objects;
|
|||||||
public class MainApplication extends Application {
|
public class MainApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
|
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
||||||
|
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
||||||
scene.getStylesheets().add(Objects.requireNonNull(
|
scene.getStylesheets().add(Objects.requireNonNull(
|
||||||
|
|
||||||
MainApplication.class.getResource("main-view.css")).toExternalForm());
|
MainApplication.class.getResource("main-view.css")).toExternalForm());
|
||||||
stage.setTitle("SharePlaner");
|
stage.setTitle("SharePlaner");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
|
55
client/app/src/main/java/users/CreateUserController.java
Normal file
55
client/app/src/main/java/users/CreateUserController.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package users;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class CreateUserController {
|
||||||
|
|
||||||
|
public TextField textName;
|
||||||
|
public TextField textPassword;
|
||||||
|
public TextField textPasswordSecond;
|
||||||
|
public ToggleButton checkButtonIsAdmin;
|
||||||
|
public TextField textLogin;
|
||||||
|
public TextField textForename;
|
||||||
|
public Label labelError;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void createUser(ActionEvent event) {
|
||||||
|
if (textLogin.getText().trim().isEmpty()){
|
||||||
|
labelError.setText("Bitte Login Namen angeben");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (textForename.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Vornamen eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (textName.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Nachnamen eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (textPassword.getText().trim().isEmpty()) {
|
||||||
|
labelError.setText("Bitte Passwort eingeben!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
||||||
|
labelError.setText("Passwörter stimmen nicht überein!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void abortBtnClick(ActionEvent event) {
|
||||||
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
}
|
@@ -1,18 +1,18 @@
|
|||||||
package users;
|
package users;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.*;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import res.DataController;
|
import res.DataController;
|
||||||
|
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
@FXML
|
@FXML
|
||||||
public TextField userField;
|
public JFXTextField userField;
|
||||||
@FXML
|
@FXML
|
||||||
public TextField passField;
|
public JFXPasswordField passField;
|
||||||
@FXML
|
@FXML
|
||||||
public Label userErrLabel;
|
public Label userErrLabel;
|
||||||
@FXML
|
@FXML
|
||||||
|
@@ -28,10 +28,16 @@ Label{
|
|||||||
|
|
||||||
.inputField{
|
.inputField{
|
||||||
-fx-padding: 10px;
|
-fx-padding: 10px;
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainButton{
|
.mainButton{
|
||||||
-fx-font-weight: bold;
|
-fx-font-weight: bold;
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
JFXButton{
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#labelError{
|
#labelError{
|
||||||
@@ -45,7 +51,14 @@ Label{
|
|||||||
-fx-font-size: 16px;
|
-fx-font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inputDate{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comboBox{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.timePicker{
|
.timePicker{
|
||||||
-fx-background-color: white;
|
-fx-background-color: white;
|
||||||
-fx-max-width: 200px;
|
|
||||||
}
|
}
|
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
<?import javafx.collections.FXCollections?>
|
<?import javafx.collections.FXCollections?>
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="main.CreateEventController">
|
fx:controller="main.CreateEventController">
|
||||||
|
|
||||||
@@ -36,10 +38,12 @@
|
|||||||
<Label styleClass="inputLabel" GridPane.rowIndex="6">Ganztägig:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="6">Ganztägig:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="7">Privat:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="7">Privat:</Label>
|
||||||
|
|
||||||
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||||
<DatePicker fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||||
|
|
||||||
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||||
<items>
|
<items>
|
||||||
<FXCollections fx:factory="observableArrayList">
|
<FXCollections fx:factory="observableArrayList">
|
||||||
<String fx:value="gering"/>
|
<String fx:value="gering"/>
|
||||||
@@ -47,14 +51,14 @@
|
|||||||
<String fx:value="hoch"/>
|
<String fx:value="hoch"/>
|
||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</ComboBox>
|
</JFXComboBox>
|
||||||
<CheckBox fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||||
<CheckBox fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||||
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||||
|
|
||||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||||
<Button onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</Button>
|
<JFXButton onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</JFXButton>
|
||||||
<Button styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</Button>
|
<JFXButton styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Anlegen</JFXButton>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<?import javafx.collections.FXCollections?>
|
<?import javafx.collections.FXCollections?>
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
<GridPane fx:id="mainGrid" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="main.CreateEventController">
|
fx:controller="main.CreateEventController">
|
||||||
@@ -36,10 +38,12 @@
|
|||||||
<Label styleClass="inputLabel" GridPane.rowIndex="6">Ganztägig:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="6">Ganztägig:</Label>
|
||||||
<Label styleClass="inputLabel" GridPane.rowIndex="7">Privat:</Label>
|
<Label styleClass="inputLabel" GridPane.rowIndex="7">Privat:</Label>
|
||||||
|
|
||||||
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
<JFXTextField styleClass="inputField" fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
|
||||||
<DatePicker fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
<JFXDatePicker styleClass="inputDate" fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="200" minWidth="200"/>
|
||||||
|
<JFXTimePicker styleClass="timePicker" fx:id="timeEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="200" minWidth="200"/>
|
||||||
|
|
||||||
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
<JFXComboBox fx:id="ComboBoxPriotity" styleClass="comboBox" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="200" minWidth="200">
|
||||||
<items>
|
<items>
|
||||||
<FXCollections fx:factory="observableArrayList">
|
<FXCollections fx:factory="observableArrayList">
|
||||||
<String fx:value="gering"/>
|
<String fx:value="gering"/>
|
||||||
@@ -47,14 +51,14 @@
|
|||||||
<String fx:value="hoch"/>
|
<String fx:value="hoch"/>
|
||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</ComboBox>
|
</JFXComboBox>
|
||||||
<CheckBox fx:id="checkBoxIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsFullDay" GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
||||||
<CheckBox fx:id="checkBoxIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
<JFXToggleButton styleClass="checkbox" fx:id="toggleBtnIsPrivate" GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
||||||
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
<Label fx:id="labelError" GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
||||||
|
|
||||||
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
<HBox GridPane.columnIndex="1" GridPane.rowIndex="9" GridPane.columnSpan="2" alignment="CENTER_RIGHT">
|
||||||
<Button onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</Button>
|
<JFXButton onAction="#abortBtnClick" maxWidth="150" minWidth="150">Abbrechen</JFXButton>
|
||||||
<Button styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Speichern</Button>
|
<JFXButton styleClass="mainButton" onAction="#createBtnClick" maxWidth="150" minWidth="150">Speichern</JFXButton>
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
@@ -72,3 +72,7 @@ Label{
|
|||||||
-fx-max-height: 40px;
|
-fx-max-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navBtn{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.image.*?>
|
<?import javafx.scene.image.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane style="-fx-background-color: #424242;" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
<GridPane style="-fx-background-color: #424242;" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="main.MainController">
|
fx:controller="main.MainController">
|
||||||
@@ -19,15 +20,15 @@
|
|||||||
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
|
<ImageView fitHeight="50.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
|
||||||
</ImageView>
|
</ImageView>
|
||||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||||
ADD
|
ADD
|
||||||
</Button>
|
</JFXButton>
|
||||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||||
ADD
|
ADD
|
||||||
</Button>
|
</JFXButton>
|
||||||
<Button onAction="#onAddBtnClick" styleClass="main-btn">
|
<JFXButton onAction="#onAddBtnClick" styleClass="main-btn">
|
||||||
ADD
|
ADD
|
||||||
</Button>
|
</JFXButton>
|
||||||
</VBox>
|
</VBox>
|
||||||
<GridPane prefHeight="200.0" prefWidth="222.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
|
<GridPane prefHeight="200.0" prefWidth="222.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -48,9 +49,9 @@
|
|||||||
<Insets left="5"/>
|
<Insets left="5"/>
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Button onAction="#onBackClick" GridPane.columnIndex="1" maxHeight="1.7976931348623157E308">zurück</Button>
|
<JFXButton styleClass="navBtn" onAction="#onBackClick" GridPane.columnIndex="1" maxHeight="1.7976931348623157E308">zurück</JFXButton>
|
||||||
<Button onAction="#onTodayClick" GridPane.columnIndex="2" maxHeight="1.7976931348623157E308">heute</Button>
|
<JFXButton styleClass="navBtn" onAction="#onTodayClick" GridPane.columnIndex="2" maxHeight="1.7976931348623157E308">heute</JFXButton>
|
||||||
<Button onAction="#onNextClick" GridPane.columnIndex="3" maxHeight="1.7976931348623157E308">weiter</Button>
|
<JFXButton styleClass="navBtn" onAction="#onNextClick" GridPane.columnIndex="3" maxHeight="1.7976931348623157E308">weiter</JFXButton>
|
||||||
|
|
||||||
<GridPane fx:id="calendarGrid" gridLinesVisible="true" styleClass="gridCalendar" GridPane.columnSpan="4"
|
<GridPane fx:id="calendarGrid" gridLinesVisible="true" styleClass="gridCalendar" GridPane.columnSpan="4"
|
||||||
GridPane.columnIndex="0" GridPane.rowIndex="1">
|
GridPane.columnIndex="0" GridPane.rowIndex="1">
|
||||||
|
56
client/app/src/main/resources/users/create-user.css
Normal file
56
client/app/src/main/resources/users/create-user.css
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
* {
|
||||||
|
-fx-base-background-color: #2B2D42;
|
||||||
|
-fx-base1-background-color: #525E74;
|
||||||
|
|
||||||
|
-fx-main-border-color: #B0B0B0;
|
||||||
|
-fx-main-text-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GridPane{
|
||||||
|
-fx-background-color: #3E415F;
|
||||||
|
-fx-padding: 20px;
|
||||||
|
-fx-font-size: 20px;
|
||||||
|
-fx-font-family: Segoe UI;
|
||||||
|
|
||||||
|
-fx-border-insets: 1;
|
||||||
|
-fx-border-color: #B0B0B0;
|
||||||
|
-fx-border-style: solid;
|
||||||
|
-fx-border-width: 2;
|
||||||
|
-fx-effect: dropshadow(three-pass-box, rgba(100, 100, 100, 1), 24, 0.5, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainLabel{
|
||||||
|
-fx-padding: 10px;
|
||||||
|
-fx-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
-fx-alignment: top-center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Label{
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-max-width: 150px;
|
||||||
|
-fx-min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textField{
|
||||||
|
-fx-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorMessage{
|
||||||
|
-fx-max-width: 400px;
|
||||||
|
-fx-min-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
Button{
|
||||||
|
-fx-max-width: 150px;
|
||||||
|
-fx-min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnLogin{
|
||||||
|
-fx-font-weight: bold;
|
||||||
|
}
|
||||||
|
|
56
client/app/src/main/resources/users/create-user.fxml
Normal file
56
client/app/src/main/resources/users/create-user.fxml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<GridPane xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
fx:controller="users.CreateUserController">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
<ColumnConstraints minWidth="100"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
<RowConstraints vgrow="ALWAYS" />
|
||||||
|
</rowConstraints>
|
||||||
|
|
||||||
|
<Label styleClass="mainLabel" GridPane.columnIndex="2" >User anlegen</Label>
|
||||||
|
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="1" GridPane.columnIndex="1">Login:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="2" GridPane.columnIndex="1">Vorname:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="3" GridPane.columnIndex="1">Nachname:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="4" GridPane.columnIndex="1">Passwort:</Label>
|
||||||
|
<Label styleClass="inputLabel" GridPane.rowIndex="5" GridPane.columnIndex="1">Passwort wiederholen:</Label>
|
||||||
|
|
||||||
|
<Label styleClass="inputLabelAdmin" GridPane.rowIndex="6" GridPane.columnIndex="1">Admin:</Label>
|
||||||
|
|
||||||
|
<TextField fx:id="textLogin" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||||
|
<TextField fx:id="textForename" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||||
|
<TextField fx:id="textName" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
||||||
|
<TextField fx:id="textPassword" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
|
<TextField fx:id="textPasswordSecond" styleClass="textField" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
||||||
|
|
||||||
|
<ToggleButton fx:id="checkButtonIsAdmin" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
|
|
||||||
|
<Label fx:id="labelError" styleClass="errorMessage" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
||||||
|
|
||||||
|
<HBox GridPane.columnIndex="2" GridPane.rowIndex="8" alignment="CENTER_RIGHT">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets right="100" left="100"/>
|
||||||
|
</HBox.margin>
|
||||||
|
<Button onAction="#abortBtnClick">Abbrechen</Button>
|
||||||
|
<Button onAction="#createUser" styleClass="btnLogin" >Anmelden</Button>
|
||||||
|
|
||||||
|
</HBox>
|
||||||
|
</GridPane>
|
||||||
|
|
@@ -34,4 +34,20 @@ Label{
|
|||||||
-fx-max-height: 400px;
|
-fx-max-height: 400px;
|
||||||
-fx-wrap-text: true;
|
-fx-wrap-text: true;
|
||||||
-fx-font-size: 16px;
|
-fx-font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userField{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.passField{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quitBtn{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginBtn{
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
|
||||||
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="users.LoginController">
|
<GridPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="users.LoginController">
|
||||||
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -19,14 +21,14 @@
|
|||||||
<Label GridPane.columnIndex="1">Anmelden</Label>
|
<Label GridPane.columnIndex="1">Anmelden</Label>
|
||||||
|
|
||||||
<Label GridPane.rowIndex="1">Username</Label>
|
<Label GridPane.rowIndex="1">Username</Label>
|
||||||
<TextField GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"/>
|
<JFXTextField styleClass="userField" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="userField"/>
|
||||||
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="1" fx:id="userErrLabel"/>
|
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="1" fx:id="userErrLabel"/>
|
||||||
|
|
||||||
<Label GridPane.rowIndex="2">Paswort</Label>
|
<Label GridPane.rowIndex="2">Paswort</Label>
|
||||||
<PasswordField GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"/>
|
<JFXPasswordField styleClass="passField" GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="passField"/>
|
||||||
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="2" fx:id="passErrLabel"/>
|
<Label styleClass="errorLbl" GridPane.columnIndex="2" GridPane.rowIndex="2" fx:id="passErrLabel"/>
|
||||||
|
|
||||||
<Button onAction="#abortBtnClick" GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</Button>
|
<JFXButton styleClass="quitBtn" onAction="#abortBtnClick" GridPane.columnIndex="1" GridPane.rowIndex="3">Beenden</JFXButton>
|
||||||
<Button onAction="#login" GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</Button>
|
<JFXButton styleClass="loginBtn" onAction="#login" GridPane.columnIndex="2" GridPane.rowIndex="3">Anmelden</JFXButton>
|
||||||
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
27
client/data/src/main/java/helper/Tuple.java
Normal file
27
client/data/src/main/java/helper/Tuple.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package helper;
|
||||||
|
|
||||||
|
public class Tuple<X, Y> {
|
||||||
|
public final X key;
|
||||||
|
public final Y value;
|
||||||
|
|
||||||
|
public Tuple(X key, Y value) {
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public X getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Y getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Tuple{" +
|
||||||
|
"key=" + key +
|
||||||
|
", value=" + value +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@@ -2,6 +2,7 @@ package res;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import helper.Tuple;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -22,6 +23,7 @@ public class DataController {
|
|||||||
|
|
||||||
private static final String LOGIN_ENDPOINT = "http://localhost:8080/user/login";
|
private static final String LOGIN_ENDPOINT = "http://localhost:8080/user/login";
|
||||||
private static final String ALL_USERS_ENDPOINT = "http://localhost:8080/user/all";
|
private static final String ALL_USERS_ENDPOINT = "http://localhost:8080/user/all";
|
||||||
|
private static final String HEADER_TEST_ENDPOINT = "http://localhost:8080/vpr/header-test";
|
||||||
|
|
||||||
private final HttpRequest httpRequest;
|
private final HttpRequest httpRequest;
|
||||||
|
|
||||||
@@ -31,16 +33,28 @@ public class DataController {
|
|||||||
|
|
||||||
public boolean login(String username, String password) {
|
public boolean login(String username, String password) {
|
||||||
try {
|
try {
|
||||||
USER_ID = Long.parseLong(httpRequest.sendPostRequest(
|
Tuple<Integer, String> response = httpRequest.sendPostRequest(
|
||||||
LOGIN_ENDPOINT,
|
LOGIN_ENDPOINT,
|
||||||
"login=" + username
|
"login=" + username
|
||||||
+ "&password=" + password,
|
+ "&password=" + password,
|
||||||
false
|
false
|
||||||
));
|
);
|
||||||
|
String[] data = response.getValue().split("\\s+");
|
||||||
|
|
||||||
|
USER_ID = Long.parseLong(data[1]);
|
||||||
|
HttpRequest.TOKEN = data[0];
|
||||||
|
|
||||||
|
Tuple<Integer, String> auth = httpRequest.sendPostRequest(
|
||||||
|
HEADER_TEST_ENDPOINT,
|
||||||
|
"",
|
||||||
|
true
|
||||||
|
);
|
||||||
|
System.out.println("auth " + auth);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return USER_ID >= 0;
|
return USER_ID >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,11 +78,11 @@ public class DataController {
|
|||||||
ArrayList<Event> eventList = new ArrayList<>();
|
ArrayList<Event> eventList = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String jsonResponse = httpRequest.sendPostRequest(ALL_EVENTS_ENDPOINT, "userId=" + USER_ID, true);
|
Tuple<Integer, String> response = httpRequest.sendPostRequest(ALL_EVENTS_ENDPOINT, "userId=" + USER_ID, true);
|
||||||
|
String jsonResponse = response.getValue();
|
||||||
System.out.println(jsonResponse);
|
System.out.println(jsonResponse);
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
//String json = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }";
|
|
||||||
|
|
||||||
for (Object obj : objectMapper.readValue(jsonResponse, Object[].class)) {
|
for (Object obj : objectMapper.readValue(jsonResponse, Object[].class)) {
|
||||||
ArrayList<Object> list = new ArrayList<>();
|
ArrayList<Object> list = new ArrayList<>();
|
||||||
@@ -108,7 +122,6 @@ public class DataController {
|
|||||||
|
|
||||||
// Parse JSON
|
// Parse JSON
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
//String json = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }";
|
|
||||||
|
|
||||||
return objectMapper.readValue(jsonString, Event[].class);
|
return objectMapper.readValue(jsonString, Event[].class);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package res;
|
package res;
|
||||||
|
|
||||||
|
import helper.Tuple;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@@ -9,7 +11,9 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class HttpRequest {
|
public class HttpRequest {
|
||||||
public String sendPostRequest(String urlString, String urlParameters, boolean sendAuth) throws Exception {
|
public static String TOKEN = "";
|
||||||
|
|
||||||
|
public Tuple<Integer, String> sendPostRequest(String urlString, String urlParameters, boolean sendAuth) throws Exception {
|
||||||
byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);
|
byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);
|
||||||
int postDataLength = postData.length;
|
int postDataLength = postData.length;
|
||||||
|
|
||||||
@@ -39,7 +43,7 @@ public class HttpRequest {
|
|||||||
|
|
||||||
if(sendAuth){
|
if(sendAuth){
|
||||||
con.setRequestProperty("Accept", "application/json");
|
con.setRequestProperty("Accept", "application/json");
|
||||||
con.setRequestProperty("Authorization", "Bearer {token}");
|
con.setRequestProperty("Authorization", "Bearer " + TOKEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
|
try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
|
||||||
@@ -47,22 +51,24 @@ public class HttpRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int status = con.getResponseCode();
|
int status = con.getResponseCode();
|
||||||
if (status == 200) {
|
String inputLine;
|
||||||
BufferedReader in = new BufferedReader(
|
StringBuilder content = new StringBuilder();
|
||||||
new InputStreamReader(con.getInputStream()));
|
BufferedReader in;
|
||||||
String inputLine;
|
|
||||||
StringBuilder content = new StringBuilder();
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
|
||||||
content.append(inputLine);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
con.disconnect();
|
if (status == 200) {
|
||||||
return content.toString();
|
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||||
} else {
|
} else {
|
||||||
con.disconnect();
|
in = new BufferedReader(new InputStreamReader(con.getErrorStream()));
|
||||||
throw new Exception("Status: " + status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
content.append(inputLine);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
con.disconnect();
|
||||||
|
|
||||||
|
return new Tuple<>(status, content.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sendGetRequest(String urlString) throws Exception {
|
public String sendGetRequest(String urlString) throws Exception {
|
||||||
|
Reference in New Issue
Block a user