Package nextapp.echo2.app.table

Examples of nextapp.echo2.app.table.DefaultTableModel


        return model;
    }
   
    public void testDefaultColumnNames() {
        DefaultTableModel model = new DefaultTableModel();
        model.setColumnCount(3);
       
        assertEquals("A", model.getColumnName(0));
        assertEquals("B", model.getColumnName(1));
        assertEquals("C", model.getColumnName(2));
       
        model = new DefaultTableModel();
        model.setColumnCount(1379);
       
        assertEquals("A", model.getColumnName(0));
        assertEquals("B", model.getColumnName(1));
        assertEquals("C", model.getColumnName(2));
        assertEquals("Y", model.getColumnName(24));
        assertEquals("Z", model.getColumnName(25));
        assertEquals("AA", model.getColumnName(26));
        assertEquals("AB", model.getColumnName(27));
        assertEquals("AC", model.getColumnName(28));
        assertEquals("AY", model.getColumnName(50));
        assertEquals("AZ", model.getColumnName(51));
        assertEquals("BA", model.getColumnName(52));
        assertEquals("ZZ", model.getColumnName(701));
        assertEquals("AAA", model.getColumnName(702));
        assertEquals("AAB", model.getColumnName(703));
        assertEquals("AAC", model.getColumnName(704));
        assertEquals("ABA", model.getColumnName(728));
        assertEquals("AZZ", model.getColumnName(1377));
        assertEquals("BAA", model.getColumnName(1378));
    }
View Full Code Here


        assertEquals("AZZ", model.getColumnName(1377));
        assertEquals("BAA", model.getColumnName(1378));
    }

    public void testDefaultTableModel() {
        DefaultTableModel model = createEmployeeTableModel();
       
        assertEquals("Employee Name", model.getColumnName(0));
        assertEquals("Age", model.getColumnName(1));
        assertEquals("Manager", model.getColumnName(2));
        assertEquals(3, model.getColumnCount());
        assertEquals(5, model.getRowCount());
        assertEquals("Bob Johnson", model.getValueAt(0, 0));
        assertEquals("Xavier Doe", model.getValueAt(0, 4));
        assertEquals(new Integer(21), model.getValueAt(1, 3));
        assertEquals(Boolean.FALSE, model.getValueAt(2, 3));

        model.deleteRow(1);
        assertEquals(4, model.getRowCount());
        assertEquals("Bob Johnson", model.getValueAt(0, 0));
        assertEquals("Xavier Doe", model.getValueAt(0, 3));
        assertEquals(new Integer(21), model.getValueAt(1, 2));
        assertEquals(Boolean.FALSE, model.getValueAt(2, 2));
       
        model.insertRow(2, new Object[]{"Whitney Ford", new Integer(33), Boolean.FALSE});
        assertEquals(5, model.getRowCount());
        assertEquals("Whitney Ford", model.getValueAt(0, 2));
        assertEquals("Bob Johnson", model.getValueAt(0, 0));
        assertEquals("Xavier Doe", model.getValueAt(0, 4));
        assertEquals(new Integer(21), model.getValueAt(1, 3));
        assertEquals(Boolean.FALSE, model.getValueAt(2, 3));
    }
View Full Code Here

    private Table createApplicationPropertiesTable(ApplicationInstance app) {
        Table table = new Table();
        table.setStyleName("Default");
        table.setDefaultRenderer(Object.class, new PropertyTableCellRenderer());
       
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        model.setColumnCount(2);

        table.getColumnModel().getColumn(0).setHeaderValue("Property");
        table.getColumnModel().getColumn(1).setHeaderValue("Value");
       
        model.addRow(new Object[]{"Locale", app.getLocale()});
        model.addRow(new Object[]{"Layout Direction", app.getLayoutDirection()});
       
        return table;
    }
View Full Code Here

       
        Table table = new Table();
        table.setStyleName("Default");
        table.setDefaultRenderer(Object.class, new PropertyTableCellRenderer());
       
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        model.setColumnCount(2);

        table.getColumnModel().getColumn(0).setHeaderValue("Property");
        table.getColumnModel().getColumn(1).setHeaderValue("Value");

        for (int i = 0; i < propertyNames.length; ++i) {
            Object propertyValue = clientProperties.get(propertyNames[i]);
            model.addRow(new Object[]{propertyNames[i], propertyValue});
        }
       
        return table;
    }
View Full Code Here

        assertEquals(Boolean.FALSE, model.getValueAt(2, 3));
    }

    public void testColumModelRendering() {
        Label label;
        DefaultTableModel model = createEmployeeTableModel();
        Table table = new Table(model);
        DefaultTableColumnModel columnModel = (DefaultTableColumnModel) table.getColumnModel();
        assertEquals(0, columnModel.getColumn(0).getModelIndex());
        assertEquals(1, columnModel.getColumn(1).getModelIndex());
        assertEquals(2, columnModel.getColumn(2).getModelIndex());
View Full Code Here

    /**
     * Creates a new <code>Table</code> with an empty
     * <code>DefaultTableModel</code>.
     */
    public Table() {
        this(new DefaultTableModel());
    }
View Full Code Here

     *
     * @param columns the initial column count
     * @param rows the initial row count
     */
    public Table(int columns, int rows) {
        this(new DefaultTableModel(columns, rows));
    }
View Full Code Here

        controlsColumn.add(new Label("TableModel"));
       
        controlsColumn.addButton("DefaultTableModel (Empty)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                testTable.setModel(new DefaultTableModel());
            }
        });
       
        controlsColumn.addButton("MultiplicationTableModel (12x12)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
View Full Code Here

       
        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        DefaultTableModel model = new DefaultTableModel();
        model.setColumnCount(4);
        for (int i = 0; i < 10; ++i) {
            model.addRow(new Object[]{"John Smith", new Integer(0), new Integer(4), new Integer(1982)});
        }
       
        TableCellRenderer renderer = new TableCellRenderer() {
       
            public Component getTableCellRendererComponent(Table table, Object value, int column, int row) {
View Full Code Here

        //If nor group is found then create a new one:
        if (newColumn == null) {
            newColumn = new Column();
            newColumn.setId(groupName);
            newColumn.setStyleName("Default");
            AccordionPaneLayoutData layoutData = new AccordionPaneLayoutData();
            layoutData.setTitle(groupTitle);
            newColumn.setLayoutData(layoutData);
            this.add(newColumn);
        }
        return newColumn;
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.table.DefaultTableModel

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.