svenAccounterstellung #3
@ -4,12 +4,17 @@ import javafx.collections.ListChangeListener;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class AccounterstellungMitarbeiter {
|
||||
|
||||
private @FXML Label status;
|
||||
private @FXML Label einmalpw;
|
||||
private @FXML HBox kindanzeige;
|
||||
private @FXML GridPane kindDaten;
|
||||
private @FXML RadioButton typMitarbeiter;
|
||||
@ -20,6 +25,7 @@ public class AccounterstellungMitarbeiter {
|
||||
accountTyp = new ToggleGroup();
|
||||
accountTyp.getToggles().add(typEltern);
|
||||
accountTyp.getToggles().add(typMitarbeiter);
|
||||
einmalpw.setText(einmalPwGenerieren());
|
||||
}
|
||||
|
||||
public void onZurueck(ActionEvent actionEvent) {
|
||||
@ -52,6 +58,7 @@ public class AccounterstellungMitarbeiter {
|
||||
Label geburtstag = new Label("Geburtstag: ");
|
||||
kindDaten.add(geburtstag, 0, 2);
|
||||
DatePicker geburtstagEingabe = new DatePicker();
|
||||
geburtstagEingabe.setEditable(false);
|
||||
kindDaten.add(geburtstagEingabe, 1, 2);
|
||||
|
||||
kindDaten.addRow(3);
|
||||
@ -60,14 +67,50 @@ public class AccounterstellungMitarbeiter {
|
||||
|
||||
kindDaten.addRow(4);
|
||||
hinzufuegen.setOnAction(e -> {
|
||||
Button neues = new Button(nameEingabe.getText());
|
||||
|
||||
boolean nameGueltig = false;
|
||||
boolean gebGueltig = false;
|
||||
|
||||
if (!nameEingabe.getText().equals("")) {
|
||||
Button neues = new Button(nameEingabe.getText());
|
||||
nameGueltig = true;
|
||||
}
|
||||
|
||||
if (!geburtstagEingabe.getEditor().getText().equals("")) {
|
||||
gebGueltig = true;
|
||||
}
|
||||
|
||||
if (nameGueltig && gebGueltig) {
|
||||
kindanzeige.getChildren().add(neues);
|
||||
neues.setOnAction(a -> {
|
||||
((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>
|
||||
</left>
|
||||
<right>
|
||||
<VBox>
|
||||
<Label text="Einmalpasswort: XXXXXXXX" />
|
||||
</VBox>
|
||||
<HBox>
|
||||
<Label text="Einmalpasswort: "/>
|
||||
<Label fx:id="einmalpw"/>
|
||||
</HBox>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<BorderPane>
|
||||
<right>
|
||||
<VBox styleClass="button-untenrechts">
|
||||
<Button text="Speichern"/>
|
||||
</VBox>
|
||||
<HBox styleClass="button-untenrechts">
|
||||
<Label fx:id="status"/>
|
||||
<Button text="Speichern" onAction="#onSpeichern"/>
|
||||
</HBox>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</bottom>
|
||||
|
@ -76,4 +76,9 @@
|
||||
|
||||
.accounterstellung_links {
|
||||
-fx-spacing: 20;
|
||||
}
|
||||
|
||||
.falscheEingabe {
|
||||
-fx-background-color: #FFDCDC;
|
||||
-fx-text-fill: #FFDCDC;
|
||||
}
|
Loading…
Reference in New Issue
Block a user