Пример #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;
  }
Пример #2
0
  private String genPagePanelJson(PageModelPanel pmp) {
    String json = "";
    PagePanel panel = pmp.getPagePanel();
    String divFloat = pmp.getDivFloat();
    String fcolumnPropName = "";
    String pcolumnPropName = "";
    json += "{";
    json += "\"panelname\":\"" + panel.getName() + "\",";
    json += "\"title\":\"" + panel.getTitle() + "\",";
    if (panel.getGroupFlag() != null && panel.getGroupFlag().intValue() == 0) {
      json += "\"panelTableName\":\"" + panel.getSystemMainTable().getTableCnName() + "\",";
      json += "\"clazz\":\"" + panel.getSystemMainTable().getClassName() + "\",";
      // 如果model根面板属于可编辑面板,如财务面板改成editorGrid,它就引用配置项
      if (panel.getXtype().getName().equalsIgnoreCase("editorgrid")
          || panel.getXtype().getName().equalsIgnoreCase("grid")) {
        SystemMainTable subTable = panel.getSystemMainTable();
        List<PageModelPanelTable> pmpts =
            this.pageModelService.findPageModelPanelTableBySub(pmp.getPageModel(), panel, subTable);
        for (PageModelPanelTable pmpt : pmpts) {
          // 配置项面板
          PagePanel parentPanel = pmpt.getParentPagePanel();
          // 配置项父表
          SystemMainTable parentTable = parentPanel.getSystemMainTable();
          SystemMainTableColumn parentPanelTablePColumn = pmpt.getParentPanelTablePColumn();
          // ConfigItem$id
          pcolumnPropName =
              parentTable.getTableName() + "$" + parentPanelTablePColumn.getPropertyName();
          SystemMainTableColumn subFc = pmpt.getSubPanelTableFColumn();
          fcolumnPropName = subFc.getPropertyName();
        }
      }
    }

    json += "\"fcolumnName\":\"" + fcolumnPropName + "\",";
    json += "\"pcolumnName\":\"" + pcolumnPropName + "\",";
    json += "\"xtype\":\"" + panel.getXtype().getName() + "\",";
    json += "\"groupFlag\":\"" + panel.getGroupFlag() + "\",";

    Integer readonlyFlag = pmp.getReadonly();
    if (readonlyFlag == null) readonlyFlag = 0;
    json += "\"readonlyFlag\":\"" + readonlyFlag + "\",";

    json += "\"queryFlag\":\"" + panel.getQueryFlag() + "\",";
    json += "\"divFloat\":\"" + divFloat + "\",";
    json += "\"order\":\"" + pmp.getOrder() + "\"";
    Set<PagePanelRelation> childpprs = panel.getChildPagePanels();
    if (!childpprs.isEmpty()) { // 遍历分组面板下面的面板
      json += ",\"childPagePanels\":[";
      for (PagePanelRelation ppr : childpprs) {
        json += this.genPagePanelJson(ppr);
        json += ",";
      }
      json = json.substring(0, json.length() - 1);
      json += "]";
    }
    json += "}";
    return json;
  }
Пример #3
0
  private String genPagePanelJson(PagePanelRelation pmp) {
    String json = "";
    PagePanel panel = pmp.getPagePanel();
    String fcolumnPropName = "";
    String pcolumnPropName = "";
    json += "{";
    json += "\"panelname\":\"" + panel.getName() + "\",";
    json += "\"title\":\"" + panel.getTitle() + "\",";
    if (panel.getGroupFlag() != null && panel.getGroupFlag().intValue() == 0) {
      json += "\"panelTableName\":\"" + panel.getSystemMainTable().getTableCnName() + "\",";
      json += "\"clazz\":\"" + panel.getSystemMainTable().getClassName() + "\",";
      List<PageGroupPanelTable> list =
          this.pgps.findGroupPanelTableBySub(pmp.getParentPagePanel(), panel);
      PageGroupPanelTable pgpt = null;
      if (list != null && !list.isEmpty()) {
        pgpt = list.iterator().next();
      }
      if (pgpt != null) {
        SystemMainTableColumn fcolumn = pgpt.getSubPanelTableFColumn();
        fcolumnPropName = fcolumn.getPropertyName();

        SystemMainTable parentPanelTable = pgpt.getParentPanelTable();
        String pptableName = parentPanelTable.getTableName();
        SystemMainTableColumn pc = pgpt.getParentPanelTablePColumn();
        pcolumnPropName = pc.getPropertyName();
        pcolumnPropName = pptableName + "$" + pcolumnPropName;
      }
    }
    json += "\"fcolumnName\":\"" + fcolumnPropName + "\",";
    json += "\"pcolumnName\":\"" + pcolumnPropName + "\",";
    json += "\"xtype\":\"" + panel.getXtype().getName() + "\",";

    Integer readonlyFlag = pmp.getReadonly();
    if (readonlyFlag == null) readonlyFlag = 0;
    json += "\"readonlyFlag\":\"" + readonlyFlag + "\",";

    json += "\"groupFlag\":\"" + panel.getGroupFlag() + "\",";
    json += "\"queryFlag\":\"" + panel.getQueryFlag() + "\",";
    json += "\"order\":\"" + pmp.getOrder() + "\"";

    Set<PagePanelRelation> childpprs = panel.getChildPagePanels();
    if (!childpprs.isEmpty()) {
      json += ",\"childPagePanels\":[";
      for (PagePanelRelation ppr : childpprs) {
        json += this.genPagePanelJson(ppr);
        json += ",";
      }
      json = json.substring(0, json.length() - 1);
      json += "]";
    }
    json += "}";
    return json;
  }
Пример #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;
 }