List of usage examples for javafx.collections ObservableList add
boolean add(E e);
From source file:org.ykc.usbcx.MainWindowController.java
void filterScopeData() { ObservableList<File> pktList = FXCollections.observableArrayList(); if (partFileList != null) { for (int i = 0; i < partFileList.size(); i++) { File xFile = partFileList.get(i); if (Utils.getFileExtension(xFile).contains("part")) { pktList.add(xFile); } else { scopeFile = xFile;/*from ww w . j a v a 2 s. c o m*/ } } partFileList = pktList; } }
From source file:edu.mit.lib.handbag.Controller.java
private void reset(boolean keepStickies) { payloadTreeView.getRoot().getChildren().clear(); ObservableList<PropertySheet.Item> items = metadataPropertySheet.getItems(); List<PropertySheet.Item> saveItems = new ArrayList<>(); saveItems.addAll(items);/* w ww . j av a2s. c o m*/ items.clear(); cleanMetadata = true; gooeyMetadata = false; boolean anyNeeded = false; int i = 0; for (MetadataSpec spec : workflowChoiceBox.getValue().getMetadata()) { if (!spec.isOptional() && spec.needsValue()) { anyNeeded = true; } MetadataItem item = new MetadataItem(spec); String oldValue = (String) saveItems.get(i).getValue(); if (spec.isSticky() && keepStickies && oldValue != null) { item.setValue(oldValue); gooeyMetadata = true; } items.add(item); i++; } completeMetadata = !anyNeeded; updateButtons(); bagSize = 0L; bagSizeLabel.setText("[empty]"); generateBagName(workflowChoiceBox.getValue().getBagNameGenerator()); bagLabel.setText(bagName); }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddSememePopup.java
private ObservableList<SimpleDisplayConcept> buildAssemblageConceptList() { ObservableList<SimpleDisplayConcept> assemblageConcepts = new ObservableListWrapper<>( new ArrayList<SimpleDisplayConcept>()); try {/* w w w . j a v a2 s .c om*/ //TODO Dan should we use sememe usage instead now? Set<Integer> colCons = OchreUtility.getAllChildrenOfConcept( IsaacMetadataConstants.DYNAMIC_SEMEME_ASSEMBLAGES.getSequence(), false, false); for (Integer col : colCons) { assemblageConcepts.add(new SimpleDisplayConcept(col)); } } catch (Exception e) { logger_.error("Unexpected error reading existing assemblage concepts", e); } return assemblageConcepts; }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java
private ObservableList<SimpleDisplayConcept> buildAssemblageConceptList() { ObservableList<SimpleDisplayConcept> assemblageConcepts = new ObservableListWrapper<>( new ArrayList<SimpleDisplayConcept>()); try {//from w w w . j ava 2 s . c o m ConceptVersionBI colCon = OTFUtility .getConceptVersion(RefexDynamic.DYNAMIC_SEMEME_ASSEMBLAGES.getNid()); Set<ConceptVersionBI> colCons = OTFUtility.getAllChildrenOfConcept(colCon, false); for (ConceptVersionBI col : colCons) { assemblageConcepts.add(new SimpleDisplayConcept(col)); } } catch (Exception e) { logger_.error("Unexpected error reading existing assemblage concepts", e); } return assemblageConcepts; }
From source file:org.jevis.jeconfig.plugin.classes.ClassTree.java
public void addChildrenList(TreeItem<JEVisClass> item, ObservableList<TreeItem<JEVisClass>> list) { _itemChildren.put(item, list);//from ww w. j ava 2 s . com try { // System.out.println("\nchildren for: " + item.getValue().getName()); for (JEVisClass child : item.getValue().getHeirs()) { // System.out.println(" posible heir: " + child.getName()); if (item.getValue().getName().equals("Classes")) { TreeItem<JEVisClass> newItem = buildItem(child); list.add(newItem); // } else if (child.getInheritance() != null && item.getValue().getName().equals(child.getInheritance().getName())) } else if (child.getInheritance() != null && item.getValue().equals(child.getInheritance())) {// && child.getInheritance().equals(item.getValue())) { // System.out.println(" is direct heir: " + child.getInheritance()); TreeItem<JEVisClass> newItem = buildItem(child); list.add(newItem); } // for (JEVisClassRelationship rel : child.getRelationships(JEVisConstants.ClassRelationship.INHERIT, JEVisConstants.Direction.FORWARD)) { // System.out.println("rel: " + rel); // if (rel.getOtherClass(item.getValue().getInheritance())) { // System.out.println("from: " +); // } else { // System.out.println("to"); // } // } } } catch (JEVisException ex) { Logger.getLogger(ClassTree.class.getName()).log(Level.SEVERE, null, ex); } // sortList(list); }
From source file:pl.betoncraft.betonquest.editor.model.QuestPackage.java
public <T extends ID> T newByID(String id, Generator<T> generator) { T object = generator.generate(id);//from www. j av a 2 s .c o m ObservableList<T> list = object.getList(); T existing = null; for (T check : list) { if (check.getId().get().equals(id)) { existing = check; break; } } if (existing == null) { existing = object; list.add(existing); } return existing; }
From source file:magicdeckmanager.card.CardManager.java
public ObservableList<PieChart.Data> getManaDistPieChartData(DeckData deckData) { ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(); final List<String> main = deckData.getMain(); Map<Color, Integer> colorDistribution = new HashMap<>(); Integer totalManaCost = 0;// w w w. jav a 2 s . c o m for (String cardName : main) { Card card = getCardFromName(cardName); if (!card.isLand()) { totalManaCost += card.cmc; final ManaCost manaCost = card.getManaCost(); final List<ManaPart> cost = manaCost.getCost(); addManaPartsToColorDistribution(cost, colorDistribution); } } for (Map.Entry<Color, Integer> entrySet : colorDistribution.entrySet()) { Color key = entrySet.getKey(); Integer value = entrySet.getValue(); double percent = (value.doubleValue() / totalManaCost.doubleValue()); percent *= 100; Integer percentInteger = (int) Math.round(percent); final String percentString = key.toString() + " " + percentInteger.toString() + "%"; pieChartData.add(new PieChart.Data(percentString, value)); } return pieChartData; }
From source file:aajavafx.VisitorScheduleController.java
public ObservableList<String> getCustomer() throws IOException, JSONException { ObservableList<String> customerStrings = FXCollections.observableArrayList(); //customers.add(new CustomerProperty(1, "Johny", "Walker", "London", "1972-07-01", "7207012222")); Customers myCustomer = new Customers(); //Managers manager = new Managers(); Gson gson = new Gson(); JSONObject jo = new JSONObject(); JSONArray jsonArray = new JSONArray(IOUtils .toString(new URL("http://localhost:8080/MainServerREST/api/customers"), Charset.forName("UTF-8"))); System.out.println(jsonArray); for (int i = 0; i < jsonArray.length(); i++) { jo = (JSONObject) jsonArray.getJSONObject(i); myCustomer = gson.fromJson(jo.toString(), Customers.class); customers.add(myCustomer);/*from ww w . j a v a 2 s . c om*/ System.out.println(myCustomer.getCuId()); String s = myCustomer.getCuId() + ". " + myCustomer.getCuFirstname() + " " + myCustomer.getCuLastname(); customerStrings.add(s); } custStrings = customerStrings; return customerStrings; }
From source file:retsys.client.controller.DeliveryChallanReturnController.java
/** * Initializes the controller class.//ww w . ja va 2 s . c o m */ @Override public void initialize(URL url, ResourceBundle rb) { dc_date.setValue(LocalDate.now()); material_name.setCellValueFactory(new PropertyValueFactory<DCItem, String>("name")); brand_name.setCellValueFactory(new PropertyValueFactory<DCItem, String>("brand")); model_code.setCellValueFactory(new PropertyValueFactory<DCItem, String>("model")); units.setCellValueFactory(new PropertyValueFactory<DCItem, String>("model")); quantity.setCellValueFactory(new PropertyValueFactory<DCItem, Integer>("quantity")); amount.setCellValueFactory(new PropertyValueFactory<DCItem, Integer>("amount")); dcDetail.getColumns().setAll(material_name, brand_name, model_code, quantity, amount); // TODO AutoCompletionBinding<Item> bindForTxt_name = TextFields.bindAutoCompletion(txt_name, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<Item>>() { @Override public Collection<Item> call(AutoCompletionBinding.ISuggestionRequest param) { List<Item> list = null; try { LovHandler lovHandler = new LovHandler("items", "name"); String response = lovHandler.getSuggestions(param.getUserText()); list = (List<Item>) new JsonHelper().convertJsonStringToObject(response, new TypeReference<List<Item>>() { }); } catch (IOException ex) { Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex); } return list; } }, new StringConverter<Item>() { @Override public String toString(Item object) { System.out.println("here..." + object); return object.getName() + " (ID:" + object.getId() + ")"; } @Override public Item fromString(String string) { throw new UnsupportedOperationException(); } }); //event handler for setting other item fields with values from selected Item object //fires after autocompletion bindForTxt_name.setOnAutoCompleted(new EventHandler<AutoCompletionBinding.AutoCompletionEvent<Item>>() { @Override public void handle(AutoCompletionBinding.AutoCompletionEvent<Item> event) { Item item = event.getCompletion(); //fill other item related fields txt_name.setUserData(item.getId()); txt_brand.setText(item.getBrand()); txt_model.setText(null); // item doesn't have this field. add?? txt_rate.setText(String.valueOf(item.getRate())); } }); AutoCompletionBinding<DeliveryChallan> bindForProject = TextFields.bindAutoCompletion(project, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<DeliveryChallan>>() { @Override public Collection<DeliveryChallan> call(AutoCompletionBinding.ISuggestionRequest param) { List<DeliveryChallan> list = null; try { LovHandler lovHandler = new LovHandler("deliverychallans", "name"); String response = lovHandler.getSuggestions(param.getUserText()); list = (List<DeliveryChallan>) new JsonHelper().convertJsonStringToObject(response, new TypeReference<List<DeliveryChallan>>() { }); } catch (IOException ex) { Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex); } return list; } }, new StringConverter<DeliveryChallan>() { @Override public String toString(DeliveryChallan object) { System.out.println("here..." + object); String strDate = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).format(LocalDateTime .ofInstant(object.getChallanDate().toInstant(), ZoneId.systemDefault())); return "Project:" + object.getProject().getName() + " DC Date:" + strDate + " DC No.:" + object.getId(); } @Override public DeliveryChallan fromString(String string) { throw new UnsupportedOperationException(); } }); bindForProject .setOnAutoCompleted(new EventHandler<AutoCompletionBinding.AutoCompletionEvent<DeliveryChallan>>() { @Override public void handle(AutoCompletionBinding.AutoCompletionEvent<DeliveryChallan> event) { DeliveryChallan dc = event.getCompletion(); dc_no.setText(dc.getId().toString()); dc_date.setValue(LocalDateTime .ofInstant(dc.getChallanDate().toInstant(), ZoneId.systemDefault()).toLocalDate()); dc_no.setText(dc.getId().toString()); project.setText(dc.getProject().getName() + " (ID:" + dc.getProject().getId() + ")"); deliverymode.setText(dc.getDeliveryMode()); concernperson.setText(dc.getConcernPerson()); ObservableList<DCItem> items = FXCollections.observableArrayList(); Iterator detailsIt = dc.getDeliveryChallanDetail().iterator(); while (detailsIt.hasNext()) { DeliveryChallanDetail detail = (DeliveryChallanDetail) detailsIt.next(); Item item = detail.getItem(); int id = item.getId(); String site = item.getSite(); String name = item.getName(); String brand = item.getBrand(); String model = null; int rate = item.getRate().intValue(); int quantity = detail.getQuantity(); int amount = detail.getAmount(); String units = detail.getUnits(); items.add(new DCItem(id, name + " (ID:" + id + ")", brand, model, rate, quantity, units, amount)); } dcDetail.setItems(items); populateAuditValues(dc); } }); txt_qty.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (!newValue) { calcAmount(); } } }); }
From source file:staff.cashier.CashierController.java
@FXML private void onClickPendingBill(ActionEvent e) { ObservableList<PendingBill> list = FXCollections.observableArrayList(); try {/*from w w w . j a v a2 s . com*/ Statement st = conn.createStatement(); int billstatus = 0; String status = "finished"; String query = "select * from order_info where bill_paid=" + billstatus + " and status='" + status + "'"; ResultSet rs = st.executeQuery(query); // int f=0; while (rs.next()) { // f++; System.out.println("in cashierCntroller"); BigInteger id = new BigInteger(Long.toString(rs.getLong("c_id"))); System.out.println("cid:" + id); Statement st1 = conn.createStatement(); String query1 = "select * from customer where c_id=" + id + ""; ResultSet rs1 = st1.executeQuery(query1); rs1.next(); System.out.println("Name:" + rs1.getString("c_name")); PendingBill a = new PendingBill(rs.getInt("order_id"), rs1.getString("c_name"), rs.getFloat("cost")); list.add(a); } // if(f!=0) cashierView.getItems().addAll(list); } catch (SQLException ex) { Logger.getLogger(CurrentOrderController.class.getName()).log(Level.SEVERE, null, ex); } }