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.image;
18:
19: import java.util.Locale;
20:
21: import org.apache.wicket.PageParameters;
22: import org.apache.wicket.markup.html.WebPage;
23: import org.apache.wicket.markup.html.link.Link;
24:
25: /**
26: * Demonstrates localization.
27: *
28: * @author Jonathan Locke
29: * @author Eelco Hillenius
30: */
31: public final class Home extends WebPage {
32: private static final long serialVersionUID = 1L;
33:
34: /**
35: * Constructor
36: *
37: * @param parameters
38: * Page parameters (ignored since this is the home page)
39: */
40: public Home(final PageParameters parameters) {
41: add(new Image("beer"));
42:
43: // Add a couple of links to be able to play around with the session
44: // locale
45: add(new Link("goCanadian") {
46: private static final long serialVersionUID = 1L;
47:
48: public void onClick() {
49: getSession().setLocale(Locale.CANADA);
50: }
51: });
52: add(new Link("goUS") {
53: private static final long serialVersionUID = 1L;
54:
55: public void onClick() {
56: getSession().setLocale(Locale.US);
57: }
58: });
59: add(new Link("goDutch") {
60: private static final long serialVersionUID = 1L;
61:
62: public void onClick() {
63: getSession().setLocale(new Locale("nl", "NL"));
64: }
65: });
66: add(new Link("goGerman") {
67: private static final long serialVersionUID = 1L;
68:
69: public void onClick() {
70: getSession().setLocale(new Locale("de", "DE"));
71: }
72: });
73: add(new Link("goChinese") {
74: private static final long serialVersionUID = 1L;
75:
76: public void onClick() {
77: getSession().setLocale(new Locale("zh", "CN"));
78: }
79: });
80: add(new Link("goDanish") {
81: private static final long serialVersionUID = 1L;
82:
83: public void onClick() {
84: getSession().setLocale(new Locale("da", "DK"));
85: }
86: });
87: }
88: }
|