public void RestoreDefaultGridLayout() { if (_dataType != null) { _target.LoadLayout(LayoutDescriptor.makeDirectDefaultForType(_dataType)); } }
public void LoadGridLayout(LayoutDescriptor descr) { if (_dataType != null) { _target.LoadLayout(descr); } }
// grid layout management public void SaveGridLayout() { if (_dataType != null) { _target.SaveLayout(LayoutDescriptor.makeDirectForType(_dataType)); } }
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); } } }
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!"); } } }
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); }
public void LoadLayout(LayoutDescriptor descr) { SLogManager.getInstance().getClassLogger(GetType()).Debug("Grid Load layout"); }
public void LoadGridLayout() { LoadGridLayout(LayoutDescriptor.makeDirectForType(_dataType)); }
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)); } }