Esempio n. 1
0
        private TabPage CreateTab(string name, ViewsFilter filter)
        {
            ResourceListView2 view = new ResourceListView2();

            TabPage page = new TabPage();

            page.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            page.Controls.Add(view);
            page.Location = new System.Drawing.Point(4, 22);
            page.Name     = "tab" + name;
            page.Size     = new System.Drawing.Size(232, 258);
            page.TabIndex = 2;
            page.Text     = name;
            page.Tag      = view;

            view.AllowDrop       = true;
            view.Anchor          = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
            view.InPlaceEdit     = false;
            view.ShowContextMenu = false;
            view.Location        = new System.Drawing.Point(0, 0);
            view.Name            = name;
            view.Size            = new System.Drawing.Size(230, 258);
            view.TabIndex        = 10;
            view.OpenProperty    = Core.Props.Open;

            view.AddTreeStructureColumn();
            view.AddIconColumn();
            RichTextColumn nameColumn = new RichTextColumn();

            nameColumn.SizeToContent = true;
            nameColumn.AddNodeDecorator(_decorator);
            view.Columns.Add(nameColumn);

            view.DoubleClick += new HandledEventHandler(this.OnDoubleClicked);
            view.JetListView.SelectionStateChanged += new JetBrains.JetListViewLibrary.StateChangeEventHandler(SelectionStateChanged);
            view.RootResource = Core.ResourceTreeManager.ResourceTreeRoot;
            // TODO: why ResourceListView, not ResourceTreeViewBase?

            if (filter != null)
            {
                view.Filters.Add(filter);
                view.Tag = filter;
            }
            IResource root = Core.ResourceTreeManager.ResourceTreeRoot;

            view.DataProvider = new ResourceTreeDataProvider(root, Core.Props.Parent);

            return(page);
        }
Esempio n. 2
0
        public ResourceListView2TestForm(IResourceDataProvider provider, bool isTree)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            _resourceListView             = new ResourceListView2();
            _resourceListView.Dock        = DockStyle.Fill;
            _resourceListView.AllowDrop   = true;
            _resourceListView.InPlaceEdit = true;
            if (isTree)
            {
                _resourceListView.AddTreeStructureColumn();
                _resourceListView.HideSelection = true;
            }
            else
            {
                //_resourceListView.AddCheckBoxColumn();
                _resourceListView.HeaderStyle        = ColumnHeaderStyle.Clickable;
                _resourceListView.AllowColumnReorder = true;
            }
            _resourceListView.AddIconColumn();
            if (isTree)
            {
                RichTextColumn rtCol = new RichTextColumn();
                rtCol.AddNodeDecorator(new UnreadNodeDecorator());
                rtCol.SizeToContent = true;
                _resourceListView.Columns.Add(rtCol);
            }
            else
            {
                /*
                 * DisplayColumnManager dcm = (DisplayColumnManager) Core.DisplayColumnManager;
                 * ColumnDescriptor[] columns = dcm.GetDefaultColumns( Core.ResourceBrowser.VisibleResources );
                 * foreach( ColumnDescriptor colDesc in columns )
                 * {
                 *  int[] propIds = dcm.PropNamesToIDs( colDesc.PropNames, true );
                 *  bool isCustom = false;
                 *  for( int i=0; i<propIds.Length; i++ )
                 *  {
                 *      if ( dcm.GetCustomColumn( propIds [i] ) != null )
                 *      {
                 *          isCustom = true;
                 *          break;
                 *      }
                 *  }
                 *
                 *  if ( isCustom )
                 *  {
                 *      AddCustomColumn( dcm, propIds );
                 *  }
                 *  else
                 *  {
                 *      ResourceListView2Column column = _resourceListView.AddColumn( propIds [0] );
                 *      column.Width = colDesc.Width;
                 *  }
                 * }
                 */
                _resourceListView.FullRowSelect = true;
            }


            /*
             * int propId = Core.ResourceStore.GetPropId( "Annotation" );
             * ICustomColumn col = (Core.DisplayColumnManager as DisplayColumnManager).GetCustomColumn( propId );
             * _resourceListView.AddCustomColumn( col );
             */

            _resourceListView.DataProvider = provider;
            Controls.Add(_resourceListView);
            Controls.SetChildIndex(_resourceListView, 0);

            _nameFilter = new ResourceNameJetFilter("");
        }
Esempio n. 3
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();
            }
        }