KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TabularMetaData.java,v 1.1 2005/03/01 13:27:10 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 /**
10  * MetaData for declaring a field of type TabularDataModel.
11  *
12  * @author Jeanette Winzenburg
13  */

14 public class TabularMetaData extends MetaData {
15     private String JavaDoc[] fieldNames;
16
17     public TabularMetaData() {
18         this("tabularvalue");
19     }
20
21     public TabularMetaData(String JavaDoc name) {
22         super(name, TabularDataModel.class, null);
23      
24     }
25     
26     public TabularMetaData(String JavaDoc name, String JavaDoc label, String JavaDoc[] fieldNames) {
27         this(name);
28         setLabel(label);
29         setFieldNames(fieldNames);
30     }
31
32     /**
33      * sets subset of fields to show. null means all.
34      * @param fieldNames
35      */

36     public void setFieldNames(String JavaDoc[] fieldNames) {
37         String JavaDoc[] oldNames = getFieldNames();
38         this.fieldNames = fieldNames;
39         firePropertyChange("fieldNames", oldNames, getFieldNames());
40         
41     }
42
43     /**
44      * returns subset of fields to show in the asociated tabular
45      * structure. may be null to indicate all or empty array to
46      * indicate none (hmmm...)
47      * @return
48      */

49     public String JavaDoc[] getFieldNames() {
50         // todo: return unmodifiable array
51
return fieldNames;
52     }
53     
54     
55     public String JavaDoc getLabel() {
56         return label;
57     }
58 }
59
Popular Tags