Ejemplo n.º 1
0
        public static IRule ParseRule(ICellVirtual[] iCellVirtualRow)
        {
            Cell[] row = Array.ConvertAll(iCellVirtualRow, item => (Cell)item);

            string[] searchPatterns = ((string)row[RuleGrid.ColPattern].Value).Split('\t');

            if (row[RuleGrid.ColType].Value.Equals("copy"))
            //Copy Rule
            {
                //if (grid.CheckRow(r))
                return new CopyRule((String)row[RuleGrid.ColDestination].Value, searchPatterns);
            }
            else if (row[RuleGrid.ColType].Value.Equals("delete"))
            //Delete Rule
            {
                return new DeleteRule(searchPatterns);
            }
            else if (row[RuleGrid.ColType].Value.Equals("replace"))
            //Replace Rule
            {
                //if (fieldsNotEmpty(grid, r, new int[]{ RuleGrid.ColDestination, RuleGrid.ColReplacement}))
                return new ReplaceRule((String)row[RuleGrid.ColDestination].Value, (String)row[RuleGrid.ColReplacement].Value, searchPatterns);
            }
            return null;
        }
Ejemplo n.º 2
0
        public ICellVirtual ApplyCondition(ICellVirtual cell)
        {
            SourceGrid.Cells.ICellVirtual copied = cell.Copy();
            copied.View = View;

            return copied;
        }
Ejemplo n.º 3
0
        public ICellVirtual ApplyCondition(ICellVirtual cell)
        {
            SourceGrid.Cells.ICellVirtual copied = cell.Copy();
            copied.View = View;

            return(copied);
        }
