TableView.SortHandler?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

TableView.SortHandler?

Scott Baxter
There is a snippet of code in the tutorial for the Stock Tracker
application that appears to deal with default sort handling for
TableView objects:

http://pivot.apache.org/tutorials/stock-tracker.ui.html

The relevant portion is:

"The following markup is used to declare the table view header
component for the Stock Tracker demo:

<TableViewHeader tableView="$stocksTableView">
    <tableViewHeaderPressListeners>
        <TableView.SortHandler/>
    </tableViewHeaderPressListeners>
</TableViewHeader>"

However, there doesn't appear to be an inner class called SortHandler
inside of TableView.  When I try to implement it in my WTKX file I get
a class not found exception.  Is this something that existed in an
earlier version of Pivot but is no longer supported, or am I doing
something wrong?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TableView.SortHandler?

Todd Volkert
It would seem that the stock tracker tutorial page is out of date.  Sorry for the confusion.  If you're running off the trunk, the latest code can be found at:

http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/

And if you're using Pivot 1.4, it's at:

http://svn.apache.org/repos/asf/pivot/tags/v1.4/tutorials/src/org/apache/pivot/tutorials/stocktracker/

-T

On Tue, Feb 23, 2010 at 9:25 PM, Scott Baxter <[hidden email]> wrote:
There is a snippet of code in the tutorial for the Stock Tracker
application that appears to deal with default sort handling for
TableView objects:

http://pivot.apache.org/tutorials/stock-tracker.ui.html

The relevant portion is:

"The following markup is used to declare the table view header
component for the Stock Tracker demo:

<TableViewHeader tableView="$stocksTableView">
    <tableViewHeaderPressListeners>
        <TableView.SortHandler/>
    </tableViewHeaderPressListeners>
</TableViewHeader>"

However, there doesn't appear to be an inner class called SortHandler
inside of TableView.  When I try to implement it in my WTKX file I get
a class not found exception.  Is this something that existed in an
earlier version of Pivot but is no longer supported, or am I doing
something wrong?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TableView.SortHandler?

Greg Brown
Administrator
Sorry, I must have missed that part of the tutorial. Sorting is now handled in response to a sortChanged() event fired by the TableView itself:

    stocksTableView.getTableViewSortListeners().add(new TableViewSortListener.Adapter() {
        @Override
        @SuppressWarnings("unchecked")
        public void sortChanged(TableView tableView) {
            List<Object> tableData = (List<Object>)tableView.getTableData();
            tableData.setComparator(new TableViewRowComparator(tableView));
        }
    });

I have updated the tutorial to reflect the current API. The update will be published to the site when we release Pivot 1.4.1.


On Feb 24, 2010, at 6:25 AM, Todd Volkert wrote:

It would seem that the stock tracker tutorial page is out of date.  Sorry for the confusion.  If you're running off the trunk, the latest code can be found at:

http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/

And if you're using Pivot 1.4, it's at:

http://svn.apache.org/repos/asf/pivot/tags/v1.4/tutorials/src/org/apache/pivot/tutorials/stocktracker/

-T

On Tue, Feb 23, 2010 at 9:25 PM, Scott Baxter <[hidden email]> wrote:
There is a snippet of code in the tutorial for the Stock Tracker
application that appears to deal with default sort handling for
TableView objects:

http://pivot.apache.org/tutorials/stock-tracker.ui.html

The relevant portion is:

"The following markup is used to declare the table view header
component for the Stock Tracker demo:

<TableViewHeader tableView="$stocksTableView">
    <tableViewHeaderPressListeners>
        <TableView.SortHandler/>
    </tableViewHeaderPressListeners>
</TableViewHeader>"

However, there doesn't appear to be an inner class called SortHandler
inside of TableView.  When I try to implement it in my WTKX file I get
a class not found exception.  Is this something that existed in an
earlier version of Pivot but is no longer supported, or am I doing
something wrong?


Loading...