Package ca.odell.glazedlists.gui

Examples of ca.odell.glazedlists.gui.AdvancedTableFormat


        public SortingColumn(TableFormat tableFormat, int column) {
            this.column = column;

            // add the preferred comparator for AdvancedTableFormat
            if(tableFormat instanceof AdvancedTableFormat) {
                AdvancedTableFormat advancedTableFormat = (AdvancedTableFormat)tableFormat;
                Comparator columnComparator = advancedTableFormat.getColumnComparator(column);
                if(columnComparator != null) comparators.add(new TableColumnComparator(tableFormat, column, columnComparator));
            // otherwise just add the default comparator
            } else {
                comparators.add(new TableColumnComparator(tableFormat, column));
            }
View Full Code Here


    /**
     * Tests that BeanTableFormat works as an AdvancedTableFormat.
     */
    public void testAdvancedTableFormat() {
        AdvancedTableFormat emptyAdvancedFootballFormat = (AdvancedTableFormat)footballFormat;
        assertEquals(Object.class,       emptyAdvancedFootballFormat.getColumnClass(0));
        assertEquals(Object.class,       emptyAdvancedFootballFormat.getColumnClass(1));
        assertEquals(Object.class,       emptyAdvancedFootballFormat.getColumnClass(2));
        assertEquals(Object.class,       emptyAdvancedFootballFormat.getColumnClass(3));
        assertEquals(Object.class,       emptyAdvancedFootballFormat.getColumnClass(4));
        assertEquals(Object.class,       emptyAdvancedFootballFormat.getColumnClass(5));
        assertEquals(GlazedLists.comparableComparator(), emptyAdvancedFootballFormat.getColumnComparator(0));
        assertEquals(GlazedLists.comparableComparator(), emptyAdvancedFootballFormat.getColumnComparator(1));
        assertEquals(GlazedLists.comparableComparator(), emptyAdvancedFootballFormat.getColumnComparator(2));
        assertEquals(GlazedLists.comparableComparator(), emptyAdvancedFootballFormat.getColumnComparator(3));
        assertEquals(GlazedLists.comparableComparator(), emptyAdvancedFootballFormat.getColumnComparator(4));
        assertEquals(GlazedLists.comparableComparator(), emptyAdvancedFootballFormat.getColumnComparator(5));

        AdvancedTableFormat fullAdvancedFootballFormat = (AdvancedTableFormat)classedFootballFormat;
        assertEquals(String.class,       fullAdvancedFootballFormat.getColumnClass(0));
        assertEquals(String.class,       fullAdvancedFootballFormat.getColumnClass(1));
        assertEquals(Color.class,        fullAdvancedFootballFormat.getColumnClass(2));
        assertEquals(Color.class,        fullAdvancedFootballFormat.getColumnClass(3));
        assertEquals(Boolean.class,      fullAdvancedFootballFormat.getColumnClass(4));
        assertEquals(Integer.class,      fullAdvancedFootballFormat.getColumnClass(5));
        assertEquals(GlazedLists.comparableComparator(), fullAdvancedFootballFormat.getColumnComparator(0));
        assertEquals(GlazedLists.comparableComparator(), fullAdvancedFootballFormat.getColumnComparator(1));
        assertEquals(null,                               fullAdvancedFootballFormat.getColumnComparator(2));
        assertEquals(null,                               fullAdvancedFootballFormat.getColumnComparator(3));
        // this returns GlazedLists.comparableComparator() on Java 5, where Boolean implements Comparable,
        // but it returns null on prior versions where Boolean does not implement Comparable
        boolean booleanIsComparable = Boolean.TRUE instanceof Comparable;
        assertEquals(booleanIsComparable, GlazedLists.comparableComparator() == fullAdvancedFootballFormat.getColumnComparator(4));
        assertEquals(GlazedLists.comparableComparator(), fullAdvancedFootballFormat.getColumnComparator(5));
    }
View Full Code Here

TOP

Related Classes of ca.odell.glazedlists.gui.AdvancedTableFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.