Example usage for javafx.collections ObservableList get

List of usage examples for javafx.collections ObservableList get

Introduction

In this page you can find the example usage for javafx.collections ObservableList get.

Prototype

E get(int index);

Source Link

Document

Returns the element at the specified position in this list.

Usage

From source file:org.simmi.GeneSetHead.java

License:asdf

public int searchTable(TableView table, String text, int i, boolean back, int... columns) {
    int v;// w w w.  ja v  a 2 s  .  c o m
    if (back) {
        v = i - 1;
        if (v == -1)
            v = table.getItems().size();
    } else
        v = (i + 1) % table.getItems().size();
    if (isGeneview()) {
        while (v != i) {
            //int m = table.convertRowIndexToModel(v);
            //if( m != -1 ) {
            //Gene g = geneset.genelist.get(m);
            //String name = column == 7 || column[0] == 8 ? g.getGeneGroup().getCommonSymbol() + ", " + g.getGeneGroup().getCommonKOName( ko2name ) + ", " +  : g.getGeneGroup().getCommonName();

            ObservableList<TableColumn> cc = table.getColumns();
            String name = "";
            for (int k : columns) {
                TableColumn tc = cc.get(k);
                String val = tc.getCellObservableValue(v).toString();
                name += val;//table.getValueAt(v, k);
            }

            if (name.toLowerCase().contains(text)) {
                //int r = table.convertRowIndexToView(v);
                table.scrollTo(v);
                //Rectangle rect = table.getCellRect(v, 0, true);
                //table.scrollRectToVisible( rect );
                break;
            }
            if (back) {
                v--;
                if (v == -1)
                    v = table.getItems().size() - 1;
            } else
                v = (v + 1) % table.getItems().size();

            //} else break;
        }
    } else {
        while (v != i) {
            //int m = table.convertRowIndexToModel(v);
            //if( m != -1 ) {

            //GeneGroup gg = allgenegroups.get(m);
            //String name = gg.getCommonName();
            ObservableList<TableColumn> cc = table.getColumns();
            String name = "";
            for (int k : columns) {
                TableColumn tc = cc.get(k);
                String val = tc.getCellObservableValue(v).toString();
                name += val;
                //name += table.getValueAt(v, k);
            }

            if (name.toLowerCase().contains(text)) {
                //int r = table.convertRowIndexToView(i);
                //Rectangle rect = table.getCellRect(v, 0, true);
                //table.scrollRectToVisible( rect );
                table.scrollTo(v);
                break;
            }
            if (back) {
                v--;
                if (v == -1)
                    v = table.getItems().size() - 1;
            } else
                v = (v + 1) % table.getItems().size();

            //} else break;
        }
    }
    return v;
}