Beispiel #1
0
  /**
   * 获取单Form面板元数据 @Methods Name forSaveSingleFormForLook @Create 2009-4-20 By daijf
   *
   * @param request
   * @return @ReturnType String
   */
  private String forSaveSingleFormForLook(HttpServletRequest request) {
    String json = "";
    String id = request.getParameter("id");
    String panelName = request.getParameter("panelname");
    PagePanel panel = pagePanelService.findPagePanel(panelName);
    SystemMainTable smt = panel.getSystemMainTable();
    String tableName = smt.getTableName();
    String className = smt.getClassName();
    Class clazz = null;
    try {
      clazz = Class.forName(className);
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    List<PagePanelColumn> pagePanelColumns = pageManager.getUserPagePanelColumn(panelName);

    Map<String, Object> dataMap = null;
    if (StringUtils.isNotBlank(id)) {
      if (panel.getXtype().getName().equals("form")) {
        Object obj = service.find(clazz, id, true);
        dataMap = metaDataManager.getEntityDataForLook(obj, tableName);
        json = CoderForLook.encode(pagePanelColumns, dataMap, true);

      } else {
        json = null;
      }

    } else {
      dataMap = pageManager.getPagePanelDataForAdd(panelName);
      json = CoderForLook.encode(pagePanelColumns, dataMap, false);
    }

    return json;
  }
Beispiel #2
0
 private String forPanelButton(HttpServletRequest request) {
   String keyName = request.getParameter("panelName");
   PagePanel panel = pagePanelService.findPagePanel(keyName);
   String json = "[";
   List<PagePanelBtn> ppbs = pagePanelBtnService.findPanelBtnByPanel(panel);
   if (ppbs.isEmpty()) {
     json += "";
   } else {
     for (PagePanelBtn ppb : ppbs) {
       if (ppb.getIsDisplay() != null && ppb.getIsDisplay() == 1) {
         json += "{";
         json += "\"btnName\":\"" + ppb.getBtnName() + "\",";
         json += "\"container\":\"" + ppb.getPagePanel().getName() + "\",";
         json +=
             "\"containerTable\":\""
                 + ppb.getPagePanel().getSystemMainTable().getTableName()
                 + "\",";
         json += "\"method\":\"" + ppb.getMethod() + "\",";
         json += "\"link\":\"" + ppb.getLink() + "\",";
         json +=
             "\"nextPageModel\":\""
                 + (ppb.getNextPageModel() == null ? "" : ppb.getNextPageModel().getName())
                 + "\",";
         json += "\"imageUrl\":\"" + ppb.getImageUrl() + "\"";
         json += "},";
       }
     }
     if (json.length() > 1) json = json.substring(0, json.length() - 1);
   }
   json += "]";
   return json;
 }
Beispiel #3
0
  /**
   * 只读预览功能 @Methods Name forLook @Create In 2009-3-13 By sa
   *
   * @param request
   * @return String
   */
  private String forLook(HttpServletRequest request) {
    String json = "";
    String id = request.getParameter("id");

    String modelName = request.getParameter("modelname");
    String panelName = request.getParameter("panelname");
    PagePanel panel = pagePanelService.findPagePanel(panelName);
    List<PagePanelColumn> pagePanelColumns = pageManager.getUserPagePanelColumn(panelName);

    Map<String, Object> dataMap = null;
    if (StringUtils.isNotBlank(id)) {
      List<Map<String, Object>> listMap =
          pageManager.getPagePanelDataForLook(modelName, panelName, id);

      if (listMap != null && !listMap.isEmpty()) {
        if (panel.getXtype().getName().equals("form")) {
          dataMap = listMap.iterator().next();
          json = CoderForLook.encode(pagePanelColumns, dataMap, true);

        } else if (panel.getXtype().getName().equals("editorgrid")) {
          int total = listMap.size();
          json = CoderForList.encode(pagePanelColumns, listMap, Long.valueOf(total));
        }
      }

    } else {
      dataMap = pageManager.getPagePanelDataForAdd(panelName);
      json = CoderForLook.encode(pagePanelColumns, dataMap, false);
    }

    return json;
  }
Beispiel #4
0
 /**
  * 使用EXTJS组件绘制查询面板时需要使用的元数据和关联数据 @Methods Name forQuery @Create In Aug 30, 2008 By yang
  *
  * @param request
  * @return @ReturnType String
  */
 @SuppressWarnings("unchecked")
 private String forQuery(HttpServletRequest request) {
   String json = "";
   //		String id = request.getParameter("id");
   String panelName = request.getParameter("panelname");
   PagePanel panel = pagePanelService.findPagePanel(panelName);
   SystemMainTable smt = panel.getSystemMainTable();
   String className = smt.getClassName();
   Class clazz = this.getClass(className);
   List<UserTableQueryColumn> userQueryColumns = metaDataManager.getUserColumnForQuery(clazz);
   Map queryMap = this.pageManager.getPagePanelDataForQuery(panelName);
   json = CoderForFind.encode(queryMap, userQueryColumns);
   return json;
 }
Beispiel #5
0
 /**
  * 为树形列表提供表头 @Methods Name forGridTreeHead @Create In Mar 13, 2009 By lee
  *
  * @param request
  * @return String
  */
 private String forGridTreeHead(HttpServletRequest request) {
   String panelName = request.getParameter("panelname");
   PagePanel pagePanel = pagePanelService.findPagePanel(panelName);
   if (pagePanel == null) return null;
   //    	String className = pagePanel.getSystemMainTable().getClassName();
   //    	List<UserTableSetting> utss = metaDataManager.getUserColumnForList(getClass(className));
   //    	PagePanel panel=pagePanelService.findPagePanel(panelName);
   List<PagePanelColumn> pagePanelColumns = pageManager.getUserPagePanelColumn(panelName);
   String json = "";
   for (PagePanelColumn ppcolumn : pagePanelColumns) { // 改成遍历
     Column column = ppcolumn.getColumn();
     String tableName = ppcolumn.getSystemMainTable().getTableName();
     String propertyName = column.getPropertyName();
     json += "{name:" + "'" + tableName + "$" + propertyName + "'" + "},";
   }
   // json+="{name:'_id'},";
   json += "{name:'_parent'},";
   json += "{name:'_level'},";
   json += "{name:'_lft'},";
   json += "{name:'_rgt'},";
   json += "{name:'_is_leaf'}";
   json = "[" + json + "]";
   return json;
 }