Esempio n. 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;
  }
Esempio n. 2
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;
  }
Esempio n. 3
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;
  }
Esempio n. 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;
 }
  public void initPagePanelBtn(PagePanel pagePanel) {
    // PagePanelType xtype = super.get(PagePanelType.class, pagePanel.getXtype().getId());
    PagePanelType xtype = pagePanel.getXtype();
    xtype = super.get(PagePanelType.class, xtype.getId());
    String xtypeName = xtype.getName();
    if (xtypeName.equals("editorgrid")) { // 可编辑表单

      PagePanelBtn addButton = new PagePanelBtn();
      addButton.setBtnName("添加");
      addButton.setMethod("addByColumn");
      addButton.setImageUrl("add");
      addButton.setPagePanel(pagePanel);
      super.save(addButton);

      PagePanelBtn delButton = new PagePanelBtn();
      delButton.setBtnName("删除");
      delButton.setMethod("removeByColumn");
      delButton.setImageUrl("remove");
      delButton.setPagePanel(pagePanel);
      super.save(delButton);

      PagePanelBtn saveButton = new PagePanelBtn();
      saveButton.setBtnName("保存");
      saveButton.setMethod("saveForGridPanel");
      saveButton.setImageUrl("save");
      saveButton.setPagePanel(pagePanel);
      super.save(saveButton);

      //			PagePanelBtn upLoadButton = new PagePanelBtn();
      //			upLoadButton.setBtnName("上传");
      //			upLoadButton.setMethod("upload");
      //			upLoadButton.setImageUrl("upload");
      //			upLoadButton.setPagePanel(pagePanel);
      //			super.save(upLoadButton);
      //
      //			PagePanelBtn exportButton = new PagePanelBtn();
      //			exportButton.setBtnName("导出");
      //			exportButton.setMethod("export");
      //			exportButton.setImageUrl("export");
      //			exportButton.setPagePanel(pagePanel);
      //			super.save(exportButton);
    } else if (xtypeName.equals("form")) {
      PagePanelBtn saveButton = new PagePanelBtn();
      saveButton.setBtnName("保存");
      saveButton.setMethod("saveForFormPanel");
      saveButton.setImageUrl("save");
      saveButton.setPagePanel(pagePanel);
      super.save(saveButton);

      PagePanelBtn resetButton = new PagePanelBtn();
      resetButton.setBtnName("重置");
      resetButton.setMethod("resetPanel");
      resetButton.setImageUrl("reset");
      resetButton.setPagePanel(pagePanel);
      super.save(resetButton);
    }
  }
Esempio n. 6
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;
  }