ILayoutCellEditor ListParamsRetriveCellEditor(object listItem, object value, ILayoutCell cell) { if (cell.Name == nameof(QParam.Value)) { QParam param = (QParam)listItem; ILayoutCellEditor editor = null; if (param != null && param.Column != null && !editors.TryGetValue(param, out editor)) { if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In) { if (!(param.Value is QQuery) && param.Column.IsReference && param.Value == null) { var sub = new QQuery(string.Empty, param.Column.ReferenceTable); sub.BuildColumn(param.Column.ReferenceTable.PrimaryKey); param.ValueRight = sub; } editor = new CellEditorQuery(); } else { editor = TableLayoutList.InitCellEditor(param.Column); if (param.Column.DataType == typeof(DateTime) && param.Comparer.Equals(CompareType.Between)) { ((CellEditorDate)editor).TwoDate = true; } } editors[param] = editor; } return(editor); } return(null); }
public LayoutValueEventArgs(object listItem, object data, ILayoutCell column) : this() { this.listItem = listItem; this.data = data; this.cell = column; }
public static ILayoutCellEditor GetCellEditor(ILayoutCell cell) { var type = cell?.DataType; if (type == null) { return(null); } type = TypeHelper.CheckNullable(type); ILayoutCellEditor editor = null; if (CellEditorFabric.TryGetValue(type, out var generator)) { editor = generator(cell); } if (editor == null) { foreach (var entry in CellEditorFabric) { if (TypeHelper.IsBaseType(type, entry.Key)) { editor = entry.Value(cell); } } } //if (type.IsEnum) //{ // editor = new CellEditorEnum(); //} if (editor == null) { if (TypeHelper.IsList(type)) { editor = new CellEditorFields() { Header = type.Name }; } else if (GuiService.IsCompound(type)) { editor = new CellEditorFields() { Header = type.Name }; } else { editor = new CellEditorText() { Format = cell.Format, MultiLine = false, DropDownWindow = false }; } } editor.DataType = type; return(editor); }
public override CellStyle OnGetCellStyle(object listItem, object value, ILayoutCell col) { if (col != null && listItem is TableItemNode node) { if (node.Item is User user && user.Online) { if (userStyle == null) { userStyle = GuiEnvironment.Theme["TreeUser"]; if (userStyle == null) { userStyle = ListInfo.StyleCell.Clone(); userStyle.Name = "TreeUser"; userStyle.Font = userStyle.Font.WithStyle(FontStyle.Oblique); GuiEnvironment.Theme.Add(userStyle); } } return(userStyle); } } return(base.OnGetCellStyle(listItem, value, col)); }
private CellStyle OnListDocumentsGetCellStyle(object sender, object listItem, object value, ILayoutCell cell) { if (listItem is DocumentSendItem item && cell == null) { if (item.Work != null && item.Work.Completed) { return(styleComplete); } else if (item.Message != null && item.Message.Length != 0) { return(styleError); } } return(null); }
protected override ILayoutCellEditor GetCellEditor(object listItem, object itemValue, ILayoutCell cell) { if (cell == valueColumn && listItem != null) { var filter = (LayoutFilter)listItem; var edit = filter.Column.GetEditor(listItem) as CellEditorText; if (edit is CellEditorDate) { ((CellEditorDate)edit).TwoDate = true; } if (edit is CellEditorFields) { edit = new CellEditorList(); var list = new SelectableList <object>(); for (int i = 0; i < List.ListSource.Count; i++) { object value = List.ReadValue(i, filter.Column); if (!list.Contains(value)) { list.Add(value); } } ((CellEditorList)edit).DataSource = list; } return(edit); } return(base.GetCellEditor(listItem, itemValue, cell)); }
protected ILayoutCellEditor OnGetCellEditor(object listItem, object value, ILayoutCell cell) { return(GetCellEditor?.Invoke(listItem, value, cell)); }
protected override ILayoutCellEditor GetCellEditor(object listItem, object itemValue, ILayoutCell cell) { if (cell.Name == "Column" && cell.GetEditor(listItem) == null) { if (query.Table == null) { return(null); } return(new CellEditorList { DataSource = query.Table.Columns }); } if (cell == colValue) { QParam param = (QParam)listItem; ILayoutCellEditor editor = null; if (param.Column != null) { if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In) { if (param.Column.IsReference && param.Value == null) { param.ValueRight = new QQuery(string.Empty, param.Column.ReferenceTable); } editor = new CellEditorQuery(); } else { editor = TableLayoutList.InitCellEditor(param.Column); } return(editor); } } return(base.GetCellEditor(listItem, itemValue, cell)); }
private ILayoutCellEditor ListOnGetCellEditor(object listItem, object itemValue, ILayoutCell cell) { if (handleGetCellEditor != null) { return(handleGetCellEditor(listItem, itemValue, cell)); } else { return(null); } }