void BaseValues() { // this.UseStandardPrinter = true; // this.GraphicsUnit = GraphicsUnit.Pixel; // this.Padding = new Padding(5); // this.DefaultFont = GlobalValues.DefaultFont; // ReportType = ReportType.FormSheet; // this.DataModel = PushPullModel.FormSheet; // // this.CommandType = System.Data.CommandType.Text; // this.ConnectionString = String.Empty; // this.CommandText = String.Empty; // TopMargin = GlobalValues.DefaultPageMargin.Left; BottomMargin = GlobalValues.DefaultPageMargin.Bottom; LeftMargin = GlobalValues.DefaultPageMargin.Left; RightMargin = GlobalValues.DefaultPageMargin.Right; // // this.availableFields = new AvailableFieldsCollection(); SortColumnsCollection = new SortColumnCollection(); GroupColumnsCollection = new GroupColumnCollection(); ParameterCollection = new ParameterCollection(); // this.sqlParameters = new SqlParameterCollection(); // this.NoDataMessage = "No Data for this Report"; }
void BaseValues() { // this.UseStandardPrinter = true; // this.GraphicsUnit = GraphicsUnit.Pixel; // this.Padding = new Padding(5); // this.DefaultFont = GlobalValues.DefaultFont; ReportType = GlobalEnums.ReportType.FormSheet; // this.DataModel = GlobalEnums.PushPullModel.FormSheet; // // this.CommandType = System.Data.CommandType.Text; // this.ConnectionString = String.Empty; // this.CommandText = String.Empty; // TopMargin = GlobalValues.DefaultPageMargin.Left; BottomMargin = GlobalValues.DefaultPageMargin.Bottom; LeftMargin = GlobalValues.DefaultPageMargin.Left; RightMargin = GlobalValues.DefaultPageMargin.Right; // // this.availableFields = new AvailableFieldsCollection(); SortColumnsCollection = new SortColumnCollection(); GroupColumnsCollection = new GroupColumnCollection(); // this.sqlParameters = new SqlParameterCollection(); ParameterCollection = new ParameterCollection(); // this.NoDataMessage = "No Data for this Report"; }
int FillList(out string strError) { strError = ""; this.listView_columns.Items.Clear(); if (String.IsNullOrEmpty(this.DefString) == true) return 0; this.columns = new SortColumnCollection(); this.columns.Build(this.DefString); for (int i = 0; i < this.columns.Count; i++) { SortColumn column = this.columns[i]; string strColumnName = GetColumnName(column.nColumnNumber); ListViewItem item = new ListViewItem((i + 1).ToString(), 0); item.SubItems.Add(strColumnName); item.SubItems.Add(column.bAsc == true ? "升" : "降"); item.SubItems.Add(column.dataType.ToString()); item.SubItems.Add(column.bIgnorCase == true ? "是" : "否"); this.listView_columns.Items.Add(item); } return 0; }
// if we have no sorting, we build the indexlist as well, so we don't need to private IndexList IndexBuilder(SortColumnCollection col) { IndexList arrayList = new IndexList(); for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++) { object[] values = new object[1]; arrayList.Add(new SortComparer(col, rowIndex, values)); } return(arrayList); }
private IndexList UnsortedIndex(SortColumnCollection col) { IndexList arrayList = new IndexList(); for (int rowIndex = 0; rowIndex < this.table.Rows.Count; rowIndex++) { object[] values = new object[1]; arrayList.Add(new SortComparer(col, rowIndex, values)); } return(arrayList); }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.columns = null; this.table = null; this.headerHeight = ColumnModel.DefaultHeaderHeight; this.cellRenderers = new Hashtable(); this.SetCellRenderer("TEXT", new TextCellRenderer()); this.cellEditors = new Hashtable(); this.SetCellEditor("TEXT", new TextCellEditor()); this.secondarySortOrder = new SortColumnCollection(); }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.columns = null; this.table = null; this.headerHeight = ColumnModel.DefaultHeaderHeight; this.cellRenderers = new Dictionary <string, ICellRenderer>(); this.SetCellRenderer(DefaultKey, new TextCellRenderer()); this.cellEditors = new Dictionary <string, ICellEditor>(); this.SetCellEditor(DefaultKey, new TextCellEditor()); this.secondarySortOrder = new SortColumnCollection(); }
private PropertyDescriptor[] BuildSortProperties (SortColumnCollection col) { PropertyDescriptor[] sortProperties = new PropertyDescriptor[col.Count]; PropertyDescriptorCollection c = this.baseList.GetItemProperties(null); for (int criteriaIndex = 0; criteriaIndex < col.Count; criteriaIndex++){ PropertyDescriptor descriptor = c.Find (col[criteriaIndex].ColumnName,true); if (descriptor == null){ throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "Die Liste enthält keine Spalte [{0}].", col[criteriaIndex].ColumnName)); } sortProperties[criteriaIndex] = descriptor; } return sortProperties; }
private PropertyDescriptor[] BuildSortProperties(SortColumnCollection col) { PropertyDescriptor[] sortProperties = new PropertyDescriptor[col.Count]; PropertyDescriptorCollection c = this.baseList.GetItemProperties(null); for (int criteriaIndex = 0; criteriaIndex < col.Count; criteriaIndex++) { PropertyDescriptor descriptor = c.Find(col[criteriaIndex].ColumnName, true); if (descriptor == null) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "Die Liste enthält keine Spalte [{0}].", col[criteriaIndex].ColumnName)); } sortProperties[criteriaIndex] = descriptor; } return(sortProperties); }
private IndexList BuildSortIndex(SortColumnCollection col) { IndexList arrayList = new IndexList(); PropertyDescriptor[] sortProperties = BuildSortProperties(col); for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++) { object rowItem = this.baseList[rowIndex]; object[] values = new object[col.Count]; // Hier bereits Wertabruf um dies nicht während des Sortierens tun zu müssen. for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++) { object value = sortProperties[criteriaIndex].GetValue(rowItem); // Hier auf Verträglichkeit testen um Vergleiche bei Sortierung zu vereinfachen. // Muss IComparable und gleicher Typ sein. if (value != null && value != DBNull.Value) { if (!(value is IComparable)) { throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); } values[criteriaIndex] = value; } } arrayList.Add(new SortComparer(col, rowIndex, values)); } if (arrayList[0].ObjectArray.GetLength(0) == 1) { List <BaseComparer> lbc = BaseListStrategy.GenericSorter(arrayList); arrayList.Clear(); arrayList.AddRange(lbc); } else { arrayList.Sort(); } return(arrayList); }
private void DoSorting(bool withMulti) { Table table = this.table; // The Table control on a form - already initialised table.Clear(); table.BeginUpdate(); table.EnableWordWrap = true; // If false, then Cell.WordWrap is ignored NumberColumn col0 = new NumberColumn("#", 20); NumberColumn col1 = new NumberColumn("Height", 50); TextColumn col2 = new TextColumn("Name", 80); TextColumn col3 = new TextColumn("Surname", 80); DateTimeColumn col4 = new DateTimeColumn("Birthday", 120); TextColumn col5 = new TextColumn("Comments", 100); table.ColumnModel = new ColumnModel(new Column[] { col0, col1, col2, col3, col4, col5 }); if (withMulti) { // Surname, Name, Height (descending) SortColumnCollection sort = new SortColumnCollection(); sort.Add(new SortColumn(3, SortOrder.Ascending)); // Surname sort.Add(new SortColumn(2, SortOrder.Ascending)); // Name sort.Add(new SortColumn(1, SortOrder.Descending)); // Height table.ColumnModel.SecondarySortOrders = sort; } TableModel model = new TableModel(); AddSortingRow(model, 1, 1.52, "Mark", "Hobbs", "23/1/1978", "likes apples"); AddSortingRow(model, 2, 1.76, "Dave", "Duke", "2/5/1977", "keeps fish"); AddSortingRow(model, 3, 1.64, "Holly", "Prench", "14/8/1979", "singer"); AddSortingRow(model, 4, 1.53, "Mark", "Hobbs", "23/1/1984", "plays football"); AddSortingRow(model, 5, 1.64, "Dave", "Hobbs", "19/1/1980", "vegetarian"); this.table.TableModel = model; this.table.EndUpdate(); }
private IndexList BuildSortIndex(SortColumnCollection col) { IndexList arrayList = new IndexList(); PropertyDescriptor[] sortProperties = BuildSortProperties (col); for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++){ object rowItem = this.baseList[rowIndex]; object[] values = new object[col.Count]; // Hier bereits Wertabruf um dies nicht während des Sortierens tun zu müssen. for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++){ object value = sortProperties[criteriaIndex].GetValue(rowItem); // Hier auf Verträglichkeit testen um Vergleiche bei Sortierung zu vereinfachen. // Muss IComparable und gleicher Typ sein. if (value != null && value != DBNull.Value) { if (!(value is IComparable)){ throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); } values[criteriaIndex] = value; } } arrayList.Add(new SortComparer(col, rowIndex, values)); } if (arrayList[0].ObjectArray.GetLength(0) == 1) { List<BaseComparer> lbc = BaseListStrategy.GenericSorter (arrayList); arrayList.Clear(); arrayList.AddRange(lbc); } else { arrayList.Sort(); } return arrayList; }
// if we have no sorting, we build the indexlist as well, so we don't need to private IndexList IndexBuilder(SortColumnCollection col) { IndexList arrayList = new IndexList(); for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++){ object[] values = new object[1]; arrayList.Add(new SortComparer(col, rowIndex, values)); } return arrayList; }
private IndexList UnsortedIndex(SortColumnCollection col) { IndexList arrayList = new IndexList(); for (int rowIndex = 0; rowIndex < this.table.Rows.Count; rowIndex++){ object[] values = new object[1]; arrayList.Add(new SortComparer(col, rowIndex, values)); } return arrayList; }
void BaseValues() { this.useStandardPrinter = true; this.graphicsUnit = GraphicsUnit.Pixel; this.padding = new Padding(5); this.defaultFont = GlobalValues.DefaultFont; this.reportType = GlobalEnums.ReportType.FormSheet; this.dataModel = GlobalEnums.PushPullModel.FormSheet; this.pageSize = GlobalValues.DefaultPageSize; this.topMargin = GlobalValues.DefaultPageMargin.Left; this.bottomMargin = GlobalValues.DefaultPageMargin.Bottom; this.leftMargin = GlobalValues.DefaultPageMargin.Left; this.rightMargin = GlobalValues.DefaultPageMargin.Right; this.availableFields = new AvailableFieldsCollection(); this.groupingsCollection = new ColumnCollection(); this.sortingCollection = new SortColumnCollection(); this.parameterCollection = new ParameterCollection(); }