/// <summary> /// Initializes a new instance of the ColumnCollectionEditor class /// using the specified collection type /// </summary> /// <param name="type">The type of the collection for this editor to edit</param> public ColumnCollectionEditor(Type type) : base(type) { this.columns = null; this.previewColumnModel = new ColumnModel(); this.previewColumnModel.Columns.Add(new TextColumn("Column", 116)); this.previewTableModel = new TableModel(); this.previewTableModel.Rows.Add(new Row()); Cell cell = new Cell(); cell.Editable = false; cell.ToolTipText = "This is a Cell ToolTip"; this.previewTableModel.Rows[0].Cells.Add(cell); this.previewTableModel.RowHeight = 20; this.previewTable = new Table(); this.previewTable.Preview = true; this.previewTable.Size = new Size(120, 274); this.previewTable.Location = new Point(246, 24); this.previewTable.GridLines = GridLines.Both; this.previewTable.TabStop = false; this.previewTable.EnableToolTips = true; this.previewTable.ColumnModel = this.previewColumnModel; this.previewTable.TableModel = this.previewTableModel; this.previewLabel = new Label(); this.previewLabel.Text = "Preview:"; this.previewLabel.Size = new Size(140, 16); this.previewLabel.Location = new Point(247, 8); }
/// <summary> /// Edits the value of the specified object using the specified /// service provider and context /// </summary> /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information</param> /// <param name="isp">A service provider object through which editing services can be obtained</param> /// <param name="value">the value of the object under edit</param> /// <returns>The new value of the object. If the value is not changed, this should return the original value</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider isp, object value) { this.columnCollection = (ColumnCollection) value; foreach (Column column in this.columnCollection) { column.PropertyChanged += new ColumnEventHandler(this.column_PropertyChanged); } object newCollection = base.EditValue(context, isp, value); ColumnModel columns = (ColumnModel)context.Instance; if (columns.Table != null) { columns.Table.PerformLayout(); columns.Table.Refresh(); } return newCollection; }
/// <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 Hashtable(); this.SetCellRenderer("TEXT", new TextCellRenderer()); this.cellEditors = new Hashtable(); this.SetCellEditor("TEXT", new TextCellEditor()); }
/// <summary> /// Edits the value of the specified object using the specified /// service provider and context /// </summary> /// <param name="context">An ITypeDescriptorContext that can be /// used to gain additional context information</param> /// <param name="isp">A service provider object through which /// editing services can be obtained</param> /// <param name="value">The object to edit the value of</param> /// <returns>The new value of the object. If the value of the /// object has not changed, this should return the same object /// it was passed</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider isp, object value) { this.columns = (ColumnCollection) value; // for some reason (might be beacause Column is an // abstract class) the table doesn't get redrawn // when a columns property changes, but we can get // around that by subscribing to the columns // PropertyChange event and passing the message on // to the table ourselves. we need to do this for // all the existing columns in the collection for (int i=0; i<this.columns.Count; i++) { this.columns[i].PropertyChanged += new ColumnEventHandler(column_PropertyChanged); } object returnObject = base.EditValue(context, isp, value); ColumnModel model = (ColumnModel) context.Instance; if (model.Table != null) { model.Table.PerformLayout(); model.Table.Refresh(); } return returnObject; }
/// <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(); }