Sorts the objects on the placeholder with the name placeholderName in the order of the result of the sortedByFormula. The formula has the same form as the List.sortedBy(sortedByFormula) formula in the formula language.
sortPlaceholderObjects(String placeholderName, String sortedByFormula) | |||
---|---|---|---|
Argument | String | placeholderName | The name of the placeholder of the component. |
String | sortedByFormula | A valid formula, which returns a sortedBy formula expression | |
Return value | |||
Exception | Throws a PlaceholderNotExistingException, if no placeholder with the specified name exists. Throws an EvaluationException, if an invalid formula is specified. |
import org.foederal.util.ui.messages.UserMessageCollector;
import com.mind8.mechatronic.skill.api.PlaceholderNotExistingException;
import com.mind8.expressionparser.EvaluationException;
placeholderName = "Einfügeplatz";
listBefore = component.getPlaceholderObjects(placeholderName);
try
{
component.sortPlaceholderObjects(placeholderName," x | x.name");
}
catch (EvaluationException ex)
{
UserMessageCollector.addError(LIBRARY,self,null,"Skript",
"Fehler im Skript:Objekte auf dem Einfügeplatz konnten aufgrund eines Formelfehlers nicht sortiert werden: " + ex);
return;
}
catch (PlaceholderNotExistingException ex)
{
UserMessageCollector.addError(LIBRARY,self,null,"Skript",
"Fehler im Skript: Ein Einfügeplatz namens 'Einfügeplatz' existiert nicht!");
return;
}
listAfter = component.getPlaceholderObjects(placeholderName);
Result
listBefore = [<<St03Ausschleusen>>],<<St02Umsetzen>>,<<St01Einsetzen>>
listAfter = [<<St01Einsetzen>>,<<St02Umsetzen>>,<<St03Ausschleusen>>]