Created
October 9, 2013 22:51
-
-
Save incepttechnologies/6909893 to your computer and use it in GitHub Desktop.
TableView -initialize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void initialize(URL url, ResourceBundle rb) { | |
System.out.println("initialize"); | |
sort(); | |
initializeTable(); | |
pageCount = getPageCount(persons.size(), itemsPerPage); | |
System.out.println("pageCount=" + pageCount); | |
pagination.setPageCount(pageCount); | |
pagination.currentPageIndexProperty().addListener(new ChangeListener<Number>() { | |
@Override | |
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { | |
System.out.println("Pagination Changed from " + oldValue + " , to " + newValue); | |
currentPageIndex = newValue.intValue(); | |
updatePersonView(); | |
} | |
}); | |
save.setOnAction(new javafx.event.EventHandler<javafx.event.ActionEvent>() { | |
@Override | |
public void handle(javafx.event.ActionEvent t) { | |
persons.add(new Person(idTxt.getText(), nameTxt.getText(), (new Integer(ageTxt.getText())).intValue())); | |
sort(); | |
updatePersonView(); | |
idTxt.setText(null); | |
nameTxt.setText(null); | |
ageTxt.setText(null); | |
} | |
}); | |
id.setOnAction(new javafx.event.EventHandler<javafx.event.ActionEvent>() { | |
@Override | |
public void handle(javafx.event.ActionEvent t) { | |
sort(); | |
if (order) { | |
Collections.reverse(persons); | |
} | |
System.out.println(" order = " + order + "; data = " + persons); | |
order = !order; | |
id.setGraphic((order) ? upImg : downImg); | |
updatePersonView(); | |
System.out.println(" comparator called"); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment