com.publicobject.amazonbrowser.TreeCriterion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glazedlists_java15 Show documentation
Show all versions of glazedlists_java15 Show documentation
Event-driven lists for dynamically filtered and sorted tables
/* Glazed Lists (c) 2003-2006 */
/* http://publicobject.com/glazedlists/ publicobject.com,*/
/* O'Dell Engineering Ltd.*/
package com.publicobject.amazonbrowser;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.ObservableElementList;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.GlazedLists;
import javax.swing.event.SwingPropertyChangeSupport;
import java.beans.PropertyChangeListener;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
/**
* This class represents one of the levels of hierarchy that exist in the
* treetable of {@link Item} objects displayed in the AmazonBrowser. Each
* active TreeCriterion contributes to the overall TreeFormat. Available
* TreeCriterion objects include:
*
*
* - title
*
- audience rating
*
- price
*
- release date
*
*
* Note that users are expected to use the list of {@link @ALL_CRITERIA}, and
* are never supposed to create their own TreeCriterion objects.
*
* @author James Lemieux
*/
public abstract class TreeCriterion {
/** The List of all possible TreeCriterion objects. */
public static final EventList ALL_CRITERIA = new ObservableElementList(new BasicEventList(), GlazedLists.beanConnector(TreeCriterion.class));
static {
ALL_CRITERIA.add(new TitleCriterion());
ALL_CRITERIA.add(new AudienceRatingCriterion());
ALL_CRITERIA.add(new PriceCriterion());
ALL_CRITERIA.add(new ReleaseDateCriterion());
}
private final SwingPropertyChangeSupport support = new SwingPropertyChangeSupport(this);
/** A human readable name used to identify this TreeCriterion. */
private final String name;
/** A flag to indicate whether this TreeCriterion is active (and thus participating in the TreeFormat) or not. */
private boolean active;
/**
* A map from the title of each synthetic Item to the actual Item in the
* hierarchy. This acts as a cache to prevent building redundant synthetic
* hierarchy Items.
*/
private final Map