Exemple #1
0
        public override void Execute(IActionContext context)
        {
            ResourceListDataProvider  provider = new ResourceListDataProvider(Core.ResourceBrowser.VisibleResources);
            ResourceListView2TestForm testForm = new ResourceListView2TestForm(provider, false);

            testForm.Show();
        }
Exemple #2
0
        private void UpdateListViewColumns(ResourceListView2 listView, ColumnDescriptor[] columns,
                                           ResourceListDataProvider dataProvider, bool setGroupProviders)
        {
            foreach (JetListViewColumn col in listView.Columns)
            {
                ConversationStructureColumn convStructureColumn = col as ConversationStructureColumn;
                if (convStructureColumn != null)
                {
                    convStructureColumn.DataProvider = dataProvider as ConversationDataProvider;
                }

                ResourcePropsColumn propsCol = col as ResourcePropsColumn;
                if (propsCol != null)
                {
                    foreach (ColumnDescriptor colDesc in columns)
                    {
                        int[] propIds = PropNamesToIDs(colDesc.PropNames, true);
                        if (propsCol.PropIdsEqual(propIds))
                        {
                            UpdateGroupProvider(setGroupProviders, colDesc, propsCol);
                            break;
                        }
                    }
                }

                ResourceListView2Column rlvCol = col as ResourceListView2Column;
                if (rlvCol != null)
                {
                    rlvCol.OwnerList = dataProvider.ResourceList;
                }
            }
        }
Exemple #3
0
        /**
         * Saves the state of the list view (column widths) under the key that is
         * specified as a sequence of columns.
         */

        internal void SaveListViewState(ResourceListView2 listView, ResourceListDataProvider dataProvider,
                                        ResourceListState state, bool async)
        {
            ColumnDescriptor[] columns = ColumnDescriptorsFromList(listView);
            columns = UpdateColumnsFromState(columns, state);
            state.SaveState(columns, dataProvider.SortSettings, async);
        }
Exemple #4
0
        /**
         * Shows the specified list of columns in the list view.
         */

        internal void ShowListViewColumns(ResourceListView2 listView,
                                          ColumnDescriptor[] columns, ResourceListDataProvider dataProvider, bool setGroupProviders)
        {
            ColumnDescriptor[] oldColumns = ColumnDescriptorsFromList(listView);
            bool hadTreeColumn            = HasTreeColumn(listView);
            bool needTreeColumn           = (dataProvider is ConversationDataProvider);

            if (!new ComparableArrayList(columns).Equals(new ComparableArrayList(oldColumns)) ||
                hadTreeColumn != needTreeColumn)
            {
                RecreateListViewColumns(listView, columns, dataProvider, setGroupProviders);
            }
            else
            {
                UpdateListViewColumns(listView, columns, dataProvider, setGroupProviders);
            }
        }
Exemple #5
0
        private void RecreateListViewColumns(ResourceListView2 listView, ColumnDescriptor[] columns,
                                             ResourceListDataProvider dataProvider, bool setGroupProviders)
        {
            bool haveTreeColumn = false;

            listView.Columns.BeginUpdate();
            try
            {
                listView.Columns.Clear();
                foreach (ColumnDescriptor desc in columns)
                {
                    int[] propIds = PropNamesToIDs(desc.PropNames, true);
                    ResourcePropsColumn colHdr;

                    if (dataProvider is ConversationDataProvider && !haveTreeColumn &&
                        ((propIds.Length == 1 && propIds [0] == ResourceProps.Type) || (desc.Flags & ColumnDescriptorFlags.FixedSize) == 0))
                    {
                        haveTreeColumn = true;
                        ConversationStructureColumn col = new ConversationStructureColumn(dataProvider as ConversationDataProvider);
                        listView.Columns.Add(col);
                    }

                    if (propIds.Length == 1 && propIds [0] == ResourceProps.Type)
                    {
                        colHdr = listView.AddIconColumn();
                        if (dataProvider is ConversationDataProvider)
                        {
                            colHdr.ShowHeader = false;
                        }
                    }
                    else
                    {
                        ICustomColumn[] customColumns = BuildCustomColumns(propIds);
                        if (customColumns == null)
                        {
                            colHdr      = listView.AddColumn(propIds);
                            colHdr.Text = GetColumnText(propIds);
                            SetPropertyToTextCallbacks(colHdr as ResourceListView2Column);
                            (colHdr as ResourceListView2Column).OwnerList = dataProvider.ResourceList;
                        }
                        else
                        {
                            colHdr = listView.AddCustomColumn(propIds, customColumns);
                        }
                        FillSortMenuText(colHdr, desc, propIds);
                        colHdr.CustomComparer = desc.CustomComparer;
                        colHdr.Alignment      = GetDefaultAlignment(propIds);
                    }

                    if ((desc.Flags & ColumnDescriptorFlags.AutoSize) != 0)
                    {
                        colHdr.AutoSize         = true;
                        colHdr.AutoSizeMinWidth = desc.Width;
                    }
                    else
                    {
                        colHdr.Width = desc.Width;
                        if ((desc.Flags & ColumnDescriptorFlags.FixedSize) != 0)
                        {
                            colHdr.FixedSize = true;
                        }
                    }

                    UpdateGroupProvider(setGroupProviders, desc, colHdr);
                }
            }
            finally
            {
                listView.Columns.EndUpdate();
            }
        }