Skip to content

Commit

Permalink
Now sorts tags
Browse files Browse the repository at this point in the history
  • Loading branch information
cyian-1756 committed Aug 31, 2018
1 parent ee7b9e0 commit 258df81
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/komickeeper/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ protected void addTags(Event e) {

@FXML
public void handleSelectedComicChange(Event arg0) {
comicTagsLabel.setText("");
String comicName = comicListView.getSelectionModel().getSelectedItem();
currentlySelectedComics = comicListView.getSelectionModel().getSelectedItems();
comicNameLabel.setText(comicName);
Expand All @@ -190,14 +191,16 @@ public void handleSelectedComicChange(Event arg0) {
comicRatingLabel.setText(comicInfo.get("rating"));
comicWriterLabel.setText(comicInfo.get("writer"));
comicDateIndexedLabel.setText(comicInfo.get("date_indexed"));
// Sort the tags alphabetically
String[] tags = comicInfo.get("tags").split(",");
Arrays.sort(tags);
StringBuilder tagsToShow = new StringBuilder();
for (String tag : tags) {
tagsToShow.append(tag).append(", ");
if (comicInfo.get("tags") != null) {
// Sort the tags alphabetically
String[] tags = comicInfo.get("tags").split(",");
Arrays.sort(tags);
StringBuilder tagsToShow = new StringBuilder();
for (String tag : tags) {
tagsToShow.append(tag).append(", ");
}
comicTagsLabel.setText(tagsToShow.toString());
}
comicTagsLabel.setText(tagsToShow.toString());
// Clear our metadata fields
tagsTextField.clear();
comicSetRatingTextField.clear();
Expand Down

0 comments on commit 258df81

Please sign in to comment.