Add a 'Preview data' menu to data source actors
Add a 'Preview data' menu to data source actors to show the content of data table(s)
a) Only shows the top 20 or so records of the table (easier)
b) maybe only shows user-selected columns (more difficult from UI perspective)
#1 Updated by ben leinfelder over 14 years ago
Did an initial pass at this for EML200DataSource actor. Uses a JTable (with simple sorting). Have not tried it with big datasets - might encounter some problem there - all in memory.
Preview is accessed from right-click context menu on actor. The org.kepler.actor.preview.Previewable interface should be implemented by any actor that wishes to expose a "Preview" of some sort. public void preview() method is the only requirement for implementing the interface (thus far).
If there is an attempt to preview a non-Previewable actor, a warning message is displayed indicating that previews are not yet supported for that type of actor.
#2 Updated by ben leinfelder over 14 years ago
Ported the PersistentTableModel from Morpho to make use of the [already] ported version of PersistentVector. This supports big big big datatables by using the disk with some records in memory.
Note: this table model uses strings for all attributes. Since this is a "Preview" that may not be the biggest deal, but it does mean numbers may not be sorted as desired (i.e. 100 < 2 when you use string comparison)
#3 Updated by ben leinfelder over 14 years ago
Added a recast() method to the PersistentTableModel implementation. This allows us to make an initial pass over the columns to divine the type correctly (which in turn allows the cells to be rendered with right-justified numbers, and left-justified strings and also to be sorted appropriately).
Note: Since there is an initial pass over every cell in the table to divine the type of the column, there could be some overhead when dealing with large datasets.
Note 2: "Missing values" are not really supported in that if a column of numbers includes something like "-" or "N/A" for a missing value then the entire column will be treated as a string (for display and sorting).