Skip to content

Commit

Permalink
update to mixer2-1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nabedge committed Nov 17, 2015
1 parent b1ba498 commit e09fe28
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion mixer2-fruitshop-springboot/pom.xml
Expand Up @@ -15,7 +15,7 @@
<slf4j.api.version>1.7.6</slf4j.api.version>
<spring.version>4.1.8.RELEASE</spring.version>
<spring.boot.version>1.2.7.RELEASE</spring.boot.version>
<mixer2.version>1.2.38</mixer2.version>
<mixer2.version>1.3.1</mixer2.version>
<tomcat.version>7.0.52</tomcat.version>
</properties>

Expand Down
Expand Up @@ -20,13 +20,12 @@
import org.mixer2.sample.web.view.helper.SectionHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

public class CartView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
HttpServletResponse response) {

Cart cart = (Cart) model.get("cart");

Expand All @@ -45,7 +44,7 @@ protected Html renderHtml(Html html, Map<String, Object> model, HttpServletReque
return html;
}

private void replaceCartForm(Html html, Cart cart) throws TagTypeUnmatchException {
private void replaceCartForm(Html html, Cart cart) {

List<CartItem> itemList = cart.getReadOnlyItemList();

Expand Down
Expand Up @@ -19,13 +19,12 @@
import org.mixer2.sample.web.view.helper.SectionHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

public class IndexView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
HttpServletResponse response) {

// get data from model
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -59,7 +58,7 @@ protected Html renderHtml(Html html, Map<String, Object> model, HttpServletReque
* @param categoryList
* @throws TagTypeUnmatchException
*/
private void replaceCategoryBox(Html html, List<Item> itemList) throws TagTypeUnmatchException {
private void replaceCategoryBox(Html html, List<Item> itemList) {
// get contextPath
String ctx = RequestUtil.getContextPath();

Expand Down
Expand Up @@ -21,13 +21,12 @@
import org.mixer2.sample.web.view.helper.SectionHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

public class ItemListView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
HttpServletResponse response) {

// embed category list on side bar
@SuppressWarnings("unchecked")
Expand All @@ -52,7 +51,7 @@ protected Html renderHtml(Html html, Map<String, Object> model, HttpServletReque
return html;
}

private void replaceItemBox(Html html, List<Item> itemList) throws TagTypeUnmatchException {
private void replaceItemBox(Html html, List<Item> itemList) {

// get contextPath
String ctx = RequestUtil.getContextPath();
Expand Down
Expand Up @@ -20,13 +20,12 @@
import org.mixer2.sample.web.view.helper.SectionHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

public class ItemView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
HttpServletResponse response) {

@SuppressWarnings("unchecked")
List<Category> categoryList = (List<Category>) model.get("categoryList");
Expand Down Expand Up @@ -56,9 +55,8 @@ protected Html renderHtml(Html html, Map<String, Object> model, HttpServletReque
* @param html
* item detail page template.
* @param item
* @throws TagTypeUnmatchException
*/
private static void replaceItemBox(Html html, Item item) throws TagTypeUnmatchException {
private static void replaceItemBox(Html html, Item item) {

// get contextPath
String ctx = RequestUtil.getContextPath();
Expand Down
Expand Up @@ -22,13 +22,12 @@
import org.mixer2.sample.web.view.helper.TransactionTokenHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

public class ConfirmView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
HttpServletResponse response) {

Cart cart = (Cart) model.get("cart");
Shipping shipping = (Shipping) model.get("shipping");
Expand Down Expand Up @@ -56,7 +55,7 @@ protected Html renderHtml(Html html, Map<String, Object> model, HttpServletReque
return html;
}

private void replaceCartTable(Html html, Cart cart, Shipping shipping) throws TagTypeUnmatchException {
private void replaceCartTable(Html html, Cart cart, Shipping shipping) {
Table cartTable = html.getBody().getById("cartTable", Table.class);
Tbody cartTbody = cartTable.getTbody().get(0);

Expand Down Expand Up @@ -106,7 +105,7 @@ private void replaceCartTable(Html html, Cart cart, Shipping shipping) throws Ta

}

private void replaceShipToAddress(Html html, Shipping shipping) throws TagTypeUnmatchException {
private void replaceShipToAddress(Html html, Shipping shipping) {
// name
Span shipToNameSpan = html.getBody().getById("shipToName", Span.class);
shipToNameSpan.unsetContent();
Expand All @@ -117,7 +116,7 @@ private void replaceShipToAddress(Html html, Shipping shipping) throws TagTypeUn
shipToAddressSpan.getContent().add(shipping.getAddress() + " " + shipping.getZipCode());
}

private void replaceOrderCompleteForm(Html html) throws TagTypeUnmatchException {
private void replaceOrderCompleteForm(Html html) {
String ctx = RequestUtil.getContextPath();
Form form = html.getById("orderCompleteForm", Form.class);
form.setMethod("post");
Expand Down
Expand Up @@ -17,7 +17,6 @@
import org.mixer2.sample.web.view.helper.SectionHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;
import org.mixer2.xhtml.util.FormUtil;
import org.springframework.validation.Errors;
import org.springframework.validation.FieldError;
Expand All @@ -28,8 +27,7 @@ public class ShippingView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException, IllegalAccessException,
InvocationTargetException {
HttpServletResponse response) throws IllegalAccessException, InvocationTargetException {

Shipping shipping = (Shipping) model.get("shipping");
boolean redirected = (Boolean) model.get("redirected");
Expand All @@ -55,8 +53,8 @@ protected Html renderHtml(Html html, Map<String, Object> model, HttpServletReque
return html;
}

private void replaceShippingForm(Html html, Shipping shipping) throws TagTypeUnmatchException,
IllegalAccessException, InvocationTargetException {
private void replaceShippingForm(Html html, Shipping shipping)
throws IllegalAccessException, InvocationTargetException {

// populate form tag
Form shippingForm = html.getBody().getById("shippingForm", Form.class);
Expand All @@ -73,7 +71,7 @@ private void replaceShippingForm(Html html, Shipping shipping) throws TagTypeUnm
shippingForm.setAction(ctx + "/checkout/confirm");
}

private void replaceErrorMessage(Html html, Errors errors) throws TagTypeUnmatchException {
private void replaceErrorMessage(Html html, Errors errors) {

Form shippingForm = html.getBody().getById("shippingForm", Form.class);

Expand Down Expand Up @@ -106,7 +104,7 @@ private void replaceErrorMessage(Html html, Errors errors) throws TagTypeUnmatch
shippingForm.removeDescendants("remove", Span.class);
}

private void removeAllErrorMessages(Html html) throws TagTypeUnmatchException {
private void removeAllErrorMessages(Html html) {
Form shippingForm = html.getBody().getById("shippingForm", Form.class);
shippingForm.removeDescendants("errorMessage", Span.class);
}
Expand Down
Expand Up @@ -12,13 +12,12 @@
import org.mixer2.sample.web.view.helper.SectionHelper;
import org.mixer2.spring.webmvc.AbstractMixer2XhtmlView;
import org.mixer2.xhtml.PathAdjuster;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

public class ThankyouView extends AbstractMixer2XhtmlView {

@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
HttpServletResponse response) {

// replace anchor link to top page
String ctx = RequestUtil.getContextPath();
Expand Down
Expand Up @@ -10,7 +10,6 @@
import org.mixer2.jaxb.xhtml.Ul;
import org.mixer2.sample.dto.Category;
import org.mixer2.sample.web.util.RequestUtil;
import org.mixer2.xhtml.exception.TagTypeUnmatchException;

/**
* Helper class for handle sidebar of html template.
Expand All @@ -20,7 +19,7 @@ public class SectionHelper {
@SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(SectionHelper.class);

public static void rewriteHeader(Html html) throws TagTypeUnmatchException {
public static void rewriteHeader(Html html) {

String ctx = RequestUtil.getContextPath();

Expand All @@ -32,17 +31,16 @@ public static void rewriteHeader(Html html) throws TagTypeUnmatchException {

}

public static void rewiteFooter(Html html) throws TagTypeUnmatchException {
public static void rewiteFooter(Html html) {
// TODO
}

/**
* rewrite side bar. replace category list ul/li tags on sidebar by category table data. and link to view cart
* @param html
* @param categoryList
* @throws TagTypeUnmatchException
*/
public static void rewriteSideBar(Html html, List<Category> categoryList) throws TagTypeUnmatchException {
public static void rewriteSideBar(Html html, List<Category> categoryList) {

Div sideBar = html.getBody().getById("sidebar", Div.class);
// get category list ul
Expand Down
Expand Up @@ -7,6 +7,7 @@
<link rel="stylesheet" type="text/css" href="../m2static/css/main.css" media="all" />
</head>
<body>
<main>
<div id="header">
<a class="topPageAnchor" href="../m2template/index.html"><img src="../m2static/img/fruitshop-logo.png" /></a>
</div>
Expand Down Expand Up @@ -56,5 +57,6 @@ <h3 class="itemNameLink">
<div id="footer">
fruits shop sample application for <a href="http://mixer2.org/">mixer2</a> and Spring MVC
</div>
</main>
</body>
</html>

0 comments on commit e09fe28

Please sign in to comment.