本文整理匯總了Java中javafx.scene.control.TreeTableColumn.setGraphic方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeTableColumn.setGraphic方法的具體用法?Java TreeTableColumn.setGraphic怎麽用?Java TreeTableColumn.setGraphic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.TreeTableColumn
的用法示例。
在下文中一共展示了TreeTableColumn.setGraphic方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildSimpleLongValueColumn
import javafx.scene.control.TreeTableColumn; //導入方法依賴的package包/類
private static TreeTableColumn<TorrentFileEntry, Long> buildSimpleLongValueColumn(
final String columnName, final String propertyName, final String style, final Insets padding,
final Function<TorrentFileEntry, String> valueGetter) {
final TreeTableColumn<TorrentFileEntry, Long> longValueColumn = new TreeTableColumn<TorrentFileEntry, Long>(columnName);
longValueColumn.setId(columnName);
longValueColumn.setGraphic(TableUtils.buildColumnHeader(longValueColumn, style));
longValueColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
longValueColumn.setCellFactory(column -> new TreeTableCell<TorrentFileEntry, Long>() {
final Label valueLabel = new Label();
@Override
protected final void updateItem(final Long value, final boolean empty) {
super.updateItem(value, empty);
if(empty) {
setText(null);
setGraphic(null);
}
else {
final TorrentFileEntry fileContent = this.getTreeTableRow().getItem();
if(fileContent == null) {
return;
}
final String formattedValue = valueGetter.apply(fileContent);
valueLabel.setText(formattedValue);
this.setGraphic(valueLabel);
this.setAlignment(Pos.CENTER_RIGHT);
super.setPadding(padding);
}
}
});
return longValueColumn;
}
示例2: buildPriorityColumn
import javafx.scene.control.TreeTableColumn; //導入方法依賴的package包/類
private static TreeTableColumn<TorrentFileEntry, FilePriority> buildPriorityColumn() {
final TreeTableColumn<TorrentFileEntry, FilePriority> priorityColumn =
new TreeTableColumn<>(PRIORITY_COLUMN_NAME);
priorityColumn.setId(PRIORITY_COLUMN_NAME);
priorityColumn.setGraphic(TableUtils.buildColumnHeader(priorityColumn, GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME));
priorityColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("priority"));
priorityColumn.setCellFactory(column -> new TreeTableCell<TorrentFileEntry, FilePriority>() {
final Label valueLabel = new Label();
@Override
protected final void updateItem(final FilePriority value, final boolean empty) {
super.updateItem(value, empty);
if(empty) {
setText(null);
setGraphic(null);
}
else {
final TorrentFileEntry fileContent = this.getTreeTableRow().getItem();
if(fileContent == null) {
return;
}
valueLabel.setText(fileContent.getPriority().toString());
this.setGraphic(valueLabel);
this.setAlignment(Pos.BASELINE_LEFT);
super.setPadding(GuiUtils.leftPadding());
}
}
});
return priorityColumn;
}
示例3: buildPathColumn
import javafx.scene.control.TreeTableColumn; //導入方法依賴的package包/類
private static TreeTableColumn<TorrentFileEntry, String> buildPathColumn() {
final TreeTableColumn<TorrentFileEntry, String> pathColumn =
new TreeTableColumn<TorrentFileEntry, String>(PATH_COLUMN_NAME);
pathColumn.setId(PATH_COLUMN_NAME);
pathColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("path"));
pathColumn.setGraphic(TableUtils.buildColumnHeader(pathColumn, GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME));
return pathColumn;
}
示例4: buildProgressColumn
import javafx.scene.control.TreeTableColumn; //導入方法依賴的package包/類
private static TreeTableColumn<TorrentFileEntry, Double> buildProgressColumn(
final TreeTableView<TorrentFileEntry> treeTableView) {
final TreeTableColumn<TorrentFileEntry, Double> progressColumn =
new TreeTableColumn<TorrentFileEntry, Double>(PROGRESS_COLUMN_NAME);
progressColumn.setId(PROGRESS_COLUMN_NAME);
progressColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("progress"));
progressColumn.setGraphic(TableUtils.buildColumnHeader(progressColumn, GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME));
progressColumn.setCellFactory(column -> new ProgressBarTreeTableCell<TorrentFileEntry>() {
@Override
public final void updateItem(final Double value, final boolean empty) {
super.updateItem(value, empty);
if(empty) {
super.setText(null);
super.setGraphic(null);
}
else {
final TorrentFileEntry fileContent = this.getTreeTableRow().getItem();
if(fileContent == null) {
return;
}
super.addEventFilter(MouseEvent.MOUSE_CLICKED, evt ->
treeTableView.getSelectionModel().select(super.getTreeTableRow().getIndex()));
super.getStyleClass().add(CssProperties.PROGRESSBAR_STOPPED);
super.setItem(fileContent.progressProperty().doubleValue());
super.setPadding(GuiUtils.noPadding());
}
}
});
return progressColumn;
}
示例5: buildComponentCellColumn
import javafx.scene.control.TreeTableColumn; //導入方法依賴的package包/類
private TreeTableColumn<RefexDynamicGUI, RefexDynamicGUI> buildComponentCellColumn(DynamicRefexColumnType type)
{
TreeTableColumn<RefexDynamicGUI, RefexDynamicGUI> ttCol = new TreeTableColumn<>(type.toString());
HeaderNode<String> headerNode = new HeaderNode<>(
filterCache_,
ttCol,
ColumnId.getInstance(type),
rootNode_.getScene(),
new HeaderNode.DataProvider<String>() {
@Override
public String getData(RefexDynamicGUI source) {
return source.getDisplayStrings(type, null).getKey();
}
});
ttCol.setGraphic(headerNode.getNode());
ttCol.setSortable(true);
ttCol.setResizable(true);
ttCol.setComparator(new Comparator<RefexDynamicGUI>()
{
@Override
public int compare(RefexDynamicGUI o1, RefexDynamicGUI o2)
{
return o1.compareTo(type, null, o2);
}
});
ttCol.setCellFactory((colInfo) -> {return new ComponentDataCell(type);});
ttCol.setCellValueFactory((callback) -> {return new ReadOnlyObjectWrapper<RefexDynamicGUI>(callback.getValue().getValue());});
return ttCol;
}