Package nextapp.echo2.app

Examples of nextapp.echo2.app.Table


                }
            });
        }


        Row topRow = new Row();
        topRow.setCellSpacing(new JbsExtent(DIALOG_INSETS));
        topRow.add(iconLabel);
        topRow.add(messageColumn);

        KeyStrokeListener ks = new KeyStrokeListener();

        ArrayList<JbsButton> buttons = new ArrayList<JbsButton>();

        if (optionType == DEFAULT_OPTION) {
            buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.ok"), OK_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_RETURN, OK_OPTION);
        } else if (optionType == YES_NO_OPTION) {
            buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.yes"), YES_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_RETURN, YES_OPTION);
            buttons.add(createButton(JbsL10N.getString("Generic.no"), NO_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE, NO_OPTION);
        } else if (optionType == YES_NO_CANCEL_OPTION) {
            buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.yes"), YES_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_RETURN, YES_OPTION);
            buttons.add(createButton(JbsL10N.getString("Generic.no"), NO_OPTION));
            buttons.add(createButton(JbsL10N.getString("Generic.cancel"), CANCEL_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE, CANCEL_OPTION);
        } else if (optionType == OK_CANCEL_OPTION) {
            buttons.add(defaultButton = createButton(JbsL10N.getString("Generic.ok"), OK_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_RETURN, OK_OPTION);
            buttons.add(createButton(JbsL10N.getString("Generic.cancel"), CANCEL_OPTION));
            ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE, CANCEL_OPTION);
        }
       
        if (btnDetails!=null)
            buttons.add(btnDetails);
       
        ks.addActionListener(this);
        topRow.add(ks);

        ButtonPanel buttonPanel = new ButtonPanel();
        ColumnLayoutData buttonPanelLayout = new ColumnLayoutData();
        buttonPanelLayout.setAlignment(new Alignment(Alignment.CENTER, Alignment.TOP));
        buttonPanel.setLayoutData(buttonPanelLayout);
View Full Code Here


  protected void initPane() {
    Column colMain = new Column();
    colMain.add(this.getLbCompanies());

    Row rowButtons = new Row();
    rowButtons.setAlignment(new Alignment(Alignment.RIGHT,Alignment.TOP));
    rowButtons.add(this.getBtnAdd());
    rowButtons.add(this.getBtnDelete());
    colMain.add(rowButtons);
   
    KeyStrokeListener ks = new KeyStrokeListener();
    ks.addKeyCombination(KeyStrokeListener.VK_INSERT,"INSERT");
    ks.addKeyCombination(KeyStrokeListener.VK_DELETE,"DELETE");
    ks.addActionListener(new ActionListener() {

      private static final long serialVersionUID = 1L;

      public void actionPerformed(ActionEvent arg0) {
        if (arg0.getActionCommand().equals("INSERT"))
          addCompany();
        else if (arg0.getActionCommand().equals("DELETE"))
          deleteCompany();
      }
     
    });
    rowButtons.add(ks);
   

    this.add(colMain);
  }
View Full Code Here

        this.setMaximizable(false);
        this.setKeystrokeListener(this.createKeyStrokeListener());
        this.setPostOnEnterKey(true);
        this.setCancelOnEscKey(true);

        SplitPane spMain = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new JbsExtent(45));

        this.add(spMain);
        spMain.add(initPnButtons());

        pnMain = new JbsContentPane();
        spMain.add(pnMain);
    }
View Full Code Here

            public void actionPerformed(ActionEvent e) {
                testTable.setModel(createEmployeeTableModel());
            }
        });
       
        testTable = new Table();
        testTable.setBorder(new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID));
        testColumn.add(testTable);

        controlsColumn.add(new Label("Appearance"));
       
View Full Code Here

                    }
                });
            }
        }
       
        Table table = new Table(TableTest.createEmployeeTableModel());
        table.setBorder(new Border(new Extent(2), new Color(0xafffcf), Border.STYLE_GROOVE));
        table.setInsets(new Insets(15, 5));
        table.setSelectionEnabled(true);
        table.setSelectionBackground(new Color(0xffcfaf));
        table.setRolloverEnabled(true);
        table.setRolloverBackground(new Color(0xafefff));
        if (launchModals) {
            table.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    getApplicationInstance().getDefaultWindow().getContent().add(createComponentSamplerModalTestWindow());
                }
            });
        }
