0

I have a treetableview with 4 level hierarchy. I want to have a column with cell factory as combobox. but this combobox should be visible only at the last child level and not the parent level. Is that possible to achieve?

Edit: I tried the following as per suggestions received.

ObservableList ADM = WSData.getADMObjectMapList();
        tbAdmMap.setCellFactory(new Callback<TreeTableColumn<ProjectPlan, String>, TreeTableCell<ProjectPlan, String>>() {

            @Override
            public TreeTableCell<ProjectPlan, String> call(TreeTableColumn<ProjectPlan, String> param) {
                TreeTableCell<ProjectPlan, String> cell = new TreeTableCell<ProjectPlan, String>() {
                    @Override
                    public void updateItem(String item, boolean empty) {
                        super.updateItem(item, empty);
                        System.out.println(getItem());
                        if (getString().equals("")) {
                            setGraphic(null);
                        } else {
                            ComboBox<String> comboBox = new ComboBox(ADM);
                            comboBox.setValue(item);
                            setGraphic(comboBox);
                        }

                    }

                    private String getString() {
                        return getItem() == null ? "" : getItem();
                    }
                };
                return cell;
            }

        });

It is giving me the proper look as I want but not taking the cell into edit mode. As in the onCommitEdit method is not getting called.

Harshita Sethi
  • 2,035
  • 3
  • 24
  • 46
  • Yes, just put the relevant logic into your `updateItem` method. Please include a [MCVE] that shows what you have tried. – James_D Oct 13 '15 at 11:40
  • @James_D Please see the edit. I tried putting logic in `updateItem` as per your suggestion. And Reached this point. – Harshita Sethi Oct 14 '15 at 07:44

0 Answers0