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

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

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

TableColumn.setText介绍

暂无

代码示例

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

public TableViewFactory<S> renameColumn(String oldName, String newName) {
  if (oldName == null || oldName.isEmpty() || newName == null || newName.isEmpty()) {
    return this;
  }
  for (int i = 0; i < columns.size(); i++) {
    TableColumn<S,?> tc = columns.get(i);
    if (oldName.equals(tc.getText())) {
      tc.setText(newName);
      break;
    }
  }
  return this;
}

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

public TableViewFactory<S> renameColumn(String oldName, String newName) {
  if (oldName == null || oldName.isEmpty() || newName == null || newName.isEmpty()) {
    return this;
  }
  for (int i = 0; i < columns.size(); i++) {
    TableColumn<S,?> tc = columns.get(i);
    if (oldName.equals(tc.getText())) {
      tc.setText(newName);
      break;
    }
  }
  return this;
}

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

public TableViewFactory<S> renameColumn(String oldName, String newName) {
  if (oldName == null || oldName.isEmpty() || newName == null || newName.isEmpty()) {
    return this;
  }
  for (int i = 0; i < columns.size(); i++) {
    TableColumn<S,?> tc = columns.get(i);
    if (oldName.equals(tc.getText())) {
      tc.setText(newName);
      break;
    }
  }
  return this;
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

private static void updateLabeled(@Nonnull final TableColumn<?, ?> node, @Nonnull final GriffonApplication application) {
  runInsideUIThread(() -> {
    String key = getI18nKey(node);
    String args = getI18nArgs(node);
    String defaultValue = getI18nDefaultValue(node);
    Object[] argArray = isBlank(args) ? EMPTY_OBJECT_ARRAY : args.split(",");
    if (isBlank(defaultValue)) {
      node.setText(application.getMessageSource().getMessage(key, argArray, application.getLocale()));
    } else {
      node.setText(application.getMessageSource().getMessage(key, argArray, application.getLocale(), defaultValue));
    }
  });
}

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

column.setText(displayName);
column.setCellValueFactory(new PropertyValueFactory(pd.getName()));
columns.add(column);

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

public void editReadOnly(ReferenceListAttribute<T,?> attribute){
  final Data oldData = dataEditor.editData().get();
  dataView = new ReferenceAttributeDataView<>(attribute);
  tableView.setItems(dataView.dataList());
  if (oldData!=null){
    attribute.stream().filter(d->d.idEquals(oldData)).findAny().ifPresent(dataEditor::edit);
  }
  tableView.getStyleClass().remove("hidden-tableview-headers");
  column.setText(uniformDesign.getLabelText(attribute));
}

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

/**
 * Create a column
 *
 * @param label
 *            the label
 * @param prefWidth
 *            the preferred width
 * @param valueExtractor
 *            function to extract the value
 * @return the column instance
 */
public static <S, T> TableColumn<S, T> createColumn(String label, double prefWidth, Function<S, T> valueExtractor) {
  TableColumn<S, T> c = new TableColumn<>();
  c.setText(label);
  c.setPrefWidth(prefWidth);
  c.setCellValueFactory(f -> new SimpleObjectProperty<>(valueExtractor.apply(f.getValue())));
  return c;
}

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

column.setText(displayName);
column.setCellValueFactory(new PropertyValueFactory(pd.getName()));
columns.add(column);

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

column.setText(displayName);
column.setCellValueFactory(new PropertyValueFactory(pd.getName()));
columns.add(column);

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

@Override
public void showFilteredResult(List<SqlResultModel> filteredResult, SqlFilterModel usedFilter) {
  resultTable.getColumns().clear();
  if (!filteredResult.isEmpty()) {
    for (int i = 0; i < filteredResult.get(0).rows.size(); i++) {
      TableColumn<SqlResultModel, String> rowColumn = new TableColumn<SqlResultModel, String>();
      rowColumn.setText(filteredResult.get(0).rows.get(i).get());
      final int rowIndex = i;
      rowColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<SqlResultModel, String>, ObservableValue<String>>() {
        @Override
        public ObservableValue<String> call(CellDataFeatures<SqlResultModel, String> param) {
          return param.getValue().rows.get(rowIndex);
        }
      });// -3 for the border
      rowColumn.prefWidthProperty().bind(resultTable.widthProperty().subtract(3).divide(filteredResult.get(0).rows.size()));
      resultTable.getColumns().add(rowColumn);
    }
    ObservableList<SqlResultModel> content = FXCollections.observableArrayList();
    content.addAll(filteredResult);
    content.remove(0);
    setOriginalItems(resultTable, content);
  }
}

代码示例来源: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: 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: com.aquafx-project/aquafx

firstNameCol.setText("First");
lastNameCol = new TableColumn<Person, String>();
lastNameCol.setGraphic(graphic1);
lastNameCol.setText("Last");
lastNameCol.setSortType(TableColumn.SortType.DESCENDING);
lastNameCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {
nameCol.setText("Name");
nameCol.getColumns().addAll(firstNameCol, lastNameCol);
emailCol = new TableColumn<Person, String>();
emailCol.setText("Email");
emailCol.setMinWidth(200);
emailCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {
countryCol.setText("Country");
countryCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {
  public ObservableValue<String> call(TableColumn.CellDataFeatures<Person, String> p) {
invitedCol.setText("Invited");
invitedCol.setPrefWidth(55);
invitedCol.setMaxWidth(55);

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

nameCol.setText("Name");
nameCol.setCellValueFactory(new PropertyValueFactory<Person,String>("name"));
emailCol = new TableColumn<Person, String>();
emailCol.setText("Email");
emailCol.setMinWidth(200);
emailCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {
countryCol.setText("Country");
countryCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {
  public ObservableValue<String> call(TableColumn.CellDataFeatures<Person, String> p) {

相关文章