Example usage for javafx.scene.control Slider getId

List of usage examples for javafx.scene.control Slider getId

Introduction

In this page you can find the example usage for javafx.scene.control Slider getId.

Prototype

public final String getId() 

Source Link

Document

The id of this Node .

Usage

From source file:ipat_fx.FXMLDocumentController.java

@FXML
public void resetScores() {

    HashMap<String, Hint> hintMap = controller.hints;
    TabPane tabpane = (TabPane) byProfilePane.getChildren().get(0);
    Tab tab = null;// w  w  w  . ja v  a 2 s.  com
    if (tabFlag.equalsIgnoreCase("byProfile")) {
        tab = tabpane.getTabs().get(0);
    } else if (tabFlag.equalsIgnoreCase("byImage")) {
        tab = tabpane.getTabs().get(0);
    } else {
        Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null,
                "Something wrong with tabFlag");
    }
    ScrollPane scrollPane = (ScrollPane) tab.getContent();
    FlowPane flowPane = (FlowPane) scrollPane.getContent();
    Iterator<Node> cellsIterator = flowPane.getChildren().iterator();
    while (cellsIterator.hasNext()) {
        GridPane cell = (GridPane) cellsIterator.next();
        Iterator<Node> cellIterator = cell.getChildren().iterator();
        while (cellIterator.hasNext()) {
            Node cellElement = cellIterator.next();
            if (cellElement instanceof Slider) {
                Set<String> keySet = hintMap.keySet();// get the hints one by one and apply to cell
                int keyCount = 0;
                for (String key : keySet) {
                    Hint h = hintMap.get(key);
                    Slider slider = ((Slider) cellElement);
                    String[] split = slider.getId().split("_");
                    if (split[0].equalsIgnoreCase(h.getHintName())) {
                        slider.setValue(Double.valueOf(h.getDefaultValue()));
                    }
                }
            }
            if (cellElement instanceof CheckBox) {
                ((CheckBox) cellElement).setSelected(false);
            }
        }
    }
}