Skip to content
Snippets Groups Projects
Commit cf561d4e authored by varajala's avatar varajala
Browse files

Changed the update name implementation

parent 4fdf23eb
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment