當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。