[pal-cvs 2966] [710] change portlet title dynamically.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 11月 20日 (火) 10:42:59 JST


Revision: 710
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=710
Author:   shinsuke
Date:     2007-11-20 10:42:58 +0900 (Tue, 20 Nov 2007)

Log Message:
-----------
change portlet title dynamically.

Modified Paths:
--------------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java
    pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/user/product/label.properties


-------------- next part --------------
Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java	2007-11-20 01:23:34 UTC (rev 709)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/SystemUtil.java	2007-11-20 01:42:58 UTC (rev 710)
@@ -6,6 +6,7 @@
 
 import javax.faces.context.FacesContext;
 import javax.portlet.PortletConfig;
+import javax.portlet.RenderResponse;
 
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.pompei.PompeiConstants;
@@ -145,4 +146,11 @@
         }
         return PompeiConstants.DEFAULT_NUM_OF_TOP_PRODUCTS;
     }
+
+    public static void setWindowTitle(String title) {
+        Object response = getFacesContext().getExternalContext().getResponse();
+        if (response instanceof RenderResponse) {
+            ((RenderResponse) response).setTitle(title);
+        }
+    }
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java	2007-11-20 01:23:34 UTC (rev 709)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java	2007-11-20 01:42:58 UTC (rev 710)
@@ -20,6 +20,7 @@
 import jp.sf.pal.pompei.service.CustomerService;
 import jp.sf.pal.pompei.service.ProductService;
 import jp.sf.pal.pompei.util.SessionUtil;
+import jp.sf.pal.pompei.util.SystemUtil;
 import jp.sf.pal.pompei.util.UploadedFileUtil;
 import jp.sf.pal.pompei.util.UrlBuilderUtil;
 
@@ -129,6 +130,10 @@
                                     .getProductImageUrl(PompeiConstants.DEFAULT_DETAILS_IMAGE_NAME));
         }
 
+        // set title
+        SystemUtil.setWindowTitle(getProductDetailsPage().getLabelHelper()
+                .getLabelValue("windowTitle"));
+
         // render faces messages
         FacesMessageUtil.renderMessages();
         return null;

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-11-20 01:23:34 UTC (rev 709)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-11-20 01:42:58 UTC (rev 710)
@@ -6,6 +6,7 @@
 import jp.sf.pal.pompei.util.UrlBuilderUtil;
 
 import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter;
+import org.seasar.teeda.extension.util.LabelHelper;
 
 public class ProductDetailsPage implements Serializable {
 
@@ -14,6 +15,8 @@
      */
     private static final long serialVersionUID = 1811488036598264012L;
 
+    private LabelHelper labelHelper;
+
     private String manufacturersName;
 
     private BigDecimal productId;
@@ -269,4 +272,18 @@
         }
         return false;
     }
+
+    /**
+     * @return the labelHelper
+     */
+    public LabelHelper getLabelHelper() {
+        return labelHelper;
+    }
+
+    /**
+     * @param labelHelper the labelHelper to set
+     */
+    public void setLabelHelper(LabelHelper labelHelper) {
+        this.labelHelper = labelHelper;
+    }
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-11-20 01:23:34 UTC (rev 709)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-11-20 01:42:58 UTC (rev 710)
@@ -22,6 +22,7 @@
 import jp.sf.pal.pompei.service.ProductService;
 import jp.sf.pal.pompei.util.PagingResultBeanWrapper;
 import jp.sf.pal.pompei.util.SessionUtil;
+import jp.sf.pal.pompei.util.SystemUtil;
 import jp.sf.pal.pompei.util.UploadedFileUtil;
 
 import org.seasar.teeda.extension.util.LabelHelper;
@@ -194,6 +195,10 @@
                     PompeiConstants.THUMBNAIL_DISPLAY);
         }
 
+        // set title
+        SystemUtil.setWindowTitle(getProductListPage().getLabelHelper()
+                .getLabelValue("windowTitle"));
+
         // render faces messages
         FacesMessageUtil.renderMessages();
         return null;

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java	2007-11-20 01:23:34 UTC (rev 709)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java	2007-11-20 01:42:58 UTC (rev 710)
@@ -11,6 +11,7 @@
 import jp.sf.pal.pompei.web.PagingResultPage;
 
 import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter;
+import org.seasar.teeda.extension.util.LabelHelper;
 
 public class ProductListPage extends PagingResultPage {
 
@@ -19,6 +20,8 @@
      */
     private static final long serialVersionUID = -2356477849446203183L;
 
+    private LabelHelper labelHelper;
+
     private int productIndex;
 
     private List<Map<String, Object>> productItems;
@@ -197,4 +200,18 @@
         return getThumbnailSrc();
     }
 
+    /**
+     * @return the labelHelper
+     */
+    public LabelHelper getLabelHelper() {
+        return labelHelper;
+    }
+
+    /**
+     * @param labelHelper the labelHelper to set
+     */
+    public void setLabelHelper(LabelHelper labelHelper) {
+        this.labelHelper = labelHelper;
+    }
+
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/user/product/label.properties
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/user/product/label.properties	2007-11-20 01:23:34 UTC (rev 709)
+++ pompei/portlets/pompei-core/trunk/src/main/resources/jp/sf/pal/pompei/web/user/product/label.properties	2007-11-20 01:42:58 UTC (rev 710)
@@ -5,3 +5,6 @@
 productDetails.productsmodel=\u578b\u756a
 productDetails.productsprice=\u4fa1\u683c
 productDetails.manufacturersname=\u30e1\u30fc\u30ab\u30fc
+
+productList.windowTitle=\u5546\u54c1\u4e00\u89a7
+productDetails.windowTitle=\u5546\u54c1\u8a73\u7d30


pal-cvs メーリングリストの案内
Back to archive index