@Override
  public Container getTabContentAt(TabPanel pane, int index) {

    if (index == 3) {
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      Container c = new EXContainer("", "div");

      List<Product> sameProvider =
          MallUtil.getMerchant(p.getProvidedBy())
              .getManager()
              .getMyProducts(Product.STATE_PUBLISHED);
      for (int i = 0; i < sameProvider.size(); i++) {

        Product pp = sameProvider.get(i);
        if (pp.getAbsolutePath().equalsIgnoreCase(getAttribute("path"))) continue;
        String url = pp.getImageUrl("");
        if (!StringUtil.isNotEmpty(url)) {
          url = "emimg/detail/img1.png";
        }
        Container cc =
            new EXContainer("sp" + i, "img")
                .setAttribute("src", "emimg/detail/img1.png")
                .setStyle("cursor", "pointer");
        c.addChild(cc.setAttribute("src", url).setAttribute("path", pp.getAbsolutePath()));
      }
      return c.setStyle("min-height", "250px");

    } else if (index == 4) {
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      Container c = new EXContainer("", "div");

      List<Product> sameProvider =
          MallUtil.getMerchant(p.getProvidedBy())
              .getManager()
              .getMyProducts(Product.STATE_PUBLISHED);
      for (int i = 0; i < sameProvider.size(); i++) {

        Product pp = sameProvider.get(i);
        if (pp.getAbsolutePath().equalsIgnoreCase(getAttribute("path"))) continue;
        String url = pp.getImageUrl("");
        if (!StringUtil.isNotEmpty(url)) {
          url = "emimg/detail/img1.png";
        }
        Container cc =
            new EXContainer("hap" + i, "img")
                .setAttribute("src", "emimg/detail/img1.png")
                .setStyle("cursor", "pointer");
        c.addChild(cc.setAttribute("src", url).setAttribute("path", pp.getAbsolutePath()));
      }
      return c.setStyle("min-height", "250px");
    } else if (index == 0) {
      if (StringUtil.isNotEmpty(getAttribute("path"))) {
        Product p =
            (Product)
                SpringUtil.getRepositoryService()
                    .getFile(getAttribute("path"), Util.getRemoteUser());
        return new EXContainer("summary", "div")
            .setText(p.getSummary())
            .setStyle("min-height", "250px");
      } else {
        return new EXContainer("sd", "div");
      }

    } else if (index == 2) {
      return new EXContainer("", "div")
          .addChild(new EXContainer("sas", "h5").setText("Coming soon"))
          .setStyle("min-height", "250px");
    } else if (index == 1) {
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      List<KeyValuePair> vnps = p.getCategories();
      EXFieldSet fs = new EXFieldSet("categories", "Specifications", false);
      for (KeyValuePair vk : vnps) fs.addField(vk.getKey(), new EXLabel("", vk.getValue()));

      return new EXContainer("", "div").addChild(fs).setStyle("min-height", "250px");
      // return new EXContainer("sas", "h3").setText("Coming soon");
    } else return null;
  }
  @Override
  public boolean ServerAction(Container container, Map<String, String> request) throws UIException {
    if (container.getName().equals("title")
        || container.getName().equals("image")
        || container.getName().equals("img")) {

      return false;
    }

    if (container.getName().startsWith("sp")) {
      String path = container.getAttribute("path");
      if (StringUtil.isNotEmpty(path) && !path.equalsIgnoreCase("null")) {
        Product p =
            (Product)
                SpringUtil.getRepositoryService()
                    .getFile(container.getAttribute("path"), Util.getRemoteUser());
        setProduct(p);
      }
      return true;
    }

    if (container.getName().startsWith("star")) {
      int index = Integer.parseInt(container.getName().replace("star", "")) + 1;
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      for (int i = 0; i < index; i++) {
        getChild("star" + i).setStyle("background", "green");
      }

      String u = Util.getRemoteUser();
      if (!StringUtil.isNotEmpty(u)) {
        u = "anonymous";
      }
      Directory votes = (Directory) p.getFile("votes");
      if (votes == null) {
        votes = p.createFile("votes", Directory.class);
      }

      String cur = votes.getProperty(u);

      if (cur == null) {
        cur = "0";
      }
      try {
        Integer.parseInt(cur);

      } catch (Exception e) {
        cur = "0";
      }

      votes.setProperty(u, (Integer.parseInt(cur) + index) + "");

      p.save();
      return true;
    }

    if (container.getName().startsWith("tn")) {
      for (Container c : getChildren()) {
        if (c.getName().startsWith("tn")) {
          c.setStyleClass("uibutton");
        }
      }
      container.setStyleClass("uibutton uibutton_active");
      getChild("image").setAttribute("src", container.getAttribute("src"));
      return true;
    }

    if (container.getName().equals("merchant")) {
      Merchant m = MallUtil.getMerchant(container.getAttribute("merchant"));
      // EXMerchantInfo info = new EXMerchantInfo("");
      EXMerchantCardV2 info = new EXMerchantCardV2("sd", m);
      EXPanel panel = new EXPanel("mm", m.getCompanyName());
      panel.setBody(info);
      // info.setMerchant(m);
      container
          .getAncestorOfType(PopupContainer.class)
          .addPopup(panel.setStyle("z-index", "3000").setStyle("width", "704px"));
      return true;
    }

    if (container.getName().equals("thumbUp")) {
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      p.thumbUp();
      p.save();
      return true;
    }

    if (container.getName().equals("thumbDown")) {
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      p.thumbDown();
      p.save();
      return true;
    }

    EXInput in = getDescendentOfType(EXInput.class);
    int value = Integer.parseInt(in.getValue().toString());
    if (container.getName().equals("addQty")) {
      in.setValue((value + 1) + "");
    } else if (container.getName().equals("delQty")) {
      if (value > 0) {
        in.setValue((value - 1) + "");
      }
    } else if (container.getName().equals("addToCart")) {
      if (container.getAncestorOfType(EXMall.class) != null) {
        Product p =
            (Product)
                SpringUtil.getRepositoryService()
                    .getFile(getAttribute("path"), Util.getRemoteUser());
        EXMiniCarts carts = getRoot().getDescendentOfType(EXMiniCarts.class);
        if (carts.getChildren().size() == 0) {
          carts.addChild(
              new EXContainer("totalll", "h4")
                  .addClass("ui-widget-header")
                  .setStyle("margin", "0")
                  .setStyle("width", "100%")
                  .setStyle("text-align", "center"));
        }
        EXMiniCart cart =
            getRoot().getDescendentOfType(EXMiniCarts.class).getMiniCart(p.getProvidedBy());
        if (!cart.getTemplateLocation().endsWith("EXMinicartNG.xhtml")) {
          cart.setTemplateLocation("templates/ng/EXMinicartNG.xhtml");
          cart.getParent().setStyle("float", "right").setStyle("margin-top", "12px");
          cart.addChild(new EXContainer("images", "div").setStyle("height", "20px"));
          cart.removeClass("cart-widget")
              .setStyle("margin", "0")
              .setStyle("padding", "0")
              .setStyle("margin-top", "0");
          cart.addChild(
              new EXContainer("checkout", "a")
                  .addEvent(new CartDetailEvent(), Event.CLICK)
                  .setAttribute("href", "#")
                  .setText("<img src=\"blueprint/images/checkout.png\"></img>"));
        }
        CartItem item = cart.getItem(p.getAbsolutePath());
        if (item == null) {
          cart.getChild("images")
              .addChild(
                  new EXContainer("img", "img")
                      .setStyle("cursor", "pointer")
                      .setAttribute("path", p.getAbsolutePath())
                      .addEvent(this, CLICK)
                      .setStyle("margin", "4px 4px 0px 4px")
                      .setStyle("width", "30px")
                      .setStyle("height", "30px")
                      .setAttribute("src", p.getImageUrl("")));
        }
        CartItem citem = cart.addToCart(p, value, container);
      } else {
        Product p =
            (Product)
                SpringUtil.getRepositoryService()
                    .getFile(getAttribute("path"), Util.getRemoteUser());
        getRoot().getDescendentOfType(EXMiniCart.class).addToCart(p, 1, container);
      }
    } else {
      Product p =
          (Product)
              SpringUtil.getRepositoryService().getFile(getAttribute("path"), Util.getRemoteUser());
      try {
        MallUtil.getCurrentUser().addToFavorite(p.getAbsolutePath());
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return true;
  }