AccounterstellungMaske
This commit is contained in:
parent
3fbca319ba
commit
0a15189a66
@ -4,12 +4,17 @@ import javafx.collections.ListChangeListener;
|
|||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.Background;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AccounterstellungMitarbeiter {
|
public class AccounterstellungMitarbeiter {
|
||||||
|
|
||||||
|
private @FXML Label status;
|
||||||
|
private @FXML Label einmalpw;
|
||||||
private @FXML HBox kindanzeige;
|
private @FXML HBox kindanzeige;
|
||||||
private @FXML GridPane kindDaten;
|
private @FXML GridPane kindDaten;
|
||||||
private @FXML RadioButton typMitarbeiter;
|
private @FXML RadioButton typMitarbeiter;
|
||||||
@ -20,6 +25,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
accountTyp = new ToggleGroup();
|
accountTyp = new ToggleGroup();
|
||||||
accountTyp.getToggles().add(typEltern);
|
accountTyp.getToggles().add(typEltern);
|
||||||
accountTyp.getToggles().add(typMitarbeiter);
|
accountTyp.getToggles().add(typMitarbeiter);
|
||||||
|
einmalpw.setText(einmalPwGenerieren());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onZurueck(ActionEvent actionEvent) {
|
public void onZurueck(ActionEvent actionEvent) {
|
||||||
@ -52,6 +58,7 @@ public class AccounterstellungMitarbeiter {
|
|||||||
Label geburtstag = new Label("Geburtstag: ");
|
Label geburtstag = new Label("Geburtstag: ");
|
||||||
kindDaten.add(geburtstag, 0, 2);
|
kindDaten.add(geburtstag, 0, 2);
|
||||||
DatePicker geburtstagEingabe = new DatePicker();
|
DatePicker geburtstagEingabe = new DatePicker();
|
||||||
|
geburtstagEingabe.setEditable(false);
|
||||||
kindDaten.add(geburtstagEingabe, 1, 2);
|
kindDaten.add(geburtstagEingabe, 1, 2);
|
||||||
|
|
||||||
kindDaten.addRow(3);
|
kindDaten.addRow(3);
|
||||||
@ -60,14 +67,50 @@ public class AccounterstellungMitarbeiter {
|
|||||||
|
|
||||||
kindDaten.addRow(4);
|
kindDaten.addRow(4);
|
||||||
hinzufuegen.setOnAction(e -> {
|
hinzufuegen.setOnAction(e -> {
|
||||||
if (!nameEingabe.getText().equals("")) {
|
|
||||||
Button neues = new Button(nameEingabe.getText());
|
Button neues = new Button(nameEingabe.getText());
|
||||||
|
|
||||||
|
boolean nameGueltig = false;
|
||||||
|
boolean gebGueltig = false;
|
||||||
|
|
||||||
|
if (!nameEingabe.getText().equals("")) {
|
||||||
|
nameGueltig = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!geburtstagEingabe.getEditor().getText().equals("")) {
|
||||||
|
gebGueltig = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameGueltig && gebGueltig) {
|
||||||
kindanzeige.getChildren().add(neues);
|
kindanzeige.getChildren().add(neues);
|
||||||
neues.setOnAction(a -> {
|
neues.setOnAction(a -> {
|
||||||
((HBox) neues.getParent()).getChildren().remove(neues);
|
((HBox) neues.getParent()).getChildren().remove(neues);
|
||||||
});
|
});
|
||||||
|
nameEingabe.setText("");
|
||||||
|
geburtstagEingabe.getEditor().setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String einmalPwGenerieren() {
|
||||||
|
final int pwLaenge = 8;
|
||||||
|
String pw = "";
|
||||||
|
Random zufall = new Random();
|
||||||
|
for (int i = 0; i < pwLaenge; i++) {
|
||||||
|
pw += (char)zufall.nextInt('A', 'Z' + 1);
|
||||||
|
}
|
||||||
|
return pw;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean eingabenGueltig() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSpeichern(ActionEvent actionEvent) {
|
||||||
|
if (eingabenGueltig()) {
|
||||||
|
status.setText("Daten Erfolgreich gespeichert");
|
||||||
|
einmalpw.setText(einmalPwGenerieren());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,18 +39,20 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</left>
|
</left>
|
||||||
<right>
|
<right>
|
||||||
<VBox>
|
<HBox>
|
||||||
<Label text="Einmalpasswort: XXXXXXXX" />
|
<Label text="Einmalpasswort: "/>
|
||||||
</VBox>
|
<Label fx:id="einmalpw"/>
|
||||||
|
</HBox>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</center>
|
</center>
|
||||||
<bottom>
|
<bottom>
|
||||||
<BorderPane>
|
<BorderPane>
|
||||||
<right>
|
<right>
|
||||||
<VBox styleClass="button-untenrechts">
|
<HBox styleClass="button-untenrechts">
|
||||||
<Button text="Speichern"/>
|
<Label fx:id="status"/>
|
||||||
</VBox>
|
<Button text="Speichern" onAction="#onSpeichern"/>
|
||||||
|
</HBox>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</bottom>
|
</bottom>
|
||||||
|
@ -77,3 +77,8 @@
|
|||||||
.accounterstellung_links {
|
.accounterstellung_links {
|
||||||
-fx-spacing: 20;
|
-fx-spacing: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.falscheEingabe {
|
||||||
|
-fx-background-color: #FFDCDC;
|
||||||
|
-fx-text-fill: #FFDCDC;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user