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

项目:marathonv5    文件:RFXListViewTextFieldListCellTest.java   
@Test public void select() {
    @SuppressWarnings("unchecked")
    ListView<String> listView = (ListView<String>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        @SuppressWarnings("unchecked")
        TextFieldListCell<String> cell = (TextFieldListCell<String>) getCellAt(listView, 3);
        Point2D point = getPoint(listView, 3);
        RFXListView rfxListView = new RFXListView(listView, null, point, lr);
        rfxListView.focusGained(rfxListView);
        cell.startEdit();
        cell.updateItem("Item 4 Modified", false);
        cell.commitEdit("Item 4 Modified");
        rfxListView.focusLost(rfxListView);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Item 4 Modified", recording.getParameters()[0]);
}
项目:IO    文件:SelectDeviceController.java   
@Override
protected void performSetup() {
    setTitle();
    // TODO: Better loading.
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            devicesLoadingLabel.setVisible(true);
            diskListView.setCellFactory(lv -> {
                TextFieldListCell<Disk> cell = new TextFieldListCell<>();
                cell.setConverter(workflowController.getStringConverterForDisks());
                return cell;
            });
            ObservableList<Disk> disks = FXCollections.observableArrayList();
            disks.addAll(workflowController.getAvailableDisks());
            devicesLoadingLabel.setVisible(false);
            diskListView.setItems(disks);
        }});
}
项目:Gargoyle    文件:CodeAreaClipboardItemListView.java   
public CodeAreaClipboardItemListView() {

        // List<ClipboardContent> clipBoardItems = parent.getClipBoardItems();
        setCellFactory(TextFieldListCell.forListView(new StringConverter<ClipboardContent>() {

            @Override
            public String toString(ClipboardContent object) {
                return object.getString();
            }

            @Override
            public ClipboardContent fromString(String string) {
                return null;
            }
        }));
        setOnKeyPressed(this::onKeyPress);
        setOnMouseClicked(this::onMouseClick);
    }
