當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeTableColumn.setGraphic方法代碼示例

本文整理匯總了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;
}
 
開發者ID:veroslav,項目名稱:jfx-torrent,代碼行數:35,代碼來源:TreeTableUtils.java

示例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;
}
 
開發者ID:veroslav,項目名稱:jfx-torrent,代碼行數:32,代碼來源:TreeTableUtils.java

示例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;
}
 
開發者ID:veroslav,項目名稱:jfx-torrent,代碼行數:10,代碼來源:TreeTableUtils.java

示例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;
}
 
開發者ID:veroslav,項目名稱:jfx-torrent,代碼行數:35,代碼來源:TreeTableUtils.java

示例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;
}
 
開發者ID:Apelon-VA,項目名稱:ISAAC,代碼行數:31,代碼來源:DynamicRefexView.java


注:本文中的javafx.scene.control.TreeTableColumn.setGraphic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。