public Container getComponentAt(TabPanel pane, TabModel model, int index) {
   Container tab = ComponentUtil.getContainer("tt", "a", "", null);
   tab.setAttribute("href", "#tabs-" + index).setStyle("font-size", "11px");
   tab.setText(model.getTabLabelAt(pane, index, false));
   EXContainer tTab = new EXContainer("", "li");
   tTab.setAttribute("class", EXTabPanel.TABS_INACTIVE_TAB_STYLE);
   tTab.addChild(tab);
   return tTab;
 }
  protected EXBorderLayoutContainer(String name, String template) {
    super(name, template);
    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%"));
  }
示例#3
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 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%"));
  }
  public EXRoleWidget(String name) throws Exception {
    super(name, 3, 0);
    addClass("ui-widget");
    addClass("ui-corner-all");
    setStyle("border-collapse", "collapse");
    setStyle("margin-left", "2px");
    setWidth(Dimension.parse("159px"));
    SecurityService service = SpringUtil.getBeanOfType(SecurityService.class);
    List<Group> groups = service.getGroups();
    // int index = 0;
    for (Group g : groups) {
      String gname = g.getName();
      int id = g.getId();
      EXRow row = addRow();
      row.setAttribute("grp-name", g.getName());
      EXCheckBox cb = new EXCheckBox("");
      cb.addEvent(
          new Event() {

            public void ClientAction(ClientProxy container) {
              container.makeServerRequest(this);
            }

            public boolean ServerAction(Container container, Map<String, String> request)
                throws UIException {

              EXIconButton ic =
                  container
                      .getAncestorOfType(PermissionButton.class)
                      .getDescendentOfType(EXIconButton.class);
              ic.setAttribute("isdirty", "true");
              String text = ic.getLabel();
              if (!text.endsWith("*")) {
                ic.setLabel(text + " *");
              }

              List<Container> checkBoxes = new ArrayList<Container>();
              ComponentUtil.getDescendentsOfType(
                  container.getParent().getParent().getDescendentOfType(EXGroupWidget.class),
                  checkBoxes,
                  EXCheckBox.class);

              for (Container c : checkBoxes) {
                ((EXCheckBox) c).setChecked(((EXCheckBox) container).isChecked());
              }
              return true;
            }

            public void Success(ClientProxy container, Map<String, String> request)
                throws UIException {
              // TODO Auto-generated method stub

            }
          },
          Event.CHANGE);
      cb.setAttribute("rId", id + "");
      row.addInCell(0, cb);

      Container uiName = ComponentUtil.getContainer("label", "span", gname, null);
      row.addInCell(1, uiName);

      Container span = ComponentUtil.getContainer("", "span", null, "ui-icon ui-icon-circle-plus");
      span.setAttribute("close", "true");
      span.addEvent(
          new Event() {

            public void ClientAction(ClientProxy container) {

              ClientProxy open =
                  container
                      .clone()
                      .setAttribute("close", "false")
                      .removeClass("ui-icon-circle-plus")
                      .addClass("ui-icon-circle-minus")
                      .getParent()
                      .getParent()
                      .getDescendentByName("childWidget")
                      .slideDown(200);
              ClientProxy close =
                  container
                      .clone()
                      .setAttribute("close", "true")
                      .removeClass("ui-icon-circle-minus")
                      .addClass("ui-icon-circle-plus")
                      .getParent()
                      .getParent()
                      .getDescendentByName("childWidget")
                      .slideUp(200);
              container.IF(container.getAttribute("close").equal("true"), open, close);
              // container.getParent().getParent().getDescendentByName("childWidget").slideDown(200);
              // container.makeServerRequest(this);

            }

            public boolean ServerAction(Container container, Map<String, String> request)
                throws UIException {
              // TODO Auto-generated method stub
              return false;
            }

            public void Success(ClientProxy container, Map<String, String> request)
                throws UIException {
              // TODO Auto-generated method stub

            }
          },
          Event.CLICK);

      row.addInCell(2, span);

      row.addClass("ui-widget-content");
      row.getChildByIndex(0).setAttribute("valign", "top");
      row.getChildByIndex(1).setAttribute("valign", "top");
      row.getChildByIndex(2).setAttribute("valign", "top");
      row.getChildByIndex(1).setAttribute("width", "125px");

      EXContainer gw = new EXContainer("childWidget", "div");
      gw.setStyle("padding-top", "3px");
      gw.setStyle("padding-left", "1px");
      gw.setDisplay(false);
      gw.addClass("roles-class");
      EXGroupWidget gWidget = new EXGroupWidget("");
      gWidget.setWidth(Dimension.parse("100%"));
      gw.addChild(gWidget);
      row.addInCell(1, gw);

      // index++;
    }
  }