parent
8ade9ad842
commit
3e344a8f74
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<VBox xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
prefHeight="400.0" prefWidth="600.0">
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Label text="Nom : "/>
|
||||||
|
<TextField fx:id="nomHabit"/>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Label text="Prix : "/>
|
||||||
|
<TextField fx:id="prixHabit"/>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Button text="Ajouter parfum" onAction="#ajouterHabit"/>
|
||||||
|
<Button text="Annuler" onAction="#annuler"/>
|
||||||
|
</HBox>
|
||||||
|
</VBox>
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<VBox xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
prefHeight="400.0" prefWidth="600.0">
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Label text="Nom : "/>
|
||||||
|
<TextField fx:id="nomParfum"/>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Label text="Prix : "/>
|
||||||
|
<TextField fx:id="prixParfum"/>
|
||||||
|
</HBox>
|
||||||
|
<VBox>
|
||||||
|
<HBox>
|
||||||
|
<Label text="Fragrance : "/>
|
||||||
|
<TextField fx:id="fragranceParfum"/>
|
||||||
|
<Button onAction="#ajouterFragrance" text="Ajouter fragrance"/>
|
||||||
|
</HBox>
|
||||||
|
<Label fx:id="fragrancesAjoutees"/>
|
||||||
|
</VBox>
|
||||||
|
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Button text="Ajouter parfum" onAction="#ajouterParfum"/>
|
||||||
|
<Button text="Annuler" onAction="#annuler"/>
|
||||||
|
</HBox>
|
||||||
|
</VBox>
|
@ -0,0 +1,51 @@
|
|||||||
|
package view;
|
||||||
|
|
||||||
|
import javafx.beans.binding.Bindings;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AjoutHabit {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField nomHabit;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField prixHabit;
|
||||||
|
|
||||||
|
|
||||||
|
private boolean isCanceled = false;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void ajouterHabit() {
|
||||||
|
fermerFenetre();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void annuler() {
|
||||||
|
isCanceled = true;
|
||||||
|
fermerFenetre();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fermerFenetre(){
|
||||||
|
nomHabit.getScene().getWindow().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getNomHabit(){
|
||||||
|
return nomHabit.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPrixHabit(){
|
||||||
|
return Integer.parseInt(prixHabit.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isCanceled() {
|
||||||
|
return isCanceled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package view;
|
||||||
|
|
||||||
|
import javafx.beans.binding.Bindings;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import view_modele.ProduitVM;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AjoutParfum {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label fragrancesAjoutees;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField nomParfum;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField prixParfum;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField fragranceParfum;
|
||||||
|
|
||||||
|
private final List<String> fragrances = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean isCanceled = false;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void ajouterParfum() {
|
||||||
|
fermerFenetre();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void annuler() {
|
||||||
|
isCanceled = true;
|
||||||
|
fermerFenetre();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fermerFenetre(){
|
||||||
|
fragranceParfum.getScene().getWindow().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void ajouterFragrance() {
|
||||||
|
fragrances.add(fragranceParfum.getText());
|
||||||
|
fragrancesAjoutees.textProperty().bind(Bindings.concat("Fragrances ajoutées : ", fragrancesToString()));
|
||||||
|
fragranceParfum.setText("");
|
||||||
|
; }
|
||||||
|
|
||||||
|
private String fragrancesToString(){
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for(String s : fragrances){
|
||||||
|
str.append(String.format("%s,",s));
|
||||||
|
}
|
||||||
|
|
||||||
|
return str.toString();
|
||||||
|
}
|
||||||
|
public String getNomParfum(){
|
||||||
|
return nomParfum.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPrixParfum(){
|
||||||
|
return Integer.parseInt(prixParfum.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getFragrancesParfum(){
|
||||||
|
return fragrances;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCanceled() {
|
||||||
|
return isCanceled;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue