public boolean hasFellow(String compId) { if (this instanceof IdSpace) return _auxinf.spaceInfo.fellows.containsKey(compId); final IdSpace idspace = getSpaceOwner(); return idspace != null && idspace.hasFellow(compId); }
/** Checks the uniqueness in ID space when changing ID. */ private static void checkIdSpaces(final AbstractComponent comp, String newId) { if (comp instanceof NonFellow) return; //no need to check if (comp instanceof IdSpace && comp._auxinf.spaceInfo.fellows.containsKey(newId)) throw new UiException("Not unique in the ID space of " + comp); final IdSpace is = getSpaceOwnerOfParent(comp); if (is instanceof Component) { if (((AbstractComponent) is)._auxinf.spaceInfo.fellows.containsKey(newId)) throw new UiException("Not unique in ID space " + is + ": " + newId); } else if (is != null) { if (is.hasFellow(newId)) throw new UiException("Not unique in ID space " + is + ": " + newId); } }
private static void checkIdSpacesDown(Component comp, IdSpace owner) { final String compId = comp.getId(); if (!(comp instanceof NonFellow) && !isAutoId(compId) && (owner instanceof Component ? ((AbstractComponent) owner)._auxinf.spaceInfo.fellows.containsKey(compId) : owner.hasFellow(compId))) throw new UiException("Not unique in the ID space of " + owner + ": " + compId); if (!(comp instanceof IdSpace)) for (AbstractComponent ac = (AbstractComponent) comp.getFirstChild(); ac != null; ac = ac._next) checkIdSpacesDown(ac, owner); //recursive }
public boolean hasAttributeOrFellow(String name, boolean recurse) { if (hasAttribute(name) || (this instanceof IdSpace && hasFellow(name))) return true; if (recurse) { if (_parent != null) return _parent.hasAttributeOrFellow(name, true); if (_page != null) return _page.hasAttributeOrFellow(name, true); if (this instanceof ShadowElement) { Component shadowHost = ((ShadowElement) this).getShadowHost(); if (shadowHost != null) return shadowHost.hasAttributeOrFellow(name, true); } if (!(this instanceof IdSpace)) return getVirtualIdSpace().hasFellow(name); } return false; }