Ejemplo n.º 1
0
  @Override
  public void renderAddEntityForm() {
    try {
      AbsEnt data = getFabric().get("div");
      LinkedHashMap<AbsEnt, String> hs = new LinkedHashMap<AbsEnt, String>();
      hs.put(
          textInput(fieldName, getReq(fieldName), "Сообщение*")
              .setAttribute(EnumAttrType.size, "80"),
          "");
      hs.put(hiddenInput("client_id", getReq("client_id")), "");
      hs.put(hiddenInput("showMenu", renders.entities.client.MENU_COMMENTS), "");

      FormOptionInterface fo = getFormOption(objectName, "add", "add");
      fo.setTitle("ОК");
      setButtonStyle(fo, BUTTON_OK);
      fo.setRenderType(RenderTypes.ajax);
      fo.setJsHandler(JsHandlers.ajax(CONTAINER_ID));
      AbsEnt form = rightForm(hs, fo);
      // AbsEnt form = standartAjaxForm(false, objectName, "add", "add", hs, "ОК",
      // getRenderConstant().OK_IMGPH);
      data.addEnt(form);
      AbsEnt Mw = standartFloatWindow("Добавить комментарий", data);
      addRenderResult(Mw.render());
    } catch (Exception ex) {
      addRenderResult(MyString.getStackExeption(ex));
    }
  }
Ejemplo n.º 2
0
  @Override
  public void renderEntityList() {
    try {
      AbsEnt data = div("", "");
      // добавление
      FormOptionInterface afo = getFormOption(objectName, "add", "");
      afo.setTitle("Добавить");
      setButtonStyle(afo, BUTTON_ADD);
      afo.setRenderType(RenderTypes.ajax);
      afo.setJsHandler(JsHandlers.ajax(CONTAINER_ID));
      AbsEnt addForm = rightForm(null, afo);
      // AbsEnt addForm = standartAjaxForm(true, objectName, "add", "", null, "Добавить",
      // fr.getRenderConstant().ADD_IMGPH);
      addForm.addEnt(hiddenInput("client_id", getReq("client_id")));

      addForm.setAttribute(EnumAttrType.style, "float: left; margin-right: 10px; ");
      AbsEnt div = div("", "Комментарии");
      div.addEnt(addForm);

      AbsEnt table = fr.getFabric().get("table").setCss(TABLE_CLASS);
      trTh(table, div);
      for (DinamicModel dm : getActionResult().getDinamicArrayList()) {
        // tr(table, dm.get("message"));
        AbsEnt messageDiv = getFabric().get("div");
        String text =
            dateFormat(dm.get("insert_date"), getRenderConstant().DT_FULL)
                + " "
                + comboLikeString("users", "getAllWithCombo", dm.get("insert_user_id"));
        AbsEnt smallDiv = getFabric().get("div").setValue(text).setCss("small_text");
        messageDiv.addEnt(smallDiv).addEnt(div("", dm.get("message")));
        tr(table, messageDiv);
      }
      data.addEnt(table);
      addRenderResult(data.render());
    } catch (Exception ex) {
      registerException(ex);
    }
  }