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.wicket.markup.html;
18:
19: import org.apache.wicket.Component;
20: import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
21: import org.apache.wicket.model.IModel;
22:
23: /**
24: * WebMarkupContainer with it's own markup and possibly <wicket:head> tag.
25: *
26: * @author Juergen Donnerstag
27: */
28: public class WebMarkupContainerWithAssociatedMarkup extends
29: WebMarkupContainer implements IHeaderPartContainerProvider {
30: private static final long serialVersionUID = 1L;
31:
32: /** A utility class which implements the internals */
33: private ContainerWithAssociatedMarkupHelper markupHelper;
34:
35: /**
36: * @see Component#Component(String)
37: */
38: public WebMarkupContainerWithAssociatedMarkup(final String id) {
39: super (id);
40: }
41:
42: /**
43: * @see org.apache.wicket.Component#Component(String, IModel)
44: */
45: public WebMarkupContainerWithAssociatedMarkup(final String id,
46: IModel model) {
47: super (id, model);
48: }
49:
50: /**
51: * Called by components like Panel and Border which have associated Markup
52: * and which may have a <wicket:head> tag.
53: * <p>
54: * Whereas 'this' might be a Panel or Border, the HtmlHeaderContainer
55: * parameter has been added to the Page as a container for all headers any
56: * of its components might wish to contribute.
57: * <p>
58: * The headers contributed are rendered in the standard way.
59: *
60: * @param container
61: * The HtmlHeaderContainer added to the Page
62: */
63: protected final void renderHeadFromAssociatedMarkupFile(
64: final HtmlHeaderContainer container) {
65: if (markupHelper == null) {
66: markupHelper = new ContainerWithAssociatedMarkupHelper(this );
67: }
68:
69: markupHelper.renderHeadFromAssociatedMarkupFile(container);
70: }
71:
72: /**
73: * @see org.apache.wicket.markup.html.IHeaderPartContainerProvider#newHeaderPartContainer(java.lang.String,
74: * java.lang.String)
75: */
76: public HeaderPartContainer newHeaderPartContainer(final String id,
77: final String scope) {
78: return new HeaderPartContainer(id, this, scope);
79: }
80: }
|