Beispiel #1
0
 public static String getFObj(ColumnMetaData colinfo) {
   String helpclass = colinfo.getHelpClass().trim();
   if ("com.pansoft.esp.standard.client.pub.ESPModelKeySetHelp".equals(helpclass)) {
     DictModel dictModel = (DictModel) colinfo.getLostValue("DictModelObject", null);
     BIZMetaData bizMetaData =
         (BIZMetaData) dictModel.getCdsParam().getValue("ESPModelStub", null);
     return bizMetaData.getKEY_DCT();
   }
   return colinfo.getFOBJ();
 }
Beispiel #2
0
 public static String getUsedColString(DictMetadata dmd) {
   List list = getUsedColumnStub(dmd);
   String col = "";
   for (int i = 0; i < list.size(); i++) {
     ColumnMetaData cmd = (ColumnMetaData) list.get(i);
     col += cmd.getColid() + ",";
   }
   if (col.length() > 0) col = col.substring(0, col.length() - 1);
   return col;
 }
Beispiel #3
0
 /**
  * 多语言的列,不含编号列
  *
  * @param dmd DictMetadata
  * @return String
  */
 public static int getUsedMLangColCount(DictMetadata dmd) {
   List list = getUsedColumnStub(dmd);
   String bhcol = dmd.getString("DCT_BMCOLID", "");
   int count = 0;
   for (int i = 0; i < list.size(); i++) {
     ColumnMetaData cmd = (ColumnMetaData) list.get(i);
     if (cmd.isMLang() && !bhcol.equals(cmd.getColid())) {
       count++;
     }
   }
   return count;
 }
Beispiel #4
0
 /**
  * @param conn JConnection
  * @param PO JParamObject
  * @param dictMetadata DictMetadata
  * @param colMetadata ColMetaData
  * @throws Exception
  */
 protected static void getColRefDictMetadata(
     JConnection conn, JParamObject PO, DictMetadata dictMetadata, ColumnMetaData colMetadata)
     throws Exception {
   // 如果列没有启用,直接返回
   TableMetadata tableMetadata = dictMetadata.getTableMetadata();
   if (!"1".equals(colMetadata.getString("COL_USE", "1"))) return;
   String COL_FOBJ = colMetadata.getString("COL_FOBJ", null);
   if (COL_FOBJ == null || "".equals(COL_FOBJ.trim())) return;
   // 如果外键是他自己,可能造成死循环,不再获取元数据
   if (COL_FOBJ.equals(tableMetadata.getString("OBJ_ID", ""))) return;
   DictMetadata fkeyDictMetadata = getMetaDataNew(conn, PO, COL_FOBJ);
   attachColmetadataRefDict(colMetadata, fkeyDictMetadata);
 }
Beispiel #5
0
 /**
  * 多语言的列,不含编号列
  *
  * @param dmd DictMetadata
  * @return String
  */
 public static java.util.List getUsedMLangColStub(DictMetadata dmd) {
   List mlangList = new ArrayList();
   List list = getUsedColumnStub(dmd);
   String bhcol = dmd.getString("DCT_BMCOLID", "");
   String col = "";
   for (int i = 0; i < list.size(); i++) {
     ColumnMetaData cmd = (ColumnMetaData) list.get(i);
     if (cmd.isMLang() && !bhcol.equals(cmd.getColid())) {
       mlangList.add(cmd);
     }
   }
   return mlangList;
 }
Beispiel #6
0
 /**
  * 多语言的列,不含编号列
  *
  * @param dmd DictMetadata
  * @return String
  */
 public static String getUsedMLangColString(DictMetadata dmd) {
   List list = getUsedColumnStub(dmd);
   String bhcol = dmd.getString("DCT_BMCOLID", "");
   String col = "";
   for (int i = 0; i < list.size(); i++) {
     ColumnMetaData cmd = (ColumnMetaData) list.get(i);
     if (cmd.isMLang() && !bhcol.equals(cmd.getColid())) {
       col += cmd.getColid() + ",";
     }
   }
   if (col.length() > 0) {
     col = col.substring(0, col.length() - 1);
   }
   return col;
 }
