New features for the SpreadsheetView.

#627 Merged at e47b758
  1. Samir Hadzic

This is a major step for the SpreadsheetView. Basically, I have put everything that I currently use. What is new :

Adding popup on cells

Adding filters

Adding sort

I've created a new HelloSpreadsheetView to demonstrate the use of the features. One of the major difficulty is the different indexes. Now we have the Grid (model) indexes, and the filtered indexes (based on row/column hidden) and the sorted indexes (when the grid is sorted).

These indexes should not impact the user as he should always consider the Grid (model) indexes. The SpreadsheetView will deal with the other indexes internally.

I removed the getSpanType method of the Grid because it's now completely the SpreadsheetView responsibility. The span is very tricky because I can beyond Excel and allow to sort rows that have a row span.

I consider this spreadsheetView stable. I know there is some bugs hanging around but it can be used safely.

I'm opened to any suggestions in order to improve the SpreadsheetView. But I will not be able to go back on some features because I need them in my professional environment.

Comments (8)

  1. petko ivanov

    hi, i have reviewed the functionality for almost 2 days and it shows a LOT of promise. At the current stage, it is still at its infancy though. Here is a list of items that would be a game changer: Column Menu - triggered by right click : sort -> submenu : (asc \ desc \ unsorted ) hide a column fix a column filter - Show available entries with list (not checkboxes, that's why too tedious) but allow <=> expressions for Strings, Doubles, Integers, etc. anything comparable really rename a column (instead of generic A,B,C). This would make this a suitable replacement for any table, not just SpreadSheet presentations. drag and drop columns to re-arrange order

    Also some general good to have ideas : * multi column sort (may be through a hidden composite column?)

    SpreadSheetView Persistency API : * when any of the above changes are done, they should persist when the app is restarted. The API hooks to be able to do that should be baked in, and a sample implementation through java preferences could be provided (thus no external dependencies) but this will enable users to write their own trivially.

    Please reach out to me to discuss in more detail if interested. Thanks

    1. Samir Hadzic author

      Hi Petko,

      Thanks for the time you spent on the SpreadsheetView. I will try to answer most of your suggestions.

      First of all, I modified the SpreadsheetView in order to allow filters and sort. I built a simple example for ControlsFX in order to demonstrate it was possible. We could go further but I'm wondering if it is a good idea. Anyone playing with the SpreadsheetView will have their own data , their own data type, their own behavior. Maybe the way I'm building a filter is not the way another wants it. That's why I simply give the ability to show and hide column/row, and anyone can provide its own implementation.

      For that matter, most of what you said has already been implemented on my side, for the company I work for. I've been able to do that because I know what kind of Spreadsheet I have, what kind of data I have : example1.png

      So really, it's up to anybody to build their own implementation and I will gladly help them if they are stuck somewhere. But we could also improve the sample and go further in order to show what can be done.

      Regarding your suggestions :

      • Column Menu, I've put all my filter and sort option in the Spreadsheet ContextMenu because filters can be added on any cell. Thus I don't think it's wise to put them in the column header contextMenu. But maybe this was not what you were saying? Also note that column header can be hidden.

      • Rename a column : This can be done today through the API. Personally I don't want my user to rename the column. I believe this is the responsibility of the developer to override the column contextMenu or the Spreadsheet contextMenu, and offer this possibility if he wants to. But we could add it by default and offer the option to disable it.

      • Multi column sort : I will repeat myself here. I've already done that by applying a custom Comparator on the SpreadsheetView. We could give the possibility in the SpreadsheetView itself but that needs time that I don't really have. It has taken me 2 full weeks of work to implement all that for my company. I don't have that much spare time for the SpreadsheetView right now. example2.PNG

      • Preferences : I've done it by creating a cache on the user computer and I retain the modification. When the Spreadsheet is brought back, I reapply the state like it was before. But this is a very personal thing. Some will want to retain where the horizontal bars were, some don't. Some will want to retain the last modified cell etc etc. We could implement that, but I think it will be very difficult to tailor it to every one.

      In the end, what I want to say is that everyone can do it through the API I provided. I do not have enough time to push all the modifications I've done on my personal side to the SpreadsheetView. Furthermore, I don't think what I've done on my side is what people want. But we can do baby steps and try to push more thing into the SpreadsheetView. Generally, people ask for small improvement and together we make it work.