01: package org.uispec4j;
02:
03: import org.uispec4j.utils.UIComponentFactory;
04: import org.uispec4j.xml.XmlAssert;
05:
06: import javax.swing.*;
07:
08: public class TableComponentTest extends UIComponentTestCase {
09: private Table table;
10: private JTable jTable;
11:
12: protected void setUp() throws Exception {
13: super .setUp();
14: init(new JTable(new String[][] {}, new String[] {}));
15: }
16:
17: private void init(JTable table) {
18: jTable = table;
19: jTable
20: .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
21: jTable.setName("myTable");
22: jTable.setDefaultEditor(Integer.class, new DefaultCellEditor(
23: new JComboBox(new Object[] { new Integer(3),
24: new Integer(4), new Integer(5) })));
25: this .table = (Table) UIComponentFactory
26: .createUIComponent(jTable);
27: }
28:
29: public void testGetComponentTypeName() throws Exception {
30: assertEquals("table", table.getDescriptionTypeName());
31: }
32:
33: public void testGetDescription() throws Exception {
34: XmlAssert.assertEquivalent("<table name='myTable'/>", table
35: .getDescription());
36: }
37:
38: public void testFactory() throws Exception {
39: checkFactory(new JTable(), Table.class);
40: }
41:
42: protected UIComponent createComponent() {
43: return table;
44: }
45: }
|