Java 类javafx.util.converter.DefaultStringConverter 实例源码

项目:manami    文件:AnimeTypeCallback.java   
@Override
public TableCell<Anime, String> call(final TableColumn<Anime, String> arg0) {
    final ChoiceBoxTableCell<Anime, String> cellFactory = new ChoiceBoxTableCell<Anime, String>(new DefaultStringConverter()) {

        @Override
        public void updateItem(final String value, final boolean empty) {
            super.updateItem(value, empty);
        }
    };
    cellFactory.getItems().clear();

    for (final AnimeType element : AnimeType.values()) {
        cellFactory.getItems().add(element.getValue());
    }

    return cellFactory;
}
项目:stvs    文件:SpecificationTableCell.java   
/**
 * Create a new SpecificationTableCell with a given validator.
 * @param validator The validator for this cell
 */
public SpecificationTableCell(ConstraintSpecificationValidator validator) {
  super(new DefaultStringConverter());
  this.validator = validator;

  validator.problemsProperty().addListener(observable -> this.onProblemsChanged());
  emptyProperty().addListener(observable -> this.onProblemsChanged());
  getStyleClass().add("spec-cell");
  ViewUtils.setupClass(this);
  onProblemsChanged();
}
项目:stvs    文件:VariableCollectionController.java   
private TableCell<FreeVariable, String> cellFactory(
        TableColumn<FreeVariable, String> tableColumn) {
    return new TextFieldTableCell<FreeVariable, String>(new DefaultStringConverter()) {
        {
            validator.problemsProperty().addListener((Observable o) -> onProblemsChanged());
            getStyleClass().add("freevar");
            onProblemsChanged();
        }

        private void configureProblematic(String tooltip) {
            getStyleClass().remove("freevar-problem");
            getStyleClass().add("freevar-problem");
            setTooltip(new Tooltip(tooltip));
        }

        private void configureUnproblematic() {
            getStyleClass().remove("freevar-problem");
            setTooltip(null);
        }

        @Override
        public void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            onProblemsChanged();
        }

        private void onProblemsChanged() {
            if (!isEmpty()) {
                List<FreeVariableProblem> problems = validator.problemsProperty().get()
                        .getOrDefault(getTableRow().getItem(), Collections.emptyList());
                if (problems.isEmpty()) {
                    configureUnproblematic();
                } else {
                    configureProblematic(String.join("\n\n", problems.stream()
                            .map(FreeVariableProblem::getGuiMessage).collect(Collectors.toList())));
                }
            }
        }
    };
}
项目:manami    文件:DefaultCallback.java   
@Override
public TableCell<Anime, String> call(final TableColumn<Anime, String> column) {
    return new TextFieldTableCell<Anime, String>(new DefaultStringConverter()) {

        @Override
        public void updateItem(final String value, final boolean empty) {
            super.updateItem(value, empty);
        }
    };
}
项目:ownNoteEditor    文件:OwnNoteTableColumn.java   
public ObjectCell(final OwnNoteEditor ownNoteEditor,
        final OwnNoteTableColumn ownNoteTableColumn, 
        final boolean linkCursor, 
        final EventHandler<MouseEvent> mouseEvent) {
    super(new DefaultStringConverter());
    myOwnNoteEditor = ownNoteEditor;
    myOwnNoteTableColumn = ownNoteTableColumn;

    if (linkCursor) {
        this.setCursor(Cursor.HAND);
    }

    this.addEventFilter(MouseEvent.MOUSE_CLICKED, mouseEvent);
}
项目:iTagPlot    文件:QuantityFormController.java   
@Override
public TableCell<ObservableList<StringProperty>,String> call(TableColumn<ObservableList<StringProperty>,String> param) {
    return new TextFieldTableCell<ObservableList<StringProperty>, String>(( new DefaultStringConverter() )) {
    @Override
    public void updateItem(String s, boolean b) {
        super.updateItem(s, b);
        TableRow row = getTableRow();
        if (row != null && (row.getIndex()+1 == this.getTableView().getItems().size()) || (cutoff && row != null && row.getIndex() == 0)) {
        setDisable(true);
        setEditable(false);
        this.setStyle("-fx-text-fill: grey");
        }
    }
    };
}
项目:CloudTrailViewer    文件:WarningCellFactory.java   
private TextFieldTableCell<WarningCell, String> createTableCell(TableColumn<WarningCell, String> col) {

        TextFieldTableCell<WarningCell, String> cell = new TextFieldTableCell<WarningCell, String>(new DefaultStringConverter()) {

            @Override
            public void updateItem(String arg0, boolean empty) {

                this.setEditable( true );

                super.updateItem(arg0, empty);

                if( !empty ) {
                    this.setText( arg0 );
                    WarningCell warnableObject = (WarningCell) this.getTableRow().getItem();

                    if( warnableObject != null && warnableObject.displayWarning(colIndex) ) {
                        this.setStyle(wrongStyle);

                    } else {
                        this.setStyle(normalStyle);
                    }
                } else {
                    this.setText( null );  // clear from recycled obj
                    this.setStyle(normalStyle);
                }
            }
        };

        return cell;
    }
