Commit f529796c authored by George Adrian Stoica's avatar George Adrian Stoica

MetaDataEditorController fixes related to MR !6

* fixed removal of items by using the iterator method
* removed couple of unnecessary if (iterator.hasnext ...) that were
surrounding a while (iterator.hasnext ...)
parent fae2182e
Pipeline #53192 passed with stage
in 2 minutes and 13 seconds
......@@ -138,16 +138,14 @@ public class MetaDataEditorController {
ObservableList<Pair<String, String>> props = propertiesTableView.getItems();
final Iterator<String> propertyNames = latlong.getMetaData().propertyNames();
if (propertyNames.hasNext()) {
while(propertyNames.hasNext()) {
final String propName = propertyNames.next();
if((propName==MetaData.NAME_PROPERTY)||(propName==MetaData.DESCRIPTION_PROPERTY)) {
continue;
} else {
latlong.getMetaData().removeProperty(propName);
}
}
}
while(propertyNames.hasNext()) {
final String propName = propertyNames.next();
if((propName==MetaData.NAME_PROPERTY)||(propName==MetaData.DESCRIPTION_PROPERTY)) {
continue;
} else {
propertyNames.remove();
}
}
for (Pair<String, String> pair : props) {
latlong.getMetaData().setProperty(pair.getKey(), pair.getValue());
}
......@@ -190,6 +188,7 @@ public class MetaDataEditorController {
private void updatePropertiesTable() {
MetaData metaData = latlong.getMetaData();
propertiesTableView.getItems().clear();
final Iterator<String> propertyNames = metaData.propertyNames();
Collection<Pair<String, String>> locationProperties = new ArrayList<Pair<String,String>>();
if( propertyNames.hasNext()) {
......@@ -203,7 +202,6 @@ public class MetaDataEditorController {
locationProperties.add(p);
}
}
propertiesTableView.getItems().clear();
propertiesTableView.getItems().addAll(locationProperties);
}
}
......@@ -212,11 +210,9 @@ public class MetaDataEditorController {
tagsBar.clearAllTags();
MetaData metaData = latlong.getMetaData();
final Iterator<String> tags = metaData.tags();
if(tags.hasNext()) {
while(tags.hasNext()) {
final String tag = tags.next();
tagsBar.addTag(tag);
}
while(tags.hasNext()) {
final String tag = tags.next();
tagsBar.addTag(tag);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment