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.pluto.internal.impl;
18:
19: import org.apache.pluto.Constants;
20:
21: import java.util.ListResourceBundle;
22: import java.util.ArrayList;
23:
24: /**
25: * InlinePortletResourceBundle implementation which provides the
26: * inline title, short-title, and keywords as properties from the
27: * bundle.
28: *
29: * @version 1.0
30: * @since Jan 9, 2006
31: */
32: class InlinePortletResourceBundle extends ListResourceBundle {
33:
34: private final Object[][] contents;
35:
36: public InlinePortletResourceBundle(Object[][] contents) {
37: this .contents = contents;
38: }
39:
40: public InlinePortletResourceBundle(String title, String shortTitle,
41: String keywords) {
42: ArrayList temp = new ArrayList();
43: if (title != null)
44: temp.add(new Object[] { Constants.TITLE_KEY, title });
45:
46: if (shortTitle != null)
47: temp.add(new Object[] { Constants.SHORT_TITLE_KEY,
48: shortTitle });
49:
50: if (keywords != null)
51: temp.add(new Object[] { Constants.KEYWORDS_KEY, keywords });
52:
53: contents = (Object[][]) temp.toArray(new Object[temp.size()][]);
54: }
55:
56: protected Object[][] getContents() {
57: return contents;
58: }
59: }
|