Replaced custom clearableTextField with normal TextField

This commit is contained in:
DieGurke 2020-07-15 14:05:47 +02:00
parent abd0113588
commit f608b2d6ec
2 changed files with 8 additions and 9 deletions

View File

@ -14,7 +14,6 @@ import javafx.scene.control.Alert.AlertType;
import envoy.client.data.*; import envoy.client.data.*;
import envoy.client.net.Client; import envoy.client.net.Client;
import envoy.client.net.WriteProxy; import envoy.client.net.WriteProxy;
import envoy.client.ui.ClearableTextField;
import envoy.client.ui.SceneContext; import envoy.client.ui.SceneContext;
import envoy.client.ui.Startup; import envoy.client.ui.Startup;
import envoy.data.LoginCredentials; import envoy.data.LoginCredentials;
@ -38,7 +37,7 @@ import envoy.util.EnvoyLog;
public final class LoginScene { public final class LoginScene {
@FXML @FXML
private ClearableTextField userTextField; private TextField userTextField;
@FXML @FXML
private PasswordField passwordField; private PasswordField passwordField;
@ -104,16 +103,16 @@ public final class LoginScene {
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) { if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait(); new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
repeatPasswordField.clear(); repeatPasswordField.clear();
} else if (!Bounds.isValidContactName(userTextField.getTextField().getText())) { } else if (!Bounds.isValidContactName(userTextField.getText())) {
new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait(); new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait();
userTextField.getTextField().clear(); userTextField.clear();
} else performHandshake(new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText(), registerCheckBox.isSelected(), } else performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText(), registerCheckBox.isSelected(),
Startup.VERSION)); Startup.VERSION));
} }
@FXML @FXML
private void offlineModeButtonPressed() { private void offlineModeButtonPressed() {
attemptOfflineMode(new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText(), false, Startup.VERSION)); attemptOfflineMode(new LoginCredentials(userTextField.getText(), passwordField.getText(), false, Startup.VERSION));
} }
@FXML @FXML

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import envoy.client.ui.ClearableTextField?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?> <?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?> <?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.GridPane?>
@ -70,12 +70,12 @@
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" /> <Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</padding> </padding>
</Label> </Label>
<ClearableTextField fx:id="userTextField" <TextField fx:id="userTextField"
GridPane.columnIndex="1"> GridPane.columnIndex="1">
<GridPane.margin> <GridPane.margin>
<Insets bottom="10.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="10.0" left="5.0" right="5.0" top="5.0" />
</GridPane.margin> </GridPane.margin>
</ClearableTextField> </TextField>
<PasswordField fx:id="passwordField" <PasswordField fx:id="passwordField"
GridPane.columnIndex="1" GridPane.rowIndex="1"> GridPane.columnIndex="1" GridPane.rowIndex="1">
<GridPane.margin> <GridPane.margin>