List of usage examples for javafx.css PseudoClass getPseudoClass
public static PseudoClass getPseudoClass(String pseudoClass)
From source file:app.order.OrderController.java
public void setCheckRowColor() { //Change Color of Check Table PseudoClass nonpaye = PseudoClass.getPseudoClass("nonpaye"); PseudoClass paye = PseudoClass.getPseudoClass("paye"); PseudoClass impaye = PseudoClass.getPseudoClass("impaye"); //PseudoClass down = PseudoClass.getPseudoClass("down"); checkTable.setRowFactory(tableView -> { TableRow<Check> row = new TableRow<>(); ChangeListener<PaymentState> changeListener = (obs, oldState, newState) -> { // row.pseudoClassStateChanged(nonpaye, oldState.equals(CheckState.NONPAYE.toString())); // row.pseudoClassStateChanged(paye, oldState.equals(CheckState.PAYE.toString())); // row.pseudoClassStateChanged(impaye, oldState.equals(CheckState.IMPAYE.toString())); row.pseudoClassStateChanged(nonpaye, oldState == PaymentState.NONPAYE); row.pseudoClassStateChanged(paye, oldState == PaymentState.PAYE); row.pseudoClassStateChanged(impaye, oldState == PaymentState.IMPAYE); };/*from ww w. j a v a 2 s . co m*/ row.itemProperty().addListener((obs, oldCheck, newCheck) -> { if (oldCheck != null) { oldCheck.paymentStateProperty().removeListener(changeListener); } if (newCheck != null) { newCheck.paymentStateProperty().addListener(changeListener); // row.pseudoClassStateChanged(nonpaye, newCheck.getState().equals(CheckState.NONPAYE.toString())); // row.pseudoClassStateChanged(paye, newCheck.getState().equals(CheckState.PAYE.toString())); // row.pseudoClassStateChanged(impaye, newCheck.getState().equals(CheckState.IMPAYE.toString())); row.pseudoClassStateChanged(nonpaye, newCheck.getPaymentState() == PaymentState.NONPAYE); row.pseudoClassStateChanged(paye, newCheck.getPaymentState() == PaymentState.PAYE); row.pseudoClassStateChanged(impaye, newCheck.getPaymentState() == PaymentState.IMPAYE); } else { row.pseudoClassStateChanged(nonpaye, false); row.pseudoClassStateChanged(paye, false); row.pseudoClassStateChanged(impaye, false); } }); return row; }); }
From source file:net.rptools.tokentool.controller.TokenTool_Controller.java
private void addPseudoClassToLeafs(TreeView<Path> tree) { PseudoClass leaf = PseudoClass.getPseudoClass("leaf"); tree.setCellFactory(tv -> {/*from w w w.jav a2s . c om*/ TreeCell<Path> cell = new TreeCell<>(); cell.itemProperty().addListener((obs, oldValue, newValue) -> { if (newValue == null) { cell.setText(""); cell.setGraphic(null); } else { cell.setText(newValue.toFile().getName()); cell.setGraphic(cell.getTreeItem().getGraphic()); } }); cell.treeItemProperty().addListener((obs, oldTreeItem, newTreeItem) -> cell .pseudoClassStateChanged(leaf, newTreeItem != null && newTreeItem.isLeaf())); return cell; }); }
From source file:net.sourceforge.pmd.util.fxdesigner.SourceEditorController.java
private IntFunction<javafx.scene.Node> lineNumberFactory() { IntFunction<javafx.scene.Node> base = LineNumberFactory.get(codeEditorArea); Val<Integer> activePar = Val.wrap(codeEditorArea.currentParagraphProperty()); return idx -> { javafx.scene.Node label = base.apply(idx); activePar.conditionOnShowing(label).values().subscribe( p -> label.pseudoClassStateChanged(PseudoClass.getPseudoClass("has-caret"), idx == p)); // adds a pseudo class if part of the focus node appears on this line currentFocusNode.conditionOnShowing(label).values() .subscribe(n -> label.pseudoClassStateChanged(PseudoClass.getPseudoClass("is-focus-node"), n != null && idx + 1 <= n.getEndLine() && idx + 1 >= n.getBeginLine())); return label; };// w w w. jav a 2s . c om }