Skip to content
Snippets Groups Projects
Commit 05a68119 authored by vincent.steinman's avatar vincent.steinman
Browse files

changed a bit some comments

parent 299fb72c
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ import java.util.regex.Pattern;
public class HelloController {
static ArrayList<Contact> contactArray = new ArrayList<>();
int selectedID = 0;
int selectedID = 0; //Save the id of the selected item in the list view
boolean imported = false; //Used to know whenever we should enable or disable button save/edit
ObservableList<String> ctType = FXCollections.observableArrayList("Friend", "Family", "Professional");
//Fx fields
......@@ -194,12 +194,13 @@ public class HelloController {
txtEmail.setText(data.get(5));
txtSocial.setText(data.get(6));
txtJob.setText(data.get(7));
//Family and professional have one more arguments
if(data.size() > 8){
txtOther.setVisible(true);
lblOther.setVisible(true);
txtOther.setText(data.get(8));
if(contactArray.get(LstCt.getSelectionModel().getSelectedIndex()) instanceof Family){
//contactArray.get(LstCt.getSelectionModel().getSelectedIndex()).EditRelation(other);
lblOther.setVisible(true);
lblOther.setText("Relation");
txtOther.setVisible(true);
......@@ -210,7 +211,7 @@ public class HelloController {
txtOther.setVisible(true);
cbxType.setValue("Professional");
}
} else {
} else { //Reset when it comes back to friends
txtOther.setVisible(false);
lblOther.setVisible(false);
cbxType.setValue("Friend");
......@@ -288,18 +289,20 @@ public class HelloController {
*/
@FXML
protected void ShowAll() {
int cpt = 0;
int cpt_id = 0;
imported = false;
btnEdit.setDisable(true);
btnAdd.setDisable(true);
for(Contact cont: contactArray){
cont.setId(cpt);
cpt++;
for(Contact cont: contactArray){ //Give the correct id to the contact (based on their place in the list
cont.setId(cpt_id);
cpt_id++;
}
LstCt.getItems().clear();
for(Contact c: contactArray){
LstCt.getItems().add(c.toString());
}
txtFirst.setText("");
txtLast.setText("");
txtAdd.setText("");
......@@ -384,6 +387,7 @@ public class HelloController {
}
/**
* Import a Friend
* @param str_array Friends informations
*/
public void ImportFriend(List<String> str_array){
Friend f = new Friend(
......@@ -400,6 +404,7 @@ public class HelloController {
}
/**
* Import a Family Member
* @param str_array Family member informations
*/
public void ImportFamily(List<String> str_array){
Family f = new Family(
......@@ -418,6 +423,7 @@ public class HelloController {
/**
* Import a Professional
* @param str_array Professional informations
*/
public void ImportProfessional(List<String> str_array){
Professional f = new Professional(
......@@ -435,13 +441,14 @@ public class HelloController {
}
/**
* Add a contact (any type) to the list
* @param str_array contact info
* @param checker checker to verify contact type
*/
public void AddContactToList(List<String> str_array, int checker){
switch (checker){
case 1 -> ImportFriend(str_array);
case 2 -> ImportFamily(str_array);
case 3 -> ImportProfessional(str_array);
default -> System.out.println("Error contact type");
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment