Package ca.odell.glazedlists.gui

Examples of ca.odell.glazedlists.gui.WritableTableFormat


    /**
     * Tests that BeanTableFormat works as a WritableTableFormat.
     */
    public void testWritableTableFormat() {
        WritableTableFormat writableFootballFormat = (WritableTableFormat)footballFormat;
        assertEquals(false,              writableFootballFormat.isEditable(riders, 0));
        assertEquals(true,               writableFootballFormat.isEditable(riders, 1));
        assertEquals(false,              writableFootballFormat.isEditable(riders, 2));
        assertEquals(false,              writableFootballFormat.isEditable(riders, 3));
       
        writableFootballFormat.setColumnValue(riders, "Regina", 1);
        assertEquals("Regina",           riders.getHome());
        assertEquals("Regina",           footballFormat.getColumnValue(riders, 1));
       
        writableFootballFormat.setColumnValue(ticats, "Lancaster", 1);
        assertEquals("Lancaster",        ticats.getHome());
        assertEquals("Lancaster",        footballFormat.getColumnValue(ticats, 1));
    }
View Full Code Here


        // regular rows are editable if the tableformat is writable
        } else if(kTableFormat instanceof WritableTableFormat) {
            swtThreadSource.getReadWriteLock().readLock().lock();
            try {
                WritableTableFormat writableTableFormat = (WritableTableFormat)kTableFormat;
                Object baseObject = swtThreadSource.get(row - getFixedHeaderRowCount());
                Object updatedObject = writableTableFormat.setColumnValue(baseObject, value, column);
                if(updatedObject != null) {
                    swtThreadSource.set(row - getFixedHeaderRowCount(), updatedObject);
                }
            } finally {
                swtThreadSource.getReadWriteLock().readLock().unlock();
View Full Code Here

        userSelectionListeners.add(listener);
    }

    private void initializeSelectColumnCommands()
    {
        final WritableTableFormat writableTableFormat = (WritableTableFormat) this.tableModel
                .getTableFormat();
        AbstractCommand selectAll = new ActionCommand(SELECT_ALL_ID)
        {

            @Override
            protected void doExecuteCommand()
            {
                shownList.getReadWriteLock().writeLock().lock();
                Iterator i = shownList.iterator();
                while (i.hasNext())
                {
                    writableTableFormat.setColumnValue(i.next(), Boolean.TRUE, 0);
                }
                shownList.getReadWriteLock().writeLock().unlock();
                theTable.repaint();
                fireUserSelectionChangedEvent();
            }
        };
        this.commandConfigurer.configure(selectAll);
        AbstractCommand selectNone = new ActionCommand(SELECT_NONE_ID)
        {

            @Override
            protected void doExecuteCommand()
            {
                shownList.getReadWriteLock().writeLock().lock();
                Iterator i = shownList.iterator();
                while (i.hasNext())
                {
                    writableTableFormat.setColumnValue(i.next(), Boolean.FALSE, 0);
                }
                shownList.getReadWriteLock().writeLock().unlock();
                theTable.repaint();
                fireUserSelectionChangedEvent();
            }
        };
        this.commandConfigurer.configure(selectNone);
        AbstractCommand selectInverse = new ActionCommand(SELECT_INVERSE_ID)
        {

            @Override
            protected void doExecuteCommand()
            {
                shownList.getReadWriteLock().writeLock().lock();
                Iterator i = shownList.iterator();
                while (i.hasNext())
                {
                    Object rowObject = i.next();
                    Object columnValue = writableTableFormat.getColumnValue(rowObject, 0);
                    writableTableFormat.setColumnValue(rowObject, Boolean.TRUE.equals(columnValue)
                            ? Boolean.FALSE
                            : Boolean.TRUE, 0);
                }
                shownList.getReadWriteLock().writeLock().unlock();
                theTable.repaint();
View Full Code Here

TOP

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

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.