Revision as of 13:09, 18 March 2010 by Msandor (Talk | contribs)


Why Query Language

Data sources with help of parsers get your data from the source but the data often comes in large chunks where you are only interested in some subset. Even if you need all data you often want to process it piece by piece. Finally, binding UI controls to data sources becomes much more easier if you can bind to a simple expression rather than binding to a complex parser function.

Design Overview: Filtering

You should know by now that data in Data Sources Framework is organized in a tree-like structure which consists of RecordSets, Records and raw data (String, Integers, etc.). The framework uses a generic notion of filtering (org.netbeans.javafx.datasrc.Filter). In the most general case, a filter processes a RecordSet and creates a new RecordSet that contains only filtered data. This functionality is available directly on a RecordSet and also on a DataSource.

Code Notes
public function filter(f : Filter) : RecordSet available on RecordSet and uses a Filter implementation to filter this RecordSet and produce another one. Results of this call are NOT cached and every call does new filtering and produces a new RecordSet.
public function filter(expr : String) : RecordSet available on RecordSet and uses an expression written in QL to filter one RecordSet and produce another one. In fact, this is a helper function that uses a special Filter.Expr implementation of a Filter.
public bound function getDataSource(expr : String) : DataSource available on DataSource and uses an expression written in QL to filter data in the DS and produce a new DS containing only filtered data. In fact, this is a helper function that in fact calls getRecordSet().filter(expr). Results of this call ARE cached and calling it for the same expression returns the same result without filtering the data source again. Also note that this function is bound which means that you can bind to it and take advantage of autorefresh feature of Data Sources Framework.

Query Language

There is a special implementation of the Filter class called Filter.Expr. It takes an expression string written in QL, evaluates it and eventually produces a filtered RecordSet. QL is itself insipred by XPath and uses its syntax in the simplest form possible to cover most use cases JavaFx users could encounter.


Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo