KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > customizers > webapp > PropertiesEntry


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  * PropertiesEntry.java
21  *
22  * Created on December 12, 2003, 6:28 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.webapp;
26
27 import java.util.List JavaDoc;
28 import java.util.ResourceBundle JavaDoc;
29
30 import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean;
31 import org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp;
32 import org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty;
33
34 import org.netbeans.modules.j2ee.sun.share.configbean.Utils;
35 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.ListMapping;
36 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.GenericTableModel;
37
38
39 /**
40  *
41  * @author Peter Williams
42  */

43 public class PropertiesEntry extends GenericTableModel.TableEntry {
44     
45     static final ResourceBundle JavaDoc bundle = ResourceBundle.getBundle(
46         "org.netbeans.modules.j2ee.sun.share.configbean.customizers.webapp.Bundle"); // NOI18N
47

48     public PropertiesEntry() {
49         this(SunWebApp.PROPERTY, bundle.getString("LBL_Properties")); // NOI18N
50
}
51     
52     public PropertiesEntry(String JavaDoc propertyName, String JavaDoc captionName) {
53         super(propertyName, captionName);
54     }
55
56     public Object JavaDoc getEntry(CommonDDBean parent) {
57         // FIXME this can be made more concise - spread out for debugging.
58
ListMapping listMap = null;
59         Object JavaDoc obj = parent.getValues(propertyName);
60         if(obj != null) {
61             WebProperty [] webProps = (WebProperty []) obj;
62             List JavaDoc properties = Utils.arrayToList(webProps);
63             listMap = new ListMapping(properties);
64         }
65         
66         return listMap;
67     }
68
69     public void setEntry(CommonDDBean parent, Object JavaDoc value) {
70         List JavaDoc list = ((ListMapping) value).getList();
71         WebProperty [] webProps = (WebProperty [])
72             Utils.listToArray(list, WebProperty.class);
73         parent.setValue(propertyName, webProps);
74     }
75     
76     public Object JavaDoc getEntry(CommonDDBean parent, int row) {
77         throw new UnsupportedOperationException JavaDoc();
78     }
79     
80     public void setEntry(CommonDDBean parent, int row, Object JavaDoc value) {
81         throw new UnsupportedOperationException JavaDoc();
82     }
83 }
84
Popular Tags