Compare commits

...

6 Commits

7 changed files with 62 additions and 59 deletions

View File

@ -16,7 +16,12 @@ application {
mainClassName = "client.MainApplication"
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.jfoenix:jfoenix:9.0.10")
implementation(project(":data"))
}

View File

@ -1,24 +1,30 @@
package main;
import com.jfoenix.controls.JFXTimePicker;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.util.StringConverter;
import javafx.util.converter.LocalTimeStringConverter;
import res.DataController;
import res.Event;
import java.time.LocalTime;
import java.time.format.FormatStyle;
import java.util.Locale;
public class CreateEventController {
@FXML
public GridPane mainGrid;
@FXML
public DatePicker datePickerDate;
@FXML
public TextField textName;
@FXML
public TextField textStart;
@FXML
public TextField textEnd;
@FXML
public ComboBox<String> ComboBoxTyp;
@FXML
public ComboBox<String> ComboBoxPriotity;
@ -28,6 +34,10 @@ public class CreateEventController {
public CheckBox checkBoxIsPrivate;
@FXML
public Label labelError;
@FXML
public JFXTimePicker timeStart;
@FXML
public JFXTimePicker timeEnd;
public CreateEventController() {
@ -35,6 +45,22 @@ public class CreateEventController {
@FXML
public void initialize() {
StringConverter<LocalTime> defaultConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMANY);
JFXTimePicker timePickerStart = new JFXTimePicker();
timeStart = timePickerStart;
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);
}
@ -50,8 +76,8 @@ public class CreateEventController {
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
checkBoxIsFullDay.isSelected(),
checkBoxIsPrivate.isSelected(),
textStart.getText(),
textEnd.getText(),
timeStart.getValue().toString(),
timeEnd.getValue().toString(),
datePickerDate.getValue().atStartOfDay(),
(int) DataController.USER_ID
);

View File

@ -148,6 +148,23 @@ public class MainController {
});
Button editBtn = new Button();
editBtn.setTextValue("edit");
editBtn.setOnAction(event1 -> {
try {
FXMLLoader fxmlLoader = new FXMLLoader(
MainApplication.class.getResource("edit-event.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 650, 650);
scene.getStylesheets().add(Objects.requireNonNull(
MainApplication.class.getResource("create-event.css")).toExternalForm());
Stage stage = new Stage();
stage.setTitle("Termin bearbeiten");
stage.setScene(scene);
stage.initModality(Modality.APPLICATION_MODAL);
stage.setResizable(false);
stage.showAndWait();
} catch (IOException e) {
e.printStackTrace();
}
});
btnHBox.getChildren().add(editBtn);
btnHBox.getChildren().add(deleteBtn);
vBox.getChildren().add(btnHBox);

View File

@ -43,4 +43,9 @@ Label{
-fx-max-height: 400px;
-fx-wrap-text: true;
-fx-font-size: 16px;
}
.timePicker{
-fx-background-color: white;
-fx-max-width: 150px;
}

View File

@ -5,7 +5,7 @@
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<GridPane 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">
<columnConstraints>
@ -39,8 +39,6 @@
<DatePicker fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="400" minWidth="400"/>
<TextField fx:id="textStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
<TextField fx:id="textEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="400" minWidth="400"/>
<ComboBox fx:id="ComboBoxTyp" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="400" minWidth="400"/>
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="6" maxWidth="200" minWidth="200">
<items>

View File

@ -1,46 +0,0 @@
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);
}
Label{
-fx-text-fill: white;
-fx-max-width: 150px;
-fx-min-width: 150px;
}
.mainLabel{
-fx-background-color: #8D99AE;
-fx-padding: 10px;
-fx-max-width: 200px;
-fx-min-width: 200px;
-fx-font-weight: bold;
-fx-alignment: center;
}
.inputField{
-fx-padding: 10px;
}
.mainButton{
-fx-font-weight: bold;
}
#labelError{
-fx-font-weight: bold;
-fx-max-width: 1000px;
-fx-text-fill: #ff5555;
-fx-padding: 16px;
-fx-min-height: 140px;
-fx-max-height: 400px;
-fx-wrap-text: true;
-fx-font-size: 16px;
}

View File

@ -2,10 +2,10 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<GridPane 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">
<columnConstraints>
@ -39,8 +39,6 @@
<DatePicker fx:id="datePickerDate" GridPane.columnIndex="1" GridPane.rowIndex="1" maxWidth="400" minWidth="400"/>
<TextField fx:id="textName" GridPane.columnIndex="1" GridPane.rowIndex="2" maxWidth="400" minWidth="400"/>
<TextField fx:id="textStart" GridPane.columnIndex="1" GridPane.rowIndex="3" maxWidth="400" minWidth="400"/>
<TextField fx:id="textEnd" GridPane.columnIndex="1" GridPane.rowIndex="4" maxWidth="400" minWidth="400"/>
<ComboBox fx:id="ComboBoxTyp" GridPane.columnIndex="1" GridPane.rowIndex="5" maxWidth="400" minWidth="400"/>
<ComboBox fx:id="ComboBoxPriotity" GridPane.columnIndex="1" GridPane.rowIndex="6" maxWidth="200" minWidth="200">
<items>