Beispiel #7
0
 public static DefaultCellEditor getColumnBlobEditor(BlobDataSet bds, ColumnMetaData colinfo) {
   DefaultCellEditor dce = (DefaultCellEditor) colinfo.getEditor();
   if (dce != null) return dce;
   IHelpCallBack callback = null;
   if (colinfo.getHelpClass().trim().length() > 0) {
     try {
       callback = (IHelpCallBack) Class.forName(colinfo.getHelpClass().trim()).newInstance();
       callback.setColumnMetaData(colinfo);
       colinfo.setLostValue("IHelpCallback", callback);
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   } else callback = new ImageHelpCallback(); // 默认的
   dce = new BlobCellEditor(callback, bds, colinfo);
   colinfo.setEditor(dce);
   return dce;
 }
Beispiel #8
0
  /**
   * @param tableMetadata TableMetadata
   * @param DOMeta DOMetaData
   */
  protected static void getColMetadata(
      JConnection conn, JParamObject PO, DictMetadata dictMetadata, DOMetaData DOMeta)
      throws Exception {
    if (DOMeta == null) return;
    TableMetadata tableMetadata = dictMetadata.getTableMetadata();
    if (tableMetadata.colList == null) tableMetadata.colList = new ArrayList();
    EFDataSet efds = DOMeta.getDOColumns();
    //        //获取自列表列与掩码Map
    //        java.util.Map map = getSelfEnumColViewMap(conn, PO, dictMetadata);
    //        //
    for (int i = 0; i < efds.getRowCount(); i++) {
      EFRowSet edrs = efds.getRowSet(i);
      ColumnMetaData colMetadata = ColumnMetaData.getInstance();
      colMetadata.setStubTable(new Hashtable());
      colMetadata.getStubTable().putAll(edrs.getDataMap());
      //			String colid = colMetadata.getString("COL_ID", "");
      String coledit = colMetadata.getString("COL_EDIT", "");
      //            if(map != null && coledit.equals("15")){
      //                String view = (String)map.get(colid);
      //                colMetadata.setString("COL_VIEW", view);
      //            }
      // 从DOMetaData中获取 gengeng 2011-11-21
      if (coledit.equals(ColumnMetaData.EL_SELFENUM))
        colMetadata.setString("COL_VIEW", edrs.getString("SYS_SELFENUM", ""));

      tableMetadata.colList.add(colMetadata);
      //            getColRefDictMetadata(conn, PO, dictMetadata, colMetadata);
    }
  }
Beispiel #9
0
 public static ColumnMetaData CreateColMetadata(
     String id, String mc, int displen, int edittype, String view) {
   ColumnMetaData col = ColumnMetaData.getInstance();
   col.setString("COL_ID", id);
   col.setString("COL_MC", mc);
   col.setString("COL_PREC", String.valueOf(displen));
   col.setString("COL_USE", "1");
   String type = "C";
   if (edittype == ColumnMetaData.EL_DATE) type = "D";
   if (edittype == ColumnMetaData.EL_INT) type = "I";
   if (edittype == ColumnMetaData.EL_FLOAT) type = "N";
   col.setString("COL_TYPE", type);
   col.setString("COL_EDIT", String.valueOf(edittype));
   if (view != null) col.setString("COL_VIEW", view);
   return col;
 }
Beispiel #10
0
 /**
  * 创建列
  *
  * @param id String
  * @param mc String
  * @param type String
  * @param len int
  * @param edittype int
  * @param view String
  * @return ColumnMetaData
  */
 public static ColumnMetaData CreateColumnMetadata(
     String id, String mc, String type, int len, int edittype, String view) {
   ColumnMetaData meta = new ColumnMetaData(null);
   meta.setString("COL_ID", id);
   meta.setString("COL_MC", mc);
   meta.setInt("COL_LEN", len);
   meta.setString("COL_TYPE", type);
   meta.setString("COL_EDIT", String.valueOf(edittype));
   if (view != null) meta.setString("COL_VIEW", view);
   return meta;
 }
Beispiel #11
0
 /**
  * @param colMetadata ColMetadata
  * @param dictMetadata DictMetadata
  */
 public static void attachColmetadataRefDict(
     ColumnMetaData colMetadata, DictMetadata dictMetadata) {
   colMetadata.refDictmetadata = dictMetadata;
 }
Beispiel #12
0
  public static TableCellRenderer getColumnRender(ColumnMetaData colinfo) {
    TableCellRenderer dcr = (TableCellRenderer) colinfo.getRender();
    if (dcr != null) return dcr;
    if (colinfo.getColType().equals("B")) {
      dcr = new BlobCellRender();
    } else if (colinfo.getHelpFObj().trim().length() > 0) {
      dcr = new FkeyCellRenderer(colinfo.getFOBJ());
      ((FkeyCellRenderer) dcr).setColumnMetaData(colinfo);
    } else if (colinfo.getHelpClass().trim().length() > 0) {
      dcr = new FkeyCellRenderer(getFObj(colinfo));
      ((FkeyCellRenderer) dcr).setColumnMetaData(colinfo);
    } else if (colinfo.isFKEY()) {
      dcr = new FkeyCellRenderer(colinfo.getFOBJ());
      ((FkeyCellRenderer) dcr).setColumnMetaData(colinfo);
    } else {
      switch (colinfo.getColEditType()) {
        case ColumnMetaData.EL_BOOL:
          dcr = new BoolCellRender("1", "0");
          break;
        case ColumnMetaData.EL_DATE:
          String pattern = colinfo.getEditPattern();
          if (pattern == null || pattern.trim().length() == 0) {
            pattern = "yyyy-MM-dd HH:mm:ss";
            if ("C".equals(colinfo.getColType())) {
              if (colinfo.getColDataLen() == 4) {
                pattern = "yyyy";
              } else if (colinfo.getColDataLen() == 6) {
                pattern = "yyyy-MM";
              } else if (colinfo.getColDataLen() == 8) {
                pattern = "yyyy-MM-dd";
              }
              if (colinfo.getColView() != null && colinfo.getColView().trim().length() > 0) {
                pattern = colinfo.getColView();
              }
              String displayformat =
                  colinfo.getExtAttriValue(
                      "COL_OPT",
                      ESPKeyValueUtil._DEFAULT_CONNECTOR_,
                      ESPKeyValueUtil._DEFAULT_DELIMETER_,
                      "DisplayFormat");
              if (displayformat != null && displayformat.trim().length() > 0) {
                pattern = displayformat;
              }
            } else if ("D".equals(colinfo.getColType())) {
              String colView = colinfo.getColView();
              if (colView.length() > 0) pattern = colView;
            }
          }
          dcr = new DateCellRenderer(pattern);
          break;
        case ColumnMetaData.EL_TIME:
          String pattern1 = colinfo.getEditPattern();
          if (pattern1 == null || pattern1.trim().length() == 0) pattern1 = "HH:mm:ss";
          dcr = new TimeCellRenderer(pattern1);
          break;
        case ColumnMetaData.EL_FLOAT:
          dcr = new NumberCellRenderer();
          ((NumberCellRenderer) dcr).setColumnMetaData(colinfo);
          break;
        case ColumnMetaData.EL_POPUP:
          {
            Hashtable hash = new Hashtable();
            String view = colinfo.getColView();
            // 如果是变量(脚本对象),则获取真正的掩码
            if (view != null && view.equals("@POUP@")) {
              //                        try {
              //                            BIZPoupScript poupScript = new BIZPoupScript(
              //                                    colinfo.getString("OBJ_ID", null),
              //                                    colinfo.getString("COL_ID", null),
              //                                    colinfo.getString("ServerName", ""));
              //                            Object obj =
              // poupScript.getScriptManager().runFunction(poupScript,colinfo.getString("COL_ID",
              // null));
              //                            if (obj != null && obj instanceof String) {
              //                                view = (String) obj;
              //                            } else {
              //                                view = "";
              //                            }
              //                        } catch (Exception ex) {
              //                            ex.printStackTrace();
              //                        }
            }
            String[] item = view.split(";");
            for (int i = 0; i < item.length; i++) {
              String[] v = item[i].split(":");
              if (v.length == 1) return null;
              hash.put(v[0], v[1]);
            }
            dcr = new EnumCellRenderer(hash);
            break;
          }
        case ColumnMetaData.EL_WINDOW:
          dcr = new PassWordCellRender();
          break;
        case ColumnMetaData.EL_PRO_BAR:
          dcr = new ProgressCellRender();
          break;
        case ColumnMetaData.EL_SELFENUM:
          {
            Hashtable hash = new Hashtable();
            String view = colinfo.getString("COL_EDITVIEW", null);
            if (view == null) view = colinfo.getColView();
            String[] item = view.split(";");
            for (int i = 0; i < item.length; i++) {
              if (item[i] == null || item[i].indexOf(":") < 0) continue;
              String s1 = item[i].substring(0, item[i].indexOf(":"));
              String s2 = item[i].substring(item[i].indexOf(":") + 1);
              hash.put(s1, s2);
            }
            dcr = new SelfEnumCellRenderer(hash);

            break;
          }
        case ColumnMetaData.EL_STRING:
          dcr = new StringCellRenderer();
          break;
        case ColumnMetaData.EL_TEXT:
          dcr = new TextCellRenderer();
          break;
        default:
          break;
      }
    }
    colinfo.setRender(dcr);
    return dcr;
  }
Beispiel #13
0
  public static DefaultCellEditor getColumnEditor(ColumnMetaData colinfo) {
    DefaultCellEditor dce = (DefaultCellEditor) colinfo.getEditor();
    if (dce != null) return dce;
    if (colinfo.getHelpFObj().trim().length() > 0) {
      dce = new FKeyCellEditor(colinfo);
    } else if (colinfo.getHelpClass().trim().length() > 0) {
      IHelpCallBack callback = null;
      try {
        callback = (IHelpCallBack) Class.forName(colinfo.getHelpClass().trim()).newInstance();
        callback.setColumnMetaData(colinfo);
        colinfo.setLostValue("IHelpCallback", callback);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
      dce = new SelfHelpCellEditor(callback, colinfo);
    } else if (colinfo.isFKEY()) {
      dce = new FKeyCellEditor(colinfo);
    } else {
      switch (colinfo.getColEditType()) {
        case ColumnMetaData.EL_STRING:
          dce = new StringCellEditor(colinfo);
          break;
        case ColumnMetaData.EL_TEXT:
          dce = new TextCellEditor(colinfo);
          break;
        case ColumnMetaData.EL_BOOL:
          dce = new BoolCellEditor();
          break;
        case ColumnMetaData.EL_DATE:
          dce = new DateCellEditor();
          ((DateCellEditor) dce).setColumnMetaData(colinfo);
          break;
        case ColumnMetaData.EL_TIME:
          dce = new TimeCellEditor(colinfo, 0);
          ((TimeCellEditor) dce).setColumnMetaData(colinfo);
          break;
        case ColumnMetaData.EL_FLOAT:
          dce = new NumberCellEditor();
          break;
        case ColumnMetaData.EL_POPUP:
          {
            Map hash = new Hashtable();
            String view = colinfo.getString("COL_EDITVIEW", null);
            if (view == null) view = colinfo.getColView();
            // 如果是变量(脚本对象),则获取真正的掩码
            if (view != null && view.equals("@POUP@")) {
              try {
                //                            BIZPoupScript poupScript = new BIZPoupScript(
                //                                    colinfo.getString("OBJ_ID", null),
                //                                    colinfo.getString("COL_ID", null),
                //                                    colinfo.getString("ServerName", ""));
                //                            Object obj = poupScript.getReturnObject();
                //                            if (obj != null && obj instanceof String) {
                //                                view = (String) obj;
                //                            } else {
                //                                view = "";
                //                            }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
            }
            String[] item = view.split(";");
            List keyList = new ArrayList();
            for (int i = 0; i < item.length; i++) {
              if (item[i] == null || item[i].indexOf(":") < 0) continue;
              String s1 = item[i].substring(0, item[i].indexOf(":"));
              String s2 = item[i].substring(item[i].indexOf(":") + 1);
              hash.put(s1, s2);
              keyList.add(s1);
            }
            String editorEditable = colinfo.getString("EnumCellEditor_EDITABLE", "0");
            if (editorEditable.equals("1")) {
              dce = new EnumCellEditor(hash, keyList, colinfo);
            } else {
              dce = new EnumCellEditor(hash, keyList);
            }

            break;
          }
          // 增加密码列
        case ColumnMetaData.EL_WINDOW:
          {
            dce = new PassWordCellEditor();
            break;
          }
          // 增加弹出窗口
        case ColumnMetaData.EL_DIALOG:
          {
            dce = new WindowCellEditor(colinfo);
            break;
          }
          // 自列表
        case ColumnMetaData.EL_SELFENUM:
          {
            Map hash = new Hashtable();
            List keyList = new ArrayList();
            String view = colinfo.getString("COL_EDITVIEW", null);
            if (view == null) view = colinfo.getColView();
            String[] item = view.split(";");
            for (int i = 0; i < item.length; i++) {
              if (item[i] == null || item[i].indexOf(":") < 0) continue;
              String s1 = item[i].substring(0, item[i].indexOf(":"));
              String s2 = item[i].substring(item[i].indexOf(":") + 1);
              hash.put(s1, s2);
              keyList.add(s1);
            }
            dce = new SelfEnumCellEditor(hash, keyList, colinfo);

            break;
          }
        default:
          break;
      }
    }
    colinfo.setEditor(dce);
    return dce;
  }