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("SchematicPages");
logText1 = "Script error: Unable to replace object to index 1.";
logText2 = "Script error: A placeholder named 'SchematicPages' does not exist!";
try
{
component.reorderPlaceholderObjects("SchematicPages",0,1);
}
catch ( IndexOutOfBoundsException ex)
{
UserMessageCollector.addError(LIBRARY, self, null, "Script", logText1);
return;
}
catch (PlaceholderNotExistingException ex)
{
UserMessageCollector.addError(LIBRARY, self, null, "Script", logText2);
return;
}
listAfter = component.getPlaceholderObjects("SchematicPages");
Result
listBefore = [<<M_SchematicPage>>,<<M_SchematicPage2>>]
listAfter = [<<M_SchematicPage2>>,<<M_SchematicPage>>]