当前位置: 首页>>代码示例>>Java>>正文


Java TableCell类代码示例

本文整理汇总了Java中javafx.scene.control.TableCell的典型用法代码示例。如果您正苦于以下问题:Java TableCell类的具体用法?Java TableCell怎么用?Java TableCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TableCell类属于javafx.scene.control包,在下文中一共展示了TableCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPoint

import javafx.scene.control.TableCell; //导入依赖的package包/类
public Point2D getPoint(TableView<?> tableView, int columnIndex, int rowIndex) {
    Set<Node> tableRowCell = tableView.lookupAll(".table-row-cell");
    TableRow<?> row = null;
    for (Node tableRow : tableRowCell) {
        TableRow<?> r = (TableRow<?>) tableRow;
        if (r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".table-cell");
    for (Node node : cells) {
        TableCell<?, ?> cell = (TableCell<?, ?>) node;
        if (tableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) {
            Bounds bounds = cell.getBoundsInParent();
            Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2);
            Point2D rowLocal = row.localToScene(localToParent, true);
            return rowLocal;
        }
    }
    return null;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:JavaFXElementPropertyAccessor.java

示例2: call

import javafx.scene.control.TableCell; //导入依赖的package包/类
@Override
public TableCell call(TableColumn p) {
    return new TableCell<Object, String>() {
        private final ImageView imageview;

        {
            imageview = new ImageView();
            imageview.setFitHeight(16);
            imageview.setFitWidth(16);
            imageview.setCache(true);
        }

        @Override
        protected void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            if (empty) {
                setText(null);
                setGraphic(null);
            } else {
                imageview.setImage(new Image(item));
                setGraphic(imageview);
            }
        }
    };
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:26,代码来源:PacketTableView.java

示例3: createWrappableTableCell

import javafx.scene.control.TableCell; //导入依赖的package包/类
/**
 * Creates a wrapped table cell.
 *
 * @param column the table column in which the cell resides
 * @return a TableCell with the text wrapped inside
 */
private TableCell<Annotation, String> createWrappableTableCell(final TableColumn<Annotation, String> column) {
    return new TableCell<Annotation, String>() {
        @Override
        protected void updateItem(final String item, final boolean empty) {
            super.updateItem(item, empty);
            if (item == null || empty) {
                setGraphic(null);
                return;
            }

            final Text text = new Text(item);
            text.setWrappingWidth(column.getWidth() - TEXT_PADDING);
            setPrefHeight(text.getLayoutBounds().getHeight());

            setGraphic(text);
        }
    };
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:25,代码来源:AnnotationController.java

示例4: wrappableTableCell

import javafx.scene.control.TableCell; //导入依赖的package包/类
/**
 * Create a table cell that wraps the text inside.
 *
 * @param param the table column
 * @return a table cell that wraps the text inside
 */
TableCell<Annotation, String> wrappableTableCell(final TableColumn<Annotation, String> param) {
    return new TableCell<Annotation, String>() {
        @Override
        protected void updateItem(final String item, final boolean empty) {
            super.updateItem(item, empty);
            if (item == null || empty) {
                setGraphic(null);
                return;
            }
            final Text text = new Text(item);
            text.setWrappingWidth(param.getWidth());
            setPrefHeight(text.getLayoutBounds().getHeight());
            setGraphic(text);
        }
    };
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:23,代码来源:NodePropertiesController.java

示例5: getVisibleCellAt

import javafx.scene.control.TableCell; //导入依赖的package包/类
public TableCell<?, ?> getVisibleCellAt(TableView<?> tableView, int row, int column) {
    Set<Node> lookupAll = getTableCells(tableView);
    TableCell<?, ?> cell = null;
    for (Node node : lookupAll) {
        TableCell<?, ?> cell1 = (TableCell<?, ?>) node;
        TableRow<?> tableRow = cell1.getTableRow();
        TableColumn<?, ?> tableColumn = cell1.getTableColumn();
        if (tableRow.getIndex() == row && tableColumn == tableView.getColumns().get(column)) {
            cell = cell1;
            break;
        }
    }
    if (cell != null) {
        return cell;
    }
    return null;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:JavaFXElementPropertyAccessor.java

示例6: _getValue

import javafx.scene.control.TableCell; //导入依赖的package包/类
@Override public String _getValue() {
    TableCell<?, ?> cell = (TableCell<?, ?>) node;
    Node graphic = cell.getGraphic();
    JavaFXElement component = (JavaFXElement) JavaFXElementFactory.createElement(graphic, driver, window);
    if (graphic != null && component != null) {
        if (graphic instanceof CheckBox) {
            String cellText = cell.getText() == null ? "" : cell.getText();
            return cellText + ":" + component._getValue();
        }
        return component._getValue();
    }
    return super._getValue();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JavaFXTableViewCellElement.java

示例7: addGroupParticipantList

import javafx.scene.control.TableCell; //导入依赖的package包/类
/** Add participant in group list */
public void addGroupParticipantList() {
	Platform.runLater(() -> {
		groupParticipantTable.setItems(groupParticipantList);

		// Nickname column setting
		groupPartiNicknameColumn.setCellValueFactory(cellData -> cellData.getValue().getNameProperty());
		groupPartiNicknameColumn.setCellFactory(new Callback<TableColumn<User, String>, TableCell<User, String>>() {
			@Override
			public TableCell<User, String> call(TableColumn<User, String> column) {
				TableCell<User, String> tc = new TableCell<User, String>() {
					@Override
					public void updateItem(String item, boolean empty) {
						if (item != null) {
							setText(item);
						}
					}
				};
				tc.setAlignment(Pos.CENTER);
				return tc;
			}
		});
	});
}
 
开发者ID:Team-Sprout,项目名称:Clipcon-Client,代码行数:25,代码来源:MainScene.java

示例8: forImage

import javafx.scene.control.TableCell; //导入依赖的package包/类
public static final <S> TableCell<S, Image> forImage() {
    final ImageView imageView = new ImageView();
    {
        imageView.setFitWidth(ItemSlot.SLOT_SIZE);
        imageView.setFitHeight(ItemSlot.SLOT_SIZE);
    }
    return new TableCell<S, Image>() {
        @Override
        protected void updateItem(Image item, boolean empty) {
            super.updateItem(item, empty);

            if (empty) {
                setText(null);
                setGraphic(null);
            } else {
                imageView.setImage(item);
                setGraphic(imageView);
            }
        }
    };
}
 
开发者ID:stechy1,项目名称:drd,代码行数:22,代码来源:CellUtils.java

示例9: integerCell

import javafx.scene.control.TableCell; //导入依赖的package包/类
private <T> Callback<TableColumn<T, Number>, TableCell<T, Number>> integerCell(
        Predicate<Integer> validator, int defaultValue) {
    return TextFieldTableCell.forTableColumn(new StringConverter<Number>() {
        @Override
        public String toString(Number object) {
            if (object == null) {
                return null;
            }
            return object.toString();
        }

        @Override
        public Number fromString(String string) {
            try {
                int value = Integer.parseInt(string);
                if (validator.test(value)) {
                    return value;
                } else {
                    return defaultValue;
                }
            } catch (NumberFormatException e) {
                return defaultValue;
            }
        }
    });
}
 
开发者ID:yuriy-budiyev,项目名称:population,代码行数:27,代码来源:PrimaryController.java

示例10: initialize

import javafx.scene.control.TableCell; //导入依赖的package包/类
@FXML
private void initialize() {
    distanceColumn.setCellValueFactory(cell -> cell.getValue().distanceProperty());
    distanceColumn.setCellFactory(param -> new TableCell<StellarObjectModel, Number>() {
        @Override
        protected void updateItem(Number item, boolean empty) {
            if (item != null) {
                NumberFormat formatter = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
                setText(formatter.format(item));
            }
        }
    });
    nameColumn.setCellValueFactory(cell -> cell.getValue().nameProperty());
    raColumn.setCellValueFactory(cell -> cell.getValue().rightAscensionProperty());
    decColumn.setCellValueFactory(cell -> cell.getValue().declinationProperty());
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:17,代码来源:StellarObjectTableController.java

示例11: buildThreadListGraphic

import javafx.scene.control.TableCell; //导入依赖的package包/类
protected TextFlow buildThreadListGraphic(final TableCell<ThreadElement, Set<ThreadElement>> cell, final Set<ThreadElement> threads) {
    final TextFlow threadsGraphic = new TextFlow();
    threadsGraphic.setPrefHeight(20);

    final Iterator<ThreadElement> threadIterator = threads.iterator();
    while (threadIterator.hasNext()) {
        final ThreadElement thread = threadIterator.next();

        threadsGraphic.getChildren().add(buildThreadLink(cell, thread));

        if (threadIterator.hasNext()) {
            threadsGraphic.getChildren().add(buildThreadSeparator());
        }
    }
    return threadsGraphic;
}
 
开发者ID:twasyl,项目名称:jstackfx,代码行数:17,代码来源:ThreadListCellFactory.java

示例12: checkTextContainment

import javafx.scene.control.TableCell; //导入依赖的package包/类
protected void checkTextContainment(final Wrap<? extends TableCell> cellWrap, final String textExpectToFind) {
    new Waiter(new Timeout("", 1000)).ensureState(new State() {
        public Object reached() {
            LookupCriteria<Node> lookupCriteria = new LookupCriteria<Node>() {
                public boolean check(Node cntrl) {
                    return Text.class.isAssignableFrom(cntrl.getClass())
                            || ((Text) cntrl).getText().equals(textExpectToFind);
                }
            };

            if (cellWrap.as(Parent.class, Node.class).lookup(Text.class, new ByText(textExpectToFind)).size() == 1) {
                return true;
            } else if (cellWrap.as(Parent.class, Node.class).lookup(lookupCriteria).size() == 1) {
                return true;
            } else {
                return null;
            }

        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:TableViewNewTest.java

示例13: getVisibleRange

import javafx.scene.control.TableCell; //导入依赖的package包/类
protected static Range getVisibleRange(final Wrap<? extends Control> testedControl) {
    int[] visibleIndices;

    if (testedControl.getControl() instanceof TableView) {
        visibleIndices = org.jemmy.fx.control.TableUtils.shown(
                testedControl.getEnvironment(),
                testedControl,
                new org.jemmy.fx.control.TableUtils.TableViewIndexInfoProvider((TableViewWrap) testedControl), TableCell.class);
    } else {
        visibleIndices = org.jemmy.fx.control.TableUtils.shown(
                testedControl.getEnvironment(),
                testedControl,
                new org.jemmy.fx.control.TableUtils.TreeTableViewIndexInfoProvider((TreeTableViewWrap) testedControl), TreeTableCell.class);
    }

    return new Range(visibleIndices[1], visibleIndices[3]);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:18,代码来源:TestBaseCommon.java

示例14: cellLookup

import javafx.scene.control.TableCell; //导入依赖的package包/类
@Test
public void cellLookup() {
    System.out.println("testLookup");

    final String D = "D";

    Wrap<? extends TableCell> tableCellWrap = tableDock.asParent().
            lookup(TableCell.class, control -> {
                String item = (String) control.getItem();
                return item != null && item.contains(D);
            }).wrap();
    assertTrue("tableViewCellsParent.lookup().wrap() returns "
            + "TableCellWrap",
            tableCellWrap instanceof TableCellWrap);

    assertTrue(tableCellWrap.getProperty(String.class, "getItem").contains(D));

    tableCellWrap.mouse().click();

    tableDock.wrap().waitState(() -> tableDock.getSelection().contains(new Point(0, 4)) ? true : null);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:TableViewLookupTest.java

示例15: generateCallback

import javafx.scene.control.TableCell; //导入依赖的package包/类
/**
 * Generates the callback function to be called on button click.
 * @return
 */
private Callback<?, ?> generateCallback() {
	return new Callback<TableColumn<HistoricalItem, String>, TableCell<HistoricalItem, String>>() {
	@SuppressWarnings("rawtypes")
	@Override
                public TableCell call(TableColumn<HistoricalItem, String> parameter) {
                    final TableCell<HistoricalItem, String> cell = new TableCell<HistoricalItem, String>() {
                        final Button button = new Button(CALLBACK);
                        @Override
                        public void updateItem(String item, boolean empty) {
                        	super.updateItem(item, empty);
                            if(empty) {
                            	setGraphic(null);
                            } else  {
                            	HistoricalItem history = getTableView().getItems().get(getIndex());
                            	button.setId(CALLBACK + " " + history.getValue());
                            	button.setOnAction(event);
                            	setGraphic(button);
                            }
                        	setText(null);
                        }
                    }; return cell;
                }};
}
 
开发者ID:adisrini,项目名称:slogo,代码行数:28,代码来源:History.java


注:本文中的javafx.scene.control.TableCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。