svnno****@sourc*****
svnno****@sourc*****
2007年 9月 28日 (金) 17:01:44 JST
Revision: 593 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=593 Author: shinsuke Date: 2007-09-28 17:01:43 +0900 (Fri, 28 Sep 2007) Log Message: ----------- decoration update. Modified Paths: -------------- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductDescription.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.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/webapp/view/user/product/productDetails.html pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html -------------- next part -------------- Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java 2007-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java 2007-09-28 08:01:43 UTC (rev 593) @@ -76,4 +76,8 @@ public static final String CATEGORY_BREADCRUMB = "CategoryBreadcrumb"; public static final String CURRENT_CATEGORY_ID = "CurrentCategoryId"; + + public static final String THUMBNAIL_DISPLAY = "thumbnail"; + + public static final String LIST_DISPLAY = "list"; } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductDescription.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductDescription.java 2007-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/exentity/ProductDescription.java 2007-09-28 08:01:43 UTC (rev 593) @@ -13,19 +13,4 @@ /** Serial version UID. (Default) */ private static final long serialVersionUID = 1L; - private UploadedFile imageFile; - - /** - * @return productsImageFile - */ - public UploadedFile getImageFile() { - return imageFile; - } - - /** - * @param productsImageFile 設定する productsImageFile - */ - public void setImageFile(UploadedFile productsImageFile) { - this.imageFile = productsImageFile; - } } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java 2007-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java 2007-09-28 08:01:43 UTC (rev 593) @@ -81,6 +81,8 @@ getCategoryListPage().setBreadcrumbItems(breadcrumbItems); } + // TODO check if breadcrumb should be put to session.. + // set sub categories getCategoryListPage().setCategoryItems( getCategoryDxo().convert( 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-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java 2007-09-28 08:01:43 UTC (rev 593) @@ -43,6 +43,25 @@ } public Class<?> prerender() { + // check login + String remoteUser = FacesContext.getCurrentInstance() + .getExternalContext().getRemoteUser(); + if (remoteUser == null) { + getProductDetailsPage().setLogin(false); + getProductDetailsPage().setUser(false); + } else { + getProductDetailsPage().setLogin(true); + // check user + Customer customers = getCustomerService().getCustomerByPortalId( + remoteUser); + if (customers == null) { + FacesMessageUtil.addWarnMessage("need.to.register.as.customer"); + getProductDetailsPage().setUser(false); + } else { + getProductDetailsPage().setUser(true); + } + } + ProductDescription description = productService .getProdcutsDescription(productDetailsPage.getProductId()); productDxo.convert(description, productDetailsPage); 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-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java 2007-09-28 08:01:43 UTC (rev 593) @@ -3,6 +3,8 @@ import java.io.Serializable; import java.math.BigDecimal; +import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter; + public class ProductDetailsPage implements Serializable { /** @@ -18,8 +20,28 @@ private String name; - private String price; + private String title; + private String description; + + private String url; + + private String code; + + private BigDecimal quantity; + + private BigDecimal weight; + + private String size; + + private boolean user; + + private boolean login; + + //TODO i18n + @BigDecimalConverter(pattern = "###,###") + private BigDecimal price; + public String getManufacturersName() { return manufacturersName; } @@ -52,12 +74,141 @@ this.name = productsName; } - public String getPrice() { + public BigDecimal getPrice() { return price; } - public void setPrice(String productsPrice) { + public void setPrice(BigDecimal productsPrice) { this.price = productsPrice; } + /** + * @return title + */ + public String getTitle() { + if (title == null) { + return getName(); + } + return title; + } + + /** + * @param title 設定する title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * @return description + */ + public String getDescription() { + return description; + } + + /** + * @param description 設定する description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return url + */ + public String getUrl() { + return url; + } + + /** + * @param url 設定する url + */ + public void setUrl(String url) { + this.url = url; + } + + /** + * @return code + */ + public String getCode() { + return code; + } + + /** + * @param code 設定する code + */ + public void setCode(String code) { + this.code = code; + } + + /** + * @return quantity + */ + public BigDecimal getQuantity() { + return quantity; + } + + /** + * @param quantity 設定する quantity + */ + public void setQuantity(BigDecimal quantity) { + this.quantity = quantity; + } + + /** + * @return weight + */ + public BigDecimal getWeight() { + return weight; + } + + /** + * @param weight 設定する weight + */ + public void setWeight(BigDecimal weight) { + this.weight = weight; + } + + /** + * @return size + */ + public String getSize() { + return size; + } + + /** + * @param size 設定する size + */ + public void setSize(String size) { + this.size = size; + } + + /** + * @return user + */ + public boolean isUser() { + return user; + } + + /** + * @param user 設定する user + */ + public void setUser(boolean user) { + this.user = user; + } + + /** + * @return login + */ + public boolean isLogin() { + return login; + } + + /** + * @param login 設定する login + */ + public void setLogin(boolean login) { + this.login = login; + } + } 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-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java 2007-09-28 08:01:43 UTC (rev 593) @@ -3,20 +3,19 @@ import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; -import org.seasar.teeda.extension.util.LabelHelper; - import jp.sf.pal.pompei.PompeiConstants; import jp.sf.pal.pompei.dxo.CategoryDxo; import jp.sf.pal.pompei.dxo.ProductDxo; -import jp.sf.pal.pompei.exentity.CategoryDescription; import jp.sf.pal.pompei.exentity.Product; import jp.sf.pal.pompei.service.CategoryService; import jp.sf.pal.pompei.service.ProductService; +import jp.sf.pal.pompei.util.SessionUtil; +import org.seasar.teeda.extension.util.LabelHelper; + public class ProductListAction implements Serializable { /** @@ -48,86 +47,29 @@ } public Class<?> prerender() { - if (productListPage.getParentId() == null) { - productListPage.setParentId(PompeiConstants.ROOT_CATEGORY_ID); - } - if (productListPage.getBreadcrumbItems() == null) { - productListPage.setCategoryId(PompeiConstants.ROOT_CATEGORY_ID); - - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); - Map<String, Object> m = new HashMap<String, Object>(); - m - .put(PompeiConstants.CATEGORY_ID, - PompeiConstants.ROOT_CATEGORY_ID); - m.put(PompeiConstants.BREADCRUMB, getLabelHelper().getLabelValue( - PompeiConstants.TOP_CATEGORY)); - list.add(m); - productListPage.setBreadcrumbItems(list); - - } else { - if (productListPage.getCategoryId() != null) { - productListPage.setParentId(productListPage.getCategoryId()); - } - - //パンくずリストを再セット - List<Map<String, Object>> list = setBreadcrumb(productListPage - .getBreadcrumbItems(), productListPage.getParentId()); - productListPage.setBreadcrumbItems(list); + BigDecimal currentCategoryId = (BigDecimal) SessionUtil + .getFromApplicationScope(PompeiConstants.CURRENT_CATEGORY_ID); + if (currentCategoryId == null) { + currentCategoryId = PompeiConstants.ROOT_CATEGORY_ID; + //TODO should put it to session } - //カテゴリ一覧の取得 - List<Map<String, Object>> cList = getCategoriesList(); - productListPage.setCategoryItems(cList); - //商品一覧の取得 - List<Product> list = productService.getProductList(productListPage - .getParentId()); + List<Product> list = productService.getProductList(currentCategoryId); List<Map<String, Object>> sList = new ArrayList<Map<String, Object>>(); productDxo.convert(list, sList); productListPage.setProductItems(sList); + // default display mode + if (getProductListPage().getDisplayMode() == null) { + getProductListPage().setDisplayMode( + PompeiConstants.THUMBNAIL_DISPLAY); + } return null; } /** - * パンくずリストを返します。 - * @param breadcrumbItems - * @param id - * @return - */ - private List<Map<String, Object>> setBreadcrumb( - List<Map<String, Object>> breadcrumbItems, BigDecimal id) { - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); - for (Map<String, Object> m : breadcrumbItems) { - list.add(m); - if (((BigDecimal) m.get(PompeiConstants.CATEGORY_ID)).equals(id)) { - return list; - } - } - CategoryDescription cd = categoryService - .getCategoryDescription(productListPage.getCategoryId()); - - if (cd == null) { - return list; - } - - Map<String, Object> m = new HashMap<String, Object>(); - m.put(PompeiConstants.CATEGORY_ID, id); - m.put(PompeiConstants.BREADCRUMB, cd.getName()); - list.add(m); - return list; - } - - private List<Map<String, Object>> getCategoriesList() { - List<CategoryDescription> list = categoryService - .getSubCategoryDescriptionList(productListPage.getParentId()); - List<Map<String, Object>> cList = new ArrayList<Map<String, Object>>(); - categoryDxo.convert(list, cList); - return cList; - } - - /** * @return productListPage */ public ProductListPage getProductListPage() { @@ -191,5 +133,4 @@ public void setLabelHelper(LabelHelper labelHelper) { this.labelHelper = labelHelper; } - } 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-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListPage.java 2007-09-28 08:01:43 UTC (rev 593) @@ -5,13 +5,13 @@ import java.util.List; import java.util.Map; +import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter; + import jp.sf.pal.pompei.PompeiConstants; import jp.sf.pal.pompei.exentity.ProductDescription; import jp.sf.pal.pompei.service.LanguageService; import jp.sf.pal.pompei.util.UrlBuilderUtil; -import org.seasar.teeda.extension.annotation.scope.SubapplicationScope; - public class ProductListPage implements Serializable { /** @@ -19,94 +19,20 @@ */ private static final long serialVersionUID = -2356477849446203183L; - private BigDecimal categoryId; - - private String breadcrumb; - - private int breadcrumbIndex; - - /** 改行ポイント*/ - // private boolean breakPoint; - - @SubapplicationScope - private List<Map<String, Object>> breadcrumbItems; - - private String name; - - private int categoryIndex; - - @SubapplicationScope - private List<Map<String, Object>> categoryItems; - - @SubapplicationScope - private BigDecimal parentId; - private int productIndex; private List<Map<String, Object>> productItems; private BigDecimal productId; + //TODO i18n + @BigDecimalConverter(pattern = "###,###") private BigDecimal price; + private String displayMode; + private LanguageService languageService; - public String getBreadcrumb() { - return breadcrumb; - } - - public void setBreadcrumb(String breadcrumb) { - this.breadcrumb = breadcrumb; - } - - public int getBreadcrumbIndex() { - return breadcrumbIndex; - } - - public void setBreadcrumbIndex(int breadcrumbIndex) { - this.breadcrumbIndex = breadcrumbIndex; - } - - public List<Map<String, Object>> getBreadcrumbItems() { - return breadcrumbItems; - } - - public void setBreadcrumbItems(List<Map<String, Object>> breadcrumbItems) { - this.breadcrumbItems = breadcrumbItems; - } - - public String getName() { - return name; - } - - public void setName(String categoriesName) { - this.name = categoriesName; - } - - public int getCategoryIndex() { - return categoryIndex; - } - - public void setCategoryIndex(int categoryIndex) { - this.categoryIndex = categoryIndex; - } - - public List<Map<String, Object>> getCategoryItems() { - return categoryItems; - } - - public void setCategoryItems(List<Map<String, Object>> categoryItems) { - this.categoryItems = categoryItems; - } - - public BigDecimal getParentId() { - return parentId; - } - - public void setParentId(BigDecimal parentId) { - this.parentId = parentId; - } - public int getProductIndex() { return productIndex; } @@ -131,23 +57,6 @@ this.price = productsPrice; } - public BigDecimal getCategoryId() { - return categoryId; - } - - public void setCategoryId(BigDecimal categoriesId) { - this.categoryId = categoriesId; - } - - // public void setDescriptionList(List list) { - // if (list != null && list.size() > 0) { - // this.productsName = ((ProductDescription) list.get(0)) - // .getProductsName(); - // } else { - // this.productsName = ""; - // } - // } - public boolean isBreakPoint() { if (productIndex % 4 == 0) { return true; @@ -167,10 +76,6 @@ return UrlBuilderUtil.createCartUrl(); } - // public void setBreakPoint(boolean test) { - // this.breakPoint = test; - // } - /** * @return languageService */ @@ -202,4 +107,27 @@ } return "-"; } + + /** + * @return displayMode + */ + public String getDisplayMode() { + return displayMode; + } + + /** + * @param displayMode 設定する displayMode + */ + public void setDisplayMode(String displayMode) { + this.displayMode = displayMode; + } + + public boolean isThumbnailDisplay() { + return PompeiConstants.THUMBNAIL_DISPLAY.equals(getDisplayMode()); + } + + public boolean isListDisplay() { + return PompeiConstants.LIST_DISPLAY.equals(getDisplayMode()); + } + } Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html 2007-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html 2007-09-28 08:01:43 UTC (rev 593) @@ -8,33 +8,58 @@ <body> <form id="productDetailsForm"> <div><span id="messages" fatalClass="portlet-msg-error" errorClass="portlet-msg-error" warnClass="portlet-msg-alert" infoClass="portlet-msg-info"></span></div> -<table border="1"> -<tr> -<td colspan="2" align="center"><img src="" style="width:90px;height:120px;" alt="画像" /></td> -</tr> -<tr> -<th><label id="productsid">ID</label></th> -<td><span id="productId">000012</span><input type="hidden" id="productId-hidden"/></td> -</tr> -<tr> -<th><label id="productsname">名前</label></th> -<td><span id="name">AAAAAAA</span></td> -</tr> -<tr> -<th><label id="productsmodel">型番</label></th> -<td><span id="model"> </span></td> -</tr> -<tr> -<th><label id="manufacturersname">メーカー</label></th> -<td><span id="manufacturersName"> </span></td> -</tr> -<tr> -<th><label id="productsprice">価格</label></th> -<td><span id="price"> </span></td> -</tr> -</table> -<br/> -<input type="submit" id="doAddCart" value="カートに追加" /> +<input id="productId" type="hidden" /> +<table style="width: 100%;"> + <tr> + <td width="300"><img id="productImage" src="" alt="画像" /></td> + <td align="left"> + <div><span id="title">タイトル</span></div> + <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/> + <table> + <tr> + <th align="right"><label>商品名</label></th> + <td><span id="name">名前</span></td> + </tr> + <tr> + <th align="right"><label>商品コード</label></th> + <td><span id="code">1234</span></td> + </tr> + <tr> + <th align="right"><label>型番</label></th> + <td><span id="model">1234</span></td> + </tr> + <tr> + <th align="right"><label>メーカー</label></th> + <td><span id="manufacturersName">1234</span></td> + </tr> + <tr> + <th align="right"><label>価格</label></th> + <td><b style="color: #990000;"><span id="price">100</span> 円</b></td> + </tr> + <tr> + <th align="right"><label>在庫数</label></th> + <td><span id="quantity">1</span></td> + </tr> + </table> + <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/> + <div id="isUser"> + <input type="submit" id="doAddCart" value="カートに追加" /> + </div> + <div id="isLogin"> + <label>商品をカートに入れるには、本サービスにユーザー登録が必要になります。</label> + </div> + <div id="isNotLogin"> + <label>商品をカートに入れるには、本サービスにログインしてください。</label> + </div> + </td> + </tr> +</table> +<hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/> +<div> +<h2 style="color:#CC6600;">詳細情報</h2> +<span id="description">説明</span> +</div> +<hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/> <input type="submit" id="jumpProductList" value="一覧に戻る" /> </form> </body></html> \ No newline at end of file Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html 2007-09-28 05:59:44 UTC (rev 592) +++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productList.html 2007-09-28 08:01:43 UTC (rev 593) @@ -2,34 +2,26 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:pal="http://pal.sourceforge.jp/jsf4portlet" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:te="http://www.seasar.org/teeda/extension"> - <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title id="title-head">商品一覧画面</title> </head> <body> -<form id="Form"> -<input type="hidden" id="parentId" /> -<div id="breadcrumbItems"> - > <a id="goSubCategory-a" href="./productList.html?categoryId=0"><span id="breadcrumb"></span></a> -</div> -<br/> -<br/> -<div id="categoryItems"> -<a id="goSubCategory" href="./productList.html?categoryId=1"><span id="name">スニーカー</span></a>&nbsp;&nbsp; -</div> -<hr/> -<div><span id="messages"></span></div> -<a id="cartLink" href="">カートを確認</a> -<br/> -<br/> +<form id="productListForm"> +<label>表示方法: </label> +<span id="isThumbnailDisplay">サムネイル表示</span> +<span id="isNotThumbnailDisplay"><a id="goProductList-thumbnail" href="./productList.html?fixed_displayMode=thumbnail">サムネイル表示</a></span> +<span id="isListDisplay">リスト表示</span> +<span id="isNotListDisplay"><a id="goProductList-list" href="./productList.html?fixed_displayMode=list">リスト表示</a></span> +<br/> +<br/> <div style="width:100%;text-align:center;"> - <div id="productItems" style="width:800px;"> + <div id="productItems"> <div style="float:left;width:240px"> - <a id="goDetails" href="productDetails.html?&productId=1"> - <img src="" style="width:60px;height:80px;" alt="画像" border="0"/><br/> + <a id="goProductDetails" href="productDetails.html?&productId=1"> + <img src="" alt="画像" border="0"/><br/> <span id="productName">AAAAAAA</span></a><br/> - <span id="price">価格</span> + <b style="color: #990000;"><span id="price">価格</span>円</b> </div> </div> </div>