Sorts the objects on the placeholder placeholder 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(Placeholder placeholder, String sortedByFormula) | |||
---|---|---|---|
Argument | Placeholder | placeholder | A placeholder of the component. |
String | sortedByFormula | A valid formula, which returns a sortedBy formula expression | |
Return value | |||
Exception | Throws an EvaluationException, if an invalid formula is specified. |
Beispiel in Groovy:
import org.foederal.util.ui.messages.UserMessageCollector;
import com.mind8.expressionparser.EvaluationException;
placeholder = component.getPlaceholders("T_Interfaces.ISchematicPage").get(0);
listBefore = component.getPlaceholderObjects(placeholder);
logText1 = "Script error: Cannot sort objects of the given placeholder due to a formula error: ";
try
{
component.sortPlaceholderObjects(placeholder, " x | x.name");
}
catch (EvaluationException ex)
{
UserMessageCollector.addError(LIBRARY, self, null, "Script", logText1 + ex);
return;
}
listAfter = component.getPlaceholderObjects(placeholder);
Result
listBefore = [<<M_SchematicPage>>,<<M_SchematicPage2>>]
listAfter = [<<M_SchematicPage2>>,<<M_SchematicPage>>]