KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > swing > data > DMToTableModelAdapterMetaDataProviderTest


1 /*
2  * $Id: DMToTableModelAdapterMetaDataProviderTest.java,v 1.1 2005/03/01 13:25:00 kleopatra Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7 package org.jdesktop.swing.data;
8
9 import org.jdesktop.dataset.DataSet;
10 import org.jdesktop.dataset.DataTable;
11 import org.jdesktop.dataset.adapter.TabularDataModelAdapter;
12 import org.jdesktop.swing.util.DataSetTestSupport;
13
14 /**
15  * tests MetaDataProvider role of DataModelToTableModelAdapter
16  *
17  * @author Jeanette Winzenburg
18  */

19 public class DMToTableModelAdapterMetaDataProviderTest extends
20         AbstractMetaDataProviderTst {
21
22     protected MetaDataProvider createFilledMetaDataProvider() {
23         DataSet dataSet = DataSetTestSupport.createDefaultDataSet(3);
24         DataSetTestSupport.fillDefaultTable(dataSet);
25         DataTable table = dataSet.getTable(DataSetTestSupport.ADAPTEE_TABLE_NAME);
26         TabularDataModel model = new TabularDataModelAdapter(table);
27         return new DataModelToTableModelAdapter(model);
28     }
29
30     protected MetaDataProvider createEmptyMetaDataProvider() {
31         DataTable table = DataSetTestSupport.createDataSet(new MetaData[] { }, 0).getTable(DataSetTestSupport.ADAPTEE_TABLE_NAME);
32         TabularDataModel model = new TabularDataModelAdapter(table);
33         return new DataModelToTableModelAdapter(model);
34     }
35
36 }
37
Popular Tags