Skip to content
Snippets Groups Projects
Commit 9c1ee8b8 authored by alec.schmidt's avatar alec.schmidt
Browse files

UI is a bit better now

parent 1eadc66a
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -40,6 +40,9 @@ public class FXMLController {
@FXML
private TextField socialBox;
@FXML
private TextField jobBox;
@FXML
private TextField searchBox;
......@@ -62,6 +65,14 @@ public class FXMLController {
private ComboBox<String> cBoxType;
private TableColumn<Contact, String> initColumn(String title, String getter){
TableColumn<Contact, String> column = new TableColumn<Contact, String>(title);
column.setCellValueFactory(
new PropertyValueFactory<>(getter)
);
return column;
}
@FXML
public void initialize() {
......@@ -70,19 +81,14 @@ public class FXMLController {
tView.getColumns().clear();
TableColumn<Contact, String> nameCol = new TableColumn<Contact, String>("Nom");
nameCol.setCellValueFactory(
new PropertyValueFactory<>("name")
);
TableColumn<Contact, String> firstNameCol = new TableColumn<Contact, String>("Prénom(s)");
firstNameCol.setCellValueFactory(
new PropertyValueFactory<>("firstNames")
);
TableColumn<Contact, String> mailCol = new TableColumn<Contact, String>("Mail(s)");
mailCol.setCellValueFactory(
new PropertyValueFactory<>("mails")
);
tView.getColumns().addAll(nameCol, firstNameCol, mailCol);
tView.getColumns().addAll(
initColumn("Nom", "name"),
initColumn("Prénom(s)", "firstNames"),
initColumn("Adresse(s)", "addresses"),
initColumn("Mail(s)", "mails"),
initColumn("Phone(s)", "phones"),
initColumn("Social(s)", "socials"),
initColumn("Job", "job"));
}
......@@ -92,6 +98,13 @@ public class FXMLController {
this.contacts.printContacts();
}
@FXML
protected void selectType() {
if (cBoxType.getValue().equals("Professionnel"))
jobBox.disableProperty().set(false);
else
jobBox.disableProperty().set(true);
}
@FXML
protected void doneEditing() {
......@@ -105,6 +118,7 @@ public class FXMLController {
c.setSocials(Arrays.asList(socialBox.getText().split(",")));
this.contacts.append(c);
tView.getItems().setAll(contacts.getList());
}
@FXML
......
......@@ -34,6 +34,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
......@@ -99,13 +100,21 @@
<Button layoutX="983.0" layoutY="504.0" mnemonicParsing="false" text="Search" />
<Button layoutX="742.0" layoutY="586.0" mnemonicParsing="false" onAction="#printCLI" text="PrintCLI" />
<Button fx:id="btnLoad" layoutX="550.0" layoutY="632.0" mnemonicParsing="false" onAction="#loadLocalSave" text="Load" />
<ComboBox fx:id="cBoxType" layoutX="359.0" layoutY="534.0" prefWidth="150.0" />
<ComboBox fx:id="cBoxType" layoutX="331.0" layoutY="422.0" onAction="#selectType" prefWidth="150.0" />
<TableView fx:id="tView" prefHeight="402.0" prefWidth="1149.0">
<columns>
<TableColumn prefWidth="75.0" text="C1" />
<TableColumn prefWidth="75.0" text="C2" />
</columns>
</TableView>
<Label layoutX="14.0" layoutY="426.0" text="Nom" />
<Label layoutX="12.0" layoutY="473.0" text="Prénom(s)" />
<Label layoutX="11.0" layoutY="526.0" text="Adresse(s)" />
<Label layoutX="3.0" layoutY="572.0" text="Téléphone(s)" />
<Label layoutX="27.0" layoutY="625.0" text="Mail(s)" />
<Label layoutX="31.0" layoutY="672.0" text="Socials" />
<TextField fx:id="jobBox" disable="true" layoutX="85.0" layoutY="706.0" />
<Label layoutX="36.0" layoutY="710.0" text="Job" />
</children>
</AnchorPane>
</children>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment