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


Java VirtualFlow类代码示例

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


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

示例1: scrollToVisible

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
public void scrollToVisible(int index) {
	VirtualFlow<?> flow = (VirtualFlow<?>) lookup(".virtual-flow");
	IndexedCell firstCell = flow.getFirstVisibleCell();
	if (firstCell == null)
		return;
	int first = firstCell.getIndex();
	int last = flow.getLastVisibleCell().getIndex();
	if (index <= first) {
		while (index <= first && flow.adjustPixels((index - first) - 1) < 0) {
			first = flow.getFirstVisibleCell().getIndex();
		}
	} else {
		while (index >= last && flow.adjustPixels((index - last) + 1) > 0) {
			last = flow.getLastVisibleCell().getIndex();
		}
	}
}
 
开发者ID:Yeregorix,项目名称:EpiStats,代码行数:18,代码来源:RankingView.java

示例2: scrollUp

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
private void scrollUp(int index) {
    TableViewSkin<?> ts = (TableViewSkin<?>) tableDots.getSkin();
    VirtualFlow<?> vf = (VirtualFlow<?>) ts.getChildren().get(1);

    int first = vf.getFirstVisibleCellWithinViewPort().getIndex();
    int last = vf.getLastVisibleCellWithinViewPort().getIndex();

    if (index <= (last + first) / 2) {
        vf.scrollTo(index - (last - first) / 2);

        ts = (TableViewSkin<?>) tableDots.getSkin();
        vf = (VirtualFlow<?>) ts.getChildren().get(1);
        first = vf.getFirstVisibleCellWithinViewPort().getIndex();
        last = vf.getLastVisibleCellWithinViewPort().getIndex();
    }
}
 
开发者ID:pashkobohdan,项目名称:GraphicsDrawer,代码行数:17,代码来源:LagrangePolynomialFunctionController.java

示例3: scrollDown

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
private void scrollDown(int index) {
    TableViewSkin<?> ts = (TableViewSkin<?>) tableDots.getSkin();
    VirtualFlow<?> vf = (VirtualFlow<?>) ts.getChildren().get(1);

    int first = vf.getFirstVisibleCellWithinViewPort().getIndex();
    int last = vf.getLastVisibleCellWithinViewPort().getIndex();

    if (index >= (last + first) / 2) {
        vf.scrollTo(index - ((last - first) / 2));

        ts = (TableViewSkin<?>) tableDots.getSkin();
        vf = (VirtualFlow<?>) ts.getChildren().get(1);
        first = vf.getFirstVisibleCellWithinViewPort().getIndex();
        last = vf.getLastVisibleCellWithinViewPort().getIndex();
    }
}
 
开发者ID:pashkobohdan,项目名称:GraphicsDrawer,代码行数:17,代码来源:LagrangePolynomialFunctionController.java

示例4: getIndex

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
private int getIndex(){
    ListViewSkin<?> ts = (ListViewSkin<?>) image_list.getSkin();
    VirtualFlow<?> vf = (VirtualFlow<?>) ts.getChildren().get(0);
    int first = vf.getFirstVisibleCell().getIndex();
    int last = vf.getLastVisibleCell().getIndex();
    int out = Math.abs(last-first);
    System.out.print(out);
    return out;
}
 
开发者ID:Obsidiam,项目名称:joanne,代码行数:10,代码来源:FXMLDocumentController.java

示例5: getFirstAndLast

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
@SuppressWarnings("restriction")
public void getFirstAndLast(ListView<?> t) {
    try {
        ListViewSkin<?> ts = (ListViewSkin<?>) t.getSkin();
        VirtualFlow<?> vf = (VirtualFlow<?>) ts.getChildren().get(0);
        first = vf.getFirstVisibleCell().getIndex();
        last = vf.getLastVisibleCell().getIndex();
    }catch (Exception ex) {}
}
 
开发者ID:Obsidiam,项目名称:joanne,代码行数:10,代码来源:FXMLDocumentController.java

示例6: initialize

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    table.setSelectionModel(null);
    Platform.runLater(() -> {
        TableViewSkin tableSkin = (TableViewSkin) table.getSkin();
        virtualFlow = (VirtualFlow) tableSkin.getChildren().get(1);
    });

}
 
开发者ID:KursX,项目名称:Parallator,代码行数:10,代码来源:MainController.java

示例7: getVisibleRows

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
/**
     * THis is a total hack. We need it as scrollTo jumps the selected row to the top
     * of the table. Jarring if the row is already visible. As a workaround, we only
     * scroll if the row isn't already visible
     * @return A 2 element ray with the start and end index of visible rows
     */
    private int[] getVisibleRows() {
//        TableView<Annotation> tableView = getTableView();
//        // TODO this does not work in Java 9
//        // See https://stackoverflow.com/questions/46474385/how-to-find-the-indices-of-the-visible-rows-in-a-tableview-in-javafx-9/46474693#46474693
        TableViewSkin<?> skin = (TableViewSkin<?>) tableView.getSkin();
        if (skin == null) return new int[] {0, 0};
        VirtualFlow<?> flow = (VirtualFlow<?>) skin.getChildren().get(1);
        int idxFirst;
        int idxLast;
        if (flow != null &&
                flow.getFirstVisibleCellWithinViewPort() != null &&
                flow.getLastVisibleCellWithinViewPort() != null) {
            idxFirst = flow.getFirstVisibleCellWithinViewPort().getIndex();
            if (idxFirst > tableView.getItems().size()) {
                idxFirst = tableView.getItems().size() - 1;
            }
            idxLast = flow.getLastVisibleCellWithinViewPort().getIndex();
            if (idxLast > tableView.getItems().size()) {
                idxLast = tableView.getItems().size() - 1;
            }
        }
        else {
            idxFirst = 0;
            idxLast = 0;
        }
        return new int[]{idxFirst, idxLast};

        // This TableViewExt appears to be buggy
        //return tableViewExt.getVisibleRows();
    }
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:37,代码来源:AnnotationTableController.java

