本文整理汇总了Java中javafx.scene.control.IndexedCell类的典型用法代码示例。如果您正苦于以下问题:Java IndexedCell类的具体用法?Java IndexedCell怎么用?Java IndexedCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexedCell类属于javafx.scene.control包,在下文中一共展示了IndexedCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scrollToVisible
import javafx.scene.control.IndexedCell; //导入依赖的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();
}
}
}
示例2: getIndexedCellWrap
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
protected Wrap<? extends IndexedCell> getIndexedCellWrap(final String text) {
final String styleClass = isTreeTests ? "tree-cell" : "tree-table-cell";
Lookup<IndexedCell> lookup = testedControl.as(Parent.class, IndexedCell.class)
.lookup(IndexedCell.class, new LookupCriteria<IndexedCell>() {
public boolean check(IndexedCell cell) {
return text.equals(cell.getText()) && cell.getStyleClass().contains(styleClass);
}
});
final int size = lookup.size();
testedControl.waitState(new State<Boolean>() {
public Boolean reached() {
if (1 == size) {
return Boolean.TRUE;
} else {
return null;
}
}
});
return lookup.wrap();
}
示例3: check
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
@Override
public boolean check(IndexedCell control) {
if (control.isVisible() && control.getOpacity() == 1.0) {
if (isTreeViewTests) {
if (control instanceof TreeCell) {
if ((((TreeCell) control).getTreeItem() != null) && ((TreeCell) control).getTreeItem().equals(item)) {
return true;
}
}
} else {
if (control instanceof TreeTableCell) {
if ((((TreeTableCell) control).getTreeTableRow().getTreeItem() != null) && ((TreeTableCell) control).getTreeTableRow().getTreeItem().equals(item)) {
return true;
}
}
}
}
return false;
}
示例4: setFirstVisibleId
import javafx.scene.control.IndexedCell; //导入依赖的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();
}
}
示例5: getDisclosureNode
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
protected Wrap getDisclosureNode(final Wrap<? extends IndexedCell> cellWrap) {
final IndexedCell cell = cellWrap.getControl();
final String arrowStyle = "tree-disclosure-node";
if (TreeCell.class.isAssignableFrom(cell.getClass())) {
return cellWrap.as(Parent.class, Node.class).lookup(new ByStyleClass(arrowStyle)).wrap();
} else if (TreeTableCell.class.isAssignableFrom(cell.getClass())) {
final NodeWrap<IndexedCell> nodeWrap = new NodeWrap(cellWrap.getEnvironment(), cellWrap.getControl().getParent());
Parent cellAsParent = nodeWrap.as(Parent.class, IndexedCell.class);
return cellAsParent.lookup(new ByStyleClass(arrowStyle)).wrap();
} else {
throw new IllegalStateException();
}
}
示例6: checkSortResult
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
boolean checkSortResult(String[][] testData) {
Boolean state = Boolean.TRUE;
for (int j = 0; j < testData[0].length; j++) {
final int fj = j;
for (int i = 0; i < testData.length; i++) {
final int fi = i;
final Wrap<? extends IndexedCell> cellWrap = getCellWrap(j, i);
final String expected = testData[i][j];
state = cellWrap.waitState(new State<Boolean>() {
public Boolean reached() {
String actual = cellWrap.getControl().getText();
if (!expected.equals(actual)) {
System.out.println("i = " + fi + " j = " + fj);
System.out.println(String.format("exp|act:%s|%s", expected, actual));
}
return expected.equals(actual) ? Boolean.TRUE : Boolean.FALSE;
}
});
}
if (Boolean.FALSE == state) {
System.out.println(String.format("Column %d ended.", j));
}
}
return state.booleanValue();
}
示例7: testDeselectionNearLeftBoundary
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
/**
* Deselects selected cell with SHIFT + LEFT and then pushes this
* combination once more to check that selection remains.
*/
@Smoke
@Test(timeout = 300000)
public void testDeselectionNearLeftBoundary() {
enableMultipleCellSelection();
scrollTo(0, 0);
KeyboardModifiers ctrl = CTRL_DOWN_MASK_OS;
Wrap<? extends IndexedCell> cellWrap = getCellWrap(0, 0);
cellWrap.mouse().click(1, cellWrap.getClickPoint(), Mouse.MouseButtons.BUTTON1, ctrl);
selectionHelper.click(0, 0);
checkSelection();
KeyboardButtons btn = KeyboardButtons.LEFT;
KeyboardModifiers shift = KeyboardModifiers.SHIFT_DOWN_MASK;
for (int i = 0; i < 1; i++) {
tableViewWrap.keyboard().pushKey(btn, shift);
selectionHelper.push(btn, shift);
}
checkSelection();
//Select the entire row
btn = KeyboardButtons.RIGHT;
for (int i = 0; i < DATA_FIELDS_NUM; i++) {
tableViewWrap.keyboard().pushKey(btn, shift);
selectionHelper.push(btn, shift);
}
checkSelection();
//Apply combo once more to ensure that it doesn't affect selection
tableViewWrap.keyboard().pushKey(btn, shift);
selectionHelper.push(btn, shift);
checkSelection();
}
示例8: getCellWrap
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
public static Wrap<? extends TableCell> getCellWrap(Wrap<? extends Control> testedControl, final int column, final int row) {
scrollTo(testedControl, column, row);
Lookup lookup = testedControl.as(Parent.class, Node.class).lookup(IndexedCell.class, new TableViewTest.ByPosition(column, row));
if (lookup.size() == 0) { // TODO: what's that?!!
scrollTo(testedControl, column, row);
lookup.size();
}
return lookup.wrap();
}
示例9: getRootAsWrap
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
private Wrap<? extends Node> getRootAsWrap(final String rootText) {
return parent.lookup(IndexedCell.class, new LookupCriteria<IndexedCell>() {
public boolean check(IndexedCell cell) {
// System.out.println("rootText = " + rootText);
// System.out.println("cell.getText() = " + cell.getText());
// System.out.println("cell.getStyleClass() = " + cell.getStyleClass());
// System.out.println("cell.getStyleClass().contains(TREE_TABLE_ROW_CELL) = " + cell.getStyleClass().contains(TREE_TABLE_CELL));
return rootText.equals(cell.getText()) && cell.getStyleClass().contains(TREE_TABLE_CELL);
}
}).wrap();
}
示例10: shown
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
/**
* Identifies which elements are shown in the TableView currently.
*
* @return {minColumn, minRow, maxColumn, maxRow} of cells that are fully
* visible in the list.
*/
public static <CellClass extends IndexedCell> int[] shown(
Environment env,
final Wrap<? extends Control> wrap,
final Function<CellClass, Point> infoProvider,
final Class<CellClass> cellType) {
final Rectangle actuallyVisibleArea = getActuallyVisibleArea(wrap);
return shown(env, wrap, infoProvider, cellType, actuallyVisibleArea);
}
示例11: constructClickableArea
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
/**
* Special for TableView, and TreeTableView, as the last column contains
* empty not clickable space.
*/
private static Rectangle constructClickableArea(Wrap<?> wrap) {
Rectangle rec = null;
final Lookup lookup = wrap.as(Parent.class, Node.class).lookup(IndexedCell.class);
for (int i = 0; i < lookup.size(); i++) {
Wrap cell = lookup.wrap(i);
if (rec == null) {
rec = cell.getScreenBounds();
} else {
rec = rec.union(cell.getScreenBounds());
}
}
return rec;
}
示例12: applyTableRowColorization
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
public static <T> void applyTableRowColorization(final IndexedCell<T> tableRow) {
if(tableRow.getIndex() % 2 != 0 && ApplicationPreferences.getProperty(
GuiProperties.ALTERNATE_LIST_ROW_COLOR, false)) {
tableRow.getStyleClass().removeAll(CssProperties.ALTERNATE_LIST_ROW_EVEN);
tableRow.getStyleClass().add(CssProperties.ALTERNATE_LIST_ROW_ODD);
}
else {
tableRow.getStyleClass().removeAll(CssProperties.ALTERNATE_LIST_ROW_ODD);
tableRow.getStyleClass().add(CssProperties.ALTERNATE_LIST_ROW_EVEN);
}
}
示例13: testGetIndexedCellAdjuster
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
@Test
public void testGetIndexedCellAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(IndexedCell.class);
assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
示例14: createTotalContentHeightProperty
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
private static ReadOnlyDoubleProperty createTotalContentHeightProperty(ListView<?> listView) {
return new ReadOnlyDoublePropertyBase() {
@SuppressWarnings({ "rawtypes" })
@Override
public double get() {
VirtualFlow flow = (VirtualFlow) listView.lookup(".virtual-flow");
int nrOfItems = listView.getItems().size();
if (nrOfItems == 0) {
return 0;
}
IndexedCell cell = flow.getCell(0);
// assuming all cells have same size
double cellHeight = cell.getBoundsInLocal().getHeight();
double totalContentHeight = cellHeight * nrOfItems;
return totalContentHeight;
}
@Override
public String getName() {
return null;
}
@Override
public Object getBean() {
return null;
}
};
}
示例15: fetchVisibleCellRange
import javafx.scene.control.IndexedCell; //导入依赖的package包/类
/**
* Gets the visible cell range in this GridView viewport
* @return
*/
private IndexRange fetchVisibleCellRange(){
IndexRange outRange = null;
try {
final VirtualFlow vf = getVirtualFlow();
if(vf != null){
final IndexedCell firstVisibleRow = vf.getFirstVisibleCell();
final IndexedCell lastVisibleRow = vf.getLastVisibleCell();
if(firstVisibleRow != null && lastVisibleRow != null){
final ObservableList<Node> firsts = firstVisibleRow.getChildrenUnmodifiable();
final GridCell firstVisibleCell = firsts.size() > 0 ? (GridCell)firsts.get(0) : null;
final ObservableList<Node> lasts = lastVisibleRow.getChildrenUnmodifiable();
final GridCell lastVisibleCell = lasts.size() > 0 ? (GridCell)lasts.get(lasts.size()-1) : null;
outRange = new IndexRange(
firstVisibleCell != null ? firstVisibleCell.getIndex() : 0,
lastVisibleCell != null ? lastVisibleCell.getIndex() : 0);
}
}
} catch (IllegalArgumentException e) {
logger.error(e);
}
if(outRange == null){
outRange = IndexRange.Undefined;
}
return outRange;
}