mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-11-16 21:33:21 +00:00
Module Client, clss AccountManager : correction erreur compilation; modification du layout (désormais en colonne)
This commit is contained in:
parent
60e3caf4de
commit
330dc78f88
@ -9,6 +9,7 @@ import com.pqt.client.gui.ressources.components.specifics.account.IFXAccountsDis
|
|||||||
import com.pqt.client.gui.ressources.components.specifics.account.listeners.SimpleAccountComponentFirerer;
|
import com.pqt.client.gui.ressources.components.specifics.account.listeners.SimpleAccountComponentFirerer;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.core.entities.user_account.Account;
|
import com.pqt.core.entities.user_account.Account;
|
||||||
|
import com.pqt.core.entities.user_account.AccountLevel;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@ -26,7 +27,7 @@ public class AccountManager implements IFXAccountsDisplayerComponent, IFXValidat
|
|||||||
|
|
||||||
private Pane mainPane;
|
private Pane mainPane;
|
||||||
|
|
||||||
private HBox mainDisconnectedPane, mainConnectedPane;
|
private VBox mainDisconnectedPane, mainConnectedPane;
|
||||||
private TextField connectedUsernameField;
|
private TextField connectedUsernameField;
|
||||||
private ChoiceBox<Account> disconnectedUsernameField;
|
private ChoiceBox<Account> disconnectedUsernameField;
|
||||||
private PasswordField passwordField;
|
private PasswordField passwordField;
|
||||||
@ -48,8 +49,8 @@ public class AccountManager implements IFXAccountsDisplayerComponent, IFXValidat
|
|||||||
private void init() {
|
private void init() {
|
||||||
mainPane = new Pane();
|
mainPane = new Pane();
|
||||||
|
|
||||||
mainConnectedPane = new HBox();
|
mainConnectedPane = new VBox();
|
||||||
mainDisconnectedPane = new HBox();
|
mainDisconnectedPane = new VBox();
|
||||||
|
|
||||||
connectedUsernameField = new TextField();
|
connectedUsernameField = new TextField();
|
||||||
connectedUsernameField.setEditable(false);
|
connectedUsernameField.setEditable(false);
|
||||||
@ -67,21 +68,26 @@ public class AccountManager implements IFXAccountsDisplayerComponent, IFXValidat
|
|||||||
passwordField = new PasswordField();
|
passwordField = new PasswordField();
|
||||||
passwordField.setPromptText(GUIStringTool.getPasswordFieldPromptText());
|
passwordField.setPromptText(GUIStringTool.getPasswordFieldPromptText());
|
||||||
|
|
||||||
VBox leftDisconnectedPaneContent = new VBox();
|
|
||||||
leftDisconnectedPaneContent.getChildren().addAll(disconnectedUsernameField, passwordField);
|
|
||||||
|
|
||||||
Button validationButton = new Button(GUIStringTool.getLoginButtonLabel());
|
Button validationButton = new Button(GUIStringTool.getLoginButtonLabel());
|
||||||
validationButton.setOnMouseClicked(event-> validatorEventFirerer.fireValidationEvent());
|
validationButton.setOnMouseClicked(event-> validatorEventFirerer.fireValidationEvent());
|
||||||
validationButton.setOnKeyTyped(event->{if(event.getCode().equals(KeyCode.ENTER)) validatorEventFirerer.fireValidationEvent();});
|
validationButton.setOnKeyTyped(event->{if(event.getCode().equals(KeyCode.ENTER)) validatorEventFirerer.fireValidationEvent();});
|
||||||
|
|
||||||
mainDisconnectedPane.getChildren().addAll(leftDisconnectedPaneContent, validationButton);
|
mainDisconnectedPane.getChildren().addAll(disconnectedUsernameField, passwordField, validationButton);
|
||||||
|
|
||||||
refreshMainPane();
|
refreshMainPane();
|
||||||
|
display(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void display(Collection<Account> content) {
|
public void display(Collection<Account> content) {
|
||||||
Platform.runLater(()->disconnectedUsernameField.setItems(FXCollections.observableArrayList(content)));
|
Platform.runLater(()->{
|
||||||
|
if(content!=null && content.size()>0)
|
||||||
|
disconnectedUsernameField.setItems(FXCollections.observableArrayList(content));
|
||||||
|
else{
|
||||||
|
disconnectedUsernameField.getItems().clear();
|
||||||
|
disconnectedUsernameField.getItems().add(new Account("null", "", AccountLevel.getLowest()));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentAccount(Account account){
|
public void setCurrentAccount(Account account){
|
||||||
@ -147,7 +153,10 @@ public class AccountManager implements IFXAccountsDisplayerComponent, IFXValidat
|
|||||||
@Override
|
@Override
|
||||||
public boolean isCreationPossible() {
|
public boolean isCreationPossible() {
|
||||||
return currentAccount==null
|
return currentAccount==null
|
||||||
|
&& disconnectedUsernameField.getAccessibleText()!=null
|
||||||
&& !disconnectedUsernameField.getAccessibleText().isEmpty()
|
&& !disconnectedUsernameField.getAccessibleText().isEmpty()
|
||||||
|
&& passwordField.getText()!=null
|
||||||
&& !passwordField.getText().isEmpty();
|
&& !passwordField.getText().isEmpty();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user