KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > layout > Item


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.layout;
17
18
19 /**
20  *
21  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
22  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
23  *
24  * @version CVS $Id: Item.java 148910 2005-01-28 18:19:44Z cziegeler $
25  */

26 public class Item extends AbstractParameters {
27     
28     private Layout layout;
29
30     private CompositeLayout parentLayout;
31     
32     /**
33      * Returns the layout.
34      * @return Layout
35      */

36     public final Layout getLayout() {
37         return layout;
38     }
39
40     /**
41      * Sets the layout.
42      * @param layout The layout to set
43      */

44     public final void setLayout(Layout layout) {
45         this.layout = layout;
46         if(layout != null) {
47             layout.setParent(this);
48         }
49     }
50     
51     public final CompositeLayout getParent() {
52         return this.parentLayout;
53     }
54
55     public final void setParent(CompositeLayout layout) {
56         this.parentLayout = layout;
57     }
58         
59     /* (non-Javadoc)
60      * @see java.lang.Object#clone()
61      */

62     protected Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
63         Item clone = (Item)super.clone();
64         
65         clone.layout = null;
66         clone.parentLayout = null;
67         
68         return clone;
69     }
70     
71     public Item copy(CompositeLayout parent) {
72         try {
73             Item clone = (Item)this.clone();
74             if ( this.layout != null ) {
75                 clone.layout = this.layout.copy();
76                 clone.layout.setParent(clone);
77             }
78             clone.parentLayout = parent;
79             return clone;
80         } catch (CloneNotSupportedException JavaDoc cnse) {
81             // ignore
82
}
83         return null;
84     }
85     
86 }
87
Popular Tags