/** Remove the items corresponding to the specified source from our cache. */ protected void removeComponentSource(Object source) { CollectionValueModel component = (CollectionValueModel) this.components.remove(source); if (component == null) { throw new IllegalStateException("missing component: " + source); } component.removeCollectionChangeListener(ValueModel.VALUE, this.componentListener); ArrayList componentCollection = (ArrayList) this.collections.remove(component); if (componentCollection == null) { throw new IllegalStateException("missing collection: " + source); } this.clearComponentItems(componentCollection); }
/** Transform the specified source to a collection value model and add its items to our cache. */ protected void addComponentSource(Object source) { CollectionValueModel component = this.transform(source); if (this.components.put(source, component) != null) { throw new IllegalStateException("duplicate component: " + source); } component.addCollectionChangeListener(ValueModel.VALUE, this.componentListener); ArrayList componentCollection = new ArrayList(component.size()); if (this.collections.put(component, componentCollection) != null) { throw new IllegalStateException("duplicate collection: " + source); } this.addComponentItems(component, componentCollection); }
/** Update our cache. */ protected void addComponentItems( CollectionValueModel itemsHolder, ArrayList componentCollection) { this.addComponentItems( (Iterator) itemsHolder.getValue(), itemsHolder.size(), componentCollection); }