History log of /external/autotest/frontend/client/src/autotest/common/table/DynamicTableSelectionManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4879914c122f4ed97eae3b08c5af1930fd75b39d 13-Nov-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Fix a bug where hosts in a cloned job weren't removed when deselecting the host from the "browse hosts" table. This again turned out to be a relatively large change for the size of the problem, because I chose to make some refactorings to attack some of the design problems the were behind the issue in the first place.

The core issue was that the ArrayDataSource was using a plain SortedSet<JSONObject> to hold the selected hosts. This is good because we want to keep them sorted, but it's bad because it uses the default object equality for JSONObjects, but we want to use a special equality based on ID or hostname. We normally accomplish that with JSONObjectSet, but that doesn't get us the sorting. JSONObjectSet is sort of a hack in the first place; the proper solution is to use custom objects that override equality.

As a first step towards that approach, I created a Host class under the models autotest.afe.models package. In order to minimize the scope of this change, I made it override JSONObject, so that we can move incrementally. I made it override equality and made HostDataSource convert the results to Host objects before returning them.

Unfortunately, I ran into a second problem. DataSource passes back results in a JSONArray. Since JSONArrays use native JS objects for storage, the objects you get out of them are always real JSONObjects, constructed on the fly -- not just declared type, but actual type. Even if you put Hosts in, they'll effectively be converted back to plain JSONObjects when you take them out. This is a reflection of a second design problem -- we shouldn't use JSONArrays to pass data around within the program. So I changed DataSource to convert results to List<JSONObject> and pass the data back that way. This required minor changes across many files, but nothing drastic anywhere.

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3943 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DynamicTableSelectionManager.java
b9c6617bdc063b3b4aa760a0a45190ee069139fd 13-Nov-2009 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Modify DynamicTableSelectionListener so that when select "none" is clicked, only deselect items matching the current filters. This turned out to be considerably trickier than i thought, because in order to do this properly and efficiently, it has to work like this: when "none" is clicked, make an RPC call for all the currently filtered items that fall within the currently selected set. We do this by making a new request to the table's active DataSource with the current filtering params plus a list of selected item IDs. There are two problems here:

1) Not all tables show DB objects -- in particular, the host detail view table when "show verifies/repairs/cleanups" is selected, and the TKO table view when grouping is active. For these tables, there's no way to filter on selected items by ID. Fortunately, these tables also happen to not be prone to the original issue, because they can't be filtered. So I added some code to only apply this new logic to tables that have active user-controlled filters. This is pretty ugly from a design point of view, but I had to take a practical approach -- it works, the code is clean, and I couldn't think of any workable alternatives.

2) The DataSource interface was poorly designed such that an RpcDataSource was stateful (and mutated every time a new request was made), so there was no way to make a new request on a DataSource without messing up its state and therefore potentially messing up the table using it. To get around this, I redesigned the interface to use a separate Query objects. Now, both the DataSource and the Query objects are immutable, and making a separate query for the "select none" operation is easy. (This actually also encouraged a change to DynamicTable to be much more efficient by avoiding many unnecessary get_num_*() calls.)

Signed-off-by: Steve Howard <showard@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3941 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DynamicTableSelectionManager.java
8579ea343f8d4c74b44d5b5cb2df3ef7552b2f6e 18-Aug-2008 showard <showard@592f7852-d20e-0410-864c-8624ca9c26a4> Snazzy new interface for select tests in Create Job view. Tests are now presented in a scrollable table, with descriptions displayed in a resizable pane on the right.
-new TestSelector widget displays table + description
-move some basic input handling from DynamicTable into DataTable, so that plain DataTables can handle clicks
-make DataTable capable of refreshing the widgets in a table without refreshing the entire table - this is useful for updating selections
-pull out the one bit of SelectionManager that depends on DynamicTable (as opposed to DataTable). This is now in DynamicTableSelectionManager, and the orignal SelectionManager can work with a plain DataTable.
-make SelectionManager capable of acting as the TableWidgetFactory for producing row selection checkboxes
-fix a couple minor bugs in (Site)CreateJobView, where some controls (skip verify, custom tests) would not be disabled when they should be
-pull out ArrayDataSource.JSONObjectComparator into a top-level class, so it could be used elsewhere to sort JSONObjects



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2004 592f7852-d20e-0410-864c-8624ca9c26a4
/external/autotest/frontend/client/src/autotest/common/table/DynamicTableSelectionManager.java