01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.layout;
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 433543 2006-08-22 06:22:54Z crossley $
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 clone() throws CloneNotSupportedException {
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 cnse) {
81: // ignore
82: }
83: return null;
84: }
85:
86: }
|