private void CreateBrowseViewer(int hvoIndex) { m_fakeFlid = Clerk.VirtualFlid; m_bvMatches = new SIL.FieldWorks.Common.Controls.BrowseViewer(m_configNode, hvoIndex, m_fakeFlid, m_cache, m_mediator, Clerk.SortItemProvider); m_bvMatches.SuspendLayout(); m_bvMatches.Location = new Point(0, 0); m_bvMatches.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; m_bvMatches.Name = "m_bv"; m_bvMatches.Sorter = null; m_bvMatches.TabStop = false; m_bvMatches.StyleSheet = m_stylesheet; m_bvMatches.Dock = DockStyle.Fill; m_bvMatches.SelectionChanged += new FwSelectionChangedEventHandler(m_bvMatches_SelectionChanged); m_bvMatches.SelectionMade += new FwSelectionChangedEventHandler(m_bvMatches_SelectionMade); this.Controls.Add(m_bvMatches); m_bvMatches.ResumeLayout(); }
private void CreateBrowseViewer(XmlNode configNode, IWritingSystem reversalWs) { m_listPublisher = new ObjectListPublisher(m_cache.DomainDataByFlid as ISilDataAccessManaged, ListFlid); m_bvMatches = new BrowseViewer(configNode, m_cache.LanguageProject.LexDbOA.Hvo, ListFlid, m_cache, m_mediator, null, m_listPublisher); m_bvMatches.SuspendLayout(); m_bvMatches.Location = new Point(0, 0); m_bvMatches.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; m_bvMatches.Name = "m_bvMatches"; m_bvMatches.Sorter = null; m_bvMatches.TabStop = false; m_bvMatches.StyleSheet = m_stylesheet; m_bvMatches.Dock = DockStyle.Fill; if (reversalWs != null) { m_bvMatches.BrowseView.Vc.ReversalWs = reversalWs.Handle; } m_bvMatches.SelectionChanged += m_bvMatches_SelectionChanged; m_bvMatches.SelectionMade += m_bvMatches_SelectionMade; Controls.Add(m_bvMatches); m_bvMatches.ResumeLayout(); }
protected override void SetupDataContext() { base.SetupDataContext(); // Make sure our persisted sorter/filters are up to date so browse viewer // has the latest set for configuring/activating the filterBar bool fNeedReload = Clerk.UpdateFiltersAndSortersIfNeeded(); // This is mainly to handle the possibility that one of our objects in a virtual // property has been deleted, either by some other tool, or by another client altogether. // Enhance: it would be very nice not to do this any time we can be sure it isn't needed. // The second 'true' here is to make it skip the sort. The sort has to be skipped at this // point because our VC has been disposed, and we haven't made a new one yet. The sort // will happen later in the sequence of Init when InitSorter is called int hvo = 0; if (Clerk.OwningObject != null) { hvo = Clerk.OwningObject.Hvo; } // We must update the list if needed BEFORE we create the actual view, otherwise, if it is trying // to display an out-of-date list containing deleted objects, all kinds of things may go wrong. if (XmlUtils.GetOptionalBooleanAttributeValue(m_configurationParameters, "forceReloadListOnInitOrChangeRoot", false)) { m_propertyTable.SetProperty(Clerk.Id + "_AlwaysRecomputeVirtualOnReloadList", true, true); // (EricP) when called by RecordView.InitBase() in the context of ListUpdateHelper.ClearBrowseListUntilReload // the list does not get reloaded until ListUpdateHelper is disposed, but the views property // will get cleared to prevent these views from accessing invalid objects. Clerk.UpdateList(false, true); } m_browseViewer = CreateBrowseViewer(m_configurationParameters, hvo, m_fakeFlid, Cache, m_mediator, m_propertyTable, Clerk.SortItemProvider, Clerk.VirtualListPublisher); m_browseViewer.SortersCompatible += Clerk.AreSortersCompatible; // If possible make it use the style sheet appropriate for its main window. m_browseViewer.SuspendLayout(); SetStyleSheet(); m_browseViewer.Dock = DockStyle.Fill; RecordFilter linkFilter = m_browseViewer.FilterFromLink(); SetupLinkScripture(); if (linkFilter != null) { Clerk.OnChangeFilter(new FilterChangeEventArgs(linkFilter, Clerk.Filter)); } if (Clerk.Filter != null && !Clerk.Filter.IsValid) { Clerk.ResetFilterToDefault(); } m_browseViewer.UpdateFilterBar(Clerk.Filter); bool fSortChanged = m_browseViewer.InitSorter(Clerk.Sorter); // true if we had to change sorter // Do this AFTER we init the sorter and filter, so if any changes are made to the // sorter or filter as we install, we still get the right load. if (fSortChanged) { HandleSortChange(); // Keep the current index -- see LT-8755. } else { List <int> sortedCols = m_browseViewer.SortedColumns; Clerk.IsDefaultSort = sortedCols.Count > 0 && sortedCols[0] == m_browseViewer.DefaultSortColumn; // This won't actually load if in the context of UpdateListHelper() Clerk.UpdateList(true, fNeedReload); } // Do this very late, it can't display properly until its record list has been built and sorted. Controls.Add(m_browseViewer); m_browseViewer.BringToFront(); m_browseViewer.ResumeLayout(); }
private void CreateBrowseViewer(XmlNode configNode, IWritingSystem reversalWs) { m_listPublisher = new ObjectListPublisher(m_cache.DomainDataByFlid as ISilDataAccessManaged, ListFlid); m_bvMatches = new BrowseViewer(configNode, m_cache.LanguageProject.LexDbOA.Hvo, ListFlid, m_cache, m_mediator, null, m_listPublisher); m_bvMatches.SuspendLayout(); m_bvMatches.Location = new Point(0, 0); m_bvMatches.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; m_bvMatches.Name = "m_bvMatches"; m_bvMatches.Sorter = null; m_bvMatches.TabStop = false; m_bvMatches.StyleSheet = m_stylesheet; m_bvMatches.Dock = DockStyle.Fill; if (reversalWs != null) m_bvMatches.BrowseView.Vc.ReversalWs = reversalWs.Handle; m_bvMatches.SelectionChanged += m_bvMatches_SelectionChanged; m_bvMatches.SelectionMade += m_bvMatches_SelectionMade; UpdateVisibleColumns(); Controls.Add(m_bvMatches); m_bvMatches.ResumeLayout(); m_bvMatches.ColumnsChanged += m_bvMatches_ColumnsChanged; }
private void CreateBrowseViewer() { m_fakeFlid = Clerk.VirtualFlid; m_bvMatches = new SIL.FieldWorks.Common.Controls.BrowseViewer(m_configNode, m_cache.LangProject.LexDbOAHvo, m_fakeFlid, m_cache, m_mediator, Clerk.SortItemProvider); m_bvMatches.SuspendLayout(); m_bvMatches.Location = new Point(0, 0); m_bvMatches.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; m_bvMatches.Name = "m_bv"; m_bvMatches.Sorter = null; m_bvMatches.TabStop = false; m_bvMatches.StyleSheet = m_stylesheet; m_bvMatches.Dock = DockStyle.Fill; m_bvMatches.SelectionChanged += new FwSelectionChangedEventHandler(m_bvMatches_SelectionChanged); m_bvMatches.SelectionMade += new FwSelectionChangedEventHandler(m_bvMatches_SelectionMade); m_bvMatches.BrowseView.KeyDown += new KeyEventHandler(BrowseView_KeyDown); this.Controls.Add(m_bvMatches); m_bvMatches.ResumeLayout(); }
protected override void SetupDataContext() { base.SetupDataContext(); // Make sure our persisted sorter/filters are up to date so browse viewer // has the latest set for configuring/activating the filterBar bool fNeedReload = Clerk.UpdateFiltersAndSortersIfNeeded(); // This is mainly to handle the possibility that one of our objects in a virtual // property has been deleted, either by some other tool, or by another client altogether. // Enhance: it would be very nice not to do this any time we can be sure it isn't needed. // The second 'true' here is to make it skip the sort. The sort has to be skipped at this // point because our VC has been disposed, and we haven't made a new one yet. The sort // will happen later in the sequence of Init when InitSorter is called int hvo = 0; if (Clerk.OwningObject != null) hvo = Clerk.OwningObject.Hvo; // We must update the list if needed BEFORE we create the actual view, otherwise, if it is trying // to display an out-of-date list containing deleted objects, all kinds of things may go wrong. if (XmlUtils.GetOptionalBooleanAttributeValue(m_configurationParameters, "forceReloadListOnInitOrChangeRoot", false)) { m_mediator.PropertyTable.SetProperty(Clerk.Id + "_AlwaysRecomputeVirtualOnReloadList", true); // (EricP) when called by RecordView.InitBase() in the context of ListUpdateHelper.ClearBrowseListUntilReload // the list does not get reloaded until ListUpdateHelper is disposed, but the views property // will get cleared to prevent these views from accessing invalid objects. Clerk.UpdateList(false, true); } m_browseViewer = CreateBrowseViewer(m_configurationParameters, hvo, m_fakeFlid, Cache, m_mediator, Clerk.SortItemProvider); // If possible make it use the style sheet appropriate for its main window. m_browseViewer.SuspendLayout(); SetStyleSheet(); m_browseViewer.Dock = DockStyle.Fill; RecordFilter linkFilter = m_browseViewer.FilterFromLink(); if (linkFilter != null) Clerk.OnChangeFilter(new FilterChangeEventArgs(linkFilter, Clerk.Filter)); if (Clerk.Filter != null && !Clerk.Filter.IsValid) Clerk.ResetFilterToDefault(); m_browseViewer.UpdateFilterBar(Clerk.Filter); bool fSortChanged = m_browseViewer.InitSorter(Clerk.Sorter); // true if we had to change sorter // Do this AFTER we init the sorter and filter, so if any changes are made to the // sorter or filter as we install, we still get the right load. if (fSortChanged) { HandleSortChange(); // Keep the current index -- see LT-8755. } else { List<int> sortedCols = m_browseViewer.SortedColumns; Clerk.IsDefaultSort = sortedCols.Count > 0 && sortedCols[0] == m_browseViewer.DefaultSortColumn; // This won't actually load if in the context of UpdateListHelper() Clerk.UpdateList(true, fSortChanged || fNeedReload); } // Do this very late, it can't display properly until its record list has been built and sorted. Controls.Add(m_browseViewer); m_browseViewer.BringToFront(); m_browseViewer.ResumeLayout(); }