Example usage for com.google.gwt.user.cellview.client ColumnSortList size

List of usage examples for com.google.gwt.user.cellview.client ColumnSortList size

Introduction

In this page you can find the example usage for com.google.gwt.user.cellview.client ColumnSortList size.

Prototype

public int size() 

Source Link

Document

Get the size of the list.

Usage

From source file:com.agnie.useradmin.contextmgr.client.presenter.shared.ui.CTXUsersCellTable.java

License:Open Source License

public Sort getSortColumn() {
    ColumnSortList sortList = table.getColumnSortList();
    if (sortList != null && sortList.size() > 0) {
        ColumnSortInfo col = sortList.get(0);

        return new Sort(col.getColumn().getDataStoreName(),
                (col.isAscending() ? SortOrder.ASC : SortOrder.DESC));
    }// ww w .java 2s . c  o m
    return null;
}

From source file:com.agnie.useradmin.main.client.presenter.sahered.ui.RolesCellTable.java

License:Open Source License

public Sort getSortColumn() {
    ColumnSortList sortList = table.getColumnSortList();
    if (sortList != null && sortList.size() > 0) {
        ColumnSortInfo col = sortList.get(0);
        return new Sort(col.getColumn().getDataStoreName(),
                (col.isAscending() ? SortOrder.ASC : SortOrder.DESC));
    }/*  ww w  .  j a v a2s.c o  m*/
    return null;
}

From source file:com.bearsoft.gwt.ui.widgets.grid.builders.ThemedHeaderOrFooterBuilder.java

@Override
protected boolean buildHeaderOrFooterImpl() {
    AbstractCellTable<T> table = getTable();
    boolean isFooter = isBuildingFooter();

    int columnCount = table.getColumnCount();
    if (columnCount > 0) {
        // Early exit if there aren't any headers or footers in the columns
        // to render.
        boolean hasHeadersOrFooters = false;
        for (int i = 0; i < columnCount; i++) {
            if (getHeader(i) != null) {
                hasHeadersOrFooters = true;
                break;
            }/*from   w  w w  .j  ava 2s.c om*/
        }
        if (hasHeadersOrFooters) {
            List<HeaderNode<T>> headersForest;
            if (headerNodes == null) {
                headersForest = new ArrayList<>();
                for (int curColumn = 0; curColumn < columnCount; curColumn++) {
                    Header<?> headerOrFooter = getHeader(curColumn);
                    HeaderNode<T> hn = new HeaderNode<T>();
                    hn.setHeader((Header<String>) headerOrFooter);
                    headersForest.add(hn);
                }
            } else {
                headersForest = headerNodes;
            }
            // Get information about the sorted columns.
            ColumnSortList sortList;
            if (sortListHolder != null) {
                sortList = sortListHolder.getSortList();
            } else {
                sortList = table.getColumnSortList();
            }
            Map<Column<T, ?>, ColumnSortList.ColumnSortInfo> sortedColumns = new HashMap<>();
            if (sortList != null) {
                for (int i = 0; i < sortList.size(); i++) {
                    ColumnSortList.ColumnSortInfo sInfo = sortList.get(i);
                    sortedColumns.put((Column<T, ?>) sInfo.getColumn(), sInfo);
                }
            }
            buildNodes(headersForest, sortedColumns);
            return true;
        } else {
            // No headers to render;
            return false;
        }
    } else {
        // Nothing to render;
        return false;
    }
}

From source file:com.databasepreservation.visualization.client.common.lists.AsyncTableCell.java

protected Sorter createSorter(ColumnSortList columnSortList,
        Map<Column<T, ?>, List<String>> columnSortingKeyMap) {
    Sorter sorter = new Sorter();
    for (int i = 0; i < columnSortList.size(); i++) {
        ColumnSortInfo columnSortInfo = columnSortList.get(i);

        List<String> sortParameterKeys = columnSortingKeyMap.get(columnSortInfo.getColumn());

        if (sortParameterKeys != null) {
            for (String sortParameterKey : sortParameterKeys) {
                sorter.add(new SortParameter(sortParameterKey, !columnSortInfo.isAscending()));
            }//from   w  w w .  j a  v a  2  s .  c  om
        } else {
            logger.warn("Selecting a sorter that is not mapped");
        }
    }
    return sorter;
}

From source file:com.eucalyptus.webui.client.view.SearchResultTable.java