Ejemplo n.º 4
0
        void setCellReadOnly(ICellVirtual vCell, bool readOnly)
        {
            Cell cell = (Cell)vCell;

            cell.Editor.EditableMode = ReadOnly || readOnly ? EditableMode.None : EditableMode.SingleClick;
            cell.Editor.EnableEdit   = !ReadOnly && !readOnly;
            cell.View.BackColor      = readOnly ? ApplicationColors.BGReadOnlyCell : ApplicationColors.BGStandardCell;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// [email protected]:CHDOC00127712: Used by Rollout Controller. If cell is in editmode, and error is set without ending edit mode. Style wont be applied to control
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="editorControl"></param>
 public void ApplyStyleToControl(ICellVirtual cell, Control editorControl)
 {
     if (UseCellViewProperties && editorControl != null && cell != null)
     {
         editorControl.BackColor = cell.View.BackColor;
         editorControl.ForeColor = cell.View.ForeColor;
         editorControl.Font      = cell.View.Font;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell,
                                                      Position p_CellPosition,
                                                      PaintEventArgs e,
                                                      Rectangle p_ClientRectangle,
                                                      DrawCellStatus p_Status)
        {
            bool l_lastExpandedCell;

            ICell cell = p_Cell as ICell;

            if (cell == null)
            { // this must be a Virtual Cell.
                l_lastExpandedCell = false;
            }
            else
            {     // this is a Real Cell
                if (cell.Grid.Rows[cell.Row].Height == 0)
                { // It is safe to quit now if this cell isn't visible.
                    return;
                }
                l_lastExpandedCell = cell.IsLastExpandedCell;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            Font l_CurrentFont = GetCellFont();

            bool l_Expand = ExpandedCell;

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              Image,
                                              ImageAlignment,
                                              ImageStretch,
                                              p_Cell.GetDisplayText(p_CellPosition),
                                              StringFormat,
                                              AlignTextToImage,
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              l_Expand,
                                              l_lastExpandedCell);
        }
Ejemplo n.º 7
0
		/// <summary>
		/// Constructor. Create a DataGridColumn class.
		/// </summary>
		public PingGridColumn(PingGrid grid,
		                      ICellVirtual headerCell,
		                      ICellVirtual dataCell,
		                      string propertyName)
			: base(grid)
		{
			mPropertyName = propertyName;
			mHeaderCell = headerCell;
			mDataCell = dataCell;
		}
Ejemplo n.º 8
0
 /// <summary>
 /// Constructor. Create a DataGridColumn class.
 /// </summary>
 public PingGridColumn(PingGrid grid,
                       ICellVirtual headerCell,
                       ICellVirtual dataCell,
                       string propertyName)
     : base(grid)
 {
     mPropertyName = propertyName;
     mHeaderCell   = headerCell;
     mDataCell     = dataCell;
 }
Ejemplo n.º 9
0
		public PingGridColumn Add(string property,
		                           string caption,
		                           ICellVirtual cell)
		{
			var col = new PingGridColumn(Grid,
			                              new SourceGrid.Extensions.PingGrids.Cells.ColumnHeader(caption),
			                              cell,
			                              property);
			Insert(Count, col);
	
			return col;
		}
Ejemplo n.º 10
0
        public DataGridColumn Add(string property,
                                  string caption,
                                  ICellVirtual cell)
        {
            SourceGrid.DataGridColumn col = new DataGridColumn(Grid,
                                                               new SourceGrid.Cells.DataGrid.ColumnHeader(caption),
                                                               cell,
                                                               property);
            Insert(Count, col);

            return(col);
        }
Ejemplo n.º 11
0
		public DataGridColumn Add(string property,
		                          string caption,
		                          ICellVirtual cell)
		{
			SourceGrid.DataGridColumn col = new DataGridColumn(Grid,
			                                                   new SourceGrid.Cells.DataGrid.ColumnHeader(caption),
			                                                   cell,
			                                                   property);
			Insert(Count, col);

			return col;
		}
Ejemplo n.º 12
0
        public PingGridColumn Add(string property,
                                  string caption,
                                  ICellVirtual cell)
        {
            var col = new PingGridColumn(Grid,
                                         new SourceGrid.Extensions.PingGrids.Cells.ColumnHeader(caption),
                                         cell,
                                         property);

            Insert(Count, col);

            return(col);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            //base.DrawCell_ImageAndText (p_Cell, p_CellPosition, e, p_ClientRectangle, p_ForeColor, p_CellBorder);
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            ICellCheckBox  l_CheckBox = (ICellCheckBox)p_Cell;
            CheckBoxStatus l_Status   = l_CheckBox.GetCheckBoxStatus(p_CellPosition);

            Image l_CheckImage = GetImageForState(l_Status.Checked, p_Cell.Grid.MouseCellPosition == p_CellPosition, l_Status.CheckEnable);

            Font l_CurrentFont = GetCellFont();

            bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell;

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              l_CheckImage,
                                              checkBoxAlignment,
                                              ImageStretch,
                                              l_Status.Caption,
                                              StringFormat,
                                              AlignTextToImage,
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              false,
                                              l_lastExpandedCell);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell,
        /// relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(
            ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e,
            System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
            {
                return;
            }

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            ICellBitmapCell l_BitmapCell  = (ICellBitmapCell)p_Cell;
            Font            l_CurrentFont = GetCellFont();

            Image l_Image = (Image)l_BitmapCell.GetBitmap(p_CellPosition);

            bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell;

            // Image and Text
            VisualModelBase.PaintImageAndText(e.Graphics,
                                              p_ClientRectangle,
                                              l_Image,
                                              imageAlignment,
                                              ImageStretch,
                                              string.Empty, // p_Cell.GetDisplayText(p_CellPosition),
                                              StringFormat,
                                              AlignTextToImage,
                                              l_Border,
                                              l_ForeColor,
                                              l_CurrentFont,
                                              false,
                                              l_lastExpandedCell);
        }
        void setCellReadOnly(ICellVirtual vCell, bool readOnly, bool viewMode, bool setColumn = false)
        {
            Cell cell = (Cell)vCell;

            //set edit for set column to double click (if editable of course) and the rest on single click
            if (setColumn)
            {
                cell.Editor.EditableMode = viewMode || readOnly ? EditableMode.None : EditableMode.Default;
            }
            else
            {
                cell.Editor.EditableMode = viewMode || readOnly ? EditableMode.None : EditableMode.SingleClick;
            }

            cell.Editor.EnableEdit = !viewMode && !readOnly;
            if (!viewMode)
            {
                cell.View.BackColor = readOnly ? ApplicationColors.BGReadOnlyCell : ApplicationColors.BGStandardCell;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell"></param>
        /// <param name="p_CellPosition"></param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status"></param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            //in questo caso non chiamo la classe base perch� devo disegnare una textbox
            //base.DrawCell_ImageAndText (p_Cell, p_CellPosition, e, p_ClientRectangle, p_ForeColor, p_CellBorder);

            RectangleBorder l_Border    = Border;
            Color           l_ForeColor = ForeColor;

            if (p_Status == DrawCellStatus.Focus)
            {
                l_Border    = FocusBorder;
                l_ForeColor = FocusForeColor;
            }
            else if (p_Status == DrawCellStatus.Selected)
            {
                l_Border    = SelectionBorder;
                l_ForeColor = SelectionForeColor;
            }

            ICellCheckBox  l_CheckBox = (ICellCheckBox)p_Cell;
            CheckBoxStatus l_Status   = l_CheckBox.GetCheckBoxStatus(p_CellPosition);

            Image l_CheckImage = GetImageForState(l_Status.Checked, p_Cell.Grid.MouseCellPosition == p_CellPosition, l_Status.CheckEnable);

            Font l_CurrentFont = GetCellFont();

            //Image and Text
            Utility.PaintImageAndText(e.Graphics,
                                      p_ClientRectangle,
                                      l_CheckImage,
                                      m_CheckBoxAlignment,
                                      ImageStretch,
                                      l_Status.Caption,
                                      StringFormat,
                                      AlignTextToImage,
                                      l_Border,
                                      l_ForeColor,
                                      l_CurrentFont);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(ICellVirtual p_Cell,
      Position p_CellPosition,
      PaintEventArgs e,
      Rectangle p_ClientRectangle,
      DrawCellStatus p_Status)
        {
            bool l_lastExpandedCell;

              ICell cell = p_Cell as ICell;
              if (cell == null)
              { // this must be a Virtual Cell.
            l_lastExpandedCell = false;
              }
              else
              { // this is a Real Cell
            if (cell.Grid.Rows[cell.Row].Height == 0)
            { // It is safe to quit now if this cell isn't visible.
              return;
            }
            l_lastExpandedCell = cell.IsLastExpandedCell;
              }

              RectangleBorder l_Border = Border;
              Color l_ForeColor = ForeColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_Border = FocusBorder;
            l_ForeColor = FocusForeColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_Border = SelectionBorder;
            l_ForeColor = SelectionForeColor;
              }

              Font l_CurrentFont = GetCellFont();

              bool l_Expand = ExpandedCell;

              // Image and Text
              VisualModelBase.PaintImageAndText(e.Graphics,
            p_ClientRectangle,
            Image,
            ImageAlignment,
            ImageStretch,
            p_Cell.GetDisplayText(p_CellPosition),
            StringFormat,
            AlignTextToImage,
            l_Border,
            l_ForeColor,
            l_CurrentFont,
            l_Expand,
            l_lastExpandedCell);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Determines whether a specfic ICellVirtual value is in this CellBaseCollection.
 /// </summary>
 /// <param name="value">
 /// The ICellVirtual value to locate in this CellBaseCollection.
 /// </param>
 /// <returns>
 /// true if value is found in this CellBaseCollection;
 /// false otherwise.
 /// </returns>
 public virtual bool Contains(ICellVirtual value)
 {
     return(this.List.Contains(value));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Set the specified cell in the specified position. This method calls SetCell(int rowIndex, int columnIndex, ICellVirtual p_Cell)
 /// </summary>
 /// <param name="position">The position.</param>
 /// <param name="cell">The cell.</param>
 public void SetCell(Position position, ICellVirtual cell)
 {
     SetCell(position.Row, position.Column, cell);
 }
Ejemplo n.º 20
0
        /// <summary>
        /// ќтобразить данные
        /// </summary>
        protected virtual void Bind()
        {
            ValueCell = null;
            if (_dataSource == null) return;

            AcceptsInputChar = false;
            //Location = new System.Drawing.Point(0, 0);gg
            ClipboardMode = SourceGrid.ClipboardMode.Copy;
            Dock = System.Windows.Forms.DockStyle.Fill;
            Name = _dataSource.Address.ConstName;
            TabStop = true;
            SelectionMode = SourceGrid.GridSelectionMode.Cell;

            FixedColumns = _dataSource.Address.YMapConstName == "" ? 1 : 2;
            FixedRows = _dataSource.Address.XMapConstName == "" ? 1 : 2;

            Columns.AddColumns();

            ToolTipText = _dataSource.Address.Comment;

            _valueCell = new SourceGrid.Cells.Virtual.CellVirtual();
            _valueCell.Model.AddModel(new FRomValueModel());
            _valueCell.Editor = SourceGrid.Cells.Editors.Factory.Create(typeof(uint));

            Rows.RowsChanged();
            Columns.ColumnsChanged();

            Rows.AutoSize(true);
            Columns.AutoSize(true);

            RecalcColor();	//ѕересчет переменных дл¤ задани¤ цвета
        }
Ejemplo n.º 21
0
 public ICellVirtual ApplyCondition(ICellVirtual cell)
 {
     return(Cell);
 }
Ejemplo n.º 22
0
 public ConditionCell(ICellVirtual cell)
 {
     mCell = cell;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Draw the image and the displaystring of the specified cell.
        /// </summary>
        /// <param name="p_Cell">The cell.</param>
        /// <param name="p_CellPosition">The cell position.</param>
        /// <param name="e">Paint arguments</param>
        /// <param name="p_ClientRectangle">Rectangle position where draw the current cell,
        /// relative to the current view,</param>
        /// <param name="p_Status">Cell status</param>
        protected override void DrawCell_ImageAndText(
      ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e,
      System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status)
        {
            if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0)
              {
            return;
              }

              RectangleBorder l_Border = Border;
              Color l_ForeColor = ForeColor;
              if (p_Status == DrawCellStatus.Focus)
              {
            l_Border = FocusBorder;
            l_ForeColor = FocusForeColor;
              }
              else if (p_Status == DrawCellStatus.Selected)
              {
            l_Border = SelectionBorder;
            l_ForeColor = SelectionForeColor;
              }

              ICellBitmapCell l_BitmapCell = (ICellBitmapCell)p_Cell;
              Font l_CurrentFont = GetCellFont();

              Image l_Image = (Image)l_BitmapCell.GetBitmap(p_CellPosition);

              bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell;

              // Image and Text
              VisualModelBase.PaintImageAndText(e.Graphics,
            p_ClientRectangle,
            l_Image,
            imageAlignment,
            ImageStretch,
            string.Empty, // p_Cell.GetDisplayText(p_CellPosition),
            StringFormat,
            AlignTextToImage,
            l_Border,
            l_ForeColor,
            l_CurrentFont,
            false,
            l_lastExpandedCell);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Set the specified cell in the specified position. Simply call SettingCell event.
 /// </summary>
 /// <param name="rowIndex">Index of the row.</param>
 /// <param name="columnIndex">Index of the column.</param>
 /// <param name="p_Cell">The cell.</param>
 public virtual void SetCell(int rowIndex, int columnIndex, ICellVirtual p_Cell)
 {
     if (SettingCell != null)
       {
     SettingCell(this, new PositionEventArgs(new Position(rowIndex, columnIndex), p_Cell));
       }
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Removes the first occurrence of a specific ICellVirtual from this CellBaseCollection.
 /// </summary>
 /// <param name="value">
 /// The ICellVirtual value to remove from this CellBaseCollection.
 /// </param>
 public virtual void Remove(ICellVirtual value)
 {
     this.List.Remove(value);
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Return the zero-based index of the first occurrence of a specific value
 /// in this CellBaseCollection
 /// </summary>
 /// <param name="value">
 /// The ICellVirtual value to locate in the CellBaseCollection.
 /// </param>
 /// <returns>
 /// The zero-based index of the first occurrence of the _ELEMENT value if found;
 /// -1 otherwise.
 /// </returns>
 public virtual int IndexOf(ICellVirtual value)
 {
     return(this.List.IndexOf(value));
 }
Ejemplo n.º 27
0
 public ICellVirtual ApplyCondition(ICellVirtual cell)
 {
     return Cell;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Inserts an element into the CellBaseCollection at the specified index
 /// </summary>
 /// <param name="index">
 /// The index at which the ICellVirtual is to be inserted.
 /// </param>
 /// <param name="value">
 /// The ICellVirtual to insert.
 /// </param>
 public virtual void Insert(int index, ICellVirtual value)
 {
     this.List.Insert(index, value);
 }
Ejemplo n.º 29
0
 public ConditionCell(ICellVirtual cell)
 {
     mCell = cell;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Adds an instance of type ICellVirtual to the end of this CellBaseCollection.
 /// </summary>
 /// <param name="value">
 /// The ICellVirtual to be added to the end of this CellBaseCollection.
 /// </param>
 public virtual void Add(ICellVirtual value)
 {
     this.List.Add(value);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Draw the specified Cell
 /// </summary>
 /// <param name="p_Panel">The panel.</param>
 /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
 /// <param name="p_Cell">The cell.</param>
 /// <param name="p_CellPosition">The cell position.</param>
 /// <param name="p_PanelDrawRectangle">The panel draw rectangle.</param>
 protected virtual void PaintCell(GridSubPanel p_Panel, PaintEventArgs e, ICellVirtual p_Cell, Position p_CellPosition, Rectangle p_PanelDrawRectangle)
 {
     p_Cell.VisualModel.DrawCell(p_Cell, p_CellPosition, e, p_PanelDrawRectangle);
 }