KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > efs > openreports > util > DisplayProperty


1 /*
2  * Copyright (C) 2006 Erik Swenson - erik@oreports.com
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */

19
20 package org.efs.openreports.util;
21
22 import java.util.StringTokenizer JavaDoc;
23
24 public class DisplayProperty
25 {
26     private String JavaDoc name;
27     private String JavaDoc displayName;
28     private String JavaDoc decorator;
29     
30     public DisplayProperty(String JavaDoc name, String JavaDoc type)
31     {
32         this.name = name;
33         this.displayName = "";
34                 
35         StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(name, " ");
36         while (st.hasMoreElements())
37         {
38             String JavaDoc element = (String JavaDoc) st.nextElement();
39             displayName = displayName + element.substring(0,1).toUpperCase() + element.substring(1) + " ";
40         }
41         
42         if (type.equals("java.sql.Date") || type.equals("java.sql.Timestamp"))
43         {
44             decorator = "org.efs.openreports.util.DateColumnDecorator";
45         }
46     }
47
48     public String JavaDoc getName()
49     {
50         return name;
51     }
52     
53     public String JavaDoc getDisplayName()
54     {
55         return displayName;
56     }
57     
58     public String JavaDoc getDecorator()
59     {
60         return decorator;
61     }
62 }
63
Popular Tags