项目:standalone-app    文件:PathEditorController.java   
@FXML
private void initialize() {
    this.list.setCellFactory(TextFieldListCell.forListView());

    List<String> path = configuration.getList(String.class, Settings.PATH_KEY, Collections.emptyList());
    this.list.getItems().addAll(path);

    stage = new Stage();
    stage.setOnCloseRequest(event -> {
        event.consume();
        stage.hide();
        this.list.getItems().removeAll(Arrays.asList(null, ""));
        configuration.setProperty(Settings.PATH_KEY, this.list.getItems());
        eventBus.post(new PathUpdatedEvent());
        pathController.reload();
    });
    stage.setScene(new Scene(root));
    stage.getIcons().add(new Image(getClass().getResourceAsStream("/res/icon.png")));
    stage.setTitle("Edit Path");
}
项目:Music-Player    文件:ControllerPlaylistList.java   
public void setNames(ObservableList<String> observableList) {
    textFiledName.setText(defaultPlaylistName);

    listNames.setEditable(true);
    listNames.setCellFactory(TextFieldListCell.forListView());
    listNames.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);

    listNames.setItems(observableList);
    listNames.getSelectionModel().selectFirst();

    textFiledName.setOnKeyReleased((event) -> {
            if (event.getCode() == KeyCode.ENTER) {
                createFile();
            }
        });
}
项目:openjfx-8u-dev-tests    文件:NewListViewApp.java   
private ComboBox getEditFactoryComboBoxChoser() {
    ComboBox<CellsApp.CellType> cb = new ComboBox<CellsApp.CellType>();
    cb.getItems().addAll(FXCollections.observableArrayList(CellsApp.CellType.values()));
    cb.setId(LIST_FACTORY_CHOICE_ID);
    cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<CellsApp.CellType>() {
        public void changed(ObservableValue<? extends CellsApp.CellType> ov, CellsApp.CellType t, CellsApp.CellType t1) {

            switch (t1) {
                case ChoiceBox:
                    testedControl.setCellFactory(ChoiceBoxListCell.forListView(new CellCustomStringConverter(), someValues));
                    break;
                case ComboBox:
                    testedControl.setCellFactory(ComboBoxListCell.forListView(new CellCustomStringConverter(), someValues));
                    break;
                case TextField:
                    testedControl.setCellFactory(TextFieldListCell.forListView(new CellCustomStringConverter()));
                    break;
                default:
                    testedControl.setCellFactory(new ListView().getCellFactory());
            }
        }
    });
    return cb;
}
项目:factoryfx    文件:ContentAssistPopupSkin.java   
public ContentAssistPopupSkin(AutoCompletePopup<String> control){
    this.control = control;
    suggestionList = new ListView<>(control.getSuggestions());

    suggestionList.getStyleClass().add(AutoCompletePopup.DEFAULT_STYLE_CLASS);

    suggestionList.getStylesheets().add(AutoCompletionBinding.class
            .getResource("autocompletion.css").toExternalForm()); //$NON-NLS-1$

    suggestionList.prefHeightProperty().bind(
            Bindings.min(control.visibleRowCountProperty(), Bindings.size(suggestionList.getItems()))
            .multiply(LIST_CELL_HEIGHT).add(18));
    suggestionList.setCellFactory(TextFieldListCell.forListView(control.getConverter()));

    suggestionList.prefWidthProperty().bind(control.prefWidthProperty());
    suggestionList.maxWidthProperty().bind(control.maxWidthProperty());
    suggestionList.minWidthProperty().bind(control.minWidthProperty());
    registerEventListener();
}
项目:standalone-app    文件:PathEditorController.java   
@FXML
private void initialize() {
    this.list.setCellFactory(TextFieldListCell.forListView());

    List<String> path = configuration.getList(String.class, Settings.PATH_KEY, Collections.emptyList());
    this.list.getItems().addAll(path);

    stage = new Stage();
    stage.setOnCloseRequest(event -> {
        event.consume();
        stage.hide();
        this.list.getItems().removeAll(Arrays.asList(null, ""));
        configuration.setProperty(Settings.PATH_KEY, this.list.getItems());
        eventBus.post(new PathUpdatedEvent());
        pathController.reload();
    });
    stage.setScene(new Scene(root));
    stage.getIcons().add(new Image(getClass().getResourceAsStream("/res/icon.png")));
    stage.setTitle("Edit Path");
}
项目:metastone    文件:BattleOfDecksConfigView.java   
public BattleOfDecksConfigView() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/BattleOfDecksConfigView.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }

    setupBehaviourBox();
    setupNumberOfGamesBox();

    selectedDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
    selectedDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    availableDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
    availableDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    addButton.setOnAction(this::handleAddButton);
    removeButton.setOnAction(this::handleRemoveButton);

    backButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU));
    startButton.setOnAction(this::handleStartButton);
}
项目:metastone    文件:CardCollectionEditor.java   
public CardCollectionEditor(String title, CardCollection cardCollection, ICardCollectionEditingListener listener, int cardLimit) {
    super("CardCollectionEditor.fxml");
    this.listener = listener;
    this.cardLimit = cardLimit;

    setTitle(title);

    editableListView.setCellFactory(TextFieldListCell.forListView(new CardStringConverter()));
    populateEditableView(cardCollection);

    catalogueListView.setCellFactory(TextFieldListCell.forListView(new CardStringConverter()));
    populateCatalogueView(null);

    filterTextfield.textProperty().addListener(this::onFilterTextChanged);
    clearFilterButton.setOnAction(actionEvent -> filterTextfield.clear());

    okButton.setOnAction(this::handleOkButton);
    cancelButton.setOnAction(this::handleCancelButton);

    addCardButton.setOnAction(this::handleAddCardButton);
    removeCardButton.setOnAction(this::handleRemoveCardButton);
}
项目:metastone    文件:TrainingConfigView.java   
public TrainingConfigView() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/TrainingConfigView.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }

    setupDeckBox();
    setupNumberOfGamesBox();

    selectedDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
    selectedDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    availableDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
    availableDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    addButton.setOnAction(this::handleAddButton);
    removeButton.setOnAction(this::handleRemoveButton);

    backButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU));
    startButton.setOnAction(this::handleStartButton);
}
项目:javafx-widgets    文件:AutoCompletePopupSkin.java   
public AutoCompletePopupSkin(AutoCompletePopup<T> control) {
  this.control = control;
  suggestionList = new ListView<T>(control.getSuggestions());
  suggestionList.getStyleClass().add(AutoCompletePopup.STYLE_CLASS);
  final URL cssUrl = AutoCompletionBinding.class.getResource(STYLE_SHEET);
  if (cssUrl != null) {
    suggestionList.getStylesheets().add(cssUrl.toExternalForm());
  } else {
    final Logger logger = LoggerFactory.getLogger(AutoCompletePopupSkin.class);
    logger.error("Failed to load the resource: {}", STYLE_SHEET);
  }

  suggestionList.prefHeightProperty().bind(
      Bindings.size(suggestionList.getItems())
              .multiply(LIST_CELL_HEIGHT)
              .add(LIST_CELL_MARGIN_BOTTOM)
  );

  suggestionList.maxHeightProperty().bind(control.maxHeightProperty());
  suggestionList.setCellFactory(
      TextFieldListCell.forListView(control.getConverter()));
  registerEventListener();
}
项目:agile    文件:NavPane.java   
@Override
public ListCell<NavItem> call(ListView<NavItem> param) {
    return new TextFieldListCell(new StringConverter<NavItem>() {

        @Override
        public String toString(NavItem object) {
            return object == null ? "null" : object.getName() + " (" + object.getCount() + ")";
        }

        @Override
        public NavItem fromString(String string) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    }) {

    };
}
项目:marathonv5    文件:TextFieldListViewSample.java   
public TextFieldListViewSample() {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
            "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
            "Row 19", "Row 20"));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listView.setEditable(true);
    listView.setCellFactory(TextFieldListCell.forListView());
    getChildren().add(listView);
}
项目:marathonv5    文件:RFXTextFieldListCell.java   
@SuppressWarnings("unchecked") @Override public String _getValue() {
    TextFieldListCell<?> cell = (TextFieldListCell<?>) node;
    @SuppressWarnings("rawtypes")
    StringConverter converter = cell.getConverter();
    if (converter != null) {
        return converter.toString(cell.getItem());
    }
    return cell.getItem().toString();
}
项目:myWMS    文件:MyWMSForm.java   
public static <T extends BasicEntity> ListView<T> createList(Class<T> elementType) {
    ListView<T> list = new ListView<>();

    @SuppressWarnings("unchecked")
    Editor<T> editor = PluginRegistry.getPlugin(elementType, Editor.class);
    if (editor == null) {
        list.setCellFactory(TextFieldListCell.forListView(ToStringConverter.of(Object::toString)));
    }
    else {
        list.setCellFactory(CellWrappers.forList(editor.createCellFactory()));
    }
    return list;
}
项目:openjfx-8u-dev-tests    文件:ListViewApp.java   
@Override
public void start(Stage stage) throws Exception {
    listView1 = new ListView();
    listView1.setId("list");
    listView1.getItems().setAll("Item 1", "Item 2", Math.PI, new Date());
    listView1.getSelectionModel().select(2);

    listView2 = new ListView<>();
    listView2.setId("records-list");
    listView2.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    for (int i = 0; i < LONG_LIST; i++) {
        listView2.getItems().add(new Record("Record " + i));
    }
    listView2.getSelectionModel().select(0);

    listView3 = new ListView<>();
    listView3.setId("countries-list");
    listView3.setEditable(true);
    listView3.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listView3.getItems().setAll("Russia", "USA", "India", "Switzerland", "Germany", "<double-click to enter your country>");
    listView3.setCellFactory(TextFieldListCell.forListView());
    listView3.getSelectionModel().select(0);

    HBox box = new HBox(10);
    //box.setPrefWrapLength(600);
    box.getChildren().add(listView1);
    box.getChildren().add(listView2);
    box.getChildren().add(listView3);

    Scene scene = new Scene(box);

    stage.setTitle("ListViewApp");
    stage.setScene(scene);
    stage.show();
}
项目:mzmine3    文件:FeatureTableColumnsEditor.java   
public FeatureTableColumnsEditor(PropertySheet.Item parameter) {

    // HBox properties
    setSpacing(10);
    setAlignment(Pos.CENTER_LEFT);

    namePatternList = new ListView<>();
    namePatternList.setEditable(true);
    namePatternList.setPrefHeight(150);
    namePatternList.setCellFactory(TextFieldListCell.forListView());

    Button addButton = new Button("Add");
    addButton.setOnAction(e -> {
      TextInputDialog dialog = new TextInputDialog();
      dialog.setTitle("Add name pattern");
      dialog.setHeaderText("New name pattern");
      Optional<String> result = dialog.showAndWait();
      result.ifPresent(value -> namePatternList.getItems().add(value));
    });

    Button removeButton = new Button("Remove");
    removeButton.setOnAction(e -> {
      List<String> selectedItems = namePatternList.getSelectionModel().getSelectedItems();
      namePatternList.getItems().removeAll(selectedItems);
    });

    VBox buttons = new VBox(addButton, removeButton);
    buttons.setSpacing(10);

    getChildren().addAll(namePatternList, buttons);
  }
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetTextFieldListCellAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(TextFieldListCell.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
项目:AsciidocFX    文件:DefaultSpellCheckLanguageFactory.java   
@Override
public FXFormNode call(Void param) {

    final ListView<Path> listView = spellcheckConfigBean.getLanguagePathList();

    listView.setCellFactory(li -> new TextFieldListCell<>(new StringConverter<Path>() {
        @Override
        public String toString(Path object) {
            return IOHelper.getPathCleanName(object);
        }

        @Override
        public Path fromString(String string) {
            return IOHelper.getPath(string);
        }
    }));

    HBox hBox = new HBox(5);
    hBox.getChildren().add(listView);

    hBox.getChildren().add(new VBox(10, languageLabel, setDefaultButton, addNewLanguageButton));
    HBox.setHgrow(listView, Priority.ALWAYS);

    listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);

    setDefaultButton.setOnAction(this::setDefaultLanguage);

    return new FXFormNodeWrapper(hBox, listView.itemsProperty());
}
项目:plep    文件:SlidingSettingsPane.java   
/**
 * Sets up the editable ListView to edit the labels/items we want to see in
 * the comboboxes on the main screen.
 */
