Javafx tableview with data from multiple classes

后端 未结 2 1439
迷失自我
迷失自我 2020-12-20 06:45

I have no problem filling my tableview with diffrent data from 1 class. But it does not work for me with multiple classes. Any idea how to solve that? I have checked out sim

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 07:06

    In my opition you only have one nice solution for this.

    You need a extra Class that holds your TaskControl, ContextControl and ProjectControl.

    Your Code can look something like that.

    class Wrapper{
     private TaskControl taskControl;
     private ContextControl contextControl;
     private ProjectControl projectControl;
     ...
     public Boolean isDone(){
       return taskControl != null ? taskControl.isDone() : null;
      }
    }
    
    
    @FXML
    private TableView tblView;
    
    @FXML
    private TableColumn colErledigt;
    
    colErledigt.setCellValueFactory(
                new PropertyValueFactory("isDone"));
    

提交回复
热议问题