I have a table-view which gets populated every time nicely,
My main controller:
@Override
public void initialize(URL location, ResourceBundle resources) {
TableColumn tblc = new TableColumn("Test");
tblc.setCellValueFactory(new PropertyValueFactory<Test, Integer>("TestData"));
tbl1.getColumns().setAll(tblc);
tbl1.setItems(aHandler.getInstance().getData());
...
My Test Class:
public class Test extends Thread {
public Integer TestData=1;
....
Test1 class which extends Test class and overwrite its run:
public class Test1 extends Test {
@Override
public void run() {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask(){
public void run() {
setTestData(getTestData()+1);
System.out.println(getTestData());
}
}, new Date(), 1000);
...
My aHandler:
public class aHandler {
private ObservableList<Test> TestObservableList = FXCollections.<Test>observableArrayList();
public ObservableList<Test> getData() {
return TestObservableList;
}
Since the tbl1 is binded to aHandler.getInstance().GetData(), the first time I initialize the class, I see column Test populated with value 1, as TestData=1; but when the timer start to change TestData, the table view does not get the new assigned value. What I am doing wrong?
I tried the best I can to explain the problem, please let me know if its still unclear, I will explain more.
EDIT: to better explain, I want to update TableView automatically everytime when the TestData value changes.. That's my end goal.