Reorganizes objects on the placeholder placeholder in a way that count objects on index srcIndex are moved to dstIndex.
reorderPlaceholderObjects(String placeholderName, int srcIndex,int count, int dstIndex) | |||
---|---|---|---|
Argument | String | placeholderName | The name of the placeholder of the component. |
Integer | srcIndex | A valid source index within the placeholder objects. | |
Integer | count | The number of objects to be moved | |
Integer | dstIndex | A valid destination index within the placeholder objects. | |
Return value | |||
Exceptions | Throws a PlaceholderNotExistingException, if no placeholder with the specified name exists. Throws an IndexOutOfBoundsException if the specified indexes are out of bounds: -1 < srcIndex < getPlaceholderObjects(placeholder).size() and dstIndex + count < getPlaceholderObjects(placeholder).size() |
import org.foederal.util.ui.messages.UserMessageCollector;
import com.mind8.mechatronic.skill.api.PlaceholderNotExistingException;
listBefore = component.getPlaceholderObjects("Einfügeplatz");
try
{
component.reorderPlaceholderObjects("Einfügeplatz",0,1,2);
}
catch ( IndexOutOfBoundsException ex)
{
UserMessageCollector.addError(LIBRARY,self,null,"Skript","Fehler im Skript: Objekt konnte nicht auf Index 2 verschoben werden");
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("Einfügeplatz");
Result
listBefore = [<<St01Einsetzen>>,<<St02Umsetzen>>,<<St03Ausschleusen>>]
listAfter = [<<St02Umsetzen>>,<<St03Ausschleusen>>,<<St01Einsetzen>>]