0

I am trying to create an editor in javafx for data modelled as a boolean double entry table : basically I have a table with named rows, named columns and a checkbox in each cell. In terms of features I would need to be able to:

  • check/uncheck a cell
  • rename/add/remove a column/row
  • load big tables (> 1000 rows and columns)
  • select rows and colums to extract a sub-table

I have tried to use the TableView class, but it's focused on columns, and I don't see any way to add row names in the same way as column names. There is still the solution to add a first column with row names, but it is not ideal. So as far as I have looked, I found 2 other solutions:

  • drawing my table on a Canvas. As I understand it would allow me to do anything I want, but I would need to implement everything and I am not sure how to deal with really big canvas (how to not dràw the entire table)
  • draw my table in html and use a webview to display it. As I understand that would help with the drawing, but would require html, javascript and the communication with rest of the app does not appear to be easy. I have not much experience with JavaFX at the moment and I am not sure which would be the most practical or if another solution would be better. What do you think would be the best?
Xavier D.
  • 1
  • 2
  • Search among these [examples](https://stackoverflow.com/questions/tagged/javafx) for ways to study each aspect in isolation; this [example](https://stackoverflow.com/q/76487091/230513) of profiling might help you examine the size issue. – trashgod Jun 28 '23 at 18:21
  • 3
    Maybe you don't want a `TableView` at all, perhaps you want a spreadsheet, either by a ControlsFX [SpreadsheetView](https://controlsfx.github.io/javadoc/11.1.0/org.controlsfx.controls/org/controlsfx/control/spreadsheet/SpreadsheetView.html) or a WebView embedded Google Docs (if that works in JavaFX), or some other technology. – jewelsea Jun 28 '23 at 19:15
  • @jewelsea thanks for the suggestion, I need to study this. I had in mind to limit dependencies and try to stay javafx only but if it really has all the needed features then the additional dependency is worth it. I need to experiment for a while before validating this solution. – Xavier D. Jun 28 '23 at 22:06
  • 4
    One "solution" you mention is using Canvas. I do not recommend that at all. There is no off-the-shelf component using Canvas that does what you want (or anything remotely close to it), so you would have to build such a solution from scratch, which would be a tremendous amount of work. Plus, if using JavaFX, the scene graph is probably better suited for this component than a Canvas anyway. – jewelsea Jun 28 '23 at 22:10

1 Answers1

0

From the ideas given in the comments and further research, I would say that :

  • Tableview is definitely not adapted, if I want a simple similar solution on the view part, ControlsFX SpreadsheetView would do a better job with row and column headers that can be customized
  • Drawing on canvas is too much work, I may consider it if I encounter memory problems
  • I have not seen much examples using a webview in javafx, unless someone can tell me otherwise, this solution is considered as not adapted (maybe not possible)
  • the remaining solution, and the one that I will chose for now, will be to create my table in a scene using some kind of grid layout and the most appropriated components for headers and cells
Xavier D.
  • 1
  • 2