Exemplo n.º 1
0
        private void UseSysCommands(EntityViewMeta evm)
        {
            //初始化实体视图中的命令按钮
            var em = evm.EntityMeta;

            if (!RafyEnvironment.Location.IsWebUI)
            {
                if (em.EntityCategory == EntityCategory.QueryObject)
                {
                    evm.AsWPFView().UseCommands(WPFCommandNames.SysQueryCommands);
                }
                else
                {
                    evm.AsWPFView().UseCommands(WPFCommandNames.SysCommands);
                }
            }
            else
            {
                if (em.EntityCategory == EntityCategory.QueryObject)
                {
                    evm.AsWebView().UseCommands(WebCommandNames.SysQueryCommands);
                }
                else
                {
                    evm.AsWebView().UseCommands(WebCommandNames.SysCommands);
                }
            }
        }
Exemplo n.º 2
0
            public OrderPropertiesWrapper(EntityViewMeta owner, int orderNo)
            {
                this._owner   = owner;
                this._orderNo = orderNo;

                owner.PropertyFound += owner_PropertyFound;
            }
Exemplo n.º 3
0
 /// <summary>
 /// 加载所有属性元数据
 /// </summary>
 /// <param name="viewMeta"></param>
 private void CreatePropertiesViewMeta(EntityViewMeta viewMeta)
 {
     foreach (var property in EntityMetaHelper.GetEntityProperties(viewMeta.EntityMeta))
     {
         this.CreateEntityPropertyViewMeta(property, viewMeta);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 隐藏所有属性的可见性。
        ///
        /// 一般使用在扩展视图中。
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        public static EntityViewMeta HideProperties(this EntityViewMeta meta, params IManagedProperty[] properties)
        {
            foreach (var p in properties)
            {
                meta.Property(p).ShowInWhere = ShowInWhere.Hide;
            }

            return(meta);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 隐藏所有属性。
        /// </summary>
        /// <param name="meta"></param>
        /// <returns></returns>
        public static EntityViewMeta HideAllProperties(this EntityViewMeta meta)
        {
            foreach (var item in meta.EntityProperties)
            {
                item.ShowIn(ShowInWhere.Hide);
            }

            return(meta);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 设置实体在列表中显示时,按照哪个属性分组。
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static EntityViewMeta GroupBy(this EntityViewMeta meta, IManagedProperty property)
        {
            //foreach (var item in properties) { meta.GroupDescriptions.Add(item); }

            //暂时只支持一个属性分组
            meta.GroupBy = meta.Property(property);

            return(meta);
        }
Exemplo n.º 7
0
        internal void InitViewMeta()
        {
            if (this._ViewMeta == null)
            {
                this._ViewMeta = UIModel.Views.Create(this.EntityType, ViewConfig.GetViewName(this.ExtendView));

                this.UseBlockDefaultCommands(this._ViewMeta);
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 使用本块中默认的一些按钮。
 /// </summary>
 protected virtual void UseBlockDefaultCommands(EntityViewMeta meta)
 {
     if (RafyEnvironment.Location.IsWPFUI)
     {
         if (this.BlockType == BlockType.Report)
         {
             meta.AsWPFView().UseCommands(WPFCommandNames.RefreshDataSourceInRDLC, WPFCommandNames.ShowReportData);
         }
     }
 }
Exemplo n.º 9
0
        protected override void UseBlockDefaultCommands(EntityViewMeta meta)
        {
            if (RafyEnvironment.Location.IsWPFUI)
            {
                //如果当前模块是一个条件面板,应该添加上查询按钮。
                meta.AsWPFView().UseCommands(WPFCommandNames.FireQuery);
            }

            base.UseBlockDefaultCommands(meta);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 加载所有属性元数据
        /// </summary>
        /// <param name="viewMeta"></param>
        private void CreatePropertiesViewMeta(EntityViewMeta viewMeta)
        {
            foreach (var property in EntityMetaHelper.GetEntityProperties(viewMeta.EntityMeta))
            {
                this.CreateEntityPropertyViewMeta(property, viewMeta);
            }

            //加入扩展属性元数据
            foreach (var mp in EntityMetaHelper.GetEntityPropertiesExtension(viewMeta.EntityMeta))
            {
                this.CreateExtensionPropertyViewMeta(mp, viewMeta);
            }
        }
Exemplo n.º 11
0
        internal EntityPropertyViewMeta CreateExtensionPropertyViewMeta(IManagedProperty mp, EntityViewMeta evm)
        {
            var epm = evm.EntityMeta.Property(mp);

            var epvm = evm.CreatePropertyViewMeta();

            epvm.Owner        = evm;
            epvm.PropertyMeta = epm;

            evm.EntityProperties.Add(epvm);

            return(epvm);
        }
Exemplo n.º 12
0
 /// <summary>
 /// 声明在Detail里显示为几列。
 /// </summary>
 /// <param name="meta"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static EntityViewMeta HasDetailColumnsCount(this EntityViewMeta meta, int value)
 {
     meta.DetailColumnsCount = value;
     return(meta);
 }
Exemplo n.º 13
0
 /// <summary>
 /// 使用此方法定义的代码块中,自动根据代码调用的顺序设置属性排列的顺序。
 /// </summary>
 /// <param name="meta"></param>
 /// <param name="from"></param>
 /// <returns></returns>
 public static IDisposable OrderProperties(this EntityViewMeta meta, int from = 1)
 {
     return(new OrderPropertiesWrapper(meta, from));
 }
Exemplo n.º 14
0
        private EntityPropertyViewMeta CreateEntityPropertyViewMeta(IManagedProperty mp, EntityViewMeta evm)
        {
            var item = evm.CreatePropertyViewMeta();

            item.Owner = evm;

            item.PropertyMeta = evm.EntityMeta.Property(mp);

            //如果这个托管属性有对应的 CLR 属性,并且这个 CLR 属性上标记了 Label 标签,则设置元数据的 Label 属性。
            var runtimeProperty = item.PropertyMeta.CLRProperty;

            if (runtimeProperty != null)
            {
                var labelAttri = runtimeProperty.GetSingleAttribute <DisplayNameAttribute>();
                if (labelAttri != null)
                {
                    item.Label = labelAttri.DisplayName;
                }
            }

            item.Readonly(mp.IsReadOnly || mp == EntityConvention.Property_TreeIndex);

            //如果是引用实体的属性,创建 SelectionViewMeta
            if (item.IsReference)
            {
                item.SelectionViewMeta = new SelectionViewMeta();
            }

            evm.EntityProperties.Add(item);

            return(item);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 设置该实体是否可以在界面上可以进行编辑
        /// </summary>
        /// <param name="meta"></param>
        /// <returns></returns>
        public static EntityViewMeta EnableEditing(this EntityViewMeta meta)
        {
            meta.NotAllowEdit = false;

            return(meta);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 设置该实体是否可以在界面上不可编辑
        /// </summary>
        /// <param name="meta"></param>
        /// <returns></returns>
        public static EntityViewMeta DisableEditing(this EntityViewMeta meta)
        {
            meta.NotAllowEdit = true;

            return(meta);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 设置实体的主显示属性。
        ///
        /// 例如,用户的主显示属性一般是用户姓名。
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static EntityViewMeta HasDelegate(this EntityViewMeta meta, IManagedProperty property)
        {
            meta.TitleProperty = meta.Property(property);

            return(meta);
        }
Exemplo n.º 18
0
 /// <summary>
 /// 设置实体的领域含义。
 /// </summary>
 /// <param name="meta"></param>
 /// <param name="label"></param>
 /// <returns></returns>
 public static EntityViewMeta DomainName(this EntityViewMeta meta, string label)
 {
     meta.Label = label;
     return(meta);
 }
Exemplo n.º 19
0
 public EntityPropertyViewMeta CreateExtensionPropertyViewMeta(IManagedProperty mp, EntityViewMeta evm)
 {
     return(this._codeReader.CreateExtensionPropertyViewMeta(mp, evm));
 }