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;
18:
19: import org.apache.wicket.markup.html.WebPage;
20: import org.apache.wicket.markup.html.basic.Label;
21: import org.apache.wicket.model.LoadableDetachableModel;
22: import org.apache.wicket.model.Model;
23:
24: /**
25: * Test page used for checking the attribute modification functionality of
26: * Component.
27: *
28: * @see AttributeModifierComponentTest
29: * @author Chris Turner
30: */
31: public class AttributeModifierComponentPage extends WebPage {
32: private static final long serialVersionUID = 1L;
33:
34: /**
35: * Construct.
36: *
37: *
38: */
39: public AttributeModifierComponentPage() {
40: // Label with attribute modifier
41: Label label1 = new Label("label1", new Model("Label 1"));
42: add(label1);
43:
44: // Label with override attribute modifier
45: Label label2 = new Label("label2", new Model("Label 2"));
46: label2.add(new AttributeModifier("class", new Model(
47: "overrideLabel")));
48: label2.add(new AttributeModifier("unknown",
49: new Model("invalid")));
50: add(label2);
51:
52: // Label with attribute inserter
53: Label label3 = new Label("label3", new Model("Label 3"));
54: label3.add(new AttributeModifier("class", true,
55: new LoadableDetachableModel() {
56: private static final long serialVersionUID = 1L;
57:
58: protected Object load() {
59: return "insertLabel";
60: }
61:
62: }));
63: add(label3);
64: }
65: }
|