src/main/java/org/efaps/ui/wicket/models/objects/AbstractUIHeaderObject.java
protected List<Field> getUserSortedColumns()
    {
        List<Field> ret = new ArrayList<>();
        try {
            final List<Field> fields = getTable().getFields();
            if (Context.getThreadContext().containsUserAttribute(
                            getCacheKey(UITable.UserCacheKey.COLUMNORDER))) {

                final String columnOrder = Context.getThreadContext().getUserAttribute(
                                getCacheKey(UITable.UserCacheKey.COLUMNORDER));

                final StringTokenizer tokens = new StringTokenizer(columnOrder, ";");
                while (tokens.hasMoreTokens()) {
                    final String fieldname = tokens.nextToken();
                    for (int i = 0; i < fields.size(); i++) {
                        if (fieldname.equals(fields.get(i).getName())) {
                            ret.add(fields.get(i));
                            fields.remove(i);
                        }
                    }
                }
                if (!fields.isEmpty()) {
                    for (final Field field : fields) {
                        ret.add(field);
                    }
                }
            } else {
                ret = fields;
            }
        } catch (final EFapsException e) {
            AbstractUIHeaderObject.LOG.debug("Error on sorting columns");
        }
        return ret;
    }
protected List<Field> getUserSortedColumns()
    {
        List<Field> ret = new ArrayList<>();
        try {
            final List<Field> fields = getTable().getFields();
            if (Context.getThreadContext().containsUserAttribute(
                            getCacheKey(UITable.UserCacheKey.COLUMNORDER))) {

                final String columnOrder = Context.getThreadContext().getUserAttribute(
                                getCacheKey(UITable.UserCacheKey.COLUMNORDER));

                final StringTokenizer tokens = new StringTokenizer(columnOrder, ";");
                while (tokens.hasMoreTokens()) {
                    final String fieldname = tokens.nextToken();
                    for (int i = 0; i < fields.size(); i++) {
                        if (fieldname.equals(fields.get(i).getName())) {
                            ret.add(fields.get(i));
                            fields.remove(i);
                        }
                    }
                }
                if (!fields.isEmpty()) {
                    for (final Field field : fields) {
                        ret.add(field);
                    }
                }
            } else {
                ret = fields;
            }
        } catch (final EFapsException e) {
            AbstractUIHeaderObject.LOG.debug("Error on sorting columns");
        }
        return ret;
    }
protected List < Field > getUserSortedColumns ( ) { List < Field > ret = new ArrayList <> ( ) ; try { final List < Field > fields = getTable ( ) . getFields ( ) ; if ( Context . getThreadContext ( ) . containsUserAttribute ( getCacheKey ( UITable . UserCacheKey . COLUMNORDER ) ) ) { final String columnOrder = Context . getThreadContext ( ) . getUserAttribute ( getCacheKey ( UITable . UserCacheKey . COLUMNORDER ) ) ; final StringTokenizer tokens = new StringTokenizer ( columnOrder , ";" ) ; while ( tokens . hasMoreTokens ( ) ) { final String fieldname = tokens . nextToken ( ) ; for ( int i = 0 ; i < fields . size ( ) ; i ++ ) { if ( fieldname . equals ( fields . get ( i ) . getName ( ) ) ) { ret . add ( fields . get ( i ) ) ; fields . remove ( i ) ; } } } if ( ! fields . isEmpty ( ) ) { for ( final Field field : fields ) { ret . add ( field ) ; } } } else { ret = fields ; } } catch ( final EFapsException e ) { AbstractUIHeaderObject . LOG . debug ( "Error on sorting columns" ) ; } return ret ; }
This method looks if for this TableModel a UserAttribute for the sorting
of the Columns exist. If they exist the Fields will be sorted as defined
by the User. If no definition of the User exist the Original default
sorting of the columns will be used. In the Case that the Definition of
the Table was altered Field which are not sorted yet will be sorted in at
the last position.

@return List of fields
This method looks if for this TableModel a UserAttribute for the sorting of the Columns exist . If they exist the Fields will be sorted as defined by the User . If no definition of the User exist the Original default sorting of the columns will be used . In the Case that the Definition of the Table was altered Field which are not sorted yet will be sorted in at the last position .