项目:AsciidocFX    文件:TableFactory.java   
@Override
public FXFormNode call(Void param) {
    tableView.setEditable(true);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    return new FXFormNodeWrapper(new VBox(3, tableView, new HBox(5, addButton, removeButton)), tableView.itemsProperty()) {
        @Override
        public void init(Element element) {
            Class wrappedType = element.getWrappedType();
            List<Field> fields = ReflectionUtils.listFields(wrappedType);
            for (Field field : fields) {
                TableColumn col = new TableColumn(field.getName());
                col.setCellValueFactory(new PropertyValueFactory(field.getName()));
                col.setCellFactory(list -> new TextFieldTableCell(new DefaultStringConverter()));

                tableView.getColumns().add(col);

            }

            addButton.setOnAction(event -> {
                try {
                    tableView.getItems().add(element.getWrappedType().newInstance());
                    tableView.edit(tableView.getItems().size() - 1, (TableColumn) tableView.getColumns().get(0));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            });

            removeButton.setOnAction(event -> {
                tableView.getItems().removeAll(tableView.getSelectionModel().getSelectedItems());
            });
        }
    };
}
项目:SnapDup    文件:TableDeviceLocationCellFactory.java   
@Override
public TableCell<T, String> call(TableColumn<T, String> param)
{
    return new TextFieldTableCell<>(new DefaultStringConverter());
}
项目:DeskChan    文件:OptionsDialog.java   
public static <S> Callback<TableColumn<S, String>, TableCell<S, String>> forTableColumn() {
    return forTableColumn(new DefaultStringConverter());
}
项目:opc-ua-client    文件:AttributeItemCellFactory.java   
public AttributeItemCellFactory() {
  converter = new DefaultStringConverter();
}
项目:arma-intellij-plugin    文件:IndexArmaAddonsStatusDialog.java   
public WrappingTextFieldTableCell() {
    super(new DefaultStringConverter());
    this.cellText = createText();
}
项目:bktail2    文件:HighlightingController.java   
public HighLightingTextCell() {
    super(new DefaultStringConverter());
    defaultStyle = getStyle();
}
项目:story-inspector    文件:StringSetControl.java   
private StringCell() {
    super(new DefaultStringConverter());
}
项目:arma-intellij-plugin    文件:IndexArmaAddonsStatusDialog.java   
public WrappingTextFieldTableCell() {
    super(new DefaultStringConverter());
    this.cellText = createText();
}
项目:org.csstudio.display.builder    文件:StringTable.java   
public StringTextCell()
{
    super(new DefaultStringConverter());
}
项目:SurePulseDataProcessor    文件:EditCell.java   
public static < S > Callback < TableColumn < S,
String > ,
TableCell < S,
String >> forTableColumn() {
    return forTableColumn(new DefaultStringConverter());
}
项目:lawless-legends    文件:SheetEditorControllerImpl.java   
private void insertViewColumn(UserType col, int pos) {
    if (pos < 0) {
        pos = table.getColumns().size();
    }
    TableColumn<Row, String> tableCol = new TableColumn<>(col.getName());
    tableCol.setCellValueFactory((features) -> {
        String val = getValue(features.getValue().getOtherAttributes(), col.getName());
        if (val == null) {
            val = "";
        }
        return new SimpleObjectProperty(val);
    });

    tableCol.setCellFactory((TableColumn<Row, String> param) -> {
        TextFieldTableCell<Row, String> myCell = new TextFieldTableCell<Row, String>(new DefaultStringConverter()) {
            @Override
            /**
             * Patch behavior so that any change is immediately persisted,
             * enter is not required.
             */
            public void startEdit() {
                super.startEdit();
                TextField textField = (TextField) getGraphic();
                textField.textProperty().addListener((p, o, n) -> {
                    setItem(n);
                    int index = this.getTableRow().getIndex();
                    Row row = tableData.get(index);
                    setValue(row.getOtherAttributes(), col.getName(), n);
                });
            }
        };
        return myCell;
    });

    tableCol.setOnEditCommit((event) -> {
        table.requestFocus();
        table.getSelectionModel().clearSelection();
    });
    tableCol.setEditable(true);
    tableCol.setContextMenu(new ContextMenu(
            createMenuItem("Rename Column", () -> renameColumn(col)),
            createMenuItem("Delete Column", () -> deleteColumnWithConfirmation(col))
    ));
    table.getColumns().add(pos, tableCol);
}
项目:Omoikane    文件:TraspasoSalienteController.java   
public ImprovedTableCell(Class<S> impl) {
    this(impl, (StringConverter<T>) new DefaultStringConverter());
}
项目:Omoikane    文件:TomaInventarioController.java   
public ImprovedTableCell(Class<S> impl) {
    this(impl, (StringConverter<T>) new DefaultStringConverter());
}
项目:Omoikane    文件:TraspasoEntranteController.java   
public ImprovedTableCell(Class<S> impl) {
    this(impl, (StringConverter<T>) new DefaultStringConverter());
}
项目:MiscellaneousStudy    文件:EditableTreeViewController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {

    // ルートの子要素を作成
    TreeItem<String> item1 = new TreeItem<String>("Item 1");
    TreeItem<String> item2 = new TreeItem<String>("Item 2");
    TreeItem<String> item3 = new TreeItem<String>("Item 3");
    TreeItem<String> item4 = new TreeItem<String>("Item 4");

    // item4 の子要素
    TreeItem<String> item41 = new TreeItem<String>("Item 4-1");
    TreeItem<String> item42 = new TreeItem<String>("Item 4-2");
    TreeItem<String> item43 = new TreeItem<String>("Item 4-3");

    // item4 に子要素を追加する
    ObservableList<TreeItem<String>> image4tChildren =
            item4.getChildren();
    image4tChildren.add(item41);
    image4tChildren.add(item42);
    image4tChildren.add(item43);

    TreeItem<String> root = new TreeItem<String>("root");
    treeView.setRoot(root);

    // ルート要素に子要素を追加する
    ObservableList<TreeItem<String>> rootChildren =
            root.getChildren();
    rootChildren.add(item1);
    rootChildren.add(item2);
    rootChildren.add(item3);
    rootChildren.add(item4);

    // 子を持つノードを開く
    root.setExpanded(true);
    item4.setExpanded(true);

    // 編集可能にする
    treeView.setEditable(true);
    treeView.setCellFactory(
            (TreeView<String> p) -> {
                TextFieldTreeCell<String> cell = new TextFieldTreeCell<String>();

                // 編集した文字列を、
                // セルが持つデータに反映させるロジックを指定。
                // 今回はテキストフィールドに入力した文字列を
                // そのままセルが持つデータとして使うので、
                // DefaultStringConverter を使用。
                cell.setConverter(new DefaultStringConverter());
                return cell;
            });
}
项目:stvs    文件:AdvancedTextFieldTableCell.java   
/**
 * Provides a {@link TextField} that allows editing of the cell content when
 * the cell is double-clicked, or when
 * {@link TableView#edit(int, javafx.scene.control.TableColumn)} is called.
 * This method will only  work on {@link TableColumn} instances which are of
 * type String.
 *
 * @return A {@link Callback} that can be inserted into the
 * {@link TableColumn#cellFactoryProperty() cell factory property} of a
 * TableColumn, that enables textual editing of the content.
 */
public static <S> Callback<TableColumn<S, String>, TableCell<S, String>> forTableColumn() {
  return forTableColumn(new DefaultStringConverter());
}
项目:AsciidocFX    文件:TextFieldTableCell.java   
/**
 * Provides a {@link TextField} that allows editing of the cell content when
 * the cell is double-clicked, or when
 * {@link TableView#edit(int, javafx.scene.control.TableColumn)} is called.
 * This method will only  work on {@link TableColumn} instances which are of
 * type String.
 *
 * @return A {@link Callback} that can be inserted into the
 * {@link TableColumn#cellFactoryProperty() cell factory property} of a
 * TableColumn, that enables textual editing of the content.
 */
public static <S> Callback<TableColumn<S, String>, TableCell<S, String>> forTableColumn() {
    return forTableColumn(new DefaultStringConverter());
}
项目:Omoikane    文件:TextFieldTableCell.java   
/**
 * Provides a {@link TextField} that allows editing of the cell content when
 * the cell is double-clicked, or when
 * {@link TableView#edit(int, javafx.scene.control.TableColumn)} is called.
 * This method will only  work on {@link TableColumn} instances which are of
 * type String.
 *
 * @return A {@link Callback} that can be inserted into the
 *      {@link TableColumn#cellFactoryProperty() cell factory property} of a
 *      TableColumn, that enables textual editing of the content.
 */
public static <S> Callback<TableColumn<S,String>, TableCell<S,String>> forTableColumn() {
    return forTableColumn(new DefaultStringConverter());
}