@Override protected <T> void onConfigChanged(ConfigKey<T> key, Object val) { onChanged(); }
@Override public void setDisplayName(String newName) { name.set(newName); displayNameAutoGenerated = false; onChanged(); }
public boolean removeChild(Location child) { boolean removed; synchronized (children) { removed = children.remove(child); } if (removed) { if (child instanceof Closeable) { Streams.closeQuietly((Closeable)child); } child.setParent(null); if (isManaged() && Locations.isManaged(child)) { // This is called as part of child's LocalLocationManager.unmanage; don't try to // unmanage it yet again as then would get a log.warn! getManagementContext().getLocationManager().unmanage(child); } } onChanged(); return removed; }
public void setParent(Location newParent, boolean updateChildListParents) { if (newParent == this) { throw new IllegalArgumentException("Location cannot be its own parent: "+this); } if (newParent == parent.get()) { return; // no-op; already have desired parent } if (parent.get() != null) { Location oldParent = parent.get(); parent.set(null); if (updateChildListParents) ((AbstractLocation)oldParent).removeChild(this); } // TODO Should we support a location changing parent? The resulting unmanage/manage might cause problems. // The code above suggests we do, but maybe we should warn or throw error, or at least test it! parent.set(newParent); if (newParent != null) { if (updateChildListParents) ((AbstractLocation)newParent).addChild(this); } onChanged(); }
child.setParent(this); onChanged();