List of usage examples for javafx.scene.control TextField getId
public final String getId()
From source file:com.rcs.shoe.shop.fx.controller.ui.Controller.java
protected Integer getSize(TextField tx) { return new Integer(tx.getId().replaceFirst("text", "")); }
From source file:com.rcs.shoe.shop.fx.controller.ui.NewProductController.java
private List<ProductHistory> getProductQuantity() { List<ProductHistory> result = new ArrayList<>(); for (TextField tx : quantityFields.values()) { Label label = quantityLabels.get(tx.getId().replaceFirst("text", "label")); Integer oldValue = new Integer(label.textProperty().getValue().trim()); Integer newValue = new Integer(tx.textProperty().getValue().trim()); if (oldValue > newValue) { ProductHistory quantityHistory = new ProductHistory(); quantityHistory.setProductNum(Integer.parseInt(produstNumber.getText())); if (storedProduct != null) { quantityHistory.setProductCode(storedProduct.getProductCode()); } else { quantityHistory.setProductCode(productCode.getText()); }/* ww w .java2 s . c om*/ quantityHistory.setSize(getSize(tx)); quantityHistory.setType(2); quantityHistory.setQuantity(newValue - oldValue); result.add(quantityHistory); } else if (oldValue < newValue) { ProductHistory quantityHistory = new ProductHistory(); quantityHistory.setProductCode(productCode.getText()); quantityHistory.setProductNum(Integer.parseInt(produstNumber.getText())); if (storedProduct != null) { quantityHistory.setProductCode(storedProduct.getProductCode()); } else { quantityHistory.setProductCode(productCode.getText()); } quantityHistory.setSize(getSize(tx)); quantityHistory.setType(1); quantityHistory.setQuantity(newValue - oldValue); result.add(quantityHistory); } } return result; }
From source file:com.rcs.shoe.shop.fx.controller.ui.NewProductController.java
private void initializeQuantityFields() { quantityFields = new HashMap<>(); quantityLabels = new HashMap<>(); ObservableList<Node> children = sizesPane.getChildren(); for (Node node : children) { if (node instanceof TextField) { TextField tx = (TextField) node; tx.textProperty().addListener(getDigitChangeListener(tx)); quantityFields.put(tx.getId(), tx); } else if (node instanceof Label) { Label label = (Label) node; if (label.getId() != null && label.getId().startsWith("label")) { quantityLabels.put(label.getId(), label); }// w w w . ja va 2 s . c o m } } }
From source file:com.bekwam.mavenpomupdater.ToolBarDelegate.java
public void updateToolBarForClipboard(TextField focusedTF, String selectedText, IndexRange selectedRange) { if (log.isDebugEnabled()) { log.debug("[UPDATE TBB]"); }//w w w . java2 s . c o m if (systemClipboard == null) { systemClipboard = Clipboard.getSystemClipboard(); } if (systemClipboard.hasString()) { if (log.isDebugEnabled()) { log.debug("[UPDATE TBB] there is content in clipboard"); } adjustForClipboardContents(); } else { if (log.isDebugEnabled()) { log.debug("[UPDATE TBB] there is NO content in clipboard"); } adjustForEmptyClipboard(); } if (StringUtils.isNotEmpty(focusedTF.getSelectedText())) { if (log.isDebugEnabled()) { log.debug("[UPDATE TBB] there is a selection"); } adjustForSelection(); } else { if (log.isDebugEnabled()) { log.debug("[UPDATE TBB] there is a de-selection"); } adjustForDeselection(); } if (log.isDebugEnabled()) { log.debug( "[UPDATE TBB] assigining tf=" + focusedTF.getId() + " as last focused; text=" + selectedText); } lastFocusedTF = focusedTF; lastSelectedText = selectedText; lastSelectedRange = selectedRange; }