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


Java TreeTableRow类代码示例

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


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

示例1: getPoint

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected Point2D getPoint(TreeTableView<?> treeTableView, int rowIndex, int columnIndex) {
    Set<Node> treeTableRowCell = treeTableView.lookupAll(".tree-table-row-cell");
    TreeTableRow<?> row = null;
    for (Node tableRow : treeTableRowCell) {
        TreeTableRow<?> r = (TreeTableRow<?>) tableRow;
        if (r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".tree-table-cell");
    for (Node node : cells) {
        TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) node;
        if (treeTableView.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,代码来源:RFXComponentTest.java

示例2: handleRowDragDropped

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected void handleRowDragDropped(TreeTableRow<T> r, DragEvent ev)
{
	Dragboard db = ev.getDragboard();
	if(isAcceptable(db, r))
	{
		int ix = (Integer)db.getContent(JAVA_DATA_FORMAT);
		TreeItem item = tree.getTreeItem(ix);
		item.getParent().getChildren().remove(item);
		getTarget(r).getChildren().add(item);
		ev.setDropCompleted(true);
		
		tree.getSelectionModel().clearSelection();
		tree.getSelectionModel().select(item);
		// FIX focus and selection differ after this
		
		ev.consume();
	}
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:19,代码来源:TreeTableHandler.java

示例3: onDragOver

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
private void onDragOver(final TreeTableRow<GPXLineItem> row, final DragEvent event) {
    Dragboard db = event.getDragboard();
    if (db.getContent(SERIALIZED_MIME_TYPE) != null) {
        if (!row.isEmpty()) {
            event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
            event.consume();
        }
    } else {
        if (db.hasFiles()) {
            for (File file:db.getFiles()) {
                // accept only gpx files
                if (GPXEditorWorker.GPX_EXT.equals(FilenameUtils.getExtension(file.getName()).toLowerCase())) {
                    event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
                    break;
                }
            }
        } else {
            event.consume();
        }
    }
}
 
开发者ID:ThomasDaheim,项目名称:GPXEditor,代码行数:22,代码来源:GPXTreeTableView.java

示例4: acceptable

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
private boolean acceptable(final Dragboard db, final TreeTableRow<GPXLineItem> row) {
    boolean result = false;
    if (db.hasContent(SERIALIZED_MIME_TYPE)) {
        final int index = (Integer) db.getContent(SERIALIZED_MIME_TYPE);
        //System.out.println("index: " + index + ", row index:" + row.getIndex());
        if (!row.isEmpty() && (row.getIndex() != index)) {
            final TreeItem<GPXLineItem> target = row.getTreeItem();
            final GPXLineItem.GPXLineItemType targetType = target.getValue().getType();
            
            final TreeItem<GPXLineItem> item = myTreeTableView.getTreeItem(index);
            final GPXLineItem.GPXLineItemType itemType = item.getValue().getType();
            
            // don't create loops and only insert on same level or drop on direct parent type
            result = !isParent(item, target) && 
                    (GPXLineItem.GPXLineItemType.isSameTypeAs(targetType, itemType) || GPXLineItem.GPXLineItemType.isParentTypeOf(targetType, itemType));
        }
    }
    return result;
}
 
开发者ID:ThomasDaheim,项目名称:GPXEditor,代码行数:20,代码来源:GPXTreeTableView.java

示例5: bindContextMenuForTreeTableCell

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
/**
 * Helper method which provides extra logic for extracting the {@link TreeItem} {@link Property} from a
 * {@link TreeTableCell}, which itself has no {@link TreeItem} property. The {@link TreeItem} {@link Property} we
 * want to bind can be found in the containing {@link TreeTableRow} instead.
 * <p>
 *
 * @param <T> the type of the item contained in the {@link TreeTableRow}
 * @param appCtx the {@link ApplicationContext} of the application
 * @param ctxMenuProperty the {@link ContextMenu} {@link Property} of the {@link TreeTableCell}
 * @param tableRowProperty the {@link TreeTableRow} {@link Property} of the {@link TreeTableCell}
 */
private static <T> void bindContextMenuForTreeTableCell(ApplicationContext appCtx,
    ObjectProperty<ContextMenu> ctxMenuProperty,
    ReadOnlyObjectProperty<TreeTableRow<T>> tableRowProperty)
{
    tableRowProperty.addListener((property, oldValue, newValue) ->
    {
        // If the containing TreeTableRow disappears, unbind the context menu if any
        if (newValue == null)
        {
            ctxMenuProperty.unbind();
            return;
        }

        // Otherwise, bind the ContextMenu to the TreeItem Property of the containing TreeTable row.
        bindContextMenu(appCtx, ctxMenuProperty, newValue.treeItemProperty());
    });
}
 
开发者ID:jvm-profiling-tools,项目名称:honest-profiler,代码行数:29,代码来源:ContextMenuUtil.java

示例6: getVisibleCellAt

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
@SuppressWarnings("rawtypes") public TreeTableCell getVisibleCellAt(TreeTableView<?> treeTableView, int row, int column) {
    Set<Node> lookupAll = getTreeTableCells(treeTableView);
    TreeTableCell cell = null;
    for (Node node : lookupAll) {
        TreeTableCell<?, ?> cell1 = (TreeTableCell<?, ?>) node;
        TreeTableRow<?> tableRow = cell1.getTreeTableRow();
        TreeTableColumn<?, ?> tableColumn = cell1.getTableColumn();
        if (tableRow.getIndex() == row && tableColumn == treeTableView.getColumns().get(column)) {
            cell = cell1;
            break;
        }
    }
    return cell;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:JavaFXElementPropertyAccessor.java

示例7: makeSourceRowDraggable

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
private void makeSourceRowDraggable(TreeTableRow<? extends SourceEntry> row) {
  row.setOnDragDetected(event -> {
    if (selectedEntry == null) {
      return;
    }
    Dragboard dragboard = row.startDragAndDrop(TransferMode.COPY_OR_MOVE);
    ClipboardContent content = new ClipboardContent();
    content.put(DataFormats.source, selectedEntry);
    dragboard.setContent(content);
    event.consume();
  });
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:13,代码来源:MainWindowController.java

示例8: updateRowStyle

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
private void updateRowStyle(TreeTableRow<T> row) {
  if (row.getItem() == null) {
    return;
  }
  switch (row.getItem().getNodeClass()) {
    case Variable:
      row.pseudoClassStateChanged(OBJECT_CLASS, false);
      row.pseudoClassStateChanged(METHOD_CLASS, false);
      row.pseudoClassStateChanged(VARIABLE_CLASS, true);
      break;
    case Object:
      row.pseudoClassStateChanged(VARIABLE_CLASS, false);
      row.pseudoClassStateChanged(METHOD_CLASS, false);
      row.pseudoClassStateChanged(OBJECT_CLASS, true);
      break;
    case Method:
      row.pseudoClassStateChanged(VARIABLE_CLASS, false);
      row.pseudoClassStateChanged(OBJECT_CLASS, false);
      row.pseudoClassStateChanged(METHOD_CLASS, true);
      break;
    default:
      row.pseudoClassStateChanged(VARIABLE_CLASS, false);
      row.pseudoClassStateChanged(METHOD_CLASS, false);
      row.pseudoClassStateChanged(OBJECT_CLASS, false);
      break;
  }
}
 
开发者ID:comtel2000,项目名称:opc-ua-client,代码行数:28,代码来源:DataTreeNodeRowFactory.java

示例9: getNode

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
public final Wrap<? extends Node> getNode() {
    return treeTableViewWrap.as(Parent.class, Node.class).
            lookup(TreeTableRow.class, new LookupCriteria<TreeTableRow>() {

        @Override
        public boolean check(TreeTableRow cntrl) {
            return cntrl.getItem() != null && cntrl.getTreeItem().equals(getControl());
        }

        @Override
        public String toString() {
            return "Node for an item " + getControl().toString();
        }
    }).wrap();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:16,代码来源:TreeTableNodeWrap.java

示例10: rowFactory

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected TreeTableRow<T> rowFactory(TreeTableView<T> view)
{
	TreeTableRow<T> r = new TreeTableRow<T>();
	r.addEventHandler(MouseEvent.DRAG_DETECTED, (ev) -> handleRowDragDetected(r, ev));
	r.addEventHandler(DragEvent.DRAG_OVER, (ev) -> handleRowDragOver(r, ev));
	r.addEventHandler(DragEvent.DRAG_DROPPED, (ev) -> handleRowDragDropped(r, ev));
	return r;
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:9,代码来源:TreeTableHandler.java

示例11: isAcceptable

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected boolean isAcceptable(Dragboard db, TreeTableRow<T> row)
{
	if(db.hasContent(JAVA_DATA_FORMAT))
	{
		int index = (Integer)db.getContent(JAVA_DATA_FORMAT);
		if(row.getIndex() != index)
		{
			TreeItem target = getTarget(row);
			TreeItem item = tree.getTreeItem(index);
			return !isParent(item, target);
		}
	}
	return false;
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:15,代码来源:TreeTableHandler.java

示例12: getTarget

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected TreeItem getTarget(TreeTableRow<T> row)
{
	TreeItem target = tree.getRoot();
	if(!row.isEmpty())
	{
		target = row.getTreeItem();
	}
	return target;
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:10,代码来源:TreeTableHandler.java

示例13: handleRowDragDetected

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected void handleRowDragDetected(TreeTableRow<T> r, MouseEvent ev)
{
	if(!r.isEmpty())
	{
		// TODO support multiple selection
		Dragboard db = r.startDragAndDrop(TransferMode.MOVE);
		db.setDragView(r.snapshot(null, null));
		ClipboardContent cc = new ClipboardContent();
		cc.put(JAVA_DATA_FORMAT, r.getIndex());
		db.setContent(cc);
		ev.consume();
	}
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:14,代码来源:TreeTableHandler.java

示例14: handleRowDragOver

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
protected void handleRowDragOver(TreeTableRow<T> r, DragEvent ev)
{
	Dragboard db = ev.getDragboard();
	if(isAcceptable(db, r))
	{
		ev.acceptTransferModes(TransferMode.COPY_OR_MOVE);
		ev.consume();
	}
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:10,代码来源:TreeTableHandler.java

示例15: handleMouseClickedEvent

import javafx.scene.control.TreeTableRow; //导入依赖的package包/类
/**
 * Handle mouse clicked event
 */
private void handleMouseClickedEvent() {
    TreeTableRow<HexData> selectedRow = (TreeTableRow<HexData>) textField.getParent().getParent();
    if (!selectedRow.getTreeItem().getValue().getOffset().contains("-")) {
        String originalLine = textField.getText();
        String selectedHex = textField.getSelectedText().trim();
        String replacedHex = showDialog(selectedHex);
        if (replacedHex != null) {
            try {
                textField.replaceSelection(replacedHex.toUpperCase());
                String payLoad = hexToASCII(textField.getText());
                TreeTableRow<HexData> hexTable = (TreeTableRow<HexData>) textField.getParent().getParent();
                TreeItem<HexData> selectedItem = hexTable.getTreeItem();
                selectedItem.setValue(new HexData(selectedItem.getValue().getOffset(), textField.getText(), packetParser.formatPayLoad(payLoad)));
                String originalHex = getPacketHexFromList();
                if (selectedItem.getValue().getOffset().contains("-")) {
                    originalHex = originalHex.replaceAll(originalLine.replaceAll(" ", "").replaceAll("\n", ""), textField.getText().replaceAll(" ", "").replaceAll("\n", ""));
                }
                byte[] rawdata = DatatypeConverter.parseHexBinary(originalHex);
                EthernetPacket p = EthernetPacket.newPacket(rawdata, 0, rawdata.length);
                packetParser.parsePacket(p, packetInfo);
                treeRoot.getChildren().clear();
                setData(packetInfo);
            } catch (IllegalRawDataException ex) {
                java.util.logging.Logger.getLogger(PacketHex.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:32,代码来源:PacketHex.java


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