Ejemplo n.º 1
0
  @Override
  public void onReady(ClientProxy proxy) {

    super.onReady(proxy);

    JMap map = new JMap();
    int columns = model_.getColumnCount();
    JArray cols = new JArray();
    for (int i = 0; i < columns; i++) {
      Class<?> t = model_.getColumnClass(i);
      JMap colOpt = new JMap();
      colOpt.put("field", i + "").put("title", model_.getColumnNameAt(i));

      if (t.isAssignableFrom(Boolean.class)) {
        colOpt.put("checkbox", true);
      }
      cols.add(new JArray().add(colOpt));
    }

    map.put("columns", cols);
    map.put("url", ResourceUtil.getMethodUrl(this));

    map.put("pagination", true);
    map.put("showFooter", true);

    proxy.addMethod("datagrid", map);
  }
 public String getTemplate() {
   try {
     if (getRoot().getServerName().equals("localhost")) {
       return ResourceUtil.getTemplate(getTemplateLocation(), getRoot());
     }
     Map bean = BaseSpringUtil.getBean("templateCache");
     if (bean != null) {
       if (bean.containsKey(templateLocation)) {
         return bean.get(templateLocation).toString();
       } else {
         String template = ResourceUtil.getTemplate(templateLocation, getRoot());
         bean.put(templateLocation, template);
         return template;
       }
     } else {
       return ResourceUtil.getTemplate(getTemplateLocation(), getRoot());
     }
   } catch (Exception e) {
     return ResourceUtil.getTemplate(getTemplateLocation(), getRoot());
   }
 }
  public EXInviteFriends(String name) {
    super(name, "div");
    setAttribute(
        "style",
        "margin: auto; width: 600px; padding: 12px; border-radius: 5px 5px 5px 5px; background: -moz-linear-gradient(center top, rgb(36, 36, 39) 0%, rgb(21, 21, 22) 100% ) repeat scroll 0px 0px transparent; box-shadow: 5px 5px 5px black;");
    addChild(
        new EXXHTMLFragment(
            "sd",
            ResourceUtil.getDownloadURL(
                "classpath", "org/castafiore/facebook/ui/InviteInfo.xhtml")));

    EXGrid grid = new EXGrid("", 4, 1);
    String facebooklogin =
        SpringUtil.getBeanOfType(FacebookGraphAPIClient.class)
            .getAuthorizationUrl(
                "180567415418654",
                "ef8be0651a0d0aa94a51ec454b9a9165",
                "http://www.emallofmauritius.com/templates.html?facebook=true");
    Container facebook =
        new EXContainer("", "a")
            .setAttribute("href", facebooklogin)
            .setText(
                "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-facebook-box-blue-icon.png></img>");

    grid.getCell(0, 0).addChild(facebook);
    grid.getCell(1, 0)
        .setText(
            "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-google-box-blue-icon.png></img>");
    grid.getCell(2, 0)
        .setText(
            "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-linkedin-box-blue-icon.png></img>");
    grid.getCell(3, 0)
        .setText(
            "<img src=http://icons.iconarchive.com/icons/yootheme/social-bookmark/72/social-twitter-box-blue-icon.png></img>");
    // addChild(grid);

    addChild(
        new EXContainer("div", "div")
            .setAttribute(
                "style",
                "padding: 8px; background: none repeat scroll 0px 0px white; margin-top: 12px;")
            .addChild(grid));

    // facebook
    // linkedin
    // google+
    // twitter
    //
  }
  public EXBorderLayoutContainer(String name) {

    super(
        name,
        ResourceUtil.getDownloadURL(
            "classpath", "org/castafiore/resource/layout/EXBorderLayoutContainer.xhtml"));

    Container c = ComponentUtil.getContainer("popupContainer", "div", null, null);
    c.setStyle("position", "absolute");
    c.setStyle("top", "10%");
    c.setStyle("left", "10%");
    addChild(c);

    for (String s : CONTENT_NAMES) {
      EXContainer top = new EXContainer(s, "td");
      top.setAttribute("valign", "top");
      addChild(top);
    }
    setWidth(Dimension.parse("100%"));
  }