Stores visual appearance related properties for a Cell
Beispiel #1
0
        void VisualizeEvent(LogEvent e)
        {
            XPTable.Models.Row row = new XPTable.Models.Row();

            XPTable.Models.Cell      cell1      = new XPTable.Models.Cell();
            XPTable.Models.CellStyle cellStyle1 = new XPTable.Models.CellStyle();
            XPTable.Models.Cell      cell2      = new XPTable.Models.Cell();
            XPTable.Models.CellStyle cellStyle2 = new XPTable.Models.CellStyle();

            cell1.Data        = e.time;
            cell1.ToolTipText = e.time.ToString("dd.MM.yyyy");

            cell2.Image = e.icon;
            cell2.Text  = e.text;

            if (e.lines.Length == 1)
            {
                cell2.ToolTipText = e.lines[0].Second;
            }

            row.Cells.AddRange(new XPTable.Models.Cell[] { cell1, cell2 });
            row.ChildIndex = 0;
            row.Editable   = false;
            row.Tag        = e;

            tableModel.Rows.Add(row);
            publishedEvents.Add(e, row);
        }
Beispiel #2
0
        static ColumnDisplay()
        {
            BoldFont = new Font(SystemFonts.DefaultFont.FontFamily, SystemFonts.DefaultFont.Size, FontStyle.Bold);

            YouStyle = new CellStyle();
            YouStyle.ForeColor = Color.Red;
            YouStyle.Font = BoldFont;
            YouStyle.BackColor = Color.Transparent;

            TribeStyle = new CellStyle();
            TribeStyle.ForeColor = Color.Blue;
            TribeStyle.BackColor = Color.Empty;
            TribeStyle.Font = BoldFont;

            DifferenceStyle = new CellStyle();
            DifferenceStyle.ForeColor = Color.LightGray;
            DifferenceStyle.BackColor = Color.Empty;
        }
Beispiel #3
0
        /// <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 Events.SelectionEventHandler(OnSelectionChanged);
            this.columnTable.CellCheckChanged += new Events.CellCheckBoxEventHandler(OnCellCheckChanged);

            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();
        }
Beispiel #4
0
        public void VisualizeFilter(string mask, string info, bool local)
        {
            Row row = new Row();

            Cell cell1 = new Cell();
            CellStyle cellStyle1 = new CellStyle();
            Cell cell2 = new Cell();
            CellStyle cellStyle2 = new CellStyle();

            cell1.Text = mask;
            cell1.Checked = !local;
            cell1.Icon = GetIconForMask(mask);
            cell1.Image = Properties.Resources.Information; // HACK: fake bitmap with same size as icon
            if (info.Length > 0)
                cell2.Text = info;
            else
                cell2.Text = GetInfoForMask(mask);

            cellStyle1.Font = new System.Drawing.Font("Courier", 8.00F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            if (globalMode)
            {
                cellStyle1.ForeColor = Color.Blue;
            }

            cell1.CellStyle = cellStyle1;
            cellStyle2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            cell2.CellStyle = cellStyle2;
            if (info.Length > 0)
            {
                cell2.ForeColor = Color.Black;
            }
            else
            {
                cell2.ForeColor = Color.Gray;
            }

            row.Cells.AddRange(new XPTable.Models.Cell[] { cell1, cell2 });
            row.ChildIndex = 0;
            row.Editable = true;

            tableModel.Rows.Add(row);
        }
        /// <summary>
        /// Initializes a new instance of the Cell class with the specified text, 
        /// Image and CellStyle
        /// </summary>
        /// <param name="text">The text displayed in the Cell</param>
        /// <param name="image">The Image displayed in the Cell</param>
        /// <param name="cellStyle">A CellStyle that specifies the visual appearance 
        /// of the Cell</param>
        public Cell(string text, Image image, CellStyle cellStyle)
        {
            this.Init();

            this.text = text;
            this.Image = image;
            this.cellStyle = cellStyle;
        }
        /// <summary>
        /// Initializes a new instance of the Cell class with the specified text, 
        /// check value and CellStyle
        /// </summary>
        /// <param name="text">The text displayed in the Cell</param>
        /// <param name="check">Specifies whether the Cell is Checked</param>
        /// <param name="cellStyle">A CellStyle that specifies the visual appearance 
        /// of the Cell</param>
        public Cell(string text, bool check, CellStyle cellStyle)
        {
            this.Init();

            this.text = text;
            this.Checked = check;
            this.cellStyle = cellStyle;
        }
        /// <summary>
        /// Initializes a new instance of the Cell class with the specified text, 
        /// object and CellStyle
        /// </summary>
        /// <param name="text">The text displayed in the Cell</param>
        /// <param name="value">The object displayed in the Cell</param>
        /// <param name="cellStyle">A CellStyle that specifies the visual appearance 
        /// of the Cell</param>
        public Cell(string text, object value, CellStyle cellStyle)
        {
            this.Init();

            this.text = text;
            this.data = value;
            this.cellStyle = cellStyle;
        }
        /// <summary>
        /// Initializes a new instance of the Cell class with the specified text 
        /// and CellStyle
        /// </summary>
        /// <param name="value">The object displayed in the Cell</param>
        /// <param name="cellStyle">A CellStyle that specifies the visual appearance 
        /// of the Cell</param>
        public Cell(object value, CellStyle cellStyle)
        {
            this.Init();

            this.data = value;
            this.cellStyle = cellStyle;
        }
        /// <summary>
        /// Initializes a new instance of the Cell class with the specified text 
        /// and CellStyle
        /// </summary>
        /// <param name="text">The text displayed in the Cell</param>
        /// <param name="cellStyle">A CellStyle that specifies the visual appearance 
        /// of the Cell</param>
        public Cell(string text, CellStyle cellStyle)
        {
            this.Init();

            this.text = text;
            this.cellStyle = cellStyle;
        }
        /// <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.colspan = 1;

            this.state = (byte) (STATE_EDITABLE | STATE_ENABLED);
        }
        /// <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;
            }
        }
Beispiel #12
0
        void table_MouseClick(object sender, MouseEventArgs ev)
        {
            int rindex = table.RowIndexAt(ev.X, ev.Y);

            if (rindex < 0)
            {
                return;
            }
            if (rindex >= table.TableModel.Rows.Count)
            {
                return;
            }
            XPTable.Models.Row row = table.TableModel.Rows[rindex];
            if (row.Parent != null)
            {
                return;
            }

            LogEvent e = row.Tag as LogEvent;

            if (row.SubRows.Count > 0)
            {
                int index = row.Index + 1;
                while (true)
                {
                    if (table.TableModel.Rows.Count <= index)
                    {
                        break;
                    }
                    XPTable.Models.Row xrow = table.TableModel.Rows[index];
                    if (xrow.ChildIndex == 0)
                    {
                        break;
                    }
                    table.TableModel.Rows.Remove(xrow);
                }
                row.SubRows.Clear();
            }
            else
            {
                foreach (Pair <Bitmap, string> line in e.lines)
                {
                    XPTable.Models.Row subrow = new XPTable.Models.Row();

                    XPTable.Models.Cell      subcell1      = new XPTable.Models.Cell();
                    XPTable.Models.CellStyle subcellStyle1 = new XPTable.Models.CellStyle();
                    XPTable.Models.Cell      subcell2      = new XPTable.Models.Cell();
                    XPTable.Models.CellStyle subcellStyle2 = new XPTable.Models.CellStyle();

                    subcell2.Image     = line.First;
                    subcell2.Text      = line.Second;
                    subcell2.ColSpan   = 2;
                    subcell2.ForeColor = Color.Gray;

                    subrow.Cells.Add(subcell1);
                    subrow.Cells.Add(subcell2);
                    subrow.Editable = false;

                    row.SubRows.Add(subrow);
                }
            }
        }