View Full Code Here

    }

    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());
        table.setAutoCreateColumnsFromModel(false);
        table.validate();
       
        label = (Label) table.getComponent(4);
        assertEquals("32", label.getText());
        label = (Label) table.getComponent(5);
        assertEquals("true", label.getText());
       
        columnModel.getColumn(2).setModelIndex(1);
        columnModel.getColumn(1).setModelIndex(2);
        table.setColumnModel(columnModel);
        table.validate();
       
        // Indices should switch.
        label = (Label) table.getComponent(4);
        assertEquals("true", label.getText());
        label = (Label) table.getComponent(5);
        assertEquals("32", label.getText());
    }
View Full Code Here

        label = (Label) table.getComponent(5);
        assertEquals("32", label.getText());
    }
   
    public void testEmptyConstructor() {
        Table table = new Table();
        assertNotNull(table.getModel());
        assertEquals(DefaultTableModel.class, table.getModel().getClass());
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        assertEquals(0, model.getColumnCount());
        assertEquals(0, model.getRowCount());
    }
View Full Code Here

        assertEquals(0, model.getColumnCount());
        assertEquals(0, model.getRowCount());
    }
   
    public void testRender() {
        Table table = new Table();
        table.setDefaultRenderer(Object.class, new TableCellRenderer() {
            public Component getTableCellRendererComponent(Table table, Object value, int column, int row) {
                switch (column) {
                case 0:
                case 1:
                    return new Label(value.toString());
                case 2:
                    CheckBox checkBox = new CheckBox();
                    checkBox.setSelected(((Boolean) value).booleanValue());
                    return checkBox;
                default:
                    throw new IndexOutOfBoundsException();
                }
            }
        });
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        model.setColumnCount(3);
        model.insertRow(0, new Object[]{"Bob Johnson", new Integer(32), Boolean.TRUE});
        model.insertRow(1, new Object[]{"Bill Simmons", new Integer(27), Boolean.TRUE});
        model.insertRow(2, new Object[]{"Tracy Smith", new Integer(54), Boolean.TRUE});
        model.insertRow(3, new Object[]{"Cathy Rogers", new Integer(21), Boolean.FALSE});
        model.insertRow(4, new Object[]{"Xavier Doe", new Integer(77), Boolean.TRUE});
        table.validate();
        assertEquals(18, table.getComponentCount());
        Component[] components = table.getComponents();
        for (int i = 3; i < components.length; ++i) {
            if (i % 3 == 2) {
                assertEquals(CheckBox.class, components[i].getClass());
            } else {
                assertEquals(Label.class, components[i].getClass());
            }
        }
        assertTrue(components[0] instanceof Label);
        assertEquals("A", ((Label) components[0]).getText());
        assertTrue(components[5] instanceof CheckBox);
        assertTrue(((CheckBox) components[5]).isSelected());
        assertTrue(components[8] instanceof CheckBox);
        assertTrue(((CheckBox) components[8]).isSelected());
        assertTrue(components[14] instanceof CheckBox);
        assertFalse(((CheckBox) components[14]).isSelected());

        assertTrue(table.getCellComponent(0, 0) instanceof Label);
        assertEquals("A", ((Label) table.getCellComponent(0, Table.HEADER_ROW)).getText());
        assertTrue(table.getCellComponent(2, 0) instanceof CheckBox);
        assertTrue(((CheckBox) table.getCellComponent(2, 0)).isSelected());
        assertTrue(table.getCellComponent(2, 1) instanceof CheckBox);
        assertTrue(((CheckBox) table.getCellComponent(2, 1)).isSelected());
        assertTrue(table.getCellComponent(2, 3) instanceof CheckBox);
        assertFalse(((CheckBox) table.getCellComponent(2, 3)).isSelected());
    }
View Full Code Here

        });
        cookiesColumn.add(setCookieButton);
    }
   
    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

    private Table createClientPropertiesTable(ContainerContext containerContext) {
        ClientProperties clientProperties = containerContext.getClientProperties();
        String[] propertyNames = clientProperties.getPropertyNames();
        Arrays.sort(propertyNames);
       
        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});
        }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.Table

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.