• UI数据缓冲层的设计()


     总共分为两部分,数据层容器实体类设计(本次)、Form表单数据层管理(下次)。

    1.UI数据缓冲层的必要性
       对于UI层的数据管理,增加数据缓冲层非常有必要,起到数据池的作用,所有的UI层数据操作都是基于DataSetPool,里面包括若干DataTable。
       不使用数据缓冲层,主要问题有以下几点:
            多值条件下,每个Field的值维护比较困难。
            对于外部程序接口处理界面层数据比较麻烦。
            界面层数据的Redo和Undo处理基本不能实现。
           界面层数据绑定比较困难,例如一个数据Map被多个UI层显示列引用的时候,遍历显示列比较消耗效率。
           UI显示列的Get/SetValue与数据层耦合性太过紧密。
           对于界面层显示数据的二次加工处理比较麻烦,比如分级数据中编号列的拆分和合并。
    2.UI数据缓冲层的概要设计
     主要分为UI层数据池的维护、数据缓冲集的设计。
     2.1.UI层数据池的维护
      Form类包括MainDataSetPool、CachedDataSetPool两个数据集池,前者是当前的数据集,后者是已经缓存的数据集。
      Form类中控件的onblur事件用于同步Form数据集的数据,更新MainDataSetPool,并维护CachedDataSetPool,更新涉及两层:Form数据、数据集版本。
      Form类需要提供数据集的实例化、转换、绑定,这些工作需要数据集提供相应的Api。
     2.2.数据缓冲集的设计
      粒度从粗到细大体上分为:DataSet、DataRelation、DataTable、DataRow、DataColumn
      命名空间启用ESF.UI.Web.Data,用于管理ESF框架。
      DataSet中包括若干DataTable、DataRelation,管理table和之间的关系。
      DataRelation用于维护table直接的关系,是一个二元表达式。
      DataTable维护数据的最小单元。
      DataRow维护数据行。
      DataColumn数据列的定义。
    3.UI数据缓冲层的详细设计
     3.1.DataColumn的设计
      ESF.UI.Web.Data.DataColumn={
       #region 成员变量
       var _colName;
       var _colType;
       var _defVal;
       var _table;
       var _disCols=new Array();
       
       #endregion
       
       #region 方法
       this.ctr(table,colName,colType,defVal);
       this.getName();
       this.getColType();
       this.getDefVal();
       this.setDefVal(val);
       this.getTable();  
       this.addDisCol(colName);
       this.getDisCols();
       #endregion
      }
     3.2.DataRow的设计
      ESF.UI.Web.Data.DataRow={
       #region 成员变量  
       var _rowId;
       var _rowData = new Object();
       var _table;
       #endregion
       #region 方法
       this.ctr(table,rowId);
       this.getRowId();
       this.getValue(colName);
       this.setValue(colName,val);
       this.getRowData();
       this.dispose();
       this.clone(rowId);
       this.toXml(serializeType);
       #endregion
      }
     3.3.DataTable的设计
      ESF.UI.Web.Data.DataTable={
       #region 成员变量  
       var _tableName;
       var _columns = new Object();
       var _dataSet;
       var _dataRows = new Object();
       var _rowIds = new Array();
       var _currrentRowId = null;
       var _version;
       #endregion
       #region 方法
       this.ctr(tableName);
       
       this.addColumn(col);
       this.getColumns();
       this.getColumn(colName);
       this.removeColumn(colName);
       this.createColumn(colName,colType,defVal);
       
       this.addDataRow(dataRow);
       this.getDataRow(rowId);
       this.getDataRows();
       this.removeDataRow(rowId);
       this.createDataRow(rowId);
       
       this.getDataSet();
       this.setDataSet(ds);
       
       this.rowCount();
       this.rowClear();
       this.contains(rowId);
       
       this.getPreRowId(rowId);
       this.getNextRowId(rowId);
       this.getFirstRowId();
       this.getLastRowId();
       this.getRowIds();
       
       
       this.getCurrentRowId();
       this.setCurrentRowId(rowId);
       this.getCurrentRow();
       
       this.getDataValue(rowId,colName);
       this.setDataValue(rowId,colName,val);
       this.clone();
       this.toXml();
       this.getVersion();
       #endregion
       #region 事件
       this.BeforeColumnChange=null;
       this.AfterColumnChange=null;
       this.BeforeRowChange=null;
       this.AfterRowChange=null;
       
       #endregion
       
      }
     3.4.DataRelation的设计
      ESF.UI.Web.Data.DataRelation={
       #region 成员变量
       var _relationName;
       var _parentCols;
       var _childCols;
       var _parentTable;
       var _childTable;
       #endregion
       
       #region 方法
       this.ctr(relationName,parentCols,childCols);
       this.getName();
       this.getParentTable();
       this.getChildTable();
       this.getParentCols();
       this.getChildCols();
       #endregion 
       
      }
     3.5.DataSet的设计
      ESF.UI.Web.Data.DataSet={
       #region 成员变量
       var _dataSetName;
       var _dataRelationNames = new Array();
       var _dataRelations = new Object();
       var _dataTableNames = new Array();
       var _dataTables = new Object();
       #endregion
       #region 方法
       this.ctr(dataSetName);
       this.getName();
       this.getDataRelations();
       this.getDataRelationsByTableName(tableName);
       this.addDataRelation(dataRelation);
       this.removeDataRelation(dataRelationName);
       
       this.getDataTables();
       this.getDataTableByName(tableName);
       this.getDataTableByIndex(index);
       this.addDataTable(dataTable);
       this.removeDataTable(dataTableName);
       
       #endregion
       
      }

  • 相关阅读:
    计算机硬件内存双通道只显示一根内存条,不能组成双通道
    VMware 虚拟机安装win10操作系统系列问题解决
    编译语言和解释语言区别
    SPSS 24下载与安装+授权码
    Reg文件操作
    DLL注册表文件相关内容
    安装TensorFlow失败
    Anaconda 包管理与环境管理
    Cookie设置域名问题,cookie跨域
    准备篇(二)C语言
  • 原文地址:https://www.cnblogs.com/program/p/2683520.html
Copyright © 2020-2023  润新知