Skip to content

Commit

Permalink
Sort the Verbs in the ContainerVerbsPanel according to their Names (#…
Browse files Browse the repository at this point in the history
…2065)

- sort verbs in the ContainerVerbsPanel according to their names
  • Loading branch information
madoar authored Aug 26, 2019
1 parent fa714e0 commit 489f2f0
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.ObservableList;
import javafx.collections.transformation.SortedList;
import org.phoenicis.containers.dto.ContainerDTO;
import org.phoenicis.engines.VerbsManager;
import org.phoenicis.javafx.components.common.control.ControlBase;
Expand All @@ -13,6 +14,8 @@
import org.phoenicis.repository.dto.ApplicationDTO;
import org.phoenicis.repository.dto.ScriptDTO;

import java.util.Comparator;

/**
* A component used to install verbs in an existing container
*/
Expand All @@ -33,9 +36,9 @@ public class ContainerVerbsPanel extends ControlBase<ContainerVerbsPanel, Contai
private final ObjectProperty<ApplicationDTO> verbs;

/**
* A list of all verbs
* A list of all verbs sorted according to their names
*/
private final ObservableList<ScriptDTO> verbScripts;
private final SortedList<ScriptDTO> verbScripts;

/**
* A boolean signifying whether all verb buttons should be locked
Expand All @@ -53,7 +56,9 @@ public ContainerVerbsPanel() {
this.verbs = new SimpleObjectProperty<>();
this.lockVerbs = new SimpleBooleanProperty();

this.verbScripts = CollectionBindings.mapToList(verbsProperty(), ApplicationDTO::getScripts);
this.verbScripts = CollectionBindings
.mapToList(verbsProperty(), ApplicationDTO::getScripts)
.sorted(Comparator.comparing(ScriptDTO::getScriptName));
}

/**
Expand Down

0 comments on commit 489f2f0

Please sign in to comment.