private void addEditLabelsPane() {
    labelsList = new ListView<>();
    // first set up the listview with empty labels in order to allow editing
    ObservableList<String> itemsLabelsList = FXCollections
            .observableArrayList("", "", "", "", "");

    // get the labels from the database and store them in the listview
    ArrayList<String> labelStrings = getLabels();
    // add items starting at the top
    for (int i = 0; i < labelStrings.size(); i++) {
        itemsLabelsList.set(i, labelStrings.get(i));
    }

    // set a CellFactory on the listview to be able make the cells editable
    // using setEditable(true) isn't enough
    labelsList.setCellFactory(TextFieldListCell.forListView());
    labelsList.setEditable(true);

    // give the listview an id (FXML) so we can look it up by its id, and
    // toggle the visibility
    labelsList.setId("labelsListView");
    labelsList.setItems(itemsLabelsList);
    labelsList.setVisible(false);
    // "magik numbers" are figured out by observations
    labelsList.setPrefWidth(120);
    labelsList
            .setPrefHeight((LISTVIEW_ROW_HEIGHT * MAX_NUMBER_LABELS) + 18);

    // position the listview in the settings pane
    GridPane.setColumnIndex(labelsList, 1);
    GridPane.setRowIndex(labelsList, 0);
    GridPane.setRowSpan(labelsList, 2);

    // when editing a label in the listview, update the value
    // in the database and setup the main gridpane with the new items in the
    // comboboxes
    labelsList.setOnEditCommit(event -> {
        labelsList.getItems().set(event.getIndex(), event.getNewValue());
        updateLabel(event.getIndex(), event.getNewValue());
        controller.setupGridPane(controller.focusDay);
    });

    editLabelsPane.getChildren().add(labelsList);
}
项目:jedai-ui    文件:StringListInput.java   
/**
 * String List input constructor
 *
 * @param parameterValues List with all parameters
 * @param index           Index of the parameter that the input should use.
 * @param defaultValue    Default value for the list. Expected to be in the form "[string1, string2]" etc.
 */
