{
if (delegateTarget == null)
this.delegateTarget = parentComponent;
- else if (parentComponent.submodel.getComponentsByName().get(delegateTarget.getName()) != delegateTarget)
+ else if (delegateTarget != parentComponent
+ && parentComponent.submodel.getComponentsByName().get(delegateTarget.getName()) != delegateTarget)
throw new IllegalArgumentException(
- "Can only set components belonging to the submodel of the parent component of this handler as the delegate target");
+ "Can only set components belonging to the submodel of the parent component of this handler or the parent component itself as the delegate target");
this.delegateTarget = delegateTarget;
}