portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shins...@apache.org
Subject cvs commit: jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld HelloWorld.java
Date Thu, 09 Sep 2004 22:18:04 GMT
shinsuke    2004/09/09 15:18:04

  Modified:    applications/demo/src/java/org/apache/jetspeed/demo/preferences
                        PreferencePortlet.java
               applications/demo/src/java/org/apache/jetspeed/portlet/helloworld
                        HelloWorld.java
  Log:
  moved English message to the resource bundle
  
  Revision  Changes    Path
  1.9       +10 -4     jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/preferences/PreferencePortlet.java
  
  Index: PreferencePortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/preferences/PreferencePortlet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PreferencePortlet.java	8 Mar 2004 00:04:41 -0000	1.8
  +++ PreferencePortlet.java	9 Sep 2004 22:18:04 -0000	1.9
  @@ -16,6 +16,8 @@
   package org.apache.jetspeed.demo.preferences;
   
   import java.io.IOException;
  +import java.text.MessageFormat;
  +import java.util.ResourceBundle;
   
   import javax.portlet.ActionRequest;
   import javax.portlet.ActionResponse;
  @@ -46,8 +48,9 @@
       protected void doView(RenderRequest request, RenderResponse response) throws PortletException,
IOException
       {
           PortletContext context = getPortletContext();
  +        ResourceBundle resource = getPortletConfig().getResourceBundle(request.getLocale());
   
  -        request.setAttribute("viewMessage", "My Mode is view.");
  +        request.setAttribute("viewMessage", resource.getString("preference.label.MyModeIsView"));
   
           PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/demo/preference/pref-view.jsp");
           rd.include(request, response);
  @@ -67,6 +70,7 @@
        */
       public void processAction(ActionRequest request, ActionResponse response) throws PortletException,
IOException
       {
  +        ResourceBundle resource = getPortletConfig().getResourceBundle(request.getLocale());
           // Integer iCount = (Integer) request.getAttribute("org.apache.jetspeed.invocationCount");
           Integer iCount = (Integer) request.getPortletSession().getAttribute("org.apache.jetspeed.invocationCount");
           if (iCount == null)
  @@ -79,9 +83,11 @@
   
           response.setRenderParameter("invocationCount", String.valueOf(count));
   
  -        response.setRenderParameter("invokeMessage", "processAction() I was invoked " +
count + " times!");
  +        MessageFormat format = new MessageFormat(resource.getString("preference.label.processActionIWasInvoked"));
  +        String[] patterns = { Integer.toString(count)};
  +        response.setRenderParameter("invokeMessage", format.format(patterns));
           request.getPortletSession().setAttribute("org.apache.jetspeed.invocationCount",
new Integer(count), PortletSession.PORTLET_SCOPE);
  -        System.out.println("--------------------------- I was invoked!!!---------------------------------");
  +        System.out.println(resource.getString("preference.label.IWasInvoked"));
       }
   
   }
  
  
  
  1.7       +3 -1      jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java
  
  Index: HelloWorld.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/portlet/helloworld/HelloWorld.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HelloWorld.java	6 Jun 2004 01:44:55 -0000	1.6
  +++ HelloWorld.java	9 Sep 2004 22:18:04 -0000	1.7
  @@ -16,6 +16,7 @@
   package org.apache.jetspeed.portlet.helloworld;
   
   import java.io.IOException;
  +import java.util.ResourceBundle;
   
   import javax.portlet.GenericPortlet;
   import javax.portlet.PortletConfig;
  @@ -87,12 +88,13 @@
       throws PortletException, IOException
       {
           PortletContext context = getPortletContext();
  +        ResourceBundle resource = getPortletConfig().getResourceBundle(request.getLocale());
           response.setContentType("text/html");
   
           PortletURL url = response.createRenderURL();
           // url.addParameter("test", "value");
           
  -        response.getWriter().println("<br/><b>Init Param 'Hello' = " + this.getInitParameter("hello")
+  "</b>");
  +        response.getWriter().println("<br/><b>"+resource.getString("helloworld.label.InitParamHello")+"
= " + this.getInitParameter("hello") +  "</b>");
           // response.getWriter().println("<br/><b>Render URL = " + url +  "</b>");
           
           PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/hello.jsp");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message