/// <summary>
		/// Initializes a new instance of the CellCollection class 
		/// that belongs to the specified Row
		/// </summary>
		/// <param name="owner">A Row representing the row that owns 
		/// the Cell collection</param>
		public CellCollection(Row owner) : base()
		{
			if (owner == null)
			{
				throw new ArgumentNullException("owner");
			}
				
			this.owner = owner;
		}
示例#2
0
		/// <summary>
		/// Adds the specified Row to the end of the collection
		/// </summary>
		/// <param name="row">The Row to add</param>
		public int Add(Row row)
		{
			if (row == null) 
			{
				throw new System.ArgumentNullException("Row is null");
			}

			int index = this.List.Add(row);

			this.OnRowAdded(new TableModelEventArgs(this.owner, row, index, index));

			return index;
		}
示例#3
0
		/// <summary>
		/// Releases all resources used by the Cell
		/// </summary>
		public void Dispose()
		{
			if (!this.disposed)
			{
				this.text = null;
				this.data = null;
				this.tag = null;
				this.rendererData = null;

				if (this.row != null)
				{
					this.row.Cells.Remove(this);
				}

				this.row = null;
				this.index = -1;
				this.cellStyle = null;
				this.checkStyle = null;
				this.imageStyle = null;
				this.tooltipText = null;

				this.state = (byte) 0;
				
				this.disposed = true;
			}
		}
示例#4
0
		/// <summary>
		/// Initialise default values
		/// </summary>
		private void Init()
		{
			this.text = null;
			this.data = null;
			this.rendererData = null;
			this.tag = null;
			this.row = null;
			this.index = -1;
			this.cellStyle = null;
			this.checkStyle = null;
			this.imageStyle = null;
			this.tooltipText = null;

			this.state = (byte) (STATE_EDITABLE | STATE_ENABLED);
		}
示例#5
0
		/// <summary>
		/// Initializes a new instance of the TableModel class with an array of Row objects
		/// </summary>
		/// <param name="rows">An array of Row objects that represent the Rows 
		/// of the TableModel</param>
		public TableModel(Row[] rows)
		{
			if (rows == null)
			{
				throw new ArgumentNullException("rows", "Row[] cannot be null");
			}
			
			this.Init();

			if (rows.Length > 0)
			{
				this.Rows.AddRange(rows);
			}
		}
示例#6
0
			/// <summary>
			/// Removes the specified Row from the selection
			/// </summary>
			/// <param name="row">The Row to be removed from the selection</param>
			internal void RemoveRow(Row row)
			{
				if (this.rows.Contains(row))
				{
					int[] oldSelectedIndicies = this.SelectedIndicies;

					this.rows.Remove(row);

					this.owner.OnSelectionChanged(new SelectionEventArgs(this.owner, oldSelectedIndicies, this.SelectedIndicies));
				}
			}
示例#7
0
		/// <summary>
		/// Adds an array of Row objects to the collection
		/// </summary>
		/// <param name="rows">An array of Row objects to add 
		/// to the collection</param>
		public void AddRange(Row[] rows)
		{
			if (rows == null) 
			{
				throw new System.ArgumentNullException("Row[] is null");
			}

			for (int i=0; i<rows.Length; i++)
			{
				this.Add(rows[i]);
			}
		}
示例#8
0
		/// <summary>
		/// Initializes a new instance of the RowEventArgs class with 
		/// the specified Row source, row index, start index, end index 
		/// and affected Cell
		/// </summary>
		/// <param name="source">The Row that originated the event</param>
		/// <param name="cell">The affected Cell</param>
		/// <param name="cellFromIndex">The start index of the affected Cell(s)</param>
		/// <param name="cellToIndex">The end index of the affected Cell(s)</param>
		public RowEventArgs(Row source, Cell cell, int cellFromIndex, int cellToIndex) : this(source, -1, cell, cellFromIndex, cellToIndex, RowEventType.Unknown)
		{
			
		}
示例#9
0
		/// <summary>
		/// Replaces the Row at the specified index to the specified Row
		/// </summary>
		/// <param name="index">The index of the Row to be replaced</param>
		/// <param name="row">The Row to be placed at the specified index</param>
		internal void SetRow(int index, Row row)
		{
			if (index < 0 || index >= this.Count)
			{
				throw new ArgumentOutOfRangeException("value");
			}

			if (row == null)
			{
				throw new ArgumentNullException("row cannot be null");
			}
					
			this.List[index] = row;

			row.InternalIndex = index;
		}
示例#10
0
		/// <summary>
		///	Returns the index of the specified Row in the model
		/// </summary>
		/// <param name="row">The Row to look for</param>
		/// <returns>The index of the specified Row in the model</returns>
		public int IndexOf(Row row)
		{
			for (int i=0; i<this.Count; i++)
			{
				if (this[i] == row)
				{
					return i;
				}
			}

			return -1;
		}
示例#11
0
		/// <summary>
		/// Inserts an array of Rows into the collection at the specified 
		/// index
		/// </summary>
		/// <param name="index">The zero-based index at which the rows 
		/// should be inserted</param>
		/// <param name="rows">The array of Rows to be inserted into 
		/// the collection</param>
		public void InsertRange(int index, Row[] rows)
		{
			if (rows == null) 
			{
				throw new System.ArgumentNullException("Row[] is null");
			}

			if (index < 0)
			{
				throw new IndexOutOfRangeException();
			}

			if (index >= this.Count)
			{
				this.AddRange(rows);
			}
			else
			{
				for (int i=rows.Length-1; i>=0; i--)
				{
					this.Insert(index, rows[i]);
				}
			}
		}
示例#12
0
		/// <summary>
		/// Inserts a Row into the collection at the specified index
		/// </summary>
		/// <param name="index">The zero-based index at which the Row 
		/// should be inserted</param>
		/// <param name="row">The Row to insert</param>
		public void Insert(int index, Row row)
		{
			if (row == null)
			{
				return;
			}

			if (index < 0)
			{
				throw new IndexOutOfRangeException();
			}
			
			if (index >= this.Count)
			{
				this.Add(row);
			}
			else
			{
				base.List.Insert(index, row);

				this.owner.OnRowAdded(new TableModelEventArgs(this.owner, row, index, index));
			}
		}
示例#13
0
		/// <summary>
		/// Removes the specified Row from the model
		/// </summary>
		/// <param name="row">The Row to remove</param>
		public void Remove(Row row)
		{
			int rowIndex = this.IndexOf(row);

			if (rowIndex != -1) 
			{
				this.RemoveAt(rowIndex);
			}
		}
示例#14
0
		/// <summary>
		/// Initializes a new instance of the RowEventArgs class with 
		/// the specified Row source, row index, start index, end index 
		/// and affected Cell
		/// </summary>
		/// <param name="source">The Row that originated the event</param>
		/// <param name="eventType">The type of event</param>
		public RowEventArgs(Row source, RowEventType eventType) : this(source, -1, null, -1, -1, eventType)
		{
			
		}
示例#15
0
		/// <summary>
		/// Initializes a new instance of the RowEventArgs class with 
		/// the specified Row source, row index, start index, end index 
		/// and affected Cell
		/// </summary>
		/// <param name="source">The Row that originated the event</param>
		/// <param name="rowIndex">The index of the Row</param>
		/// <param name="cell">The affected Cell</param>
		/// <param name="cellFromIndex">The start index of the affected Cell(s)</param>
		/// <param name="cellToIndex">The end index of the affected Cell(s)</param>
		/// <param name="eventType">The type of event</param>
		public RowEventArgs(Row source, int rowIndex, Cell cell, int cellFromIndex, int cellToIndex, RowEventType eventType) : base()
		{
			this.source = source;
			this.rowIndex = rowIndex;
			this.cell = cell;
			this.cellFromIndex = cellFromIndex;
			this.cellToIndex = cellToIndex;
			this.eventType = eventType;
		}
示例#16
0
		/// <summary>
		/// Replaces the Row in the TableModel located at index a with the specified Row
		/// </summary>
		/// <param name="a">The index of the Row that will be replaced</param>
		/// <param name="row">The Row that will be moved to index a</param>
		protected void Set(int a, Row row)
		{
			this.TableModel.Rows.SetRow(a, row);
		}
			/// <summary>
			/// 
			/// </summary>
			/// <param name="model"></param>
			/// <returns></returns>
			public void AddColumns(ColumnModel model)
			{
				this.model = model;

				CellStyle cellStyle = new CellStyle();
				cellStyle.Padding = new CellPadding(6, 0, 0, 0);

				this.columnTable.BeginUpdate();
				
				for (int i=0; i<model.Columns.Count; i++)
				{
					Row row = new Row();
				
					Cell cell = new Cell(model.Columns[i].Text, model.Columns[i].Visible);
					cell.Tag = model.Columns[i].Width;
					cell.CellStyle = cellStyle;
				
					row.Cells.Add(cell);

					this.columnTable.TableModel.Rows.Add(row);
				}

				this.columnTable.SelectionChanged += new SelectionEventHandler(columnTable_SelectionChanged);
				this.columnTable.CellCheckChanged += new CellCheckBoxEventHandler(columnTable_CellCheckChanged);

				if (this.columnTable.VScroll)
				{
					this.columnTable.ColumnModel.Columns[0].Width -= SystemInformation.VerticalScrollBarWidth;
				}

				if (this.columnTable.TableModel.Rows.Count > 0)
				{
					this.columnTable.TableModel.Selections.SelectCell(0, 0);

					this.showButton.Enabled = !this.model.Columns[0].Visible;
					this.hideButton.Enabled = this.model.Columns[0].Visible;

					this.widthTextBox.Text = this.model.Columns[0].Width.ToString();
				}

				this.columnTable.EndUpdate();
			}
		/// <summary>
		/// Initializes a new instance of the TableModelEventArgs class with 
		/// the specified TableModel source, start index, end index and affected Column
		/// </summary>
		/// <param name="source">The TableModel that originated the event</param>
		/// <param name="row">The affected Row</param>
		/// <param name="fromIndex">The start index of the affected Row(s)</param>
		/// <param name="toIndex">The end index of the affected Row(s)</param>
		public TableModelEventArgs(TableModel source, Row row, int fromIndex, int toIndex)
		{
			this.source = source;
			this.row = row;
			this.fromIndex = fromIndex;
			this.toIndex = toIndex;
		}