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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vincent.steinman
tp-java
Commits
299fb72c
Commit
299fb72c
authored
2 years ago
by
vincent.steinman
Browse files
Options
Downloads
Patches
Plain Diff
edit relation/workplace
parent
222e2614
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tp/src/main/java/com/example/tpfx/HelloController.java
+19
-22
19 additions, 22 deletions
tp/src/main/java/com/example/tpfx/HelloController.java
with
19 additions
and
22 deletions
tp/src/main/java/com/example/tpfx/HelloController.java
+
19
−
22
View file @
299fb72c
...
...
@@ -49,7 +49,7 @@ public class HelloController {
//Fx functions
/**
* Form start up. Hide and Disable unwanted component
* Form start up. Hide and Disable unwanted component
*/
@FXML
protected
void
initialize
()
{
...
...
@@ -66,6 +66,7 @@ public class HelloController {
*/
@FXML
protected
void
AddCt
()
{
//enhanced switch, doesn't need break
switch
(
cbxType
.
getValue
().
toString
()){
//Use the combo box value
case
"Friend"
->
AddPal
();
case
"Family"
->
AddFam
();
...
...
@@ -240,21 +241,23 @@ public class HelloController {
List
<
String
>
social
=
SplitLine
(
txtSocial
.
getText
(),
" "
);
String
job
=
txtJob
.
getText
();
String
other
=
txtOther
.
getText
();
int
selected_id
=
LstCt
.
getSelectionModel
().
getSelectedIndex
();
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setFirstName
(
firstName
);
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setLastName
(
lastName
);
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setAddr
(
address
);
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setPhone
(
phone
);
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setEmail
(
emails
);
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setSocial
(
social
);
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
setJob
(
job
);
if
(
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
getType
().
equals
(
"Family"
)){
// Family fam = (Family)contactArray.get(LstCt.getSelectionModel().getSelectedIndex());
// fam.editRelation(other);
// int tmp = LstCt.getSelectionModel().getSelectedIndex();
// contactArray.get(tmp) = fam;
contactArray
.
get
(
selected_id
).
setFirstName
(
firstName
);
contactArray
.
get
(
selected_id
).
setLastName
(
lastName
);
contactArray
.
get
(
selected_id
).
setAddr
(
address
);
contactArray
.
get
(
selected_id
).
setPhone
(
phone
);
contactArray
.
get
(
selected_id
).
setEmail
(
emails
);
contactArray
.
get
(
selected_id
).
setSocial
(
social
);
contactArray
.
get
(
selected_id
).
setJob
(
job
);
if
(
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
())
instanceof
Family
){
Family
fam
=
(
Family
)
contactArray
.
get
(
selected_id
);
fam
.
setRelation
(
other
);
contactArray
.
set
(
selected_id
,
fam
);
}
else
if
(
contactArray
.
get
(
LstCt
.
getSelectionModel
().
getSelectedIndex
()).
getType
().
equals
(
"Professional"
)){
Professional
pro
=
(
Professional
)
contactArray
.
get
(
selected_id
);
pro
.
setWork
(
other
);
contactArray
.
set
(
selected_id
,
pro
);
}
ShowAll
();
}
...
...
@@ -366,7 +369,8 @@ public class HelloController {
List
<
String
>
emailList
=
Arrays
.
asList
(
emails
.
split
(
"/"
));
List
<
String
>
socialList
=
Arrays
.
asList
(
social
.
split
(
"/"
));
Professional
pro
=
new
Professional
(
first_name_list
,
lastName
,
address
,
phoneList
,
emailList
,
socialList
,
job
,
wp
);
Professional
pro
=
new
Professional
(
first_name_list
,
lastName
,
address
,
phoneList
,
emailList
,
socialList
,
job
,
wp
);
Add
(
pro
);
}
/**
...
...
@@ -448,11 +452,4 @@ public class HelloController {
public
List
<
String
>
SplitLine
(
String
str
,
String
splitter
){
return
Arrays
.
asList
(
str
.
split
(
splitter
));
}
//TODO
/*
Unit Test,
edit relation/job?
*/
}
\ No newline at end of file
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