License:Open Source License

public void load() {
    AsyncDataProvider<SearchResultRow> dataProvider = new AsyncDataProvider<SearchResultRow>() {
        @Override//www.ja va  2 s. c  o m
        protected void onRangeChanged(HasData<SearchResultRow> display) {
            SearchRange sr = new SearchRange(-1);
            Range range = display.getVisibleRange();
            if (range != null) {
                sr.setStart(range.getStart());
                sr.setLength(range.getLength());
            }
            ColumnSortList sortList = cellTable.getColumnSortList();
            if (sortList != null && sortList.size() > 0) {
                ColumnSortInfo sort = sortList.get(0);
                if (sort != null) {
                    sr.setSortField(tableColIdx
                            .get(cellTable.getColumnIndex((Column<SearchResultRow, ?>) sort.getColumn())));
                    sr.setAscending(sort.isAscending());
                }
            }
            changeHandler.handleRangeChange(sr);
        }
    };
    dataProvider.addDataDisplay(cellTable);

    AsyncHandler sortHandler = new AsyncHandler(cellTable);
    cellTable.addColumnSortHandler(sortHandler);
}

From source file:com.gafactory.core.client.ui.grids.BaseListGrid.java

License:Open Source License

@Override
public void onColumnSort(ColumnSortEvent event) {
    loader.clearSortInfo();/* ww  w.  ja va2  s.  c  o m*/
    ColumnSortList sorting = event.getColumnSortList();
    for (int i = 0; i < sorting.size(); i++) {
        ColumnSortList.ColumnSortInfo columnSortInfo = sorting.get(i);
        String field = columnSortInfo.getColumn().getDataStoreName();

        Preconditions.checkNotNull(field);

        SortInfoBean sortInfoBean = new SortInfoBean(field,
                columnSortInfo.isAscending() ? SortDir.ASC : SortDir.DESC);
        loader.addSortInfo(sortInfoBean);

    }

    if (secondSortingField != null) {
        loader.addSortInfo(new SortInfoBean(secondSortingField, SortDir.ASC));
    }

    loader.load();
}

From source file:com.gafactory.core.shared.loader.FilterPagingLoader.java

License:Open Source License

private List<SortInfoBean> toSortingBeanList(ColumnSortList sorting) {

    List<SortInfoBean> list = Lists.newArrayList();
    for (int i = 0; i < sorting.size(); i++) {
        ColumnSortList.ColumnSortInfo columnSortInfo = sorting.get(i);
        String field = columnSortInfo.getColumn().getDataStoreName();

        Preconditions.checkNotNull(field);

        SortInfoBean sortInfoBean = new SortInfoBean(field,
                columnSortInfo.isAscending() ? SortDir.ASC : SortDir.DESC);
        list.add(sortInfoBean);//from w  ww  .  j a  v  a2 s  .c o  m
    }

    return list;
}

From source file:com.google.gwt.sample.dynatable.client.ui.CellTableMain.java

private void updateSort() {
    ColumnSortList csl = calendarCellTable.getColumnSortList();
    for (int i = 0; i < csl.size(); i++) {
        ColumnSortInfo info = csl.get(i);
        String fieldName = info.getColumn().getDataStoreName();
        if (fieldName != null && fieldName.length() > 0) {
            if (info.isAscending()) {
                sort = new OfySortParameter(info.getColumn().getDataStoreName());
            } else {
                sort = new OfySortParameter(info.getColumn().getDataStoreName(), OfySortType.descending);
            }/*  w  w  w.j a v a 2s . c o m*/
        }
    }
}

From source file:com.gwtmodel.table.view.table.PresentationTable.java

License:Apache License

@Override
public void removeSort() {
    if (table == null) {
        return;//from   w ww  . ja  v  a  2  s .c o m
    }
    ColumnSortList sortList = table.getColumnSortList();
    if (sortList == null) {
        return;
    }
    while (sortList.size() > 0) {
        // ColumnSortInfo i = sortList.get(0);
        // sortList.remove(i);
        sortList.clear();
    }

}

From source file:com.gwtmodel.table.view.table.PresentationTable.java

License:Apache License

@Override
public boolean isSorted() {
    if (table == null) {
        return false;
    }/*  w ww .  j  av a2s . com*/
    ColumnSortList sortList = table.getColumnSortList();
    return sortList.size() > 0;
}