public StringListInput(List<JPair<String, Object>> parameterValues, int index, String defaultValue) {
    // Create HashSet instance and add it to the parameters
    set = new HashSet<>();
    parameterValues.get(index).setRight(set);

    // Create the editable list
    ObservableList<String> stringList = FXCollections.observableArrayList();

    ListView<String> simpleList = new ListView<>(stringList);
    simpleList.setEditable(true);
    simpleList.setCellFactory(TextFieldListCell.forListView());

    simpleList.setOnEditCommit(t -> simpleList.getItems().set(t.getIndex(), t.getNewValue()));

    // Create the add/remove item buttons
    Button addBtn = new Button("Add");
    addBtn.onActionProperty().setValue(event -> stringList.add("(double click to edit)"));

    Button removeBtn = new Button("Remove last");
    removeBtn.onActionProperty().setValue(event -> {
        ObservableList<String> list = simpleList.getItems();

        // Only try to remove if list contains at least 1 item
        if (list.size() > 0) {
            list.remove(list.size() - 1);
        }
    });

    HBox addRemoveHBox = new HBox();
    addRemoveHBox.setSpacing(5);
    addRemoveHBox.setAlignment(Pos.CENTER);
    addRemoveHBox.getChildren().add(addBtn);
    addRemoveHBox.getChildren().add(removeBtn);

    // Add a listener to the string list, so when it changes we update the Set
    simpleList.getItems().addListener((ListChangeListener<String>) c -> {
        // Clear the current set's contents, and add the new ones
        set.clear();
        set.addAll(simpleList.getItems());
    });

    // Add buttons to the container
    this.setSpacing(5);
    this.getChildren().add(simpleList);
    this.getChildren().add(addRemoveHBox);

    // If there is a default value for the list, add it now
    if (!defaultValue.equals("-")) {
        // Remove first and last characters (which are expected to be square brackets)
        defaultValue = defaultValue.substring(1, defaultValue.length() - 1);

        // Split into Strings and add them to the set
        String[] strings = defaultValue.split(", ");

        // Update the list with the new strings (which also updates the HashSet because of the listener)
        simpleList.getItems().addAll(strings);
    }
}
项目:Gargoyle    文件:BigTextView.java   
@FXML
public void initialize() {
    pagination = new Pagination(TOTAL_PAGE) {
        @Override
        protected Skin<?> createDefaultSkin() {
            return new CPagenationSkin(this) {
            };
        }
    };

    pagination.setCache(true);

    pagination.setPageFactory(new Callback<Integer, Node>() {

        @Override
        public Node call(Integer param) {

            //              if (isUsePageCache && pageCache.containsKey(param)) {
            //                  SimpleTextView simpleTextView = pageCache.get(param);
            //                  if (simpleTextView != null)
            //                      return simpleTextView;
            //              }

            String readContent = readPage(param);
            SimpleTextView simpleTextView = new SimpleTextView(readContent, false);
            simpleTextView.setPrefSize(TextArea.USE_COMPUTED_SIZE, Double.MAX_VALUE);

            //              if (isUsePageCache)
            //                  pageCache.put(param, simpleTextView);

            return simpleTextView;
        }
    });
    pagination.setPrefSize(Pagination.USE_COMPUTED_SIZE, Pagination.USE_COMPUTED_SIZE);
    this.setCenter(pagination);
    //
    lvFindRslt.setCellFactory(TextFieldListCell.forListView(new StringConverter<FindModel>() {

        @Override
        public String toString(FindModel object) {
            return String.format("%d   ( Count : %d )", object.getPage() + 1, object.lines.size());
        }

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

    lvFindRslt.setOnMouseClicked(this::lvFindRsltOnMouseClick);
}
项目:Gargoyle    文件:UtubeDownloaderComposite.java   
@FXML
public void initialize() {
    btnDownload.setDisable(true);
    this.txtDownloadLocation.setText(System.getProperty("user.home"));
    this.txtDownloadLocation.setPromptText("Downlaod Location");

    // this.lvDownlaodCont.setCellFactory(new Callback<ListView<UtubeItemDVO>, ListCell<UtubeItemDVO>>() {
    //
    // @Override
    // public ListCell<UtubeItemDVO> call(ListView<UtubeItemDVO> param) {
    // return new UtubeListCell();
    // }
    // });
    // this.lvDownlaodCont.setOnDragDetected(ev -> {
    // ev.setDragDetect(true);
    // });

    txtUtubeURL.setOnDragOver(ev -> {
        if (ev.getDragboard().hasUrl()) {
            ev.acceptTransferModes(TransferMode.LINK);
            ev.consume();
        }
    });

    txtUtubeURL.setOnDragDropped(ev -> {
        Dragboard dragboard = ev.getDragboard();
        String url = dragboard.getUrl();
        txtUtubeURL.setText(url);
    });

    txtUtubeURL.textProperty().addListener((oba, o, n) -> {
        btnDownload.setDisable(n.trim().isEmpty());
    });

    // 초기값
    this.cbQuality.getItems().addAll(YoutubeQuality.values());
    // 디폴트
    this.cbQuality.getSelectionModel().select(YoutubeQuality.p480);

    this.cbQuality.setCellFactory(new Callback<ListView<YoutubeQuality>, ListCell<YoutubeQuality>>() {

        @Override
        public ListCell<YoutubeQuality> call(ListView<YoutubeQuality> param) {
            return new TextFieldListCell<>(new StringConverter<YoutubeQuality>() {

                @Override
                public String toString(YoutubeQuality object) {
                    return object.name();
                }

                @Override
                public YoutubeQuality fromString(String string) {
                    return YoutubeQuality.valueOf(string);
                }
            });
        }
    });

    this.wasDownloading.addListener((oba, o, n) -> {
        if (n != null)
            this.btnDownload.setDisable(n.booleanValue());
    });

    this.downloadedFile.addListener((oba, o, n) -> {
        if (n != null && n.exists()) {
            //              btnOpen.setDisable(false);
            this.txtFileName.setText(n.getName());
        } else {
            //              btnOpen.setDisable(true);
        }
    });
}
项目:Gargoyle    文件:SqlMappingTableViewRegister.java   
@FXML
public void initialize() {

    StringConverter<Map<String, Object>> stringConverter = new StringConverter<Map<String, Object>>() {

        @Override
        public String toString(Map<String, Object> object) {
            if (object == null)
                return "";

            Object alias = object.get("alias");
            Object url = object.get("jdbc.url");

            if (ValueUtil.isNotEmpty(alias))
                return String.format("%s (%s)", alias.toString(), url.toString());

            return url.toString();
        }

        @Override
        public Map<String, Object> fromString(String string) {
            return null;
        }
    };
    cbConnection.setConverter(stringConverter);
    cbConnection.setCellFactory(TextFieldListCell.forListView(stringConverter));

    cbConnection.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Map<String, Object>>() {

        @Override
        public void changed(ObservableValue<? extends Map<String, Object>> observable, Map<String, Object> oldValue,
                Map<String, Object> newValue) {

            if (newValue == null)
                return;

            String jdbcDriver = ConfigResourceLoader.getInstance().get("dbms." + newValue.get(ResourceLoader.DBMS.toString()));

            registConnection(jdbcDriver, newValue.get(ResourceLoader.BASE_KEY_JDBC_URL).toString(),
                    newValue.get(ResourceLoader.BASE_KEY_JDBC_ID) == null ? ""
                            : newValue.get(ResourceLoader.BASE_KEY_JDBC_ID).toString(),
                    newValue.get(ResourceLoader.BASE_KEY_JDBC_PASS) == null ? ""
                            : newValue.get(ResourceLoader.BASE_KEY_JDBC_PASS).toString());

        }
    });

}
项目:fx-log    文件:EditableListView.java   
public void setConverter(StringConverter<T> converter) {
    this.converter = converter;
    setCellFactory(TextFieldListCell.forListView(converter));
}
项目:myWMS    文件:BasicEntityEditor.java   
/**
 * Attempts to automatically assign the <code>valueEditor</code>, <code>valueViewer</code>, 
 * <code>fetchValue</code> and <code>fetchCompletions</code>
 * properties.
 * @param context
 * @param boClass
 */
public void configure(ContextBase context, Class<T> boClass) {
    try {
        Class<? extends BusinessObjectQueryRemote<T>> queryClass = BeanDirectory.getQuery(boClass);
        BusinessObjectQueryRemote<T> query = context.getBean(queryClass);
        MExecutor exec = context.getBean(MExecutor.class);
        if (getFetchCompleteions() == null) {
            setFetchCompleteions(s -> {
                QueryDetail qd = new QueryDetail(0, 100);
                qd.addOrderByToken("modified", false);
                return exec.call(() -> query.autoCompletion(s, qd));
            });
        }
        if (getFetchValue() == null) {
            setFetchValue(bto -> exec.call(() -> query.queryById(bto.getId())));
        }
    }
    catch (UndeclaredThrowableException e) {
        if (e.getUndeclaredThrowable() instanceof ClassNotFoundException) {
            log.log(Level.SEVERE, "No query bean available, not completion will be possible for " + boClass.getName());
        }
        else {
            throw e; 
        }
    }

    @SuppressWarnings("unchecked")
    Editor<T> editorPlugin = PluginRegistry.getPlugin(boClass, Editor.class);
    if (editorPlugin != null) {
        Callback<ListView<BODTO<T>>, ListCell<BODTO<T>>> cellFactory = CellWrappers.forList(editorPlugin.createTOCellFactory());
        if (cellFactory == null) cellFactory = TextFieldListCell.forListView(ToStringConverter.of(BODTO::getName));
        setCellFactory(cellFactory);
        setValueEditor(d -> editorPlugin.edit(context, boClass, d.getId()));
        setValueViewer(d -> {
            Flow flow = context.getBean(Flow.class);
            Objects.requireNonNull(flow, "Cannot find flow");
            editorPlugin.view(context, flow, boClass, d.getId());
        });
    }
    else {
        setCellFactory(TextFieldListCell.forListView(ToStringConverter.of(BODTO::getName)));
        log.warning(()->"No editor found for " + boClass.getName());
    }

}
项目:CoinJoin    文件:MainController.java   
public void onBitcoinSetup() {
     model.setWallet(bitcoin.wallet());
     addressControl.addressProperty().bind(model.addressProperty());
     balance.textProperty().bind(EasyBind.map(model.balanceProperty(), coin -> MonetaryFormat.BTC.noCode().format(coin).toString()));
     // Don't let the user click send money when the wallet is empty.
     sendMoneyOutBtn.disableProperty().bind(model.balanceProperty().isEqualTo(Coin.ZERO));

     TorClient torClient = Main.bitcoin.peerGroup().getTorClient();
     if (torClient != null) {
         SimpleDoubleProperty torProgress = new SimpleDoubleProperty(-1);
         String torMsg = "Initialising Tor";
         syncItem = Main.instance.notificationBar.pushItem(torMsg, torProgress);
         torClient.addInitializationListener(new TorInitializationListener() {
             @Override
             public void initializationProgress(String message, int percent) {
                 Platform.runLater(() -> {
                     syncItem.label.set(torMsg + ": " + message);
                     torProgress.set(percent / 100.0);
                 });
             }

             @Override
             public void initializationCompleted() {
                 Platform.runLater(() -> {
                     syncItem.cancel();
                     showBitcoinSyncMessage();
                 });
             }
         });
     } else {
         showBitcoinSyncMessage();
     }
     model.syncProgressProperty().addListener(x -> {
         if (model.syncProgressProperty().get() >= 1.0) {
             readyToGoAnimation();
             if (syncItem != null) {
                 syncItem.cancel();
                 syncItem = null;
             }
         } else if (syncItem == null) {
             showBitcoinSyncMessage();
         }
     });

     Bindings.bindContent(outputSelect.getItems(), model.getOutputs());

     outputSelect.setCellFactory(new Callback<ListView<TransactionOutput>, ListCell<TransactionOutput>>() {

@Override
public ListCell<TransactionOutput> call(
        ListView<TransactionOutput> param) {
    return new TextFieldListCell<TransactionOutput>(new StringConverter<TransactionOutput>() {

        @Override
        public String toString(TransactionOutput object) {
            return (object.getValue().toPlainString() + " BTC | " + object.getAddressFromP2PKHScript(object.getParams()));
        }

        @Override
        public TransactionOutput fromString(String string) {
            // TODO Auto-generated method stub
            return null;
        }

    });
}

     });

     destAddr = Main.bitcoin.wallet().currentReceiveAddress();
     changeAddr = Main.bitcoin.wallet().getChangeAddress();

     destination.setEditable(false);
     destination.setText(destAddr.toString());
     change.setEditable(false);
     change.setText(changeAddr.toString());

     debugInfo.setEditable(false);
     debugInfo.clear();
 }
项目:Gargoyle    文件:ResourceView.java   
@FXML
public void initialize() {

    if (data != null)
        txtFilter.setText(data.get());

    consumer = new SimpleObjectProperty<>();

    // 이벤트 리스너 등록 consumer가 변경될때마다 ResultDialog에 값을 set.
    consumer.addListener((oba, oldval, newval) -> {
        result.setConsumer(consumer.get());
    });

    resources = FXCollections.observableArrayList();

    lvResources.setCellFactory(TextFieldListCell.forListView(stringConverter()));

    /* Control + C 기능 적용 */

    lvResources.addEventHandler(KeyEvent.KEY_PRESSED, this::lvResourcesOnKeyPressed);

    // lvResources.getItems().addAll(loadClasses);

    // 자동완성기능 사용시 주석풀것
    // autoCompletionBinding = getCompletionBinding();

    txtFilter.textProperty().addListener(txtFilterChangeListener);
    txtFilter.setOnKeyPressed(this::txtFilterOnKeyPressed);

    btnReflesh.setOnMouseClicked(this::btnRefleshOnMouseClick);

    init();
    Platform.runLater(() -> {
        onInited();
    });
}
项目:jutility-javafx    文件:ListViewWrapper.java   
private void updateCellFactory() {

        this.setCellFactory((param) -> new TextFieldListCell<>(this.getConverter()));
    }