KickJava   Java API By Example, From Geeks To Geeks.

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


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  * ConstraintFieldValueEntry.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.ConstraintField;
32
33 import org.netbeans.modules.j2ee.sun.share.configbean.Utils;
34 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.BeanListMapping;
35 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.GenericTableModel;
36
37 /**
38  *
39  * @author Peter Williams
40  */

41 public class ConstraintFieldValueEntry extends GenericTableModel.TableEntry {
42
43     private static final ResourceBundle JavaDoc webappBundle = ResourceBundle.getBundle(
44         "org.netbeans.modules.j2ee.sun.share.configbean.customizers.webapp.Bundle"); // NOI18N
45

46     public ConstraintFieldValueEntry() {
47         super(ConstraintField.CONSTRAINT_FIELD_VALUE,
48             webappBundle.getString("LBL_ConstraintFieldValues")); // NOI18N
49
}
50     
51     /** The parent is the ConstraintField being edited. The expected return
52      * is a ConstraintField that has the array of ConstraintFieldValues.
53      * We can't just return the parent because if it gets changed and the user
54      * hits cancel, the changes will still be commited (bad!).
55      *
56      * @param parent The real ConstraintField that provides initialization data
57      * for the returned bean.
58      * @return A new ConstraintField that has any existing data saved into it,
59      * but can be edited and changed at will independent of the parent.
60      */

61     public Object JavaDoc getEntry(CommonDDBean parent) {
62         return new BeanListMapping((CommonDDBean) parent.clone(), getPropertyName());
63     }
64
65     /** Value is type ConstraintField but contains only an array of
66      * ConstraintFieldValues so we merge this into the parent ConstraintField
67      * which already contains the other stuff.
68      *
69      * @param parent The real ConstraintField that is to be saved (merged) into.
70      * @param value The temporary ConstraintField that has been used for storage
71      * during editing.
72      */

73     public void setEntry(CommonDDBean parent, Object JavaDoc value) {
74         parent.merge(((BeanListMapping) value).getBean(), CommonDDBean.MERGE_UPDATE);
75     }
76     
77     public Object JavaDoc getEntry(CommonDDBean parent, int row) {
78         throw new UnsupportedOperationException JavaDoc();
79     }
80     
81     public void setEntry(CommonDDBean parent, int row, Object JavaDoc value) {
82         throw new UnsupportedOperationException JavaDoc();
83     }
84     
85 }
86
Popular Tags