/** * Assigns a {@link org.jdesktop.swingx.decorator.ComponentAdapter} to this * pipeline if no adapter has previously been assigned to the pipeline. Once an * adapter has been assigned to this pipeline, any attempt to change that will * cause an exception to be thrown. * * @param adapter the <code>ComponentAdapter</code> to assign * @throws IllegalArgumentException if adapter is null * @throws IllegalStateException if an adapter is already assigned to this * pipeline and the new adapter is not the same the existing adapter */ public final void assign(ComponentAdapter adapter) { if (adapter == null) { throw new IllegalArgumentException("null adapter"); } // also assign individual filters when adapter is bound if (this.adapter == null) { this.adapter = adapter; for (int i = 0; i < filters.length; i++) { filters[i].assign(adapter); } if (sorter != null) { sorter.assign(adapter); } flush(); } else if (this.adapter != adapter){ throw new IllegalStateException("Can't bind to a different adapter"); } }
/** * setModel() and setFilters() may be called in either order. * * @param pipeline */ private void use(FilterPipeline pipeline) { if (pipeline != null) { // check JW: adding listener multiple times (after setModel)? if (initialUse(pipeline)) { pipeline.addPipelineListener(getFilterPipelineListener()); pipeline.assign(getComponentAdapter()); } else { pipeline.flush(); } } }
/** * setModel() and setFilters() may be called in either order. * * @param pipeline */ private void use(FilterPipeline pipeline) { if (pipeline != null) { // check JW: adding listener multiple times (after setModel)? if (initialUse(pipeline)) { pipeline.addPipelineListener(getFilterPipelineListener()); pipeline.assign(getComponentAdapter()); } else { pipeline.flush(); } } }
private void updateInternals(ListDataEvent e) { boolean wasEnabled = getSelectionMapper().isEnabled(); getSelectionMapper().setEnabled(false); try { updateModelSelection(e); } finally { getSelectionMapper().setEnabled(wasEnabled); } ignoreFilterContentChanged = true; getFilters().flush(); ignoreFilterContentChanged = false; }
public void setModel(ListModel model) { ListModel old = this.getModel(); if (old != null) { old.removeListDataListener(listDataListener); } this.delegate = model; delegate.addListDataListener(getListDataListener()); // sequence of method calls? // fire contentsChanged after internal cleanup? fireContentsChanged(this, -1, -1); // fix #477-swingx getSelectionMapper().clearModelSelection(); getFilters().flush(); }
public void intervalAdded(ListDataEvent e) { boolean wasEnabled = getSelectionMapper().isEnabled(); getSelectionMapper().setEnabled(false); try { updateModelSelection(e); ignoreFilterContentChanged = true; getFilters().flush(); ignoreFilterContentChanged = false; // do the mapping after the flush and refire refireMappedEvent(getMappedEvent(e)); } finally { // for mutations, super and UI must be done with updating their internals // before it's safe to synch the view selection getSelectionMapper().setEnabled(wasEnabled); } }
public void intervalRemoved(ListDataEvent e) { boolean wasEnabled = getSelectionMapper().isEnabled(); getSelectionMapper().setEnabled(false); try { updateModelSelection(e); // do the mapping before flushing // otherwise we may get indexOOBs ListDataEvent mappedEvent = getMappedEvent(e); ignoreFilterContentChanged = true; getFilters().flush(); ignoreFilterContentChanged = false; refireMappedEvent(mappedEvent); } finally { // for mutations, super and UI must be done with updating their internals // before it's safe to synch the view selection getSelectionMapper().setEnabled(wasEnabled); } }