parent
3e344a8f74
commit
db1f986314
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<fx:root type="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="nomProduit"/>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
<HBox>
|
||||||
|
<Label text="Prix : "/>
|
||||||
|
<TextField fx:id="prixProduit"/>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
</fx:root>
|
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
|
<?import view.uc.UCCommun?>
|
||||||
|
<fx:root type="VBox" xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
prefHeight="400.0" prefWidth="600.0">
|
||||||
|
|
||||||
|
<ListView fx:id="listeFragrances"/>
|
||||||
|
<HBox>
|
||||||
|
<TextField fx:id="nouvelleFragrance"/>
|
||||||
|
<Button onAction="#ajouterFragrance" text="Ajouter"/>
|
||||||
|
<Button onAction="#supprimerFragrance" text="Supprimer"/>
|
||||||
|
<Button text="Désélectionner" onAction="#deselectionner"/>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
</fx:root>
|
@ -0,0 +1,36 @@
|
|||||||
|
package view.uc;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.util.converter.NumberStringConverter;
|
||||||
|
import view_modele.ProduitVM;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class UCCommun extends VBox {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField nomProduit;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField prixProduit;
|
||||||
|
|
||||||
|
public UCCommun() throws IOException {
|
||||||
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/uc/UC_Commun.fxml"));
|
||||||
|
loader.setController(this);
|
||||||
|
loader.setRoot(this);
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bind(ProduitVM produit){
|
||||||
|
nomProduit.textProperty().bindBidirectional(produit.nomProperty());
|
||||||
|
prixProduit.textProperty().bindBidirectional(produit.prixProperty(), new NumberStringConverter());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unbind(ProduitVM produit){
|
||||||
|
nomProduit.textProperty().unbindBidirectional(produit.nomProperty());
|
||||||
|
prixProduit.textProperty().unbindBidirectional(produit.prixProperty());
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,28 @@
|
|||||||
package view.uc;
|
package view.uc;
|
||||||
|
|
||||||
public class UCDetailHabit {
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import view_modele.CouleurVM;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class UCDetailHabit extends VBox {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ListView<CouleurVM> listeCouleurs;
|
||||||
|
|
||||||
|
private UCCommun ucCommun;
|
||||||
|
|
||||||
|
public UCDetailHabit() throws IOException {
|
||||||
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/uc/UC_DetailHabit.fxml"));
|
||||||
|
loader.setController(this);
|
||||||
|
loader.setRoot(this);
|
||||||
|
loader.load();
|
||||||
|
|
||||||
|
ucCommun = new UCCommun();
|
||||||
|
getChildren().add(ucCommun);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package view.uc;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import view_modele.ParfumVM;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class UCDetailParfum extends VBox {
|
||||||
|
|
||||||
|
private ParfumVM parfumVM;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ListView<String> listeFragrances;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField nouvelleFragrance;
|
||||||
|
|
||||||
|
private UCCommun ucCommun;
|
||||||
|
|
||||||
|
public UCDetailParfum() throws IOException {
|
||||||
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/uc/UC_DetailParfum.fxml"));
|
||||||
|
loader.setRoot(this);
|
||||||
|
loader.setController(this);
|
||||||
|
loader.load();
|
||||||
|
|
||||||
|
ucCommun = new UCCommun();
|
||||||
|
getChildren().add(ucCommun);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProduit(ParfumVM parfum){
|
||||||
|
this.parfumVM = parfum;
|
||||||
|
bind(parfum);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bind(ParfumVM parfum){
|
||||||
|
unbind();
|
||||||
|
ucCommun.bind(parfum);
|
||||||
|
listeFragrances.itemsProperty().bind(parfum.listeFragrancesProperty());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unbind(){
|
||||||
|
if(this.parfumVM != null){
|
||||||
|
ucCommun.unbind(parfumVM);
|
||||||
|
listeFragrances.itemsProperty().unbind();
|
||||||
|
nouvelleFragrance.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisibiliy(boolean visible){
|
||||||
|
if(!visible){
|
||||||
|
unbind();
|
||||||
|
}
|
||||||
|
super.setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void ajouterFragrance(){
|
||||||
|
parfumVM.addFragrance(nouvelleFragrance.getText());
|
||||||
|
nouvelleFragrance.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void supprimerFragrance(){
|
||||||
|
parfumVM.removeFragrance(listeFragrances.getSelectionModel().getSelectedItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void deselectionner(){
|
||||||
|
//parfum.addFragrance(nouvelleFragrance.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue