Exemple #1
0
  /**
   * 单个面板生成JSON方法 @Methods Name genPagePanelJson @Create In Apr 20, 2009 By sa
   *
   * @param panel
   * @return String
   */
  @SuppressWarnings("unused")
  private String genPagePanelJson(PagePanel panel) {
    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() + "\",";
      // 此处缺少面板中多表的关系处理
      //
      //	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;
  }
Exemple #2
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;
  }