KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > customizers > common > GenericTablePanelTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * GenericTablePanelTest.java
21  * JUnit based test
22  *
23  * Created on April 20, 2004, 12:24 PM
24  */

25
26 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.common;
27
28 import java.util.ArrayList JavaDoc;
29 import java.util.Collection JavaDoc;
30 import java.util.List JavaDoc;
31 import java.util.ResourceBundle JavaDoc;
32 import javax.swing.JLabel JavaDoc;
33 import javax.swing.JPanel JavaDoc;
34 import javax.swing.table.JTableHeader JavaDoc;
35 import javax.swing.table.TableColumn JavaDoc;
36 import javax.swing.table.TableColumnModel JavaDoc;
37 import junit.framework.*;
38 import org.netbeans.modules.schema2beans.BaseBean;
39
40 import org.netbeans.modules.j2ee.sun.common.dd.webapp.WebProperty;
41 import org.netbeans.modules.j2ee.sun.common.dd.webapp.JspConfig;
42 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.*;
43
44 /**
45  *
46  * @author vkraemer
47  */

48 public class GenericTablePanelTest extends TestCase {
49     
50     private static final ResourceBundle JavaDoc webappBundle = ResourceBundle.getBundle(
51     "org.netbeans.modules.j2ee.sun.share.configbean.customizers.webapp.Bundle"); // NOI18N
52

53     public void testSomething() {
54         ArrayList JavaDoc tableColumns = new ArrayList JavaDoc(3);
55         tableColumns.add(new GenericTableModel.AttributeEntry(
56         WebProperty.NAME, "LBL_Name", true)); // NOI18N
57
tableColumns.add(new GenericTableModel.AttributeEntry(
58         WebProperty.VALUE, "LBL_Value", true)); // NOI18N
59
tableColumns.add(new GenericTableModel.ValueEntry(
60         WebProperty.DESCRIPTION, "LBL_Description")); // NOI18N
61

62         // add JspConfig table
63
GenericTableModel jspConfigModel = new GenericTableModel(JspConfig.PROPERTY, WebProperty.class, tableColumns);
64         jspConfigModel.setData(new JspConfig());
65         Object JavaDoc objectArray[] = new Object JavaDoc[3];
66         objectArray[0] = "Name1";
67         objectArray[1] = "Value1";
68         objectArray[2] = "Description1";
69         jspConfigModel.addRow(objectArray);
70         jspConfigModel.alreadyExists(objectArray);
71         objectArray = new Object JavaDoc[3];
72         objectArray[0] = "Name2";
73         objectArray[1] = "Value2";
74         objectArray[2] = "Description2";
75         jspConfigModel.editRow(0, objectArray);
76         jspConfigModel.getColumnNames();
77         jspConfigModel.getData();
78         jspConfigModel.getDataBaseBean();
79         jspConfigModel.getPropertyDefinitions();
80         jspConfigModel.getRowCount();
81         jspConfigModel.getValueAt(0,1);
82         jspConfigModel.getValues(0);
83         GenericTablePanel j, jspConfigPanel = new GenericTablePanel(jspConfigModel,
84             webappBundle, "JspConfigProperties", // NOI18N - property name
85
DynamicPropertyPanel.class, HelpContext.HELP_WEBAPP_JSPCONFIG_POPUP,
86             PropertyListMapping.getPropertyList(PropertyListMapping.WEBAPP_JSPCONFIG_PROPERTIES));
87         j = jspConfigPanel;
88         j.setHeadingMnemonic('a');
89         
90         javax.swing.JFrame JavaDoc foo = new javax.swing.JFrame JavaDoc();
91         foo.getContentPane().add(jspConfigPanel);
92         
93         jspConfigPanel.getInputDialog();
94         j.getInputDialog(objectArray);
95         jspConfigModel.removeRow(0);
96         
97     }
98     
99     public GenericTablePanelTest(java.lang.String JavaDoc testName) {
100         super(testName);
101     }
102     
103 }
104
Popular Tags