javafx.scene.control.TableColumn.setEditable()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中javafx.scene.control.TableColumn.setEditable()方法的一些代码示例,展示了TableColumn.setEditable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableColumn.setEditable()方法的具体详情如下:
包路径:javafx.scene.control.TableColumn
类名称:TableColumn
方法名:setEditable

TableColumn.setEditable介绍

暂无

代码示例

代码示例来源:origin: torakiki/pdfsam

@Override
public TableColumn<SelectionTableRowData, String> getTableColumn() {
  TableColumn<SelectionTableRowData, String> tableColumn = SelectionTableColumn.super.getTableColumn();
  tableColumn.setEditable(true);
  tableColumn.setOnEditCommit(t -> t.getTableView().getItems().get(t.getTablePosition().getRow()).pace
      .set(defaultIfBlank(t.getNewValue(), "1")));
  return tableColumn;
}

代码示例来源:origin: torakiki/pdfsam

@Override
public TableColumn<SelectionTableRowData, String> getTableColumn() {
  TableColumn<SelectionTableRowData, String> tableColumn = SelectionTableColumn.super.getTableColumn();
  tableColumn.setEditable(true);
  tableColumn.setOnEditCommit(
      t -> t.getTableView().getItems().get(t.getTablePosition().getRow()).pageSelection.set(t.getNewValue()));
  return tableColumn;
}

代码示例来源:origin: org.tentackle/tentackle-fx

@Override
public void configure(FxTableView<S> table) {
 table.getColumns().clear();
 boolean tableEditable = false;
 for (TableColumnConfiguration<S,?> config: nameColumnConfigMap.values()) {
  boolean columnEditable = config.isEditable();
  tableEditable |= columnEditable;
  TableColumn<S,?> column = config.getTableColumn();
  column.setEditable(columnEditable);
  table.getColumns().add(column);
 }
 table.setEditable(tableEditable);
 table.getSelectionModel().cellSelectionEnabledProperty().set(tableEditable);
 table.setConfiguration(this);
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

public static <T> void setupEditableBooleanColumn(TableColumn<T, Boolean> column, final ColumnBooleanAccessor<T> propertyAccessor) {
  column.getTableView().setEditable(true);
  column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<T, Boolean>, ObservableValue<Boolean>>() {
    @Override
    public ObservableValue<Boolean> call(CellDataFeatures<T, Boolean> param) {
      return propertyAccessor.getProperty(param.getValue());
    }
  });
  column.setOnEditCommit(new EventHandler<CellEditEvent<T, Boolean>>() {
    @Override
    public void handle(CellEditEvent<T, Boolean> t) {
      propertyAccessor.getProperty(t.getRowValue()).setValue(t.getNewValue());
    }
  });
  column.setCellFactory(CheckBoxTableCell.forTableColumn(column));
  column.setEditable(true);
}

代码示例来源:origin: io.datafx/crud

public static <T> List<TableColumn<T, ?>> createColumns(Class<T> entityType, ExceptionHandler exceptionHandler) {
    List<TableColumn<T, ?>> columns = new ArrayList<>();
    for (Field field : entityType.getDeclaredFields()) {

      ViewColumn columnAnnotation = field.getAnnotation(ViewColumn.class);

      if (columnAnnotation != null) {
        TableColumn<T, ?> column = new TableColumn<>();
        column.setText(columnAnnotation.value());
        column.setEditable(columnAnnotation.editable());
        column.setSortable(columnAnnotation.sortable());
        column.setResizable(columnAnnotation.resizeable());
        column.setCellValueFactory(e -> {
          try {
            return new SimpleObjectProperty(DataFXUtils.getPrivileged(field, e.getValue()));
          } catch (Exception exception) {
            exceptionHandler.setException(exception);
            return null;
          }
        });
        columns.add(column);
      }
    }
    return columns;
  }
}

代码示例来源:origin: org.javafxdata/datafx-crud

public static <T> List<TableColumn<T, ?>> createColumns(Class<T> entityType, ExceptionHandler exceptionHandler) {
    List<TableColumn<T, ?>> columns = new ArrayList<>();
    for (Field field : entityType.getDeclaredFields()) {

      ViewColumn columnAnnotation = field.getAnnotation(ViewColumn.class);

      if (columnAnnotation != null) {
        TableColumn<T, ?> column = new TableColumn<>();
        column.setText(columnAnnotation.value());
        column.setEditable(columnAnnotation.editable());
        column.setSortable(columnAnnotation.sortable());
        column.setResizable(columnAnnotation.resizeable());
        column.setCellValueFactory(e -> {
          try {
            return new SimpleObjectProperty(DataFXUtils.getPrivileged(field, e.getValue()));
          } catch (Exception exception) {
            exceptionHandler.setException(exception);
            return null;
          }
        });
        columns.add(column);
      }
    }
    return columns;
  }
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

/**
 * T Tableobject
 * Column Display Type
 */
public static <T> void setupEditableStringColumn(TableColumn<T, String> column, final ColumnStringAccessor<T> propertyAccessor) {
  column.getTableView().setEditable(true);
  column.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<T, String>, ObservableValue<String>>() {
    @Override
    public ObservableValue<String> call(CellDataFeatures<T, String> param) {
      return propertyAccessor.getProperty(param.getValue());
    }
  });
  column.setEditable(true);
  column.setOnEditCommit(new EventHandler<CellEditEvent<T, String>>() {
    @Override
    public void handle(CellEditEvent<T, String> t) {
      propertyAccessor.getProperty(t.getRowValue()).setValue(t.getNewValue());
    }
  });
  column.setCellFactory(new Callback<TableColumn<T, String>, TableCell<T, String>>() {
    @Override
    public TableCell<T, String> call(TableColumn<T, String> param) {
      return new EditingCell<T>();
    }
  });
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

c.setEditable(true);
return c;

代码示例来源:origin: com.aquafx-project/aquafx

lastNameCol.setEditable(true);
lastNameCol.setCellFactory(TextFieldTableCell.forTableColumn());
lastNameCol.setOnEditCommit(new EventHandler<CellEditEvent<Person, String>>() {
vipCol.setEditable(true);
vipCol.setCellFactory(CheckBoxTableCell.forTableColumn(vipCol));
final Callback<TableColumn<Person, Boolean>, TableCell<Person, Boolean>> cellFactory = CheckBoxTableCell.forTableColumn(vipCol);

代码示例来源:origin: com.aquafx-project/aquafx

lastNameCol.setEditable(true);
lastNameCol.setCellFactory(TextFieldTableCell.forTableColumn());
lastNameCol.setOnEditCommit(new EventHandler<CellEditEvent<Person, String>>() {
vipCol.setEditable(true);
vipCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, Boolean>, ObservableValue<Boolean>>() {

代码示例来源:origin: org.jrebirth.af.showcase/todos

textColumn.setPrefWidth(200);
textColumn.setMinWidth(100);
textColumn.setEditable(true);
textColumn.setCellValueFactory(this::getColumnContent);
textColumn.setCellFactory(this::getTableCell);

代码示例来源:origin: org.jrebirth.af.showcase/todos

textColumn.setPrefWidth(200);
textColumn.setMinWidth(100);
textColumn.setEditable(true);
textColumn.setCellValueFactory(this::getColumnContent);
textColumn.setCellFactory(this::getTableCell);

相关文章