Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FXExamples
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
varajala
FXExamples
Commits
cf561d4e
Commit
cf561d4e
authored
3 years ago
by
varajala
Browse files
Options
Downloads
Patches
Plain Diff
Changed the update name implementation
parent
4fdf23eb
Branches
listchooser-update
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FXGui/src/fi/jyu/mit/fxgui/ListChooser.java
+15
-6
15 additions, 6 deletions
FXGui/src/fi/jyu/mit/fxgui/ListChooser.java
with
15 additions
and
6 deletions
FXGui/src/fi/jyu/mit/fxgui/ListChooser.java
+
15
−
6
View file @
cf561d4e
...
...
@@ -194,16 +194,25 @@ public class ListChooser<T> extends ListView<StringAndObject<T>> implements Choo
}
/**
* Updates the text in the indexed field to the provided name.
* @param index Index of the updated field
* @param newName the new name to be set
*/
public
void
updateItemName
(
int
index
,
String
newName
)
{
StringAndObject
<
T
>
item
=
getItems
().
get
(
index
);
item
.
setName
(
newName
);
setSelectedIndex
(-
1
);
setSelectedIndex
(
index
);
}
/**
* Updates the text in the selected field to the provided name.
* @param newName the new name to be set
*/
public
void
updateSelectedName
(
String
newName
)
{
StringAndObject
<
T
>
item
=
getSelectionModel
().
getSelectedItem
();
if
(
item
!=
null
)
{
item
.
setName
(
newName
);
int
index
=
this
.
setSelectedIndex
(-
1
);
this
.
setSelectedIndex
(
index
);
}
int
index
=
getSelectedIndex
();
if
(
index
==
-
1
)
return
;
updateItemName
(
index
,
newName
);
}
...
...
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