コード例 #1
0
 public void RestoreDefaultGridLayout()
 {
     if (_dataType != null)
     {
         _target.LoadLayout(LayoutDescriptor.makeDirectDefaultForType(_dataType));
     }
 }
コード例 #2
0
 public void LoadGridLayout(LayoutDescriptor descr)
 {
     if (_dataType != null)
     {
         _target.LoadLayout(descr);
     }
 }
コード例 #3
0
 // grid layout management
 public void SaveGridLayout()
 {
     if (_dataType != null)
     {
         _target.SaveLayout(LayoutDescriptor.makeDirectForType(_dataType));
     }
 }
コード例 #4
0
ファイル: GridAdapter.cs プロジェクト: EgafEdizioni/xwcs.core
 public void SaveLayout(LayoutDescriptor descr)
 {
     using (Stream wr = descr.GetWriter())
     {
         if (wr != null)
         {
             SLogManager.getInstance().getClassLogger(GetType()).Debug($"Grid Save Layout: {descr.CombinePath()}");
             _view.SaveLayoutToStream(wr);
         }
     }
 }
コード例 #5
0
ファイル: GridAdapter.cs プロジェクト: EgafEdizioni/xwcs.core
 public void LoadLayout(LayoutDescriptor descr)
 {
     using (Stream rr = descr.GetReader())
     {
         if (rr != null)
         {
             SLogManager.getInstance().getClassLogger(GetType()).Debug($"Grid Load layout: {descr.CombinePath()}");
             _view.RestoreLayoutFromStream(rr);
         }
         else
         {
             SLogManager.getInstance().getClassLogger(GetType()).Warn($"Grid layout: {descr.CombinePath()} NOT FOUND!");
         }
     }
 }
コード例 #6
0
        public List <LayoutDescriptor> GetLayoutsByTypeAndPrefix(Type type, string prefix)
        {
            if (Layouts == null)
            {
                return(null);
            }

            List <LayoutDescriptor> ret = new List <LayoutDescriptor>()
            {
                LayoutDescriptor.makeDirectDefaultForType(type), LayoutDescriptor.makeDirectForType(type)
            };

            var tmp = Layouts.Groups.FindAll(g => g.prefix == prefix && g.type == type.Name).FirstOrDefault();

            if (tmp != null)
            {
                ret.AddRange(tmp.Layouts.Select(e => LayoutDescriptor.makeCustomForType(type.Name, tmp.path, e)));
            }

            return(ret);
        }
コード例 #7
0
ファイル: GridAdapter.cs プロジェクト: EgafEdizioni/xwcs.core
 public void LoadLayout(LayoutDescriptor descr)
 {
     SLogManager.getInstance().getClassLogger(GetType()).Debug("Grid Load layout");
 }
コード例 #8
0
 public void LoadGridLayout()
 {
     LoadGridLayout(LayoutDescriptor.makeDirectForType(_dataType));
 }
コード例 #9
0
        private void ConnectGrid()
        {
            if (_target != null && !_gridIsConnected && _dataType != null && _target.IsReady)
            {
                // check columns loaded
                if (_target.ColumnsCount() == 0)
                {
                    _target.PopulateColumns();
                }

                if (!_isTypeDataTable)
                {
                    PropertyInfo[] pis = _dataType.GetProperties(BindingFlags.Instance | BindingFlags.Public);
                    foreach (PropertyInfo pi in pis)
                    {
                        applyAttributes(pi.Name);
                    }
                }
                else
                {
                    DataTable dt = base.DataSource as DataTable;
                    if (dt != null)
                    {
                        /*
                         *                      PropertyInfo[] pis = _dataType.GetProperties(BindingFlags.Instance | BindingFlags.Public);
                         *                      foreach (PropertyInfo pi in pis)
                         *                      {
                         *  string strName = pi.Name;
                         *                              if (dt.Columns[strName]	!= null)
                         *                              {
                         *                                      applyAttributes(pi.Name);
                         *                              }
                         *                      }
                         */
                        foreach (DataColumn c in dt.Columns)
                        {
                            applyAttributes(c.ColumnName);
                        }
                    }
                }
                //attach CustomRowCellEditForEditing event too
                _target.CustomRowCellEditForEditing += CustomRowCellEditForEditingHandler;
                _target.ShownEditor += EditorShownHandler;


                _target.CellValueChanged += _target_CellValueChanged;


                if (HandleCustomColumnDisplayText)
                {
                    _target.CustomColumnDisplayText += CustomColumnDisplayText;
                }

                _gridIsConnected = true;


                if (!ReferenceEquals(null, _editorsHost) && !ReferenceEquals(null, _dataType) && !ReferenceEquals(null, _target))
                {
                    _editorsHost.onGridConnected(this, new GridConnectedEventData()
                    {
                        Control = _target, DataBindingSource = this, DataType = _dataType, Kind = GridConnectedEventKind.GridConnected
                    });
                }

                // probably good place save default layout
                _target.SaveLayout(LayoutDescriptor.makeDirectDefaultForType(_dataType));
            }
        }