1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
public class CustomerPanel extends StackPane {
private GroupCustomers gc;
private ScrollPane scrollPaneRoot;
private VBox vboxRoot;
private TabPane tabPaneCustomer;
private Tab tabCustomer;
private Tab tabConstructionSite;
private BorderPane borderPane_detailCustomer;
private VBox vbox_borderPaneCustomer_customer;
private VBox vbox_borderPaneCustomer_site;
private HBox hbox_borderPaneCustomerEmail;
private HBox hbox_borderPaneCustomerPhone_customer;
private HBox hbox_borderPaneCustomerGsm_customer;
private HBox hbox_borderPaneCustomerPhone_site;
private HBox hbox_borderPaneCustomerGsm_site;
private ToolBar toolBar;
private Region emptyRegion;
private Button button_UpdateCustomer;
private Label lbToolbar_borderPaneDetailCustomer;
private Label lbEMail_p, lbPhone_customer_p, lbGsm_customer_p;
private Label lbPhone_site_p, lbGsm_site_p;
private Label lbContactCustomer, lbVAT_number, lbAddress_customer, lbZipCodeAndCity_customer, lbEMail, lbPhone_customer, lbGsm_customer;
private Label lbAddress_site, lbZipCodeAndCity_site, lbPhone_site, lbGsm_site;
public CustomerPanel(GroupCustomers gc){
this.gc = gc;
// scrollPane **************************************************************
scrollPaneRoot = new ScrollPane();
scrollPaneRoot.setStyle("-fx-background-color: WHITE");
scrollPaneRoot.setStyle("-fx-border-color: black");
scrollPaneRoot.setFitToWidth(true);
scrollPaneRoot.setFitToHeight(true);
scrollPaneRoot.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPaneRoot.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
// vboxRoot *****************************************************************
vboxRoot = new VBox();
vboxRoot.setStyle("-fx-background-color: whitesmoke");
// borderPane_detailCustomer ********************************************
borderPane_detailCustomer = new BorderPane();
borderPane_detailCustomer.setPadding(new Insets(21, 19, 21, 12)); // top, right, bottom, left
// ToolBar ---------------------------------------------------------
toolBar = new ToolBar();
toolBar.setStyle("-fx-background-color: gainsboro");
emptyRegion = new Region();
HBox.setHgrow(emptyRegion, Priority.ALWAYS);
lbToolbar_borderPaneDetailCustomer = new Label();
lbToolbar_borderPaneDetailCustomer.setFont(Font.font(null, FontWeight.BOLD, 13));
button_UpdateCustomer = new Button();
button_UpdateCustomer.setStyle("-fx-base: gainsboro");
button_UpdateCustomer.setGraphic(new ImageView("pictures/iconEdit_20x20.png"));
toolBar.getItems().addAll(lbToolbar_borderPaneDetailCustomer, emptyRegion, button_UpdateCustomer);
// TabPane -----------------------------------------------------
tabPaneCustomer = new TabPane();
tabPaneCustomer.setStyle("-fx-background-color: ghostwhite");
tabPaneCustomer.getStyleClass().add("tabPaneCustomer_css"); //permet d'appliquer le css seulement sur ce tab
tabPaneCustomer.setPadding(new Insets(1, 10, 10, 10)); // top, right, bottom, left
// 1. tabCustomer ------------------------------------------
tabCustomer = new Tab(Messages.getString("customer"));
tabCustomer.setClosable(false);
vbox_borderPaneCustomer_customer = new VBox(8);
// vbox_borderPaneCustomer -----------------------------------------
lbContactCustomer = new Label();
lbVAT_number = new Label();
lbAddress_customer = new Label();
lbZipCodeAndCity_customer = new Label();
lbEMail_p = new Label("", new ImageView("pictures/Email.png"));
GridPane.setHalignment(lbEMail_p, HPos.LEFT);
lbEMail_p.setFont(Font.font(null, FontWeight.BOLD, 12));
lbEMail_p.setPadding(new Insets(3, 0, 0, 0));
lbEMail = new Label();
lbPhone_customer_p = new Label("", new ImageView("pictures/Phone.png"));
GridPane.setHalignment(lbPhone_customer_p, HPos.LEFT);
lbPhone_customer_p.setFont(Font.font(null, FontWeight.BOLD, 12));
lbPhone_customer_p.setPadding(new Insets(3, 0, 0, 0));
lbPhone_customer = new Label();
lbGsm_customer_p = new Label("", new ImageView("pictures/MobilePhone.png"));
GridPane.setHalignment(lbGsm_customer_p, HPos.LEFT);
lbGsm_customer_p.setFont(Font.font(null, FontWeight.BOLD, 12));
lbGsm_customer_p.setPadding(new Insets(3, 0, 0, 0));
lbGsm_customer = new Label();
hbox_borderPaneCustomerEmail = new HBox(10);
hbox_borderPaneCustomerEmail.getChildren().addAll(lbEMail_p, lbEMail);
hbox_borderPaneCustomerPhone_customer = new HBox(10);
hbox_borderPaneCustomerPhone_customer.getChildren().addAll(lbPhone_customer_p, lbPhone_customer);
hbox_borderPaneCustomerGsm_customer = new HBox(10);
hbox_borderPaneCustomerGsm_customer.getChildren().addAll(lbGsm_customer_p, lbGsm_customer);
// 2. tabConstructionSite -----------------------------------
tabConstructionSite = new Tab(Messages.getString("tabConstructionSite"));
tabConstructionSite.setClosable(false);
// vbox_borderPaneCustomer -----------------------------------------
vbox_borderPaneCustomer_site = new VBox(8);
vbox_borderPaneCustomer_site.setPadding(new Insets(8, 4, 8, 9));
lbAddress_site = new Label();
lbZipCodeAndCity_site = new Label();
lbPhone_site_p = new Label("", new ImageView("pictures/Phone.png"));
GridPane.setHalignment(lbPhone_site_p, HPos.LEFT);
lbPhone_site_p.setFont(Font.font(null, FontWeight.BOLD, 12));
lbPhone_site_p.setPadding(new Insets(3, 0, 0, 0));
lbPhone_site = new Label();
lbGsm_site_p = new Label("", new ImageView("pictures/MobilePhone.png"));
GridPane.setHalignment(lbGsm_site_p, HPos.LEFT);
lbGsm_site_p.setFont(Font.font(null, FontWeight.BOLD, 12));
lbGsm_site_p.setPadding(new Insets(3, 0, 0, 0));
lbGsm_site = new Label();
hbox_borderPaneCustomerPhone_site = new HBox(10);
hbox_borderPaneCustomerPhone_site.getChildren().addAll(lbPhone_site_p, lbPhone_site);
hbox_borderPaneCustomerGsm_site = new HBox(10);
hbox_borderPaneCustomerGsm_site.getChildren().addAll(lbGsm_site_p, lbGsm_site);
vbox_borderPaneCustomer_site.getChildren().addAll(lbAddress_site, lbZipCodeAndCity_site, hbox_borderPaneCustomerPhone_site, hbox_borderPaneCustomerGsm_site);
tabConstructionSite.setContent(vbox_borderPaneCustomer_site);
borderPane_detailCustomer.setTop(toolBar);
borderPane_detailCustomer.setCenter(tabPaneCustomer);
vboxRoot.getChildren().add(borderPane_detailCustomer);
buildVbox_borderPaneCustomer_customer(false);
tabCustomer.setContent(vbox_borderPaneCustomer_customer);
tabPaneCustomer.getTabs().add(tabCustomer);
// Construct layout *********************************************************
scrollPaneRoot.setContent(vboxRoot);
this.getChildren().add(scrollPaneRoot);
}
public void buildVbox_borderPaneCustomer_customer(boolean isCompany){
vbox_borderPaneCustomer_customer.getChildren().clear();
vbox_borderPaneCustomer_customer.setPadding(new Insets(8, 4, 8, 9));
if(!isCompany){
vbox_borderPaneCustomer_customer.getChildren().addAll(lbAddress_customer, lbZipCodeAndCity_customer, hbox_borderPaneCustomerEmail, hbox_borderPaneCustomerPhone_customer, hbox_borderPaneCustomerGsm_customer);
}else{
vbox_borderPaneCustomer_customer.getChildren().addAll(lbContactCustomer, lbVAT_number, lbAddress_customer, lbZipCodeAndCity_customer, hbox_borderPaneCustomerEmail, hbox_borderPaneCustomerPhone_customer, hbox_borderPaneCustomerGsm_customer);
}
} |
Partager