public override void PopulateRecordBar(RecordList recList) { CheckDisposed(); // The ListBar has a problem in that when it is populated for the first time the horizonal // scroll scrolls over a little ways over hiding the left most + or -. I (Rand) sent some // time searching this out and found that it is a bug in the ListView control. It is not // our bug. The scrolling happens when EnsureVisible() is called on the listview. I found // a way around it. By calling this method twice the bug goes away, it looks like the list // must be populated, cleared, then repopulated before the bug is bypassed. There are also // other things that have an effect on it, such as ClearListBar() must be before // BeginUpdate(). Also selection must be made before ExpandAll() or CollapseAll() is called. // JohnT: no, the problem is when we EnsureVisible of a node that is wider than the window. // EnsureVisble tries to show as much as possible of the label; since it won't fit, it scrolls // horizontally and hides the plus/minus. // To avoid this if it is desired to EnsureVisible, use the EnsureSelectedNodeVisible routine // (which temporarily makes the label short while calling EnsureVisible). // (I'm not sure why Rand's comment is in this exact location, so I'm not deleting it.) if (this.IsShowing) { m_fOutOfDate = false; } else { m_fOutOfDate = true; return; } XWindow window = (XWindow)m_mediator.PropertyTable.GetValue("window"); window.TreeBarControl.IsFlatList = true; using (new WaitCursor(window)) { ListView list = (ListView)window.ListStyleRecordList; list.BeginUpdate(); window.ClearRecordBarList(); //don't want to directly clear the nodes, because that causes an event to be fired as every single node is removed! m_hvoToListViewItemTable.Clear(); AddListViewItems(recList.SortedObjects, list); try { list.Font = new System.Drawing.Font(recList.FontName, recList.TypeSize); } catch(Exception error) { IApp app = (IApp)m_mediator.PropertyTable.GetValue("App"); ErrorReporter.ReportException(error, app.SettingsKey, m_mediator.FeedbackInfoProvider.SupportEmailAddress, null, false); } UpdateSelection(recList.CurrentObject); list.EndUpdate(); if (list.SelectedItems.Count >0) {}//list.s .EnsureVisible(); } }
public override void PopulateRecordBar(RecordList list) { PopulateRecordBar(list, Editable); }
protected virtual void PopulateRecordBar(RecordList list, bool editable) { CheckDisposed(); if (IsShowing) { m_fOutOfDate = false; } else { m_fOutOfDate = true; return; } m_list = list; var window = (XWindow)m_mediator.PropertyTable.GetValue("window"); using (new WaitCursor(window)) { window.TreeBarControl.IsFlatList = false; var tree = (TreeView)window.TreeStyleRecordList; var expandedItems = new Set<int>(); if (m_tree != null && !m_expand) GetExpandedItems(m_tree.Nodes, expandedItems); m_tree = tree; // Removing the handlers first seems to be necessary because multiple tree handlers are // working with one treeview. Only this active one should have handlers connected. // If we fail to do this, switching to a different list causes drag and drop to stop working. ReleaseRecordBar(); tree.NodeMouseClick += tree_NodeMouseClick; if(editable) { tree.MouseDown += tree_MouseDown; tree.MouseMove += tree_MouseMove; tree.DragDrop += tree_DragDrop; tree.DragOver += tree_DragOver; tree.GiveFeedback += tree_GiveFeedback; // REVIEW (Hasso) 2015.02: this handler currently does nothing. Needed? tree.ContextMenuStrip = CreateTreebarContextMenuStrip(); tree.ContextMenuStrip.MouseClick += tree_MouseClicked; } else { tree.ContextMenuStrip = new ContextMenuStrip(); } tree.AllowDrop = editable; tree.BeginUpdate(); window.ClearRecordBarList(); //don't want to directly clear the nodes, because that causes an event to be fired as every single note is removed! m_hvoToTreeNodeTable.Clear(); // type size must be set before AddTreeNodes is called m_typeSize = list.TypeSize; AddTreeNodes(list.SortedObjects, tree); tree.Font = new Font(list.FontName, m_typeSize); tree.ShowRootLines = m_hierarchical; if (m_expand) tree.ExpandAll(); else { tree.CollapseAll(); ExpandItems(tree.Nodes, expandedItems); } // Set the selection after expanding/collapsing the tree. This allows the true // selection to be visible even when the tree is collapsed but the selection is // an internal node. (See LT-4508.) UpdateSelection(list.CurrentObject); tree.EndUpdate(); EnsureSelectedNodeVisible(tree); } }
public override void PopulateRecordBar(RecordList list) { PopulateRecordBar(list, true); }
public override void PopulateRecordBar(RecordList list) { base.PopulateRecordBar(list); UpdateHeaderVisibility(); }
public abstract void PopulateRecordBar(RecordList list);
public void PopulateRecordBarIfNeeded(RecordList list) { CheckDisposed(); if (m_fOutOfDate) { PopulateRecordBar(list); } }
/// <summary> /// Initialize the IxCoreColleague /// </summary> /// <param name="mediator"></param> /// <param name="viewConfiguration"></param> public virtual void Init(Mediator mediator, XmlNode viewConfiguration) { CheckDisposed(); XmlNode clerkConfiguration = ToolConfiguration.GetClerkNodeFromToolParamsNode(viewConfiguration); m_mediator = mediator; m_clerkConfiguration = clerkConfiguration; m_id = XmlUtils.GetOptionalAttributeValue(clerkConfiguration, "id", "missingId"); m_clerkProvidingRootObject = XmlUtils.GetOptionalAttributeValue(clerkConfiguration,"clerkProvidingOwner"); m_shouldHandleDeletion = XmlUtils.GetOptionalBooleanAttributeValue(clerkConfiguration, "shouldHandleDeletion", true); m_fAllowDeletions = XmlUtils.GetOptionalBooleanAttributeValue(clerkConfiguration, "allowDeletions", true); var cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); m_list = RecordList.Create(cache, mediator, clerkConfiguration.SelectSingleNode("recordList")); m_list.Clerk = this; m_relatedClerk = XmlUtils.GetOptionalAttributeValue(clerkConfiguration, "relatedClerk"); m_relationToRelatedClerk = XmlUtils.GetOptionalAttributeValue(clerkConfiguration, "relationToRelatedClerk"); TryRestoreSorter(mediator, clerkConfiguration, cache); TryRestoreFilter(mediator, clerkConfiguration, cache); m_list.ListChanged += OnListChanged; m_list.AboutToReload += m_list_AboutToReload; m_list.DoneReload += m_list_DoneReload; XmlNode recordFilterListProviderNode = ToolConfiguration.GetDefaultRecordFilterListProvider(clerkConfiguration); bool fSetFilterMenu = false; if (recordFilterListProviderNode != null) { m_filterProvider = RecordFilterListProvider.Create(m_mediator, recordFilterListProviderNode); if (m_filterProvider != null && m_list.Filter != null) { // find any matching persisted menubar filter // NOTE: for now assume we can only set/persist one such menubar filter at a time. foreach (RecordFilter menuBarFilterOption in m_filterProvider.Filters) { if (m_list.Filter.Contains(menuBarFilterOption)) { m_activeMenuBarFilter = menuBarFilterOption; m_filterProvider.OnAdjustFilterSelection(m_activeMenuBarFilter); m_mediator.PropertyTable.SetDefault(CurrentFilterPropertyTableId, m_activeMenuBarFilter.id, false, PropertyTable.SettingsGroup.LocalSettings); fSetFilterMenu = true; break; } } } } if (!fSetFilterMenu) { OnAdjustFilterSelection(null); } // we never want to persist this value, since it is dependent upon the filter property. m_mediator.PropertyTable.SetPropertyPersistence(CurrentFilterPropertyTableId, false, PropertyTable.SettingsGroup.LocalSettings); //we handled the tree bar only if we are the root clerk if (m_clerkProvidingRootObject == null) { m_recordBarHandler = RecordBarHandler.Create(m_mediator, clerkConfiguration);//,m_flid); } else { RecordClerk clerkProvidingRootObject; Debug.Assert(TryClerkProvidingRootObject(out clerkProvidingRootObject), "We expected to find clerkProvidingOwner '" + m_clerkProvidingRootObject + "'. Possibly misspelled."); } //mediator. TraceLevel = TraceLevel.Info; //we do not want to be a top-level colleague, because //if we were, we would always receive events, for example navigation events //which might be intended for another RecordClerk, specifically the RecordClerk //being used by the currently active vector editor, browse view, etc. //so, instead, we let the currently active view include us as a "child" colleague. //NO! mediator.AddColleague(this); // Install this object in the PropertyTable so that others can find it. // NB: This *must* be done before the call to SetupDataContext, // or we are asking for an infinite loop, has SetupDataContext() // causes user interface widgets to wake up and look for this object. // If we have not registered the existence of this object yet in the property table, // those widgets will be inclined to try to create us. Hence, the infinite loop. //Note that, on the downside, this means that we need to be careful //not to broadcast any record changes until we are actually initialize enough //to deal with the resulting request that will come from those widgets. StoreClerkInPropertyTable(clerkConfiguration); SetupDataContext(false); }
internal ListUpdateHelper(RecordList list, Control parentForWaitCursor) : this(list != null ? list.Clerk : null, parentForWaitCursor) { }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (m_isDisposed) return; if (disposing) { // Dispose managed resources here. //ResetStatusBarPanel("StatusPanelRecordNumber", ""); //ResetStatusBarPanel("StatusPanelMessage", ""); m_list.ListChanged -= OnListChanged; m_list.AboutToReload -= m_list_AboutToReload; m_list.DoneReload -= m_list_DoneReload; RemoveNotification(); // before disposing list, we need it to get to the Cache. m_list.Dispose(); if (m_mediator != null) { m_mediator.RemoveColleague(this); } if (m_rch != null) m_rch.Dispose(); if (m_recordBarHandler != null) m_recordBarHandler.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_mediator = null; // This has to be done after the calls to ResetStatusBarPanel in the 'true' section. m_list = null; m_id = null; m_clerkProvidingRootObject = null; m_recordBarHandler = null; m_filterProvider = null; m_activeMenuBarFilter = null; m_rch = null; m_fIsActiveInGui = false; m_isDisposed = true; }
public override void PopulateRecordBar(RecordList list) { CheckDisposed(); if (this.IsShowing) { m_fOutOfDate = false; } else { m_fOutOfDate = true; return; } m_list = list; XWindow window = (XWindow)m_mediator.PropertyTable.GetValue("window"); window.Cursor = Cursors.WaitCursor; window.TreeBarControl.IsFlatList = false; TreeView tree = (TreeView)window.TreeStyleRecordList; Set<int> expandedItems = new Set<int>(); if (m_tree != null && !m_expand) GetExpandedItems(m_tree.Nodes, expandedItems); m_tree = tree; id = nextID++; treeHash = m_tree.GetHashCode(); // Removing the handlers first seems to be necessary because multiple tree handlers are // working with one treeview. Only this active one should have handlers connected. // If we fail to do this, switching to a different list causes drag and drop to stop working. ReleaseRecordBar(); tree.NodeMouseClick += new TreeNodeMouseClickEventHandler(tree_NodeMouseClick); tree.MouseDown += new MouseEventHandler(tree_MouseDown); tree.MouseMove += new MouseEventHandler(tree_MouseMove); tree.DragDrop += new DragEventHandler(tree_DragDrop); tree.DragOver += new DragEventHandler(tree_DragOver); tree.GiveFeedback += new GiveFeedbackEventHandler(tree_GiveFeedback); tree.ContextMenuStrip = CreateTreebarContextMenuStrip(); tree.ContextMenuStrip.MouseClick += new MouseEventHandler(tree_MouseClicked); tree.AllowDrop = true; tree.BeginUpdate(); window.ClearRecordBarList(); //don't want to directly clear the nodes, because that causes an event to be fired as every single note is removed! m_hvoToTreeNodeTable.Clear(); // type size must be set before AddTreeNodes is called m_typeSize = list.TypeSize; AddTreeNodes(list.SortedObjects, tree); tree.Font = new System.Drawing.Font(list.FontName, m_typeSize); tree.ShowRootLines = m_hierarchical; if (m_expand) tree.ExpandAll(); else { tree.CollapseAll(); ExpandItems(tree.Nodes, expandedItems); } // Set the selection after expanding/collapsing the tree. This allows the true // selection to be visible even when the tree is collapsed but the selection is // an internal node. (See LT-4508.) UpdateSelection(list.CurrentObject); tree.EndUpdate(); EnsureSelectedNodeVisible(tree); window.Cursor = Cursors.Default; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) return; if (disposing) { // Dispose managed resources here. //ResetStatusBarPanel("StatusPanelRecordNumber", ""); //ResetStatusBarPanel("StatusPanelMessage", ""); m_list.ListChanged -= new ListChangedEventHandler(OnListChanged); m_list.AboutToReload -= new EventHandler(m_list_AboutToReload); m_list.DoneReload -= new EventHandler(m_list_DoneReload); m_list.Dispose(); if (m_mediator != null) { m_mediator.RemoveColleague(this); } if (m_filterProvider != null) m_filterProvider.Dispose(); if (m_rch != null && m_rch is IDisposable) (m_rch as IDisposable).Dispose(); if (m_recordBarHandler != null) m_recordBarHandler.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_mediator = null; // This has to be done after the calls to ResetStatusBarPanel in the 'true' section. m_list = null; m_id = null; m_clerkProvidingRootObject = null; m_recordBarHandler = null; m_filterProvider = null; m_activeMenuBarFilter = null; m_rch = null; m_fIsActiveInGui = false; m_isDisposed = true; }
/// <summary> /// Constructor /// </summary> /// <param name="list"></param> /// <param name="actions">Actions to take during the ListChanged event</param> public ListChangedEventArgs(RecordList list, ListChangedActions actions) { m_list = list; m_actions = actions; }
/// <summary> /// a factory method for RecordLists /// </summary> /// <param name="cache"></param> /// <param name="recordListNode"></param> /// <returns></returns> static public RecordList Create(FdoCache cache, Mediator mediator, XmlNode recordListNode) { RecordList list = null; //does the configuration specify a special RecordList class? XmlNode customListNode = recordListNode.SelectSingleNode("dynamicloaderinfo"); if (customListNode != null) list = (RecordList)DynamicLoader.CreateObject(customListNode); else list = new RecordList(); list.Init(cache, mediator, recordListNode); return list; }