示例#1
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;
 }
示例#2
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;
  }