Exemple #1
0
        private void setImage()
        {
            ImageList imageListSmall = new ImageList();

            Image documenticon = RPFTool.Properties.Resources.file;

            Image foldericon = RPFTool.Properties.Resources.folder;

            Bitmap folder   = new Bitmap(foldericon);
            Bitmap document = new Bitmap(documenticon);

            // Initialize the ImageList objects with bitmaps.
            imageListSmall.Images.Add(document);
            imageListSmall.Images.Add(folder);

            filelistview.SmallImageList = imageListSmall;

            BrightIdeasSoftware.OLVColumn namecolumn = filelistview.GetColumn(0);
            namecolumn.ImageGetter = delegate(object rowObject)
            {
                fileSystemObject p = (fileSystemObject)rowObject;
                if (p is RPFLib.Common.File)
                {
                    return(0); // document
                }
                else
                {
                    return(1); // folder
                }
            };
        }
Exemple #2
0
        private void SetEpubView()
        {
            //this.olvFiles = new BrightIdeasSoftware.ObjectListView();
            BrightIdeasSoftware.OLVColumn olvColumnFileName     = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
            BrightIdeasSoftware.OLVColumn olvColumnFilePath     = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
            BrightIdeasSoftware.OLVColumn olvColumnFileModified = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
            BrightIdeasSoftware.OLVColumn olvColumnSize         = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));


            this.oEpubFileList.AllColumns.Add(olvColumnFileName);
            this.oEpubFileList.AllColumns.Add(olvColumnFilePath);
            this.oEpubFileList.AllColumns.Add(olvColumnFileModified);
            this.oEpubFileList.AllColumns.Add(olvColumnSize);
            //this.oEpubFileList.AllColumns.Add();
            this.oEpubFileList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                olvColumnFileName,
                olvColumnFilePath,
                olvColumnFileModified,
                olvColumnSize
            });
            //
            // olvColumnFileName
            //
            olvColumnFileName.AspectName               = "FileName";
            olvColumnFileName.CellPadding              = null;
            olvColumnFileName.IsTileViewColumn         = true;
            olvColumnFileName.Text                     = "FileName";
            olvColumnFileName.UseInitialLetterForGroup = true;
            olvColumnFileName.Width                    = 180;
            //
            // olvColumnFileCreated
            //
            olvColumnFilePath.AspectName   = "FilePath";
            olvColumnFilePath.CellPadding  = null;
            olvColumnFilePath.DisplayIndex = 4;
            olvColumnFilePath.Text         = "FilePath";
            olvColumnFilePath.Width        = 131;
            //
            // olvColumnFileModified
            //
            olvColumnFileModified.AspectName       = "Title";
            olvColumnFileModified.CellPadding      = null;
            olvColumnFileModified.DisplayIndex     = 1;
            olvColumnFileModified.IsTileViewColumn = true;
            olvColumnFileModified.Text             = "Title";
            olvColumnFileModified.Width            = 127;
            //
            // olvColumnSize
            //
            olvColumnSize.AspectName      = "Source";
            olvColumnSize.CellPadding     = null;
            olvColumnSize.DisplayIndex    = 2;
            olvColumnSize.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            olvColumnSize.Text            = "Source";
            olvColumnSize.TextAlign       = System.Windows.Forms.HorizontalAlignment.Right;
            olvColumnSize.Width           = 80;
        }
Exemple #3
0
        public void GenerateListView(ObjectListView varListView, List <ListViewColumnsInfo> nameSizeList)
        {
            List <OLVColumn> columnsList = new List <OLVColumn>();
            var totalColumns             = nameSizeList.Count();
            int counter = 0;

            foreach (ListViewColumnsInfo nameSize in nameSizeList)
            {
                counter++;
                OLVColumn columnHeader = new BrightIdeasSoftware.OLVColumn();
                columnHeader.Text       = nameSize.Header;
                columnHeader.IsVisible  = nameSize.Visible;
                columnHeader.AspectName = nameSize.Header;

                // Only for last column
                if (totalColumns == counter)
                {
                    var lastColumn        = nameSizeList.Last();
                    var withoutLastColumn = nameSizeList.Where(x => !x.Header.Equals(lastColumn));
                    var withOfAll         = withoutLastColumn.Sum(x => x.ColumnSize);
                    columnHeader.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
                    int colWidthAfterAutoResizeByContent = columnHeader.Width;
                    if (nameSize.ColumnSize > colWidthAfterAutoResizeByContent)
                    {
                        columnHeader.Width = nameSize.ColumnSize;
                    }
                    else
                    {
                        columnHeader.Width = colWidthAfterAutoResizeByContent;
                    }
                }
                else
                {
                    columnHeader.Width = nameSize.ColumnSize;
                }

                // Set header style
                var headerstyle = new HeaderFormatStyle();
                headerstyle.SetBackColor(Color.FromArgb(83, 83, 91));
                headerstyle.SetForeColor(Color.White);
                columnHeader.HeaderFormatStyle = headerstyle;
                if (nameSize.IsButton)
                {
                    columnHeader.IsButton     = nameSize.IsButton;
                    columnHeader.TextAlign    = HorizontalAlignment.Center;
                    columnHeader.ButtonSizing = OLVColumn.ButtonSizingMode.FixedBounds;
                    columnHeader.ButtonSize   = new Size(15, 15);
                }
                columnsList.Add(columnHeader);
                varListView.AllColumns.Add(columnHeader);
            }
            varListView.Columns.AddRange(columnsList.Cast <System.Windows.Forms.ColumnHeader>().ToArray());
        }
        public FieldsListView()
        {
            CellEditActivation      = CellEditActivateMode.DoubleClick;
            CellEditTabChangesRows  = true;
            CopySelectionOnControlC = false;
            FullRowSelect           = true;
            MultiSelect             = false;
            HeaderStyle             = ColumnHeaderStyle.Nonclickable;
            ShowGroups          = false;
            UseCellFormatEvents = true;
            UseHyperlinks       = true;
            DragSource          = new FieldValueDragSource();

            if (KeePass.Program.Config.MainWindow.EntryListAlternatingBgColors)
            {
                AlternateRowBackColor    = UIUtil.GetAlternateColor(BackColor);
                UseAlternatingBackColors = true;
            }

            mFieldNames = new OLVColumn
            {
                Text = Properties.Resources.Name,
                AutoCompleteEditor = false,
                AspectGetter       = rowObject => ((RowObject)rowObject).DisplayName,
                AspectPutter       = SetFieldName
            };
            mFieldValues = new OLVColumn
            {
                Text = Properties.Resources.Value,
                AutoCompleteEditor = false,
                FillsFreeSpace     = true,
                Hyperlink          = true,
                AspectGetter       = rowObject => ((RowObject)rowObject).GetDisplayValue(this),
                AspectPutter       = SetFieldValue
            };

            Columns.Add(mFieldNames);
            Columns.Add(mFieldValues);

            ShowItemToolTips = true;
        }
Exemple #5
0
        /// <summary>
        /// Draw a slight colouring over our tinted column
        /// </summary>
        /// <remarks>
        /// This overlay only works when:
        /// - the list is in Details view
        /// - there is at least one row
        /// - there is a selected column (or a specified tint column)
        /// </remarks>
        /// <param name="olv"></param>
        /// <param name="g"></param>
        /// <param name="r"></param>
        public override void Draw(ObjectListView olv, Graphics g, Rectangle r)
        {
            if (olv.View != System.Windows.Forms.View.Details)
            {
                return;
            }

            if (olv.GetItemCount() == 0)
            {
                return;
            }

            OLVColumn column = this.ColumnToTint ?? olv.SelectedColumn;

            if (column == null)
            {
                return;
            }

            Point sides = NativeMethods.GetScrolledColumnSides(olv, column.Index);

            if (sides.X == -1)
            {
                return;
            }

            Rectangle columnBounds = new Rectangle(sides.X, r.Top, sides.Y - sides.X, r.Bottom);

            // Find the bottom of the last item. The tinting should extend only to there.
            OLVListItem lastItem = olv.GetLastItemInDisplayOrder();

            if (lastItem != null)
            {
                Rectangle lastItemBounds = lastItem.Bounds;
                if (!lastItemBounds.IsEmpty && lastItemBounds.Bottom < columnBounds.Bottom)
                {
                    columnBounds.Height = lastItemBounds.Bottom - columnBounds.Top;
                }
            }
            g.FillRectangle(this.tintBrush, columnBounds);
        }
        /// <summary>
        /// Apply the selected values from the given list as a filter on the given column
        /// </summary>
        /// <param name="checkedList">A list in which the checked items should be used as filters</param>
        /// <param name="column">The column for which a filter should be generated</param>
        virtual protected void EnactFilter(ToolStripCheckedListBox checkedList, OLVColumn column)
        {
            if (column.ListView is not ObjectListView olv || olv.IsDisposed)
            {
                return;
            }

            // Collect all the checked values
            ArrayList chosenValues = new ArrayList();

            foreach (object x in checkedList.CheckedItems)
            {
                if (x is ICluster cluster)
                {
                    chosenValues.Add(cluster.ClusterKey);
                }
            }
            column.ValuesChosenForFiltering = chosenValues;

            olv.UpdateColumnFiltering();
        }
Exemple #7
0
        /// <summary>
        /// Configure the given column to show the given property.
        /// The title and aspect name of the column are already filled in.
        /// </summary>
        /// <param name="column"></param>
        /// <param name="property"></param>
        protected virtual void ConfigureColumn(OLVColumn column, PropertyDescriptor property)
        {
            if (property.PropertyType == typeof(bool) || property.PropertyType == typeof(CheckState))
            {
                column.TextAlign  = HorizontalAlignment.Center;
                column.Width      = 32;
                column.CheckBoxes = true;

                if (property.PropertyType == typeof(CheckState))
                {
                    column.TriStateCheckBoxes = true;
                }
            }

            // If our column is a BLOB, it could be an image, so assign a renderer to draw it.
            // CONSIDER: Is this a common enough case to warrant this code?
            if (property.PropertyType == typeof(System.Byte[]))
            {
                column.Renderer = new ImageRenderer();
            }
        }
Exemple #8
0
        private void DrawImageAndText(Graphics g, Rectangle r, OLVColumn column, TextFormatFlags flags, Font f, Color color, int imageTextGap) {
            Rectangle textRect = r;
            textRect.X += (column.ImageList.ImageSize.Width + imageTextGap);
            textRect.Width -= (column.ImageList.ImageSize.Width + imageTextGap);

            Size textSize = Size.Empty;
            if (column.ShowTextInHeader)
                textSize = TextRenderer.MeasureText(g, column.Text, f, textRect.Size, flags);

            int imageY = r.Top + ((r.Height - column.ImageList.ImageSize.Height) / 2);
            int imageX = textRect.Left;
            if (column.HeaderTextAlign == HorizontalAlignment.Center)
                imageX = textRect.Left + ((textRect.Width - textSize.Width) / 2);
            if (column.HeaderTextAlign == HorizontalAlignment.Right)
                imageX = textRect.Right - textSize.Width;
            imageX -= (column.ImageList.ImageSize.Width + imageTextGap);

            column.ImageList.Draw(g, imageX, imageY, column.ImageList.Images.IndexOfKey(column.HeaderImageKey));

            this.DrawText(g, textRect, column, flags, f, color);
        }
        /// <summary>
        /// Create and return an editor that is appropriate for the given value.
        /// Return null if no appropriate editor can be found.
        /// </summary>
        /// <param name="model">The model involved</param>
        /// <param name="column">The column to be edited</param>
        /// <param name="value">The value to be edited. This value may not be the exact
        /// value for the column/model combination. It could be simply representative of
        /// the appropriate type of value.</param>
        /// <returns>A Control that can edit the given type of values</returns>
        public Control GetEditor(Object model, OLVColumn column, Object value)
        {
            Control editor;

            // Give the first chance delegate a chance to decide
            if (this.firstChanceCreator != null)
            {
                editor = this.firstChanceCreator(model, column, value);
                if (editor != null)
                {
                    return(editor);
                }
            }

            // Try to find a creator based on the type of the value (or the column)
            Type type = value == null ? column.DataType : value.GetType();

            if (type != null && this.creatorMap.ContainsKey(type))
            {
                editor = this.creatorMap[type](model, column, value);
                if (editor != null)
                {
                    return(editor);
                }
            }

            // Enums without other processing get a special editor
            if (value != null && value.GetType().IsEnum)
            {
                return(this.CreateEnumEditor(value.GetType()));
            }

            // Give any default creator a final chance
            if (this.defaultCreator != null)
            {
                return(this.defaultCreator(model, column, value));
            }

            return(null);
        }
Exemple #10
0
        /// <summary>
        /// Draw one cell of the header
        /// </summary>
        /// <param name="g"></param>
        /// <param name="columnIndex"></param>
        /// <param name="itemState"></param>
        protected void CustomDrawHeaderCell(Graphics g, int columnIndex, int itemState) {
            Rectangle r = this.GetItemRect(columnIndex);
            OLVColumn column = this.ListView.GetColumn(columnIndex);
            const int CDIS_SELECTED = 1;
            bool isPressed = ((itemState & CDIS_SELECTED) == CDIS_SELECTED);

            // Calculate which style should be used for the header
            HeaderStateStyle stateStyle = this.CalculateStyle(column, columnIndex == this.ColumnIndexUnderCursor, isPressed);

            // If there is an owner drawn delegate installed, give it a chance to draw the header
            if (column.HeaderDrawing != null) {
                if (!column.HeaderDrawing(g, r, columnIndex, column, isPressed, stateStyle))
                    return;
            }

            // Draw the background
            if (this.ListView.HeaderUsesThemes &&
                VisualStyleRenderer.IsSupported &&
                VisualStyleRenderer.IsElementDefined(VisualStyleElement.Header.Item.Normal))
                this.DrawThemedBackground(g, r, columnIndex, isPressed);
            else
                this.DrawUnthemedBackground(g, r, columnIndex, isPressed, stateStyle);
            

            // Draw the sort indicator if this column has one
            if (this.HasSortIndicator(column)) {
                if (this.ListView.HeaderUsesThemes &&
                    VisualStyleRenderer.IsSupported &&
                    VisualStyleRenderer.IsElementDefined(VisualStyleElement.Header.SortArrow.SortedUp))
                    this.DrawThemedSortIndicator(g, r);
                else
                    r = this.DrawUnthemedSortIndicator(g, r);
            }

            if (this.HasFilterIndicator(column))
                r = this.DrawFilterIndicator(g, r);

            // Finally draw the text
            this.DrawHeaderImageAndText(g, r, column, stateStyle);
        }
        /// <summary>
        /// Create an AutoCompleteCellEditor
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="column"></param>
        public AutoCompleteCellEditor(ObjectListView lv, OLVColumn column)
        {
            this.DropDownStyle = ComboBoxStyle.DropDown;

            Dictionary <String, bool> alreadySeen = new Dictionary <string, bool>();

            for (int i = 0; i < Math.Min(lv.GetItemCount(), 1000); i++)
            {
                String str = column.GetStringValue(lv.GetModelObject(i));
                if (!alreadySeen.ContainsKey(str))
                {
                    this.Items.Add(str);
                    alreadySeen[str] = true;
                }
            }

            this.Sorted             = true;
            this.AutoCompleteSource = AutoCompleteSource.ListItems;
            this.AutoCompleteMode   = AutoCompleteMode.Append;

            ControlUtilities.AutoResizeDropDown(this);
        }
Exemple #12
0
        internal virtual bool HandleHeaderCustomDraw(ref Message m)
        {
            BrightIdeasSoftware.NativeMethods.NMCUSTOMDRAW lParam = (BrightIdeasSoftware.NativeMethods.NMCUSTOMDRAW)m.GetLParam(typeof(BrightIdeasSoftware.NativeMethods.NMCUSTOMDRAW));
            switch (lParam.dwDrawStage)
            {
            case 1:
                this.cachedNeedsCustomDraw = this.NeedsCustomDraw;
                m.Result = (IntPtr)0x20;
                return(true);

            case 0x10001:
            {
                int       index  = lParam.dwItemSpec.ToInt32();
                OLVColumn column = this.ListView.GetColumn(index);
                if (!this.cachedNeedsCustomDraw)
                {
                    Font prototype = column.HeaderFont ?? (this.ListView.HeaderFont ?? this.ListView.Font);
                    if ((this.HotFontStyle != FontStyle.Regular) && (index == this.ColumnIndexUnderCursor))
                    {
                        prototype = new Font(prototype, this.HotFontStyle);
                    }
                    BrightIdeasSoftware.NativeMethods.SelectObject(lParam.hdc, prototype.ToHfont());
                    m.Result = (IntPtr)2;
                    break;
                }
                using (Graphics graphics = Graphics.FromHdc(lParam.hdc))
                {
                    graphics.TextRenderingHint = ObjectListView.TextRendereringHint;
                    this.CustomDrawHeaderCell(graphics, index, lParam.uItemState);
                }
                m.Result = (IntPtr)4;
                break;
            }

            default:
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// Initialize the form to show the columns of the given view
        /// </summary>
        /// <param name="olv"></param>
        /// <param name="view"></param>
        protected void InitializeForm(ObjectListView olv, View view)
        {
            this.AllColumns          = olv.AllColumns;
            this.RearrangableColumns = new List <OLVColumn>(this.AllColumns);
            foreach (OLVColumn col in this.RearrangableColumns)
            {
                if (view == View.Details)
                {
                    this.MapColumnToVisible[col] = col.IsVisible;
                }
                else
                {
                    this.MapColumnToVisible[col] = col.IsTileViewColumn;
                }
            }
            this.RearrangableColumns.Sort(new SortByDisplayOrder(this));

            this.objectListView1.BooleanCheckStateGetter = delegate(object rowObject)
            {
                return(this.MapColumnToVisible[(OLVColumn)rowObject]);
            };

            this.objectListView1.BooleanCheckStatePutter = delegate(object rowObject, bool newValue)
            {
                // Some columns should always be shown, so ignore attempts to hide them
                OLVColumn column = (OLVColumn)rowObject;
                if (!column.CanBeHidden)
                {
                    return(true);
                }

                this.MapColumnToVisible[column] = newValue;
                EnableControls();
                return(newValue);
            };

            this.objectListView1.SetObjects(this.RearrangableColumns);
            this.EnableControls();
        }
        /// <summary>
        /// Enable the controls on the dialog to match the current state
        /// </summary>
        protected void EnableControls()
        {
            if (this.objectListView1.SelectedIndices.Count == 0)
            {
                this.buttonMoveUp.Enabled   = false;
                this.buttonMoveDown.Enabled = false;
                this.buttonShow.Enabled     = false;
                this.buttonHide.Enabled     = false;
            }
            else
            {
                // Can't move the first row up or the last row down
                this.buttonMoveUp.Enabled   = (this.objectListView1.SelectedIndices[0] != 0);
                this.buttonMoveDown.Enabled = (this.objectListView1.SelectedIndices[0] < (this.objectListView1.GetItemCount() - 1));

                OLVColumn selectedColumn = (OLVColumn)this.objectListView1.SelectedObject;

                // Some columns cannot be hidden (and hence cannot be Shown)
                this.buttonShow.Enabled = !this.MapColumnToVisible[selectedColumn] && selectedColumn.CanBeHidden;
                this.buttonHide.Enabled = this.MapColumnToVisible[selectedColumn] && selectedColumn.CanBeHidden;
            }
        }
Exemple #15
0
 /// <summary>
 /// Generate aspect getters and putters for any columns that are missing them (and for which we have
 /// enough information to actually generate a getter)
 /// </summary>
 protected virtual void CreateMissingAspectGettersAndPutters()
 {
     foreach (OLVColumn x in ListView.AllColumns)
     {
         OLVColumn column = x; // stack based variable accessible from closures
         if (column.AspectGetter == null && !String.IsNullOrEmpty(column.AspectName))
         {
             column.AspectGetter = delegate(object row)
             {
                 // In most cases, rows will be DataRowView objects
                 var drv = row as DataRowView;
                 if (drv == null)
                 {
                     return(column.GetAspectByName(row));
                 }
                 return((drv.Row.RowState == DataRowState.Detached)
                                                      ? null
                                                      : drv[column.AspectName]);
             };
         }
         if (column.IsEditable && column.AspectPutter == null && !String.IsNullOrEmpty(column.AspectName))
         {
             column.AspectPutter = delegate(object row, object newValue)
             {
                 // In most cases, rows will be DataRowView objects
                 var drv = row as DataRowView;
                 if (drv == null)
                 {
                     column.PutAspectByName(row, newValue);
                 }
                 else
                 {
                     drv[column.AspectName] = newValue;
                 }
             };
         }
     }
 }
        /// <summary>
        /// Handle the LButtonUp windows message
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        protected bool HandleLButtonUp(ref Message m)
        {
            //System.Diagnostics.Debug.WriteLine("WM_LBUTTONUP");

            // Was the mouse released over a header checkbox?
            if (columnIndexCheckBoxMouseDown < 0)
            {
                return(true);
            }

            // Was the mouse released over the same checkbox on which it was pressed?
            if (columnIndexCheckBoxMouseDown != GetColumnCheckBoxUnderCursor())
            {
                return(true);
            }

            // Toggle the header's checkbox
            OLVColumn column = ListView.GetColumn(columnIndexCheckBoxMouseDown);

            ListView.ToggleHeaderCheckBox(column);

            return(true);
        }
Exemple #17
0
        /// <summary>
        /// Create and return an editor that is appropriate for the given value.
        /// Return null if no appropriate editor can be found.
        /// </summary>
        /// <param name="model">The model involved</param>
        /// <param name="column">The column to be edited</param>
        /// <param name="value">The value to be edited. This value may not be the exact
        /// value for the column/model combination. It could be simply representative of
        /// the appropriate type of value.</param>
        /// <returns>A Control that can edit the given type of values</returns>
        public Control GetEditor(Object model, OLVColumn column, Object value) {
            Control editor;

            if (this.firstChanceCreator != null) {
                editor = this.firstChanceCreator(model, column, value);
                if (editor != null)
                    return editor;
            }

            if (value != null && this.creatorMap.ContainsKey(value.GetType())) {
                editor = this.creatorMap[value.GetType()](model, column, value);
                if (editor != null)
                    return editor;
            }

            if (this.defaultCreator != null)
                return this.defaultCreator(model, column, value);

            if (value != null && value.GetType().IsEnum)
                return this.CreateEnumEditor(value.GetType());

            return null;
        }
 /// <summary>
 /// Generate aspect getters and putters for any columns that are missing them (and for which we have
 /// enough information to actually generate a getter)
 /// </summary>
 protected virtual void CreateMissingAspectGettersAndPutters()
 {
     for (int i = 0; i < this.Columns.Count; i++)
     {
         OLVColumn column = this.GetColumn(i);
         if (column.AspectGetter == null && !String.IsNullOrEmpty(column.AspectName))
         {
             column.AspectGetter = delegate(object row) {
                 // In most cases, rows will be DataRowView objects
                 DataRowView drv = row as DataRowView;
                 if (drv != null)
                 {
                     return(drv[column.AspectName]);
                 }
                 else
                 {
                     return(column.GetAspectByName(row));
                 }
             };
         }
         if (column.IsEditable && column.AspectPutter == null && !String.IsNullOrEmpty(column.AspectName))
         {
             column.AspectPutter = delegate(object row, object newValue) {
                 // In most cases, rows will be DataRowView objects
                 DataRowView drv = row as DataRowView;
                 if (drv != null)
                 {
                     drv[column.AspectName] = newValue;
                 }
                 else
                 {
                     column.PutAspectByName(row, newValue);
                 }
             };
         }
     }
 }
        /// <summary>
        /// Create a Filter menu on the given tool tip for the given column in the given ObjectListView.
        /// </summary>
        /// <remarks>This is the main entry point into this class.</remarks>
        /// <param name="strip"></param>
        /// <param name="listView"></param>
        /// <param name="column"></param>
        /// <returns>The strip that should be shown to the user</returns>
        virtual public ToolStripDropDown MakeFilterMenu(ToolStripDropDown strip, ObjectListView listView, OLVColumn column)
        {
            if (strip == null)
            {
                throw new ArgumentNullException("strip");
            }
            if (listView == null)
            {
                throw new ArgumentNullException("listView");
            }
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            if (!column.UseFiltering || column.ClusteringStrategy == null || listView.Objects == null)
            {
                return(strip);
            }

            List <ICluster> clusters = this.Cluster(column.ClusteringStrategy, listView, column);

            if (clusters.Count > 0)
            {
                this.SortClusters(column.ClusteringStrategy, clusters);
                strip.Items.Add(this.CreateFilteringMenuItem(column, clusters));
            }

            return(strip);
        }
        /// <summary>
        /// Create a collection of clusters that should be presented to the user
        /// </summary>
        /// <param name="strategy"></param>
        /// <param name="listView"></param>
        /// <param name="column"></param>
        /// <returns></returns>
        virtual protected List <ICluster> Cluster(IClusteringStrategy strategy, ObjectListView listView, OLVColumn column)
        {
            // Build a map that correlates cluster key to clusters
            NullableDictionary <object, ICluster> map = new NullableDictionary <object, ICluster>();
            int count = 0;

            foreach (object model in listView.Objects)
            {
                object key = strategy.GetClusterKey(model);
                if (key == System.DBNull.Value)
                {
                    key = null;
                }
                if (key == null && !this.TreatNullAsDataValue)
                {
                    continue;
                }
                if (map.ContainsKey(key))
                {
                    map[key].Count += 1;
                }
                else
                {
                    map[key] = strategy.CreateCluster(key);
                }

                // Check our limit
                count += 1;
                if (count > this.MaxObjectsToConsider)
                {
                    break;
                }
            }

            // Now that we know exactly how many items are in each cluster, create a label for it
            foreach (ICluster cluster in map.Values)
            {
                cluster.DisplayLabel = strategy.GetClusterDisplayLabel(cluster);
            }

            return(new List <ICluster>(map.Values));
        }
Exemple #21
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtractableCohortUI));
     tbID           = new System.Windows.Forms.TextBox();
     label5         = new System.Windows.Forms.Label();
     lblDescription = new System.Windows.Forms.Label();
     label1         = new System.Windows.Forms.Label();
     tbOverrideReleaseIdentifierSQL = new System.Windows.Forms.TextBox();
     pDescription        = new System.Windows.Forms.Panel();
     helpIcon1           = new Rdmp.UI.SimpleControls.HelpIcon();
     tlvCohortUsage      = new BrightIdeasSoftware.TreeListView();
     olvUsedIn           = new BrightIdeasSoftware.OLVColumn();
     tlvPreviousVersions = new BrightIdeasSoftware.TreeListView();
     olvOtherVersions    = new BrightIdeasSoftware.OLVColumn();
     olvVersion          = new BrightIdeasSoftware.OLVColumn();
     splitContainer1     = new System.Windows.Forms.SplitContainer();
     label2          = new System.Windows.Forms.Label();
     tbVersion       = new System.Windows.Forms.TextBox();
     label3          = new System.Windows.Forms.Label();
     tbProjectNumber = new System.Windows.Forms.TextBox();
     btnShowProject  = new System.Windows.Forms.Button();
     label4          = new System.Windows.Forms.Label();
     tbOriginId      = new System.Windows.Forms.TextBox();
     panel1          = new System.Windows.Forms.Panel();
     ((System.ComponentModel.ISupportInitialize)(tlvCohortUsage)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(tlvPreviousVersions)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(splitContainer1)).BeginInit();
     splitContainer1.Panel1.SuspendLayout();
     splitContainer1.Panel2.SuspendLayout();
     splitContainer1.SuspendLayout();
     panel1.SuspendLayout();
     this.SuspendLayout();
     //
     // tbID
     //
     tbID.Location = new System.Drawing.Point(183, 5);
     tbID.Margin   = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tbID.Name     = "tbID";
     tbID.ReadOnly = true;
     tbID.Size     = new System.Drawing.Size(116, 23);
     tbID.TabIndex = 12;
     //
     // label5
     //
     label5.AutoSize = true;
     label5.Location = new System.Drawing.Point(158, 9);
     label5.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     label5.Name     = "label5";
     label5.Size     = new System.Drawing.Size(21, 15);
     label5.TabIndex = 11;
     label5.Text     = "ID:";
     //
     // lblDescription
     //
     lblDescription.AutoSize = true;
     lblDescription.Location = new System.Drawing.Point(117, 128);
     lblDescription.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     lblDescription.Name     = "lblDescription";
     lblDescription.Size     = new System.Drawing.Size(62, 15);
     lblDescription.TabIndex = 13;
     lblDescription.Text     = "Audit Log:";
     //
     // label1
     //
     label1.AutoSize = true;
     label1.Location = new System.Drawing.Point(17, 39);
     label1.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     label1.Name     = "label1";
     label1.Size     = new System.Drawing.Size(162, 15);
     label1.TabIndex = 11;
     label1.Text     = "OverrideReleaseIdentifierSQL:";
     //
     // tbOverrideReleaseIdentifierSQL
     //
     tbOverrideReleaseIdentifierSQL.Location     = new System.Drawing.Point(183, 35);
     tbOverrideReleaseIdentifierSQL.Margin       = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tbOverrideReleaseIdentifierSQL.Name         = "tbOverrideReleaseIdentifierSQL";
     tbOverrideReleaseIdentifierSQL.Size         = new System.Drawing.Size(545, 23);
     tbOverrideReleaseIdentifierSQL.TabIndex     = 12;
     tbOverrideReleaseIdentifierSQL.TextChanged += new System.EventHandler(this.tbOverrideReleaseIdentifierSQL_TextChanged);
     //
     // pDescription
     //
     pDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                 | System.Windows.Forms.AnchorStyles.Right)));
     pDescription.Location = new System.Drawing.Point(183, 125);
     pDescription.Margin   = new System.Windows.Forms.Padding(4, 3, 4, 3);
     pDescription.Name     = "pDescription";
     pDescription.Size     = new System.Drawing.Size(1036, 186);
     pDescription.TabIndex = 15;
     //
     // helpIcon1
     //
     helpIcon1.BackColor             = System.Drawing.Color.Transparent;
     helpIcon1.BackgroundImage       = ((System.Drawing.Image)(resources.GetObject("helpIcon1.BackgroundImage")));
     helpIcon1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
     helpIcon1.Location      = new System.Drawing.Point(729, 33);
     helpIcon1.Margin        = new System.Windows.Forms.Padding(0);
     helpIcon1.MinimumSize   = new System.Drawing.Size(26, 25);
     helpIcon1.Name          = "helpIcon1";
     helpIcon1.Size          = new System.Drawing.Size(26, 25);
     helpIcon1.SuppressClick = false;
     helpIcon1.TabIndex      = 17;
     //
     // tlvCohortUsage
     //
     tlvCohortUsage.AllColumns.Add(olvUsedIn);
     tlvCohortUsage.CellEditUseWholeCell = false;
     tlvCohortUsage.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
         olvUsedIn
     });
     tlvCohortUsage.Cursor        = System.Windows.Forms.Cursors.Default;
     tlvCohortUsage.Dock          = System.Windows.Forms.DockStyle.Fill;
     tlvCohortUsage.HideSelection = false;
     tlvCohortUsage.Location      = new System.Drawing.Point(0, 0);
     tlvCohortUsage.Margin        = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tlvCohortUsage.Name          = "tlvCohortUsage";
     tlvCohortUsage.ShowGroups    = false;
     tlvCohortUsage.Size          = new System.Drawing.Size(628, 318);
     tlvCohortUsage.TabIndex      = 18;
     tlvCohortUsage.UseCompatibleStateImageBehavior = false;
     tlvCohortUsage.View        = System.Windows.Forms.View.Details;
     tlvCohortUsage.VirtualMode = true;
     //
     // olvUsedIn
     //
     olvUsedIn.AspectName   = "ToString";
     olvUsedIn.MinimumWidth = 100;
     olvUsedIn.Text         = "Used In";
     olvUsedIn.Width        = 100;
     //
     // tlvPreviousVersions
     //
     tlvPreviousVersions.AllColumns.Add(olvOtherVersions);
     tlvPreviousVersions.AllColumns.Add(olvVersion);
     tlvPreviousVersions.CellEditUseWholeCell = false;
     tlvPreviousVersions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
         olvOtherVersions,
         olvVersion
     });
     tlvPreviousVersions.Cursor        = System.Windows.Forms.Cursors.Default;
     tlvPreviousVersions.Dock          = System.Windows.Forms.DockStyle.Fill;
     tlvPreviousVersions.HideSelection = false;
     tlvPreviousVersions.Location      = new System.Drawing.Point(0, 0);
     tlvPreviousVersions.Margin        = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tlvPreviousVersions.Name          = "tlvPreviousVersions";
     tlvPreviousVersions.ShowGroups    = false;
     tlvPreviousVersions.Size          = new System.Drawing.Size(579, 318);
     tlvPreviousVersions.TabIndex      = 19;
     tlvPreviousVersions.UseCompatibleStateImageBehavior = false;
     tlvPreviousVersions.View        = System.Windows.Forms.View.Details;
     tlvPreviousVersions.VirtualMode = true;
     //
     // olvOtherVersions
     //
     olvOtherVersions.AspectName   = "ToString";
     olvOtherVersions.MinimumWidth = 100;
     olvOtherVersions.Text         = "Other Versions";
     olvOtherVersions.Width        = 100;
     //
     // olvVersion
     //
     olvVersion.AspectName = "ExternalVersion";
     olvVersion.Text       = "Version";
     //
     // splitContainer1
     //
     splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                    | System.Windows.Forms.AnchorStyles.Right)));
     splitContainer1.Location = new System.Drawing.Point(5, 317);
     splitContainer1.Margin   = new System.Windows.Forms.Padding(4, 3, 4, 3);
     splitContainer1.Name     = "splitContainer1";
     //
     // splitContainer1.Panel1
     //
     splitContainer1.Panel1.Controls.Add(tlvCohortUsage);
     //
     // splitContainer1.Panel2
     //
     splitContainer1.Panel2.Controls.Add(tlvPreviousVersions);
     splitContainer1.Size             = new System.Drawing.Size(1212, 318);
     splitContainer1.SplitterDistance = 628;
     splitContainer1.SplitterWidth    = 5;
     splitContainer1.TabIndex         = 20;
     //
     // label2
     //
     label2.AutoSize = true;
     label2.Location = new System.Drawing.Point(131, 69);
     label2.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     label2.Name     = "label2";
     label2.Size     = new System.Drawing.Size(48, 15);
     label2.TabIndex = 11;
     label2.Text     = "Version:";
     //
     // tbVersion
     //
     tbVersion.Location     = new System.Drawing.Point(183, 65);
     tbVersion.Margin       = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tbVersion.Name         = "tbVersion";
     tbVersion.ReadOnly     = true;
     tbVersion.Size         = new System.Drawing.Size(185, 23);
     tbVersion.TabIndex     = 12;
     tbVersion.TextChanged += new System.EventHandler(this.tbOverrideReleaseIdentifierSQL_TextChanged);
     //
     // label3
     //
     label3.AutoSize = true;
     label3.Location = new System.Drawing.Point(85, 99);
     label3.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     label3.Name     = "label3";
     label3.Size     = new System.Drawing.Size(94, 15);
     label3.TabIndex = 11;
     label3.Text     = "Project Number:";
     //
     // tbProjectNumber
     //
     tbProjectNumber.Location     = new System.Drawing.Point(183, 95);
     tbProjectNumber.Margin       = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tbProjectNumber.Name         = "tbProjectNumber";
     tbProjectNumber.ReadOnly     = true;
     tbProjectNumber.Size         = new System.Drawing.Size(185, 23);
     tbProjectNumber.TabIndex     = 12;
     tbProjectNumber.TextChanged += new System.EventHandler(this.tbOverrideReleaseIdentifierSQL_TextChanged);
     //
     // btnShowProject
     //
     btnShowProject.Location = new System.Drawing.Point(372, 94);
     btnShowProject.Margin   = new System.Windows.Forms.Padding(4, 3, 4, 3);
     btnShowProject.Name     = "btnShowProject";
     btnShowProject.Size     = new System.Drawing.Size(52, 25);
     btnShowProject.TabIndex = 21;
     btnShowProject.Text     = "Show";
     btnShowProject.UseVisualStyleBackColor = true;
     btnShowProject.Click += new System.EventHandler(this.btnShowProject_Click);
     //
     // label4
     //
     label4.AutoSize = true;
     label4.Location = new System.Drawing.Point(369, 9);
     label4.Margin   = new System.Windows.Forms.Padding(4, 0, 4, 0);
     label4.Name     = "label4";
     label4.Size     = new System.Drawing.Size(57, 15);
     label4.TabIndex = 11;
     label4.Text     = "Origin ID:";
     //
     // tbOriginId
     //
     tbOriginId.Location = new System.Drawing.Point(430, 5);
     tbOriginId.Margin   = new System.Windows.Forms.Padding(4, 3, 4, 3);
     tbOriginId.Name     = "tbOriginId";
     tbOriginId.ReadOnly = true;
     tbOriginId.Size     = new System.Drawing.Size(117, 23);
     tbOriginId.TabIndex = 12;
     //
     // panel1
     //
     panel1.Controls.Add(tbID);
     panel1.Controls.Add(splitContainer1);
     panel1.Controls.Add(btnShowProject);
     panel1.Controls.Add(label5);
     panel1.Controls.Add(label4);
     panel1.Controls.Add(helpIcon1);
     panel1.Controls.Add(tbOriginId);
     panel1.Controls.Add(pDescription);
     panel1.Controls.Add(label1);
     panel1.Controls.Add(lblDescription);
     panel1.Controls.Add(tbOverrideReleaseIdentifierSQL);
     panel1.Controls.Add(tbProjectNumber);
     panel1.Controls.Add(label2);
     panel1.Controls.Add(label3);
     panel1.Controls.Add(tbVersion);
     panel1.Dock     = System.Windows.Forms.DockStyle.Fill;
     panel1.Location = new System.Drawing.Point(0, 0);
     panel1.Margin   = new System.Windows.Forms.Padding(4, 3, 4, 3);
     panel1.Name     = "panel1";
     panel1.Size     = new System.Drawing.Size(1220, 650);
     panel1.TabIndex = 22;
     //
     // ExtractableCohortUI
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.Controls.Add(panel1);
     this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
     this.Name   = "ExtractableCohortUI";
     this.Size   = new System.Drawing.Size(1220, 650);
     ((System.ComponentModel.ISupportInitialize)(tlvCohortUsage)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(tlvPreviousVersions)).EndInit();
     splitContainer1.Panel1.ResumeLayout(false);
     splitContainer1.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(splitContainer1)).EndInit();
     splitContainer1.ResumeLayout(false);
     panel1.ResumeLayout(false);
     panel1.PerformLayout();
     this.ResumeLayout(false);
 }
Exemple #22
0
 /// <summary>
 /// Find the first row in the given range of rows that prefix matches the string value of the given column.
 /// </summary>
 /// <param name="text"></param>
 /// <param name="first"></param>
 /// <param name="last"></param>
 /// <param name="column"></param>
 /// <returns>The index of the matched row, or -1</returns>
 protected override int FindMatchInRange(string text, int first, int last, OLVColumn column)
 {
     return(this.DataSource.SearchText(text, first, last, column));
 }
Exemple #23
0
 public TypedColumn(OLVColumn column)
 {
     this.column = column;
 }
Exemple #24
0
 public virtual int SearchText(string value, int first, int last, OLVColumn column)
 {
     return(-1);
 }
 /// <summary>
 /// Create a model object comparer
 /// </summary>
 /// <param name="col"></param>
 /// <param name="order"></param>
 public ModelObjectComparer(OLVColumn col, SortOrder order)
 {
     this.column    = col;
     this.sortOrder = order;
 }
        /// <summary>
        /// Create columns for ListView
        /// </summary>
        private void CreateListViewColumn()
        {
            this.olvSkyrimDict.AllColumns.Clear();
              this.olvTHSkyrimSourceStrings.AllColumns.Clear();
              this.olvTHSkyrimTargetStrings.AllColumns.Clear();

              string typeCol = String.Empty;

              System.Collections.Generic.List<OLVColumn> listCol = new System.Collections.Generic.List<OLVColumn>();
              BrightIdeasSoftware.OLVColumn olvCol;
              BrightIdeasSoftware.OLVColumn primarySortColumn;

              #region olvTHSkyrimSourceStrings / olvTHSkyrimTargetStrings

              for (int i = 0; i < 2; i++)
              {
            listCol.Clear();

            olvCol = new BrightIdeasSoftware.OLVColumn();
            olvCol.AspectName = "StringID";
            olvCol.Text = "ID";
            olvCol.Width = 60;
            olvCol.HeaderTextAlign = HorizontalAlignment.Center;
            olvCol.Groupable = false;
            olvCol.Name = "olvColSkyrimSourceStringsIDHexa";
            olvCol.HeaderFormatStyle = headerFormatStyleData2;
            olvCol.TextAlign = HorizontalAlignment.Center;
            olvCol.Sortable = true;
            listCol.Add(olvCol);

            olvCol = new BrightIdeasSoftware.OLVColumn();
            olvCol.AspectName = "SkyrimText";
            olvCol.Text = "Text";
            olvCol.Width = 450;
            olvCol.HeaderTextAlign = HorizontalAlignment.Center;
            olvCol.Groupable = false;
            olvCol.Name = "olvColSkyrimSourceStringsText";
            olvCol.HeaderFormatStyle = headerFormatStyleData2;
            olvCol.TextAlign = HorizontalAlignment.Left;
            olvCol.Sortable = true;
            listCol.Add(olvCol);
            primarySortColumn = olvCol;

            if (i == 0)
            {
              this.olvTHSkyrimSourceStrings.AllColumns.AddRange(listCol);
              this.olvTHSkyrimSourceStrings.RebuildColumns();
            }

            if (i == 1)
            {
              this.olvTHSkyrimTargetStrings.AllColumns.AddRange(listCol);
              this.olvTHSkyrimTargetStrings.RebuildColumns();
            }
              }
              #endregion

              #region olvSkyrimDict

              listCol.Clear();

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "StringID";
              olvCol.Text = "ID";
              olvCol.Width = 60;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSkyrimStringIDHexa";
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = true;
              listCol.Add(olvCol);

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "SourceString";
              olvCol.Text = "Source";
              olvCol.Width = 240;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSkyrimItemDescSourceLang";
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              listCol.Add(olvCol);
              primarySortColumn = olvCol;

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "TargetString";
              olvCol.Text = "Target";
              olvCol.Width = 240;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSkyrimItemDescTargetLang";
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              listCol.Add(olvCol);

              this.olvSkyrimDict.AllColumns.AddRange(listCol);
              this.olvSkyrimDict.RebuildColumns();
              this.olvSkyrimDict.PrimarySortColumn = primarySortColumn;

              #endregion
        }
        /// <summary>
        /// Create columns for ListView
        /// </summary>
        private void CreateListViewColumnTH(string olvType, string sortColumnName, SortOrder order)
        {
            if (olvType == "Strings") this.olvTHStrings.AllColumns.Clear();
              if (olvType == "DLStrings") this.olvTHILStrings.AllColumns.Clear();
              if (olvType == "ILStrings") this.olvTHDLStrings.AllColumns.Clear();
              if (olvType == "OtherStrings") this.olvTHOtherStrings.AllColumns.Clear();

              string typeCol = "STR";
              if (olvType == "DLStrings") typeCol = "DL";
              if (olvType == "ILStrings") typeCol = "IL";
              if (olvType == "OtherStrings") typeCol = "OTHER";

              System.Collections.Generic.List<OLVColumn> listCol = new System.Collections.Generic.List<OLVColumn>();
              BrightIdeasSoftware.OLVColumn olvCol;
              BrightIdeasSoftware.OLVColumn primarySortColumn = null;
              BrightIdeasSoftware.OLVColumn secondarySortColumn = null;

              listCol.Clear();

              #region GroupName

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "GroupName";
              olvCol.Text = "Group";
              olvCol.Width = 100;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColGroup" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = true;
              listCol.Add(olvCol);
              primarySortColumn = olvCol;

              #endregion

              #region StringStatus

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "StringStatus";
              olvCol.Text = "State";
              olvCol.Width = 50;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColStringStatus" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              listCol.Add(olvCol);

              #endregion

              #region CompareStatusSource

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "CompareStatusSource";
              olvCol.Text = "Src <>";
              olvCol.Width = 50;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColCompareStatus" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              listCol.Add(olvCol);

              #endregion

              #region CompareStatusSource

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "CompareStatusTarget";
              olvCol.Text = "Tgt <>";
              olvCol.Width = 50;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColCompareStatusTarget" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              listCol.Add(olvCol);

              #endregion

              #region CompareStatusSource

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "RecordType";
              olvCol.Text = "Type";
              olvCol.Width = 60;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColRecordType" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "RecordType") secondarySortColumn = olvCol;
              listCol.Add(olvCol);

              #endregion

              #region EditorID

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "EditorID";
              olvCol.Text = "Editor ID";
              olvCol.Width = 200;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColEditorID" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "EditorID") { secondarySortColumn = olvCol; olvCol.HeaderImageKey = order == SortOrder.Ascending ? "sort-descend" : "sort-ascend"; }
              listCol.Add(olvCol);

              #endregion

              #region SourceItemDesc

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "SourceItemDesc";
              olvCol.Text = "Source Text";
              olvCol.Width = 300;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSourceItemDesc" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "SourceItemDesc") secondarySortColumn = olvCol;
              listCol.Add(olvCol);

              #endregion

              #region TargetItemDesc

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "TargetItemDesc";
              olvCol.Text = "Target Text";
              olvCol.Width = 300;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColTargetItemDesc" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "TargetItemDesc") secondarySortColumn = olvCol;
              listCol.Add(olvCol);

              #endregion

              #region SourceStringIDHexa

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "SourceStringIDHexa";
              olvCol.Text = "String ID";
              olvCol.Width = 70;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSourceStringIDHexa" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              olvCol.IsVisible = false;
              listCol.Add(olvCol);

              #endregion

              #region WriteStringInPlugIn

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "WriteStringInPlugIn";
              olvCol.Text = "Write";
              olvCol.Width = 300;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvWriteStringInPlugIn" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              olvCol.IsVisible = false;
              listCol.Add(olvCol);

              #endregion

              #region FormID

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "FormID";
              olvCol.Text = "Form ID";
              olvCol.Width = 70;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColFormID" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              olvCol.IsVisible = false;
              listCol.Add(olvCol);

              #endregion

              ObjectListView ovl = null;

              if (olvType == "Strings") ovl = olvTHStrings;
              if (olvType == "DLStrings") ovl = olvTHDLStrings;
              if (olvType == "ILStrings") ovl = olvTHILStrings;
              if (olvType == "OtherStrings") ovl = olvTHOtherStrings;

              if (olvType != null)
              {
            ovl.BeginUpdate();
            ovl.HeaderUsesThemes = false;
            ovl.Items.Clear();
            ovl.Columns.Clear();
            ovl.AllColumns.AddRange(listCol);
            ovl.RebuildColumns();
            ovl.AlwaysGroupByColumn = primarySortColumn;
            ovl.AlwaysGroupBySortOrder = SortOrder.Ascending;
            ovl.SortGroupItemsByPrimaryColumn = true;
            ovl.GridLines = true;
            if (secondarySortColumn != null)
            {
              ovl.SecondarySortColumn = secondarySortColumn;
              ovl.SecondarySortOrder = order;
            }
            ovl.EndUpdate();
              }
        }
Exemple #28
0
 public override int SearchText(string value, int first, int last, OLVColumn column)
 {
     return(DefaultSearchText(value, first, last, column, this));
 }
        /// <summary>
        /// Create a collection of clusters that should be presented to the user
        /// </summary>
        /// <param name="strategy"></param>
        /// <param name="listView"></param>
        /// <param name="column"></param>
        /// <returns></returns>
        virtual protected List <ICluster> Cluster(IClusteringStrategy strategy, ObjectListView listView, OLVColumn column)
        {
            // Build a map that correlates cluster key to clusters
            NullableDictionary <object, ICluster> map = new NullableDictionary <object, ICluster>();
            int count = 0;

            foreach (object model in listView.ObjectsForClustering)
            {
                this.ClusterOneModel(strategy, map, model);

                if (count++ > this.MaxObjectsToConsider)
                {
                    break;
                }
            }

            // Now that we know exactly how many items are in each cluster, create a label for it
            foreach (ICluster cluster in map.Values)
            {
                cluster.DisplayLabel = strategy.GetClusterDisplayLabel(cluster);
            }

            return(new List <ICluster>(map.Values));
        }
Exemple #30
0
        /**************************************************************************************************/
        private void FillControls()
        {
            DataTable dt = BCDB2.Instance.getDataTable(@"EXEC sp_3_GetValuesFromlkpBigQueueColumnMetaData @filterName=N'" + theQueue.QueueName + "'");

            List<OLVColumnMetaData> columnMetaDataList ; //= new List<OLVColumnMetaData>();
            columnMetaDataList = new List<OLVColumnMetaData>(
                           (from dRow in dt.AsEnumerable()
                            select (GetOLVColumnMetaDataTableRow(dRow)))
                           );

            //create special empty first column
            //so that we can avoid the extra space in front of every value
            BrightIdeasSoftware.OLVColumn olvc = new BrightIdeasSoftware.OLVColumn();
            fastDataListView1.AllColumns.Add(olvc);
            System.Windows.Forms.ColumnHeader[] colHeaderArray = new System.Windows.Forms.ColumnHeader[] { olvc };
            fastDataListView1.Columns.AddRange(colHeaderArray);
            olvc.Text = "firstCol";
            olvc.MinimumWidth = 0;
            olvc.MaximumWidth = 0;

            foreach (DataColumn c in theQueue.dt.Columns)
            {
                Application.DoEvents();
                String colName = c.ColumnName;
                OLVColumnMetaData metadataColumn = null;
                foreach (OLVColumnMetaData mdc in columnMetaDataList)
                {
                    if (string.Compare(mdc.columnHeader,colName,true)==0)
                        metadataColumn = mdc;
                }

                if (metadataColumn != null)
                {
                    olvc = new BrightIdeasSoftware.OLVColumn();
                    olvc.Tag = metadataColumn;
                    fastDataListView1.AllColumns.Add(olvc);
                    colHeaderArray = new System.Windows.Forms.ColumnHeader[] { olvc };
                    fastDataListView1.Columns.AddRange(colHeaderArray);
                    olvc.AspectName = colName;
                    olvc.Text = colName;
                }
                else //if (currentFilterSelectionIndex == 0)
                {
                    olvc = new BrightIdeasSoftware.OLVColumn();
                    fastDataListView1.AllColumns.Add(olvc);
                    colHeaderArray = new System.Windows.Forms.ColumnHeader[] { olvc };
                    fastDataListView1.Columns.AddRange(colHeaderArray);
                    olvc.AspectName = colName;
                    olvc.Text = colName;
                    olvc.IsVisible = false;
                }
            }

            fastDataListView1.RebuildColumns();

            fastDataListView1.UseAlternatingBackColors = true;
            fastDataListView1.AlternateRowBackColor = Color.WhiteSmoke;
            fastDataListView1.AllColumns[0].Width = 0;

            int count = 0;
            foreach (OLVColumn columnToSize in fastDataListView1.AllColumns)
            {
                Application.DoEvents();
                columnToSize.Width = -2;
                count++;

                try
                {
                    if (columnToSize.Tag != null)
                    {
                        OLVColumnMetaData md = (OLVColumnMetaData)columnToSize.Tag;
                        if (columnToSize.Width < md.columnWidth)
                        {
                            columnToSize.Width = md.columnWidth;
                        }
                        if (md.columnDisplayOrder < fastDataListView1.AllColumns.Count)
                        {
                            columnToSize.DisplayIndex = md.columnDisplayOrder;
                        }
                        if (string.IsNullOrEmpty(md.displayText) == false)
                        {
                            columnToSize.Text = md.displayText;
                        }
                        if (string.IsNullOrEmpty(md.AspectToStringFormat) == false)
                        {
                            columnToSize.AspectToStringFormat = md.AspectToStringFormat;
                        }
                    }
                }
                catch(Exception excp)
                {
                    Logger.Instance.WriteToLog(excp.ToString());
                }
            }

                        fastDataListView1.DataSource = SetBindingSource();

            //initialize the row count
            ListViewDataSetSelectedIndexChanged(fastDataListView1, new System.EventArgs());

            //relabel the tab
            this.Text = theQueue.QueueText;

            if (theQueue.dt.Rows.Count > 0)
            {
                fastDataListView1.SelectedIndex = 0;
            }
            else
            {
                SessionManager.Instance.ClearActivePatient();
            }
        }
 /// <summary>
 /// Create a ColumnComparer that will order the rows in a list view according
 /// to the values in a given column
 /// </summary>
 /// <param name="col">The column whose values will be compared</param>
 /// <param name="order">The ordering for column values</param>
 public ColumnComparer(OLVColumn col, SortOrder order)
 {
     this.column    = col;
     this.sortOrder = order;
 }
Exemple #32
0
 public virtual void Sort(OLVColumn column, SortOrder order)
 {
 }
Exemple #33
0
        /// <summary>
        /// Define Result DataListView, columnsm, binding
        /// </summary>
        public void SetResultListBinding()
        {
            ResultListView.MultiSelect = true;//Melek
            //ResultListView.DataBindings.
            ResultListView.SmallImageList = this.imageList1;
            ResultListView.RowHeight = 20;

            ResultListView.Location = new System.Drawing.Point(8, 101);
            ResultListView.Size = new System.Drawing.Size(1250, 585);
            ResultListView.BackColor = System.Drawing.Color.Gainsboro;

            //ResultListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            //            | System.Windows.Forms.AnchorStyles.Left)
            //            | System.Windows.Forms.AnchorStyles.Right)));
            //MonitoringTab.Controls.Add(ResultListView);
            ResultsView_Panel.Controls.Add(ResultListView);
            ResultListView.Dock = DockStyle.Fill;
            ResultListView.FormatRow += new System.EventHandler<BrightIdeasSoftware.FormatRowEventArgs>(this.ResultListView_FormatRow);
            // ResultListView.FormatRow -= new System.EventHandler<BrightIdeasSoftware.FormatRowEventArgs>(this.ResultListView_FormatRow);//Melek - remove the eventhandler - Memory Allocation
            // handle selection of a stream
            ResultListView.EmptyListMsg = "No result at the moment.";
            ResultListView.AllowColumnReorder = true;

            #region defines all columns of result view

            //OLVColumn RColJobID = new OLVColumn();
            //RColJobID.AspectName = "JobID"; // name of the get parameter to get the value from
            //RColJobID.HeaderFont = null;
            //RColJobID.IsTileViewColumn = true;
            //RColJobID.Text = "Job ID";
            //RColJobID.Width = 60;
            //ResultListView.AllColumns.Add(RColJobID);

            OLVColumn RColStreamName = new OLVColumn();
            RColStreamName.AspectName = "StreamFileName";
            RColStreamName.HeaderFont = null;
            RColStreamName.IsTileViewColumn = true;
            RColStreamName.Text = "Name";
            RColStreamName.Width = 510;
            RColStreamName.ImageGetter = delegate(object row)
            {
                switch (((VStream)row).Final_Decision.Made)
                {
                    case Decision.FAIL:
                        return "lred16.png";
                    case Decision.BORDERLINE:
                        return "lamber16.png";
                    case Decision.PASS:
                        return "lgreen16.png";
                    default:
                        return "lgrey16.png";
                }
            };

            ResultListView.AllColumns.Add(RColStreamName);

            OLVColumn RProfile = new OLVColumn();
            RProfile.AspectName = "QualityProfile";
            RProfile.HeaderFont = null;
            RProfile.IsTileViewColumn = true;
            RProfile.Text = "Quality Profile";
            RProfile.Width = 100;
            ResultListView.AllColumns.Add(RProfile);

            OLVColumn RAvMOSstd = new OLVColumn();
            RAvMOSstd.AspectName = "AvMOSStdDev";
            RAvMOSstd.HeaderFont = null;
            RAvMOSstd.IsTileViewColumn = true;
            RAvMOSstd.Text = "Av.MOS (Std.dev)";
            RAvMOSstd.Width = 80;
            ResultListView.AllColumns.Add(RAvMOSstd);

            OLVColumn RColBadPerc = new OLVColumn();
            RColBadPerc.AspectName = "BadPerc";
            RColBadPerc.HeaderFont = null;
            RColBadPerc.IsTileViewColumn = true;
            RColBadPerc.Text = "Bad %";
            RColBadPerc.TextAlign = HorizontalAlignment.Center;
            RColBadPerc.Width = 50;
            TextBarRenderer BadPercRenderer = new TextBarRenderer();
            BadPercRenderer.UseStandardBar = false;
            BadPercRenderer.BackgroundColor = Colours.pass_backColor;
            BadPercRenderer.GradientStartColor = Colours.borderline_backColor;
            BadPercRenderer.GradientEndColor = System.Drawing.Color.Crimson;
            BadPercRenderer.MaximumValue = 100;
            BadPercRenderer.MinimumValue = 0;
            RColBadPerc.Renderer = BadPercRenderer;
            ResultListView.AllColumns.Add(RColBadPerc);

            OLVColumn RColTroughWarning = new OLVColumn();
            RColTroughWarning.AspectName = "TroughWarning";
            RColTroughWarning.HeaderFont = null;
            RColTroughWarning.IsTileViewColumn = true;
            RColTroughWarning.Text = "Troughs";
            RColTroughWarning.Width = 60;
            ResultListView.AllColumns.Add(RColTroughWarning);

            OLVColumn RColBlankWarning = new OLVColumn();
            RColBlankWarning.AspectName = "BlankWarning";
            RColBlankWarning.HeaderFont = null;
            RColBlankWarning.IsTileViewColumn = true;
            RColBlankWarning.Text = "Blank";
            RColBlankWarning.Width = 50;
            ResultListView.AllColumns.Add(RColBlankWarning);

            //OLVColumn RColFrozenWarning = new OLVColumn();
            //RColFrozenWarning.AspectName = "FrozenWarning";
            //RColFrozenWarning.HeaderFont = null;
            //RColFrozenWarning.IsTileViewColumn = true;
            //RColFrozenWarning.Text = "Froz.";
            //RColFrozenWarning.Width = 50;
            //ResultListView.AllColumns.Add(RColFrozenWarning);

            OLVColumn RColVideo = new OLVColumn();
            RColVideo.AspectName = "Video";
            RColVideo.HeaderFont = null;
            RColVideo.IsTileViewColumn = true;
            RColVideo.Text = "Video";
            RColVideo.Width = 110;
            ResultListView.AllColumns.Add(RColVideo);

            OLVColumn RColProfile = new OLVColumn();
            RColProfile.AspectName = "VideoCodecProfile";
            RColProfile.HeaderFont = null;
            RColProfile.IsTileViewColumn = true;
            RColProfile.Text = "Codec Profile";
            RColProfile.Width = 70;
            //ResultListView.AllColumns.Add(RColProfile);

            OLVColumn RColLabRes = new OLVColumn();
            RColLabRes.AspectName = "ResolutionLabel";
            RColLabRes.HeaderFont = null;
            RColLabRes.IsTileViewColumn = true;
            RColLabRes.Text = "Format";
            RColLabRes.Width = 70;
            ResultListView.AllColumns.Add(RColLabRes);

            OLVColumn RColRes = new OLVColumn();
            RColRes.AspectName = "Resolution";
            RColRes.HeaderFont = null;
            RColRes.IsTileViewColumn = true;
            RColRes.Text = "Resolution";
            RColRes.Width = 70;
            RColRes.IsVisible = true;
            ResultListView.AllColumns.Add(RColRes);

            OLVColumn RColAR = new OLVColumn();
            RColAR.AspectName = "DisplayAspectRatioString";
            RColAR.HeaderFont = null;
            RColAR.IsTileViewColumn = true;
            RColAR.Text = "A.R.";
            RColAR.Width = 50;
            ResultListView.AllColumns.Add(RColAR);

            OLVColumn RColAudio = new OLVColumn();
            RColAudio.AspectName = "AudioSummary";
            RColAudio.HeaderFont = null;
            RColAudio.IsTileViewColumn = true;
            RColAudio.Text = "Audio";
            RColAudio.Width = 130;
            ResultListView.AllColumns.Add(RColAudio);

            //OLVColumn RMOS = new OLVColumn();
            //RMOS.AspectName = "avMOS";
            //RMOS.HeaderFont = null;
            //RMOS.IsTileViewColumn = true;
            //RMOS.Text = "Average MOS";
            //RMOS.Width = 80;
            //PartialMultiImageRenderer mosRenderer = new PartialMultiImageRenderer("star16.png", 5, 1, 5);
            //RMOS.Renderer = mosRenderer;
            //ResultListView.AllColumns.Add(RMOS);

            //OLVColumn RColFieldWarning = new OLVColumn();
            //RColFieldWarning.AspectName = "FieldWarning";
            //RColFieldWarning.HeaderFont = null;
            //RColFieldWarning.IsTileViewColumn = true;
            //RColFieldWarning.Text = "Fields";
            //RColFieldWarning.Width = 50;
            //ResultListView.AllColumns.Add(RColFieldWarning);

            OLVColumn RColDuration = new OLVColumn();
            RColDuration.AspectName = "VideoDurationString";
            RColDuration.HeaderFont = null;
            RColDuration.IsTileViewColumn = true;
            RColDuration.Text = "Duration";
            RColDuration.Width = 60;
            ResultListView.AllColumns.Add(RColDuration);

            OLVColumn RColCompletedDate = new OLVColumn();
            RColCompletedDate.AspectName = "CompletedDate";
            RColCompletedDate.HeaderFont = null;
            RColCompletedDate.IsTileViewColumn = true;
            RColCompletedDate.Text = "Completed";
            RColCompletedDate.Width = 120;
            ResultListView.AllColumns.Add(RColCompletedDate);

            OLVColumn RPath = new BrightIdeasSoftware.OLVColumn();
            RPath.AspectName = "StreamPath";
            RPath.HeaderFont = null;
            RPath.IsTileViewColumn = true;
            RPath.Text = "Path";
            RPath.Width = 230;
            ResultListView.AllColumns.Add(RPath);

            OLVColumn RColComment = new OLVColumn();
            RColComment.AspectName = "Comment";
            RColComment.HeaderFont = null;
            RColComment.IsTileViewColumn = true;
            RColComment.Text = "Comment";
            RColComment.Width = 150;
            ResultListView.AllColumns.Add(RColComment);

            #endregion

            ResultListView.DataSource = SummaryList;

            ResultListView.Name = "ResultDataListView";
            ResultListView.ShowGroups = false;
            ResultListView.GridLines = true;

            ResultListView.FullRowSelect = true;
            ResultListView.DoubleClick += new System.EventHandler(ListViewDataSetSelectedIndexChanged);
            //ResultListView.SelectedIndexChanged += new System.EventHandler(this.ResultsListViewDataSetSelectedIndexChanged); //Melek

            // ResultListView.CellClick +=  new EventHandler<BrightIdeasSoftware.CellClickEventArgs>(this.ResultsListViewDataSetSelectedIndexChanged); //Melek

            // ResultListView.DoubleClick -= new System.EventHandler(ListViewDataSetSelectedIndexChanged);//Melek - remove the eventhandler - Memory Allocation
            //ResultListView.HighlightBackgroundColor = System.Drawing.Color.Crimson;
            //ResultListView.HighlightForegroundColor = System.Drawing.Color.White;

            ResultListView.UseCellFormatEvents = true;

            // Hot item settings
            ResultListView.UseHotItem = true;
            ResultListView.UseTranslucentHotItem = true;

            RowBorderDecoration rbd = new RowBorderDecoration();
            rbd.BorderPen = new Pen(Color.Black, 2);
            rbd.FillBrush = null;
            rbd.CornerRounding = 4.0f;
            HotItemStyle hotItemStyle2 = new HotItemStyle();
            hotItemStyle2.Decoration = rbd;

            HotItemStyle hotItemStyle = new HotItemStyle();
            hotItemStyle.ForeColor = Color.AliceBlue;
            //hotItemStyle.BackColor = Color.FromArgb(255, 64, 64, 64);

            #region new column style - Melek

            hotItemStyle.BackColor = Color.Gainsboro;
            hotItemStyle.ForeColor = Color.Black;
            hotItemStyle.Font = new System.Drawing.Font(Font.FontFamily, Font.Size + 2, FontStyle.Regular);
            hotItemStyle.Decoration = rbd;

            #endregion end of  new column style - Melek

            ResultListView.HotItemStyle = hotItemStyle;
            ResultListView.UseFiltering = true;
            ResultListView.CellRightClick += new EventHandler<BrightIdeasSoftware.CellRightClickEventArgs>(this.ResultListView_CellRightClick);
            // ResultListView.CellRightClick -= new EventHandler<BrightIdeasSoftware.CellRightClickEventArgs>(this.ResultListView_CellRightClick); //Melek - remove the eventhandler - Memory Allocation
            // layout
            ResultListView.HeaderFormatStyle = headerFormatStyleData;
            ResultListView.HeaderUsesThemes = false;
            ResultListView.RebuildColumns();
        }
Exemple #34
0
 /// <summary>
 /// Create a TintedColumnDecoration
 /// </summary>
 /// <param name="column"></param>
 public TintedColumnDecoration(OLVColumn column)
     : this()
 {
     this.ColumnToTint = column;
 }
Exemple #35
0
        /// <summary>
        /// Joblistview (databinding)
        /// </summary>
        public void SetJoblistBinding()
        {
            JobListView.Location = new System.Drawing.Point(6, 8);
            JobListView.Size = new System.Drawing.Size(1250, 835);
            JobListView.View = View.Details;
            JobListView.AllowColumnReorder = true;
            JobListView.UseAlternatingBackColors = true;
            JobListView.BackColor = System.Drawing.Color.Gainsboro;
            JobListView.AlternateRowBackColor = System.Drawing.Color.FromArgb(239, 235, 245);

            //JobListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            //            | System.Windows.Forms.AnchorStyles.Left)
            //            | System.Windows.Forms.AnchorStyles.Right)));

            // JobListTab.Controls.Add(JobListView);
            JoblistviewPanel.Controls.Add(JobListView);

            JobListView.Dock = DockStyle.Fill; //Melek
            //JobListView.Scrollable = true;
            JobListView.EmptyListMsg = "v.Cortex is searching for files (jobs) - No job at the moment.";
            JobListView.OwnerDraw = true;

            JobListView.HeaderFormatStyle = this.headerFormatStyleData;
            JobListView.HeaderUsesThemes = false;

            JobListView.ShowGroups = false;
            JobListView.GridLines = true;

            JobListView.FullRowSelect = true;
            JobListView.CellRightClick += new EventHandler<BrightIdeasSoftware.CellRightClickEventArgs>(this.JobListView_CellRightClick);
            //JobListView.CellRightClick -= new EventHandler<BrightIdeasSoftware.CellRightClickEventArgs>(this.JobListView_CellRightClick);//Melek - remove the eventhandler - Memory Allocation
            // this prevents column sorting.
            // we don't need this as this is a joblist, so jobs should be listed in the order they re going to be processed.
            JobListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;

            // this sorts the joblist by priority
            // ideally a custom sorting should be made so that the processing jobs always appear at the top of the list.
            // at the moment if a job is added with a priority lower than the job currently processing it will appear over it.
            // but this does not affect the processing order that is handled by the job manager.
            JobListView.Sort("Priority");

            //JobListView.DataSource = GjobList;
            JobListView.DataSource = jobList;

            #region columns definition
            //BrightIdeasSoftware.OLVColumn ColJobID = new BrightIdeasSoftware.OLVColumn();
            //ColJobID.AspectName = "JobID";
            //ColJobID.HeaderFont = null;
            //ColJobID.IsTileViewColumn = true;
            //ColJobID.Text = "Job ID";
            //ColJobID.Width = 60;
            // JobListView.AllColumns.Add(ColJobID);

            BrightIdeasSoftware.OLVColumn ColPriority = new BrightIdeasSoftware.OLVColumn();
            ColPriority.AspectName = "Priority";
            ColPriority.HeaderFont = null;
            ColPriority.IsTileViewColumn = true;
            ColPriority.Text = "Priority";
            ColPriority.Width = 50;
            //JobListView.AllColumns.Add(ColPriority);

            BrightIdeasSoftware.OLVColumn ColPriorityName = new BrightIdeasSoftware.OLVColumn(); //Melek
            ColPriorityName.AspectName = "PriorityName";
            ColPriorityName.HeaderFont = null;
            ColPriorityName.IsTileViewColumn = true;
            ColPriorityName.Text = "Priority";
            ColPriorityName.Width = 80;
            JobListView.AllColumns.Add(ColPriorityName);

            OLVColumn ColProgression = new OLVColumn();
            ColProgression.AspectName = "ProgTask";
            ColProgression.HeaderFont = null;
            ColProgression.IsTileViewColumn = true;
            ColProgression.Text = "Status";
            ColProgression.Width = 120;
            ColProgression.TextAlign = HorizontalAlignment.Center;
            JobProgRenderer ProgRenderer = new JobProgRenderer();
            //ProgRenderer.BackgroundColor = System.Drawing.Color.CornflowerBlue;
            ProgRenderer.BackgroundColor = System.Drawing.Color.LightSkyBlue;
            //ProgRenderer.GradientStartColor = Color.LightSteelBlue;
            ProgRenderer.TextColor = Brushes.White;
            ProgRenderer.MaximumValue = 100;
            ProgRenderer.UseStandardBar = false;
            ColProgression.Renderer = ProgRenderer;
            JobListView.AllColumns.Add(ColProgression);

            BrightIdeasSoftware.OLVColumn ColName = new BrightIdeasSoftware.OLVColumn();
            ColName.AspectName = "StreamFileName";
            ColName.HeaderFont = null;
            ColName.IsTileViewColumn = true;
            ColName.Text = "Name";
            ColName.Width = 420;
            JobListView.AllColumns.Add(ColName);

            BrightIdeasSoftware.OLVColumn ColProfile = new BrightIdeasSoftware.OLVColumn();
            ColProfile.AspectName = "Profile";
            ColProfile.HeaderFont = null;
            ColProfile.IsTileViewColumn = true;
            ColProfile.Text = "Profile";
            ColProfile.Width = 120;
            JobListView.AllColumns.Add(ColProfile);

            BrightIdeasSoftware.OLVColumn ColPath = new BrightIdeasSoftware.OLVColumn();
            ColPath.AspectName = "Folder";
            ColPath.HeaderFont = null;
            ColPath.IsTileViewColumn = true;
            ColPath.Text = "Path";
            ColPath.Width = 430;
            JobListView.AllColumns.Add(ColPath);

            BrightIdeasSoftware.OLVColumn ColFormat = new BrightIdeasSoftware.OLVColumn();
            ColFormat.AspectName = "Format";
            ColFormat.HeaderFont = null;
            ColFormat.IsTileViewColumn = true;
            ColFormat.Text = "Format";
            ColFormat.Width = 250;
            ColFormat.IsVisible = true;
            JobListView.AllColumns.Add(ColFormat);

            BrightIdeasSoftware.OLVColumn ColFileSize = new BrightIdeasSoftware.OLVColumn();
            ColFileSize.AspectName = "FileSize";
            ColFileSize.HeaderFont = null;
            ColFileSize.TextAlign = HorizontalAlignment.Right;
            ColFileSize.IsTileViewColumn = true;
            ColFileSize.Text = "File size";
            ColFileSize.Width = 60;
            ColFileSize.IsVisible = true;
            JobListView.AllColumns.Add(ColFileSize);

            BrightIdeasSoftware.OLVColumn ColDuration = new BrightIdeasSoftware.OLVColumn();
            ColDuration.AspectName = "Duration";
            ColDuration.HeaderFont = null;
            ColDuration.IsTileViewColumn = true;
            ColDuration.Text = "Duration";
            ColDuration.Width = 90;
            ColDuration.IsVisible = true;
            JobListView.AllColumns.Add(ColDuration);
            /*
            BrightIdeasSoftware.OLVColumn ColTask = new BrightIdeasSoftware.OLVColumn();
            ColTask.AspectName = "Task";
            ColTask.HeaderFont = null;
            ColTask.IsTileViewColumn = true;
            ColTask.Text = "Task";
            ColTask.Width = 70;
            JobListView.AllColumns.Add(ColTask);

            BrightIdeasSoftware.OLVColumn ColStatus = new BrightIdeasSoftware.OLVColumn();
            ColStatus.AspectName = "Status";
            ColStatus.HeaderFont = null;
            ColStatus.IsTileViewColumn = true;
            ColStatus.Text = "Status";
            ColStatus.Width = 100;
            JobListView.AllColumns.Add(ColStatus);
            */
            //BrightIdeasSoftware.OLVColumn ColStartTime = new BrightIdeasSoftware.OLVColumn();
            //ColStartTime.AspectName = "StartTime";
            //ColStartTime.HeaderFont = null;
            //ColStartTime.IsTileViewColumn = true;
            //ColStartTime.Text = "Start time";
            //ColStartTime.Width = 120;
            //JobListView.AllColumns.Add(ColStartTime);

            //BrightIdeasSoftware.OLVColumn ColEndTime = new BrightIdeasSoftware.OLVColumn();
            //ColEndTime.AspectName = "EndTime";
            //ColEndTime.HeaderFont = null;
            //ColEndTime.IsTileViewColumn = true;
            //ColEndTime.Text = "Completed in";
            //ColEndTime.Width = 105;

            //JobListView.AllColumns.Add(ColEndTime);
            #endregion

            JobListView.RebuildColumns();
        }