Skip to content

An attempt to make a TableCell for the ever-so-handy CheckComboBox

Notifications You must be signed in to change notification settings

TurekBot/CheckComboBoxTableCellDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CheckComboBoxTableCellDemo

I'm trying to make a TableCell for the ever-so-handy CheckComboBox.

I've taken and adapted the original ComboBoxTableCell and CellUtils implementations.

Can you help me figure out what I'm doing wrong?

What I've done

  • Changed all ComboBox to CheckComboBox
  • Commented out some things that deal with selection; CheckComboBox doesn't use a SelectionModel it uses a CheckModel.
  • Commented out some things that deal with editability; 'ppurrently CheckComboBox doesn't believe in such things, either.
  • Only committing the change once the user closes the combo box instead of after the first selection.
  • Used column.addEventHandler(TableColumn.editCommitEvent(), event -> {/*Do stuff here*/}); instead of .setOnEditCommit to preserve the default property write back (see TableView Documentation)
  • Transferring checks from one TableCell to another in the updateItem method

Yet, it still doesn't work quite right.

  • When ever the rows move around, they lose their value (I know this has to do with the updateItem method, but I can't figure out which part of it isn't working as intended)
    • Problem: I was using the column.setOnEditCommit() and as the documentation states in the Editing section, java then assumes you'll put yourself in charge of writing the committed value back to the property.
    • Solution: To observe commit events, without affecting their being written back to the underlying property, I instead use, column.addEventHandler(TableColumn.editCommitEvent(), event -> {/*Do stuff here*/});
  • I can't pass in a StringConverter that works; so for now I'm doing this conversion a different way. I would, however, like to do it with a converter.
  • In my POJO, to represent the checked items in the CheckComboBox, I wanted to be able to use a ListProperty<String>, but the original implementation of ComboBoxTableCell seems to favor a StringProperty.
  • When you click from the CheckComboBox to the same cell you get this exception (which looks a lot like this one). It renders the cell useless. Here's an animation of how to replicate it.

MCVE

I really do want to figure this out, so I went through the trouble of making a Minimal Complete Verifiable Example.

It will save you a lot of work and guessing—it will help you help me, so please download and run it.


About

An attempt to make a TableCell for the ever-so-handy CheckComboBox

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages