List of usage examples for javafx.scene.control.cell PropertyValueFactory PropertyValueFactory
public PropertyValueFactory(@NamedArg("property") String property)
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(450);//from w w w. j a v a 2 s. c o m stage.setHeight(550); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); firstNameCol.setSortType(TableColumn.SortType.DESCENDING); lastNameCol.setSortable(false); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(450);/*w ww . j a va 2s . co m*/ stage.setHeight(550); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); final Button addButton = new Button("Add"); addButton.setOnAction((ActionEvent e) -> { data.add(new Person("Z", "X")); }); hb.getChildren().addAll(addButton); hb.setSpacing(3); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table, hb); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(450);//from w w w. ja va 2s .c o m stage.setHeight(550); table.setEditable(true); TableColumn<Person, String> firstNameCol = new TableColumn<>("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); firstNameCol.setCellFactory(TextFieldTableCell.<Person>forTableColumn()); firstNameCol.setOnEditCommit((CellEditEvent<Person, String> t) -> { ((Person) t.getTableView().getItems().get(t.getTablePosition().getRow())).setFirstName(t.getNewValue()); }); TableColumn<Person, String> lastNameCol = new TableColumn<>("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); lastNameCol.setCellFactory(TextFieldTableCell.<Person>forTableColumn()); lastNameCol.setOnEditCommit((CellEditEvent<Person, String> t) -> { ((Person) t.getTableView().getItems().get(t.getTablePosition().getRow())).setLastName(t.getNewValue()); }); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:account.management.controller.ViewCNFController.java
/** * Initializes the controller class.// w ww . j a va 2 s . co m */ @Override public void initialize(URL url, ResourceBundle rb) { id.setCellValueFactory(new PropertyValueFactory("id")); name.setCellValueFactory(new PropertyValueFactory("party_name")); address.setCellValueFactory(new PropertyValueFactory("party_address")); new Thread(() -> { try { HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "get/cnf/all").asJson(); JSONArray array = res.getBody().getArray(); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); String id = obj.get("id").toString(); String name = obj.getString("party_name"); String address = obj.getString("party_address"); tableView.getItems().add(new CNF(id, name, address)); } } catch (Exception e) { } }).start(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(400);/*from w w w. j a v a 2 s .c o m*/ stage.setHeight(550); table.setEditable(true); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("lastName")); TableColumn emailCol = new TableColumn("Email"); emailCol.setMinWidth(200); emailCol.setCellValueFactory(new PropertyValueFactory<Person, String>("email")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(400);/*from w ww . j a v a 2 s . com*/ stage.setHeight(550); table.setEditable(true); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName")); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("lastName")); TableColumn emailCol = new TableColumn("Email"); emailCol.setMinWidth(200); emailCol.setCellValueFactory(new PropertyValueFactory<Person, String>("email")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); final Button addButton = new Button("Add"); addButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { data.add(new Person("new", "new", "new")); } }); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table, addButton); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:br.com.ajaio.midas.desktop.controller.ContaCrudFXMLController.java
/** * Initializes the controller class.//w ww . j a v a 2 s . c o m */ @Override public void initialize(URL url, ResourceBundle rb) { TableColumn nomeBancoCol = new TableColumn("Banco"); nomeBancoCol.setMinWidth(200); nomeBancoCol.setCellValueFactory(new PropertyValueFactory<Conta, String>("nomeBanco")); TableColumn agenciaCol = new TableColumn("Agncia"); agenciaCol.setMinWidth(200); agenciaCol.setCellValueFactory(new PropertyValueFactory<Conta, String>("agencia")); TableColumn contaCol = new TableColumn("Conta"); contaCol.setMinWidth(200); contaCol.setCellValueFactory(new PropertyValueFactory<Conta, String>("conta")); TableColumn saldoCol = new TableColumn("Saldo Atual"); saldoCol.setMinWidth(200); saldoCol.setCellValueFactory(new PropertyValueFactory<Conta, String>("saldoAtual")); TableColumn editar = new TableColumn("Editar"); TableColumn apagar = new TableColumn("Apagar"); tbContas.getColumns().addAll(nomeBancoCol, agenciaCol, contaCol, saldoCol, editar, apagar); context = new ClassPathXmlApplicationContext("application-context.xml"); }
From source file:br.com.ajaio.midas.desktop.controller.BancoCrudFXMLController.java
/** * Initializes the controller class.//from www.ja v a 2 s. co m */ @Override public void initialize(URL url, ResourceBundle rb) { TableColumn nomeCol = new TableColumn("Nome Banco"); nomeCol.setMinWidth(200); nomeCol.setCellValueFactory(new PropertyValueFactory<Banco, String>("nome")); TableColumn numeroCol = new TableColumn("Nmero Banco"); numeroCol.setMinWidth(150); numeroCol.setCellValueFactory(new PropertyValueFactory<Banco, String>("numeroBanco")); TableColumn editar = new TableColumn("Editar"); TableColumn apagar = new TableColumn("Apagar"); tbBancos.getColumns().addAll(nomeCol, numeroCol, editar, apagar); context = new ClassPathXmlApplicationContext("application-context.xml"); }
From source file:account.management.controller.ViewProjectController.java
/** * Initializes the controller class./*from w ww. j a va2s. co m*/ */ @Override public void initialize(URL url, ResourceBundle rb) { this.name.setCellValueFactory(new PropertyValueFactory("name")); this.investment.setCellValueFactory(new PropertyValueFactory("investment")); this.party.setCellValueFactory(new PropertyValueFactory("party")); this.start_date.setCellValueFactory(new PropertyValueFactory("formattedStartDate")); this.operation_date.setCellValueFactory(new PropertyValueFactory("formattedOperationDate")); this.dimilish_date.setCellValueFactory(new PropertyValueFactory("formattedDimilishDate")); new Thread(() -> { try { HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "get/project/all").asJson(); JSONArray array = res.getBody().getArray(); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); String id = obj.get("id").toString(); String name = obj.getString("name"); String investment = String.valueOf(Float.parseFloat(obj.getString("investment"))); String related_party = obj.getString("related_party"); String starting_date = obj.getString("starting_date"); String operation_date = obj.getString("operation_date"); String dimilish_date = obj.getString("dimilish_date"); tableView.getItems().add(new Project(id, name, investment, related_party, starting_date, operation_date, dimilish_date)); } } catch (UnirestException ex) { Logger.getLogger(ViewProjectController.class.getName()).log(Level.SEVERE, null, ex); } }).start(); }
From source file:account.management.controller.ViewBankAccountController.java
/** * Initializes the controller class.// w w w. ja v a2 s . co m */ @Override public void initialize(URL url, ResourceBundle rb) { bank_list = FXCollections.observableArrayList(); id.setCellValueFactory(new PropertyValueFactory("id")); name.setCellValueFactory(new PropertyValueFactory("name")); description.setCellValueFactory(new PropertyValueFactory("description")); new Thread(() -> { try { HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "bank").asJson(); JSONArray array = res.getBody().getArray(); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); int id = obj.getInt("id"); String name = obj.getString("name"); String desc = obj.getString("description"); Account acc = new Account(id, name, desc); bank_list.add(acc); } } catch (UnirestException ex) { Msg.showError(""); } finally { this.table.getItems().addAll(bank_list); } }).start(); }