KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > portlet > plugins > language > InfoBundle


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.portlet.plugins.language;
10
11 import java.util.ArrayList JavaDoc;
12 import java.util.List JavaDoc;
13 import java.util.ListResourceBundle JavaDoc;
14
15 import org.apache.log4j.Logger;
16 import org.jboss.portal.portlet.PortletConstants;
17 import org.jboss.portal.portlet.metadata.LanguagesMetaData;
18
19 /**
20  * A resource bundle that contains the inline information defined by the portle specification.
21  *
22  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
23  * @version $Revision: 1.4 $
24  */

25 public class InfoBundle extends ListResourceBundle JavaDoc
26 {
27
28    private static final Logger log = Logger.getLogger(InfoBundle.class);
29
30    private final Object JavaDoc[][] content;
31
32    public InfoBundle(LanguagesMetaData.InfoMetaData metaData)
33    {
34       log.debug("Creates the parent bundle");
35
36       //
37
List JavaDoc list = new ArrayList JavaDoc(3);
38       list.add(new Object JavaDoc[]{PortletConstants.PORTLET_TITLE, metaData.getTitle()});
39
40       //
41
if (metaData.getShortTitle() != null)
42       {
43          list.add(new Object JavaDoc[]{PortletConstants.PORTLET_SHORT_TITLE, metaData.getShortTitle()});
44       }
45
46       //
47
if (metaData.getKeywords() != null)
48       {
49          list.add(new Object JavaDoc[]{PortletConstants.PORTLET_KEYWORDS, metaData.getKeywords()});
50       }
51
52       //
53
content = (Object JavaDoc[][])list.toArray(new Object JavaDoc[list.size()][]);
54    }
55
56    protected Object JavaDoc[][] getContents()
57    {
58       return content;
59    }
60 }
61
Popular Tags