* Ensures that the instance we are reparenting is compatible with the destination
* type.
*/
private boolean validateReparentType(Model targetModel, Model destination, String parentProperty, ReparentInfo reparentNode)
{
Type childType = targetModel.getType();
Type parentType = destination != null ? destination.getType() : document.getRoot().getType();
if (standardDefs.isContainer(parentType) && standardDefs.isIUIComponent(childType) && parentProperty == null)
{
return true;
}
else if (parentProperty != null || parentType.getDefaultProperty() != null)
{
Property property = (parentProperty != null) ? parentType.getProperty(parentProperty) : parentType.getDefaultProperty();
Style style = (parentProperty != null) ? parentType.getStyle(parentProperty) : null;
if (standardDefs.isItemsComponent(parentType) && (property.getName() == parentType.getDefaultProperty().getName()))
{
return true;
}
if ((property != null) &&
((property.getType() == document.getTypeTable().arrayType) ||
(property.getType().getElementType() != null)))
{
Type propertyElementType = property.getElementType();
if ((propertyElementType == null) || childType.isAssignableTo(propertyElementType))
return true;
}
else if (property != null && isStatefulCompatibleType(property.getType()))