KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > data > query > DynamicQueryBinding


1 package prefuse.data.query;
2
3 import javax.swing.JComponent JavaDoc;
4
5 import prefuse.data.expression.Predicate;
6 import prefuse.data.tuple.TupleSet;
7
8 /**
9  * <p>Abstract base class for dynamic query bindings, which support
10  * data queries that can be dynamically edited with direct manipulation
11  * user interface components. DynamicQueryBinding instances
12  * take a particular field of a table, create a
13  * {@link prefuse.data.expression.Predicate} instance for filtering Tuples
14  * based on the values of that data field, and bind that Predicate to any
15  * number of user interface components that can be used to manipulate the
16  * parameters of the predicate.</p>
17  *
18  * <p>Examples include dynamically filtering over a particular range of
19  * values ({@link RangeQueryBinding}), isolating specific categories of
20  * data ({@link ListQueryBinding}), and performing text search over
21  * data ({@link SearchQueryBinding}).</p>
22  *
23  * @author <a HREF="http://jheer.org">jeffrey heer</a>
24  */

25 public abstract class DynamicQueryBinding {
26     
27     /** The actual query over Table data. */
28     protected Predicate m_query;
29     /** The TupleSet processed by the query. */
30     protected TupleSet m_tuples;
31     /** The data field processed by the query. */
32     protected String JavaDoc m_field;
33     
34     /**
35      * Create a new DynamicQueryBinding. Called by subclasses.
36      * @param tupleSet the TupleSet to query
37      * @param field the data field (Table column) to query
38      */

39     protected DynamicQueryBinding(TupleSet tupleSet, String JavaDoc field) {
40         m_tuples = tupleSet;
41         m_field = field;
42     }
43     
44     // ------------------------------------------------------------------------
45

46     /**
47      * Returns the query predicate bound to this dynamic query. The predicate's
48      * behavior can vary dynamically based on interaction with user interface
49      * components created by this binding. To automatically monitor changes to
50      * this predicate, clients should register an
51      * {@link prefuse.data.event.ExpressionListener} with the
52      * {@link prefuse.data.expression.Predicate} returned by this method.
53      * @return the dynamic query {@link prefuse.data.expression.Predicate}
54      */

55     public Predicate getPredicate() {
56         return m_query;
57     }
58     
59     /**
60      * Sets the dynamic query predicate. For class-internal use only.
61      * @param p the predicate to set
62      */

63     protected void setPredicate(Predicate p) {
64         m_query = p;
65     }
66     
67     /**
68      * Generates a new user interface component for dynamically adjusting
69      * the query values. The type of the component depends on the subclass
70      * of DynamicQueryBinding being used. Some subclasses can generate
71      * multiple types of user interface components. Such classes will include
72      * additional methods for generating the specific kinds of components
73      * supported.
74      * @return a user interface component for adjusting the query.
75      */

76     public abstract JComponent JavaDoc createComponent();
77     
78 } // end of class DynamicQueryBinding
79
Popular Tags