Exemple #1
0
        void ColumnSelectionMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            _lastMenuItemClicked = e.ClickedItem as ToolStripMenuItem;
            ColumnHeader colHeader = _lastMenuItemClicked.Tag as ColumnHeader;

            if (null == colHeader)
            {
                return;
            }

            _lastMenuItemClicked.Checked = !_lastMenuItemClicked.Checked;
            bool           visible     = _lastMenuItemClicked.Checked;
            ColumnHeaderEx colHeaderEx = colHeader as ColumnHeaderEx;

            if (colHeaderEx != null)
            {
                colHeaderEx.Visible = visible;
            }
            else
            {
                if (visible)
                {
                    colHeader.Width = 60;
                }
                else
                {
                    colHeader.Width = 0;
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///     <see cref="VirtualListView.makeColumns()"/>
        /// </summary>
        /// <remarks>
        /// Create an additional column for each of the index groups used by the cached Sord objects.
        /// It merly looks on the currently available Sords in the cache and does not
        /// read all Sords from the IndexServer.
        /// </remarks>
        protected override void makeColumns()
        {
            if (objectsCacheValue == null)
            {
                return;
            }

            Dictionary <String, DocMaskLineUsage> mapDmlUsage = new Dictionary <String, DocMaskLineUsage>();

            if (this.ShowObjKeyColumns)
            {
                for (int i = 0; i < objectsCacheValue.CountEstimated; i++)
                {
                    FWSord sord = SordsCache[i];

                    if (!ShowDocuments && (sord is FWDocument))
                    {
                        continue;
                    }
                    if (!ShowFolders && (sord is FWFolder))
                    {
                        continue;
                    }

                    DocMask dm = Conn.MasterData.DocMasks[sord.MaskId].Core;
                    for (int dmlIdx = 0; dmlIdx < dm.lines.Length; dmlIdx++)
                    {
                        DocMaskLine      dml       = dm.lines[dmlIdx];
                        String           groupName = dml.key.ToLower();
                        DocMaskLineUsage u         = null;
                        if (!mapDmlUsage.TryGetValue(groupName, out u))
                        {
                            u            = new DocMaskLineUsage();
                            u.GroupName  = groupName;
                            u.lableNames = new List <String>();
                            u.lableNames.Add(dml.name);
                            mapDmlUsage[groupName] = u;
                        }
                        u.usageCount++;
                        u.minDmlId = Math.Min(u.minDmlId, dmlIdx);
                        FWObjKeyValue okeyValue = sord.ObjKeys[dmlIdx].Value;
                        if (okeyValue != null && !okeyValue.IsEmpty())
                        {
                            u.valueCount++;
                        }
                    }
                }
            }

            List <DocMaskLineUsage> lstDmlUsages = new List <DocMaskLineUsage>(mapDmlUsage.Values);

            lstDmlUsages.Sort(new DocMaskLineUsageComparer());

            List <ColumnHeaderEx> lstHeaders = new List <ColumnHeaderEx>(lstDmlUsages.Count + 11);

            ColumnHeaderName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByName <FWSord>()));
            lstHeaders.Add(ColumnHeaderName);

            ColumnHeaderXDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByXDate <FWSord>()));
            lstHeaders.Add(ColumnHeaderXDate);

            ColumnHeaderIDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByIDate <FWSord>()));
            lstHeaders.Add(ColumnHeaderIDate);

            ColumnHeaderMaskName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByMaskName <FWSord>(this.connVal)));
            lstHeaders.Add(ColumnHeaderMaskName);

            ColumnHeaderOwner.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByOwnerName <FWSord>()));
            lstHeaders.Add(ColumnHeaderOwner);

            ColumnHeaderVersion.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersion <FWSord>()));
            lstHeaders.Add(ColumnHeaderVersion);

            ColumnHeaderVersionDate.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionDate <FWSord>()));
            lstHeaders.Add(ColumnHeaderVersionDate);

            ColumnHeaderVersionUser.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionOwner <FWSord>()));
            lstHeaders.Add(ColumnHeaderVersionUser);

            ColumnHeaderFileSize.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByVersionFileSize <FWSord>()));
            lstHeaders.Add(ColumnHeaderFileSize);

            ColumnHeaderArcPath.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByArcPath <FWSord>()));
            lstHeaders.Add(ColumnHeaderArcPath);

            ColumnHeaderLockName.Tag = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByLockName <FWSord>()));
            lstHeaders.Add(ColumnHeaderLockName);

            if (this.ShowObjKeyColumns)
            {
                foreach (DocMaskLineUsage u in lstDmlUsages)
                {
                    if (u.valueCount > 0)
                    {
                        ColumnHeaderEx h     = new ColumnHeaderEx();
                        String         hname = "";
                        for (int i = 0; i < u.lableNames.Count; i++)
                        {
                            if (i > 0)
                            {
                                hname += "/";
                            }
                            hname += u.lableNames[i];
                        }
                        h.Text = hname;
                        h.Tag  = new ColumnHeaderTag(compareObjectComparersVal.Add(new FWCompareSordByObjKey <FWSord>(u.GroupName)));
                        h.Name = hname;
                        lstHeaders.Add(h);
                    }
                }
            }

            this.Columns.Clear();
            this.Columns.AddRange(lstHeaders.ToArray());
        }