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

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

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

TableColumn.getTableView介绍

暂无

代码示例

代码示例来源: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: 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: org.jrebirth.af.showcase/todos

@Override
  public void updateItem(final String item, final boolean empty) {
    super.updateItem(item, empty);
    if (item == null || empty) {
      setText(null);
      setStyle("");
      setBackground(null);
    } else {
      setText(item);
      final Todo t = column.getTableView().getItems().get(getTableRow().getIndex());
      getStyleClass().add("todoCell");
      if (t.done()) {
        getStyleClass().removeAll("undone");
        getStyleClass().add("done");
      } else {
        getStyleClass().removeAll("done");
        getStyleClass().add("undone");
      }
    }
  }
};

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

@Override
  public void updateItem(final String item, final boolean empty) {
    super.updateItem(item, empty);
    if (item == null || empty) {
      setText(null);
      setStyle("");
      setBackground(null);
    } else {
      setText(item);
      final Todo t = column.getTableView().getItems().get(getTableRow().getIndex());
      getStyleClass().add("todoCell");
      if (t.done()) {
        getStyleClass().removeAll("undone");
        getStyleClass().add("done");
      } else {
        getStyleClass().removeAll("done");
        getStyleClass().add("undone");
      }
    }
  }
};

相关文章