01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.springframework.ui.context.support;
18:
19: import org.springframework.context.MessageSource;
20: import org.springframework.ui.context.Theme;
21: import org.springframework.util.Assert;
22:
23: /**
24: * Default {@link Theme} implementation, wrapping a name and an
25: * underlying {@link org.springframework.context.MessageSource}.
26: *
27: * @author Juergen Hoeller
28: * @since 17.06.2003
29: */
30: public class SimpleTheme implements Theme {
31:
32: private final String name;
33:
34: private final MessageSource messageSource;
35:
36: /**
37: * Create a SimpleTheme.
38: * @param name the name of the theme
39: * @param messageSource the MessageSource that resolves theme messages
40: */
41: public SimpleTheme(String name, MessageSource messageSource) {
42: Assert.notNull(name, "Name must not be null");
43: Assert.notNull(messageSource, "MessageSource must not be null");
44: this .name = name;
45: this .messageSource = messageSource;
46: }
47:
48: public final String getName() {
49: return this .name;
50: }
51:
52: public final MessageSource getMessageSource() {
53: return this.messageSource;
54: }
55:
56: }
|