Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp-java
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vincent.steinman
tp-java
Commits
05a68119
Commit
05a68119
authored
2 years ago
by
vincent.steinman
Browse files
Options
Downloads
Patches
Plain Diff
changed a bit some comments
parent
299fb72c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tp/src/main/java/com/example/tpfx/HelloController.java
+15
-8
15 additions, 8 deletions
tp/src/main/java/com/example/tpfx/HelloController.java
with
15 additions
and
8 deletions
tp/src/main/java/com/example/tpfx/HelloController.java
+
15
−
8
View file @
05a68119
...
...
@@ -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"
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment