List of usage examples for javafx.collections ObservableList add
boolean add(E e);
From source file:com.ggvaidya.scinames.ui.DatasetDiffController.java
private ObservableList<String> getComparisonStatRowHeaders() { ObservableList<String> rowHeader = FXCollections.observableArrayList(); rowHeader.add("Number of rows"); rowHeader.add("Number of columns"); rowHeader.add("Number of names recognized"); rowHeader.add("Number of names in rows"); rowHeader.add("Number of binomial names recognized"); rowHeader.add("Number of binomial names in rows"); rowHeader.add("Number of changes"); Project project = datasetDiffView.getProjectView().getProject(); rowHeader.addAll(project.getChanges().map(ch -> ch.getType()).distinct().sorted() .map(type -> "Number of changes of type '" + type.getType() + "'").collect(Collectors.toList())); return rowHeader; }
From source file:retsys.client.controller.CreditNoteController.java
public void addItem(ActionEvent event) { sno++;//from ww w .ja va2 s . c om ObservableList<CreditNoteItem> list = creditNoteDetail.getItems(); if (list == null) { list = FXCollections.observableArrayList(); } Integer id = null; if (!creditNoteNo.getText().isEmpty()) { id = Integer.parseInt(creditNoteNo.getText()); } CreditNoteItem item = new CreditNoteItem(name.getText(), Double.parseDouble(amount.getText()), Double.parseDouble(quantity.getText()), true); list.add(item); totalCredit.setText(Double.toString(Double.sum(Double.parseDouble(totalCredit.getText() + "0"), Double.parseDouble(amount.getText()) * Double.parseDouble(quantity.getText())))); creditNoteDetail.setItems(list); }
From source file:de.perdoctus.ebikeconnect.gui.ActivitiesOverviewController.java
private void addChartSeries(final String title, final List<? extends Number> samples) { logger.info(title + ": " + samples.size() + " samples."); final XYChart.Series<Number, Number> series = new XYChart.Series<>(); series.setName(title);// ww w . j av a 2s .com final ObservableList<XYChart.Data<Number, Number>> data = series.getData(); for (int i = 0; i < samples.size(); i += 4) { final Number number = samples.get(i); if (number != null) { final XYChart.Data<Number, Number> dataPoint = new XYChart.Data<>(i, number); data.add(dataPoint); } } chartRangeSlider.setMax(samples.size()); if (data.size() > 0) { chart.getData().add(series); } }
From source file:retsys.client.controller.PurchaseOrderController.java
public void addItem(ActionEvent event) { sno++;// w w w .ja v a 2 s.co m ObservableList<POItem> list = poDetail.getItems(); if (list == null) { list = FXCollections.observableArrayList(); } POItem item = new POItem((int) txt_location.getUserData(), txt_location.getText(), txt_name.getText(), txt_brand.getText(), txt_model.getText(), Double.parseDouble(txt_qty.getText()), false, null); list.add(item); poDetail.setItems(list); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("ObservableLists"); Group root = new Group(); Scene scene = new Scene(root, 400, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);/*from w w w .j a v a 2 s. c o m*/ gridpane.setVgap(10); Label candidatesLbl = new Label("Left"); GridPane.setHalignment(candidatesLbl, HPos.CENTER); gridpane.add(candidatesLbl, 0, 0); Label heroesLbl = new Label("Right"); gridpane.add(heroesLbl, 2, 0); GridPane.setHalignment(heroesLbl, HPos.CENTER); final ObservableList<String> lefts = FXCollections.observableArrayList("A", "B", "C"); final ListView<String> leftListView = new ListView<String>(lefts); leftListView.setPrefWidth(150); leftListView.setPrefHeight(150); gridpane.add(leftListView, 0, 1); final ObservableList<String> rights = FXCollections.observableArrayList(); final ListView<String> rightListView = new ListView<String>(rights); rightListView.setPrefWidth(150); rightListView.setPrefHeight(150); gridpane.add(rightListView, 2, 1); Button sendRightButton = new Button(">"); sendRightButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { String item = leftListView.getSelectionModel().getSelectedItem(); if (item != null) { leftListView.getSelectionModel().clearSelection(); lefts.remove(item); rights.add(item); } } }); Button sendLeftButton = new Button("<"); sendLeftButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { String item = rightListView.getSelectionModel().getSelectedItem(); if (item != null) { rightListView.getSelectionModel().clearSelection(); rights.remove(item); lefts.add(item); } } }); VBox vbox = new VBox(5); vbox.getChildren().addAll(sendRightButton, sendLeftButton); gridpane.add(vbox, 1, 1); GridPane.setConstraints(vbox, 1, 1, 1, 2, HPos.CENTER, VPos.CENTER); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:testclientside.implement.implPerson.java
@Override public ObservableList<Person> search(String a) { ObservableList<Person> listData = FXCollections.observableArrayList(); JSONArray arr;// w ww. j a va2 s. c o m String jsonStr = Service.ServiceGet("search.php?nama=" + a); if (jsonStr != null) { try { JSONObject jsonObj = new JSONObject(jsonStr); arr = jsonObj.getJSONArray("hobi"); for (int i = 0; i < arr.length(); i++) { JSONObject c = arr.getJSONObject(i); Person p = new Person(); p.setId(c.getString("id")); p.setNama(c.getString("nama")); p.setHobi(c.getString("hobi")); listData.add(p); } } catch (JSONException e) { } } else { System.err.println("No Data"); } return listData; }
From source file:com.jscriptive.moneyfx.ui.chart.ChartFrame.java
public void yearlyInOutToggled(ActionEvent actionEvent) { final NumberAxis xAxis = new NumberAxis(); final CategoryAxis yAxis = new CategoryAxis(); yAxis.setLabel("In/Out in Euro"); xAxis.setLabel("Year"); final BarChart<Number, String> barChart = new BarChart<>(xAxis, yAxis); barChart.setTitle("Yearly in/out"); chartFrame.setCenter(barChart);//from ww w . j a va 2 s .c o m ToggleButton toggle = (ToggleButton) actionEvent.getTarget(); if (toggle.isSelected()) { Account account = accountCombo.getValue(); String accountLabel = getAccountLabel(account); XYChart.Series<Number, String> inSeries = new XYChart.Series<>(); inSeries.setName("In" + accountLabel); barChart.getData().add(inSeries); XYChart.Series<Number, String> outSeries = new XYChart.Series<>(); outSeries.setName("Out" + accountLabel); barChart.getData().add(outSeries); ValueRange<LocalDate> period = getTransactionOpRange(account, yearCombo.getValue()); if (period.isEmpty()) { return; } ObservableList<String> categories = FXCollections.observableArrayList(); for (int y = period.from().getYear(); y < period.to().getYear() + 6; y++) { categories.add(String.valueOf(y)); } yAxis.setCategories(categories); Service<Void> service = new Service<Void>() { @Override protected Task<Void> createTask() { return new Task<Void>() { @Override protected Void call() throws Exception { List<TransactionVolume> incomingVolumes = (account == ALL_ACCOUNTS) ? transactionRepository.getYearlyIncomingVolumes(false) : transactionRepository.getYearlyIncomingVolumesOfAccount(account, false); if (INTEGER_ZERO.compareTo(yearCombo.getValue()) < 0) { incomingVolumes = incomingVolumes.stream() .filter(v -> v.getYear().equals(yearCombo.getValue())) .sorted((v1, v2) -> v1.getDate().compareTo(v2.getDate())).collect(toList()); } for (TransactionVolume volume : incomingVolumes) { XYChart.Data<Number, String> inData = new XYChart.Data<>(volume.getVolume(), String.valueOf(volume.getYear())); Platform.runLater(() -> { inSeries.getData().add(inData); StackPane node = (StackPane) inData.getNode(); node.getChildren().add( new Label(CurrencyFormat.getInstance().format(volume.getVolume()))); node.addEventHandler(MOUSE_CLICKED, event -> handleYearlyInOutChartMouseClickEvent( (account == ALL_ACCOUNTS) ? null : account, ofYearDay(volume.getYear(), 1), event)); }); } List<TransactionVolume> outgoingVolumes = (account == ALL_ACCOUNTS) ? transactionRepository.getYearlyOutgoingVolumes(false) : transactionRepository.getYearlyOutgoingVolumesOfAccount(account, false); if (INTEGER_ZERO.compareTo(yearCombo.getValue()) < 0) { outgoingVolumes = outgoingVolumes.stream() .filter(v -> v.getYear().equals(yearCombo.getValue())) .sorted((v1, v2) -> v1.getDate().compareTo(v2.getDate())).collect(toList()); } for (TransactionVolume volume : outgoingVolumes) { XYChart.Data<Number, String> outData = new XYChart.Data<>(volume.getVolume().abs(), String.valueOf(volume.getYear())); Platform.runLater(() -> { outSeries.getData().add(outData); StackPane node = (StackPane) outData.getNode(); node.getChildren().add( new Label(CurrencyFormat.getInstance().format(volume.getVolume()))); node.addEventHandler(MOUSE_CLICKED, event -> handleYearlyInOutChartMouseClickEvent( (account == ALL_ACCOUNTS) ? null : account, ofYearDay(volume.getYear(), 1), event)); }); } return null; } }; } }; service.start(); } }
From source file:retsys.client.controller.PurchaseOrderConfirmController.java
public void addItem(ActionEvent event) { sno++;/* w w w . j ava2s. c o m*/ ObservableList<POItem> list = poDetail.getItems(); if (list == null) { list = FXCollections.observableArrayList(); } POItem item = new POItem((int) txt_location.getUserData(), txt_location.getText(), txt_name.getText(), txt_brand.getText(), txt_model.getText(), Integer.parseInt(txt_qty.getText()), false, null); list.add(item); poDetail.setItems(list); }
From source file:retsys.client.controller.DeliveryChallanReturnController.java
public void addItem(ActionEvent event) { ObservableList<DCItem> list = dcDetail.getItems(); if (list == null) { list = FXCollections.observableArrayList(); }// w w w. j av a 2 s .c o m DCItem item = new DCItem((int) txt_name.getUserData(), txt_name.getText(), txt_brand.getText(), txt_model.getText(), Double.valueOf(txt_rate.getText()).intValue(), Integer.parseInt(txt_qty.getText()), txt_units.getText(), Double.valueOf(txt_amount.getText()).intValue()); list.add(item); dcDetail.setItems(list); }
From source file:retsys.client.controller.DeliveryChallanController.java
public void addItem(ActionEvent event) { ObservableList<DCItem> list = dcDetail.getItems(); if (list == null) { list = FXCollections.observableArrayList(); }//from w w w .ja v a 2 s. c o m DCItem item = new DCItem(splitId(txt_name.getText()), txt_name.getText(), txt_brand.getText(), txt_model.getText(), Double.valueOf(txt_rate.getText()).intValue(), Integer.parseInt(txt_qty.getText()), txt_units.getText(), Double.valueOf(txt_amount.getText()).intValue()); list.add(item); dcDetail.setItems(list); }