コード例 #1
0
 protected BaseGetLayoutColumnQueryHandler(
     IViewRepository repository,
     IColumnAdapter adapter)
 {
     _repository = repository;
     _adapter    = adapter;
 }
コード例 #2
0
 public BaseGetAllLayoutColumnsQueryHandler(
     IColumnRepository repository,
     IColumnAdapter adapter)
 {
     _repository = repository;
     _adapter    = adapter;
 }
コード例 #3
0
 public GetColorColumnQueryHandler(
     IViewRepository repository,
     IColumnAdapter adapter)
     : base(repository, adapter)
 {
 }
コード例 #4
0
 public GetAllLabelColumnsQueryHandler(
     IColumnRepository repository,
     IColumnAdapter adapter)
     : base(repository, adapter)
 {
 }
コード例 #5
0
        //private void applyAttributes(PropertyInfo pi)
        private void applyAttributes(string propertyName)
        {
            IColumnAdapter gc = _target.ColumnByFieldName(propertyName);

            if (ReferenceEquals(null, gc))
            {
                return;
            }
            // take all first, but cache just custom, but we need Standard Display
            IEnumerable <Attribute> attrs = ReflectionHelper.GetAttributesFromPath(_dataType, propertyName);
            IList <CustomAttribute> ac    = new List <CustomAttribute>();

            foreach (Attribute a in attrs)
            {
                if (a is CustomAttribute)
                {
                    GridColumnPopulated gcp = new GridColumnPopulated {
                        FieldName = propertyName, RepositoryItem = null, Column = gc
                    };
                    (a as CustomAttribute).applyGridColumnPopulation(this, gcp);
                    ac.Add(a as CustomAttribute);
                    RepositoryItem ri = gcp.RepositoryItem;
                    if (ri != null)
                    {
                        _target.RepositoryItems.Add(ri);
                        _repositories[propertyName] = ri;
                        if (gc != null)
                        {
                            gc.ColumnEdit = ri;
                        }
                    }
                }
                if (a is xwcs.core.db.binding.attributes.StyleAttribute)
                {
                    xwcs.core.db.binding.attributes.StyleAttribute sa = a as xwcs.core.db.binding.attributes.StyleAttribute;
                    if (sa.VAlignment != VAlignment.Default)
                    {
                        gc.VAlignment = sa.VAlignment;
                    }
                    if (sa.HAlignment != HAlignment.Default)
                    {
                        gc.HAlignment = sa.HAlignment;
                    }

                    if (!ReferenceEquals(sa.ColumnWidth, null))
                    {
                        if (sa.ColumnWidth >= 0)
                        {
                            gc.Width = sa.ColumnWidth;
                        }
                    }
                    if (sa.BackgrounColor > 0)
                    {
                        gc.BackGrndColor                       = sa.BackgrounColor;
                        gc.AppearanceCell.BackColor            = System.Drawing.Color.FromArgb((int)sa.BackgrounColor);
                        gc.AppearanceCell.Options.UseBackColor = true;
                    }
                }

                // handle column name
                if (a is System.ComponentModel.DataAnnotations.DisplayAttribute)
                {
                    System.ComponentModel.DataAnnotations.DisplayAttribute da = a as System.ComponentModel.DataAnnotations.DisplayAttribute;

                    gc.Caption      = da.GetName() ?? gc.Caption;
                    gc.Caption      = da.GetShortName() ?? gc.Caption;
                    gc.VisibleIndex = da.GetOrder() ?? gc.VisibleIndex;

                    if (gc.Caption.ToUpper() != (da.GetName() ?? gc.Caption).ToUpper())
                    {
                        gc.ToolTip = da.GetName();
                    }
                    if (gc.ToolTip.ToUpper() != (da.GetDescription() ?? gc.ToolTip).ToUpper())
                    {
                        if (gc.ToolTip != "")
                        {
                            gc.ToolTip = gc.ToolTip + "\n";
                        }
                        gc.ToolTip = gc.ToolTip + da.GetDescription();
                    }
                }
            }

            if (ac.Count > 0)
            {
                _attributesCache[propertyName] = ac;
            }
        }