示例8: setFirstVisibleId

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
/**
 * Shifts the list view on display to start with the indicated index.
 */
private void setFirstVisibleId() {
    ListViewSkin<?> listViewSkin = (ListViewSkin<?>) getCurrentListView().getSkin();
    VirtualFlow<?> virtualFlow = (VirtualFlow<?>) listViewSkin.getChildren().get(0);
    IndexedCell<?> firstVisibleCell = virtualFlow.getFirstVisibleCellWithinViewPort();
    if (firstVisibleCell != null) {
        firstVisibleId = firstVisibleCell.getIndex();
    }
}
 
开发者ID:cs2103jan2016-w13-4j,项目名称:main,代码行数:12,代码来源:MainController.java

示例9: getVirtualFlow

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
private VirtualFlow<TableRow<T>> getVirtualFlow() {
	Parent p = getSkinnable();
	while (p != null) {
		if (p instanceof VirtualFlow) {
			return (VirtualFlow<TableRow<T>>) p;
		}
		p = p.getParent();
	}
	return null;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:11,代码来源:CTableRowSkin.java

示例10: invokeFlowCellLength

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
/**
 * Reflectively invokes protected getCellLength(i) of flow.
 * @param index the index of the cell.
 * @return the cell height of the cell at index.
 */
protected double invokeFlowCellLength(int index) {
	double height = 1.0;
	Class<?> clazz = VirtualFlow.class;
	try {
		Method method = clazz.getDeclaredMethod("getCellLength", Integer.TYPE);
		method.setAccessible(true);
		return ((double) method.invoke(flow, index));
	} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
			| InvocationTargetException e) {
		e.printStackTrace();
	}
	return height;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:19,代码来源:TableViewWithVisibleRowCount.java

示例11: getFirstVisibleRowIndex

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
public static int getFirstVisibleRowIndex(TableView table) {
    VirtualFlow<?> flow = getVirtualFlow(table);
    if (flow == null || flow.getFirstVisibleCellWithinViewPort() == null) {
        return 0;
    }
    int indexFirst = flow.getFirstVisibleCellWithinViewPort().getIndex();
    if (indexFirst >= table.getItems().size()) {
        return table.getItems().size() - 1;
    } else {
        return indexFirst;
    }
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:13,代码来源:UIUtils.java

示例12: getLastVisibleRowIndex

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
@SuppressWarnings("WeakerAccess")
public static int getLastVisibleRowIndex(TableView table) {
    VirtualFlow<?> flow = getVirtualFlow(table);
    if (flow == null || flow.getLastVisibleCellWithinViewPort() == null) {
        return 0;
    }
    int index = flow.getLastVisibleCellWithinViewPort().getIndex();
    if (index >= table.getItems().size()) {
        return table.getItems().size() - 1;
    } else {
        return index;
    }
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:14,代码来源:UIUtils.java

示例13: getVirtualFlow

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
private static VirtualFlow<?> getVirtualFlow(TableView table) {
    TableViewSkin<?> skin = (TableViewSkin) table.getSkin();
    if (skin == null) {
        return null;
    }
    return (VirtualFlow) skin.getChildren().get(1);
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:8,代码来源:UIUtils.java

示例14: asScrollable2D

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
/**
 * Returns implementation of Scrollable2D interface.
 */
@As
public Scrollable2D asScrollable2D() {
    if (scrollable2D == null) {
        scrollable2D = new Scrollable2DImpl(this, new ScrollsLookupCriteria() {
            @Override
            public boolean checkFor(ScrollBar scrollBar) {
                return ((scrollBar.getParent() instanceof VirtualFlow)
                        && (scrollBar.getParent().getParent() instanceof TreeTableView));
            }
        });
    }
    return scrollable2D;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:TreeTableViewWrap.java

示例15: asScrollable2D

import com.sun.javafx.scene.control.skin.VirtualFlow; //导入依赖的package包/类
@As
public Scrollable2D asScrollable2D() {
    if (scrollable2D == null) {
        scrollable2D = new Scrollable2DImpl(this, new ScrollsLookupCriteria() {
            @Override
            public boolean checkFor(ScrollBar scrollBar) {
                return ((scrollBar.getParent() instanceof VirtualFlow)
                        && (scrollBar.getParent().getParent() instanceof TreeView));
            }
        });
    }
    return scrollable2D;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:14,代码来源:TreeViewWrap.java


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