Java 类javafx.scene.control.cell.CheckBoxListCell 实例源码

项目:Java-9-Programming-Blueprints    文件:TwitterPreferencesController.java   
private Node buildConfigurationUI() {
    VBox box = new VBox();
    box.setPadding(new Insets(10));

    CheckBox cb = new CheckBox(MessageBundle.getInstance().getString("homeTimelineCB"));
    cb.selectedProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean oldVal, Boolean newVal) -> {
        showHomeTimeline = newVal;
    });

    Label label = new Label(MessageBundle.getInstance().getString("userListLabel") + ":");

    ListView<SelectableItem<UserList>> lv = new ListView<>();
    lv.setItems(itemList);
    lv.setCellFactory(CheckBoxListCell.forListView(item -> item.getSelected()));
    VBox.setVgrow(lv, Priority.ALWAYS);

    box.getChildren().addAll(cb, label, lv);
    showTwitterListSelection();

    return box;
}
项目:TableFilterFX    文件:FilterPopUp.java   
private void defineListView() {
    listView.prefWidthProperty().bind(maxCellWidth);
    listView.setCellFactory(param -> {
        Callback<T, ObservableValue<Boolean>> callback = param1 -> {
            SimpleBooleanProperty property = mapCellValueToSelectedProperty.get(param1);
            return property;
        };
        CheckBoxListCell<T> checkboxCell = new CheckBoxListCell<>(callback);
        checkboxCell.widthProperty().addListener((ChangeListener<Number>) (observable, oldValue, newValue) -> {
            double width = newValue.doubleValue() + listView.getInsets().getLeft() + listView.getInsets().getRight()
                    + 25;
            if (maxCellWidth.get() < width) {
                maxCellWidth.set(width);
            }
        });

        return checkboxCell;
    });
}
项目:bgfinancas    文件:RelatoriosControlador.java   
private void relatorioGraficoLinhas(){   
    listaCategorias.setEditable(true);
    if(listaCategorias.getItems().size()<=0){
        ObservableList<DespesaCategoria> categorias = new DespesaCategoria().listar();
        listaCategorias.setItems(categorias);
    }
    listaCategorias.setCellFactory(CheckBoxListCell.forListView((DespesaCategoria param) -> {
        BooleanProperty observable = param.getSelecao();
        observable.addListener((obs, wasSelected, isNowSelected) -> gerarGraficoLinhas() );
        return observable;
    }));
    ajustarColunas(25,75);
    tabela.add(listaCategorias, 0, 1);
    tabela.add(graficoLinhas, 1, 1);  
    gerarGraficoLinhas();
}
项目:logbook-kai    文件:ColumnVisibleController.java   
@FXML
void initialize() {
    this.listView.setCellFactory(
            CheckBoxListCell.forListView(t -> t.visibleProperty(),
                    new StringConverter<TableColumn<?, ?>>() {
                        @Override
                        public String toString(TableColumn<?, ?> table) {
                            return table.getText();
                        }

                        @Override
                        public TableColumn<? extends Object, ?> fromString(String string) {
                            throw new IllegalStateException();
                        }
                    }));
}
项目:marathonv5    文件:JavaFXElementFactory.java   
public static void reset() {
    add(Node.class, JavaFXElement.class);
    add(TextInputControl.class, JavaFXTextInputControlElement.class);
    add(HTMLEditor.class, JavaFXHTMLEditor.class);
    add(CheckBox.class, JavaFXCheckBoxElement.class);
    add(ToggleButton.class, JavaFXToggleButtonElement.class);
    add(Slider.class, JavaFXSliderElement.class);
    add(Spinner.class, JavaFXSpinnerElement.class);
    add(SplitPane.class, JavaFXSplitPaneElement.class);
    add(ProgressBar.class, JavaFXProgressBarElement.class);
    add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
    add(ColorPicker.class, JavaFXColorPickerElement.class);
    add(ComboBox.class, JavaFXComboBoxElement.class);
    add(DatePicker.class, JavaFXDatePickerElement.class);
    add(TabPane.class, JavaFXTabPaneElement.class);
    add(ListView.class, JavaFXListViewElement.class);
    add(TreeView.class, JavaFXTreeViewElement.class);
    add(TableView.class, JavaFXTableViewElement.class);
    add(TreeTableView.class, JavaFXTreeTableViewElement.class);
    add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
    add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
项目:marathonv5    文件:JavaFXCheckBoxListCellElement.java   
@SuppressWarnings("unchecked") @Override public String _getValue() {
    @SuppressWarnings("rawtypes")
    CheckBoxListCell cell = (CheckBoxListCell) getComponent();
    ObservableValue<Boolean> call = (ObservableValue<Boolean>) cell.getSelectedStateCallback().call(cell.getItem());
    int selection = call.getValue() ? 2 : 0;
    String text = cell.getText() + ":" + JavaFXCheckBoxElement.states[selection];
    return text;
}
项目:marathonv5    文件:RFXCheckBoxListCell.java   
@SuppressWarnings("unchecked") @Override public String _getValue() {
    @SuppressWarnings("rawtypes")
    CheckBoxListCell cell = (CheckBoxListCell) node;
    ObservableValue<Boolean> call = (ObservableValue<Boolean>) cell.getSelectedStateCallback().call(cell.getItem());
    String cbText;
    if (call != null) {
        int selection = call.getValue() ? 2 : 0;
        cbText = JavaFXCheckBoxElement.states[selection];
    } else {
        Node cb = cell.getGraphic();
        RFXComponent comp = getFinder().findRawRComponent(cb, null, null);
        cbText = comp._getValue();
    }
    return cbText;
}
项目:Retrospector    文件:StatsTabController.java   
public void setupOverall() {
        for (String user : DataManager.getUsers()) {
            addUserToOverallUserList(user);
        }
        overallUserList.setCellFactory(CheckBoxListCell.forListView(Stroolean::booleanProperty));
        overallUserList.setOnMouseClicked(e -> {
            if (e.getClickCount() == 2) {
                Stroolean me = overallUserList.getSelectionModel().getSelectedItem();
                for (Stroolean stroolean : strooleans)
                    stroolean.setBoolean(false);
                me.setBoolean(true);
            }
        });
        chartRpdX.setLabel("Day");
        chartRpdY.setLabel("Reviews");
        chartMediaPerCategory.setLegendVisible(true);

        // Pop Overs
        mediaPerCategoryPopOver = new PopOver();
        mediaPerCategoryPopOver.setAutoHide(true);
//        mediaPerCategoryPopOver.setAutoFix(true);
        mediaPerCategoryPopOver.setHideOnEscape(true);
        mediaPerCategoryPopOver.setDetachable(false);
        mediaPerCategoryPopOver.setArrowLocation(PopOver.ArrowLocation.LEFT_CENTER);
        chartMediaPerCategory.setOnMouseClicked(e -> {
            if (e.getClickCount() == 2)
                mediaPerCategoryPopOver.show(chartMediaPerCategory);
        });

        try {
            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/retrospector/fxml/chart/ChartPopup.fxml"));
            Parent root = (Parent) fxmlLoader.load();
            mediaPerCategorySettings = fxmlLoader.getController();
            mediaPerCategorySettings.setup(this::updateOverall);
            mediaPerCategoryPopOver.setContentNode(root);
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
项目:bunkr    文件:FileSecAuditWindow.java   
@Override
public void initControls()
{
    this.topLabel = new Label("These files all have stale encryption settings. Select the ones you want to fix, and press the 'Re-encrypt' button to re-encrypt them.");
    this.topLabel.setWrapText(true);
    this.pathsBox = new ListView<>();
    this.pathsBox.setCellFactory(CheckBoxListCell.forListView(param -> param.selected));
    this.pathsBox.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    this.backButton = new Button("Back");
    this.fixButton = Icons.buildIconButton("Re-encrypt Selected Files", Icons.ICON_RELOAD);
    this.fixAllButton = Icons.buildIconButton("Re-encrypt All Files", Icons.ICON_RELOAD);
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetCheckBoxListCellAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(CheckBoxListCell.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
项目:jedai-ui    文件:Step3Controller.java   
@FXML
public void initialize() {
    // Create comparator object that will be used for list sorting later
    listComparator = new BlockCleaningCustomComparator();

    // Initialize block cleaning methods list
    model.setBlockCleaningMethods(FXCollections.observableList(new ArrayList<>()));

    // Create map with options
    optionsMap = new HashMap<>();
    optionsMap.put(JedaiOptions.SIZE_BASED_BLOCK_PURGING, new SimpleBooleanProperty(false));
    optionsMap.put(JedaiOptions.COMPARISON_BASED_BLOCK_PURGING, new SimpleBooleanProperty(false));
    optionsMap.put(JedaiOptions.BLOCK_FILTERING, new SimpleBooleanProperty(false));

    // Add items to the list
    list.getItems().addAll(optionsMap.keySet());
    list.getItems().sort(listComparator);

    // Set list cells to have checkboxes which use the map's boolean values
    list.setCellFactory(CheckBoxListCell.forListView(optionsMap::get));

    // Listen for changes in each BooleanProperty
    for (String s : optionsMap.keySet()) {
        optionsMap.get(s).addListener((observable, oldValue, newValue) -> {
            // Add/remove the string to/from the model
            if (newValue) {
                selectedList.getItems().add(s);
                model.getBlockCleaningMethods().add(s);
            } else {
                model.getBlockCleaningMethods().remove(s);
                selectedList.getItems().remove(s);
            }

            // Sort the list to the correct order using the custom comparator
            selectedList.getItems().sort(listComparator);
        });
    }

    // Listen for changes in the model, and change the values of the boolean properties
    model.blockCleaningMethodsProperty().addListener((observable, oldValue, newValue) -> {
        // Set the value of each checkbox to true or false depending on if it's in the list or not
        for (String method : optionsMap.keySet()) {
            optionsMap.get(method).setValue(
                    newValue.contains(method)
            );
        }
    });
}
项目:ulviewer    文件:MainController.java   
public void initialize(URL location, ResourceBundle resources) {
    FXMLLoader logParseWizardLoader = new FXMLLoader(getClass().getResource("logparse-wizard.fxml"));
    FXMLLoader chartWizardLoader = new FXMLLoader(getClass().getResource("chart-wizard.fxml"));
    FXMLLoader samplingWizardLoader = new FXMLLoader(getClass().getResource("sampling-wizard.fxml"));
    FXMLLoader classHistoLoader = new FXMLLoader(getClass().getResource("chart/classhisto.fxml"));
    FXMLLoader classLoadLoader = new FXMLLoader(getClass().getResource("table/classload.fxml"));
    FXMLLoader ageTableLoader = new FXMLLoader(getClass().getResource("table/agetable.fxml"));

    try{
        logParseWizardLoader.load();
        logParseWizardController = logParseWizardLoader.getController();
        logParseWizardScene = new Scene(logParseWizardLoader.getRoot());
        chartWizardLoader.load();
        chartWizardController = chartWizardLoader.getController();
        samplingWizardLoader.load();
        samplingWizardController = samplingWizardLoader.getController();
        classHistoLoader.load();
        classHistoScene = new Scene(classHistoLoader.getRoot());
        classHistoController = classHistoLoader.getController();
        classLoadLoader.load();
        classLoadScene = new Scene(classLoadLoader.getRoot());
        classLoadController = classLoadLoader.getController();
        ageTableLoader.load();
        ageTableScene = new Scene(ageTableLoader.getRoot());
        ageTableController = ageTableLoader.getController();
    }
    catch(IOException e){
        throw new UncheckedIOException(e);
    }

    visibleList.setCellFactory(CheckBoxListCell.forListView(DecoratorSwitch::enableProperty));
    decoratorBox.getSelectionModel()
                  .selectedItemProperty()
                  .addListener((v, o, n) -> Optional.ofNullable(n)
                                                    .ifPresent(d -> visibleList.getItems().setAll(d.valueProperty())));
    searchText.textProperty().addListener((v, o, n) -> onSearchTextChanged(n));
    isUnloadedProperty = new SimpleBooleanProperty(true);
    pushLogMenu.disableProperty().bind(isUnloadedProperty);
    chartMenu.disableProperty().bind(isUnloadedProperty);
    tableMenu.disableProperty().bind(isUnloadedProperty);
    selectAllButton.disableProperty().bind(isUnloadedProperty);
    unselectAllButton.disableProperty().bind(isUnloadedProperty);
}
项目:minc-launcher    文件:Controller.java   
private void setupModsListView() {
    listViewMods.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listViewMods.setCellFactory(CheckBoxListCell.forListView(new Callback<ModRow, ObservableValue<Boolean>>() {
        @Override
        public ObservableValue<Boolean> call(ModRow item) {
            return item.onProperty();
        }
    }));

    // Set up filtered data
    FilteredList<ModRow> filteredModsByText = new FilteredList<>(modList.getMods(), p -> true);
    FilteredList<ModRow> filteredModsByStatus = new FilteredList<>(filteredModsByText, p -> true);

    // filter with name
    textFieldModsFilter.textProperty().addListener((observable, oldValue, newValue) -> {
        filteredModsByText.setPredicate(modRow -> {
            // If filter text is empty, display all persons.
            if (newValue == null || newValue.isEmpty()) {
                return true;
            }

            // Compare first name and last name of every modRow with filter text.
            String lowerCaseFilter = newValue.toLowerCase();

            if (modRow.getFile() != null && modRow.getFile().getName().toLowerCase().contains(lowerCaseFilter)) {
                return true; // Filter matches name.
            }
            return false; // Does not match.
        });
    });

    toggleGrooupMods.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
        public void changed(ObservableValue<? extends Toggle> ov,
                            Toggle old_toggle, Toggle new_toggle) {
            if (toggleGrooupMods.getSelectedToggle() != null) {
                System.out.println(toggleGrooupMods.getSelectedToggle());
                if (radioButtonModsAll.isSelected()) {
                    filteredModsByStatus.setPredicate(row -> {
                        return true;
                    });
                } else if (radioButtonModsEnabled.isSelected()) {
                    filteredModsByStatus.setPredicate(row -> {
                        return row.isChecked();
                    });
                } else if (radioButtonModsDisabled.isSelected()) {
                    filteredModsByStatus.setPredicate(row -> {
                        return !row.isChecked();
                    });
                } else {
                    log.error("what?");
                }
            }
        }
    });

    listViewMods.setItems(filteredModsByStatus);

    modList.getEnabled().addListener(new SetChangeListener<ModRow>() {
        @Override
        public void onChanged(Change<? extends ModRow> c) {
            log.debug("modified: c=" + c);
            labelEanbledModsCount.setText(ResStrings.get("label.enabled.mods") + ": " + modList.getEnabled().size());
        }
    });

    loadModList();
}
项目:dwoss    文件:CustomerEnhanceController.java   
/**
 * Build up a ListView with CheckBoxes for the Set of CunstomerFlags
 */
private void buildFlagBox() {
    //transform a Set to a ObservableList of CustomerFlag
    List<CustomerFlag> templist = new ArrayList<>();
    flagsSet.forEach(f -> templist.add(f));
    ObservableList<CustomerFlag> allFlagsFromTheCustomer = FXCollections.observableArrayList(templist);

    //fill with all posibile flags
    ObservableList<CustomerFlag> observableArrayListOfAllFlags = FXCollections.observableArrayList(CustomerFlag.values());

    ObservableList<CustomerFlagWithSelect> listForTheView = FXCollections.observableArrayList();

    //fill the CustomerFlagWithSelect List
    observableArrayListOfAllFlags.stream().map((ovall) -> {
        CustomerFlagWithSelect cfs = new CustomerFlagWithSelect(ovall);
        if ( allFlagsFromTheCustomer.contains(ovall) ) {
            cfs.setSelected(true);
        }
        return cfs;
    }).forEachOrdered((cfs) -> {
        listForTheView.add(cfs);
    });

    listForTheView.forEach(flag -> flag.selectedProperty().addListener((observable, wasSelected, isSelected) -> {
        if ( isSelected ) {
            outputFlagslist.add(flag.getFlag());
        }
    }));

    ListView<CustomerFlagWithSelect> checklist = new ListView<>();
    checklist.setItems(listForTheView);
    checklist.setMinWidth(150.0);
    checklist.setCellFactory(CheckBoxListCell.forListView(CustomerFlagWithSelect::selectedProperty, new StringConverter<CustomerFlagWithSelect>() {
        @Override
        public String toString(CustomerFlagWithSelect object) {
            return object.getFlag().getName();
        }

        @Override
        public CustomerFlagWithSelect fromString(String string) {
            return null;
        }
    }));

    Label flagLable = new Label("Flags: ");
    flagVBox.getChildren().addAll(flagLable, checklist);
}