@Override
    public void sort()
        throws EFapsException
    {
        if (getSortKey() != null && getSortKey().length() > 0) {
            int sortKeyTmp = 0;
            final List<Field> fields = getUserSortedColumns();
            for (int i = 0; i < fields.size(); i++) {
                final Field field = fields.get(i);
                if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance())
                                && !field.isNoneDisplay(getMode()) && !field.isHiddenDisplay(getMode())) {
                    if (field.getName().equals(getSortKey())) {
                        break;
                    }
                    sortKeyTmp++;
                }
            }
            if (sortKeyTmp < getTable().getFields().size()) {
                final int index = sortKeyTmp;
                Collections.sort(this.values, new Comparator<UIRow>()
                {

                    @Override
                    public int compare(final UIRow _rowModel1,
                                       final UIRow _rowModel2)
                    {
                        final ISortable cellModel1 = _rowModel1.getCells().get(index);
                        final ISortable cellModel2 = _rowModel2.getCells().get(index);
                        return cellModel1.compareTo(cellModel2);
                    }
                });
                if (getSortDirection() == SortDirection.DESCENDING) {
                    Collections.reverse(this.values);
                }
            }
        }
    }
@Override
    public void sort()
        throws EFapsException
    {
        if (getSortKey() != null && getSortKey().length() > 0) {
            int sortKeyTmp = 0;
            final List<Field> fields = getUserSortedColumns();
            for (int i = 0; i < fields.size(); i++) {
                final Field field = fields.get(i);
                if (field.hasAccess(getMode(), getInstance(), getCommand(), getInstance())
                                && !field.isNoneDisplay(getMode()) && !field.isHiddenDisplay(getMode())) {
                    if (field.getName().equals(getSortKey())) {
                        break;
                    }
                    sortKeyTmp++;
                }
            }
            if (sortKeyTmp < getTable().getFields().size()) {
                final int index = sortKeyTmp;
                Collections.sort(this.values, new Comparator<UIRow>()
                {

                    @Override
                    public int compare(final UIRow _rowModel1,
                                       final UIRow _rowModel2)
                    {
                        final ISortable cellModel1 = _rowModel1.getCells().get(index);
                        final ISortable cellModel2 = _rowModel2.getCells().get(index);
                        return cellModel1.compareTo(cellModel2);
                    }
                });
                if (getSortDirection() == SortDirection.DESCENDING) {
                    Collections.reverse(this.values);
                }
            }
        }
    }
@ Override public void sort ( ) throws EFapsException { if ( getSortKey ( ) != null && getSortKey ( ) . length ( ) > 0 ) { int sortKeyTmp = 0 ; final List < Field > fields = getUserSortedColumns ( ) ; for ( int i = 0 ; i < fields . size ( ) ; i ++ ) { final Field field = fields . get ( i ) ; if ( field . hasAccess ( getMode ( ) , getInstance ( ) , getCommand ( ) , getInstance ( ) ) && ! field . isNoneDisplay ( getMode ( ) ) && ! field . isHiddenDisplay ( getMode ( ) ) ) { if ( field . getName ( ) . equals ( getSortKey ( ) ) ) { break ; } sortKeyTmp ++ ; } } if ( sortKeyTmp < getTable ( ) . getFields ( ) . size ( ) ) { final int index = sortKeyTmp ; Collections . sort ( this . values , new Comparator < UIRow > ( ) { @ Override public int compare ( final UIRow _rowModel1 , final UIRow _rowModel2 ) { final ISortable cellModel1 = _rowModel1 . getCells ( ) . get ( index ) ; final ISortable cellModel2 = _rowModel2 . getCells ( ) . get ( index ) ; return cellModel1 . compareTo ( cellModel2 ) ; } } ) ; if ( getSortDirection ( ) == SortDirection . DESCENDING ) { Collections . reverse ( this . values ) ; } } } }
The instance method sorts the table values depending on the sort key in
{@link #sortKey} and the sort direction in {@link #sortDirection}.
@throws EFapsException on error
The instance method sorts the table values depending on the sort key in {