The argument used when we broadcast OnRecordNavigation.
Inheritance: IComparable
Example #1
0
		/// <summary>
		/// Jump to the specified index in the list.
		/// </summary>
		/// <param name="index">The index.</param>
		/// <param name="suppressFocusChange">if set to <c>true</c> focus changes will be suppressed.</param>
		public void JumpToIndex(int index, bool suppressFocusChange)
		{
			CheckDisposed();
			//if we aren't changing the index, just bail out. (Fixes, LT-11401)
			if (m_list.CurrentIndex == index)
			{
				//Refactor: we would prefer to bail out without broadcasting anything but...
				//There is a chain of messages and events that I don't yet understand which relies on
				//the RecordNavigation event being sent when we jump to the record we are already on.
				//The back button navigation in particular has major problems if we don't do this.
				//I suspect that something is suppressing the event handling initially, and I have found evidence in
				//RecordBrowseView line 483 and elsewhere that we rely on the re-broadcasting.
				//in order to maintain the LT-11401 fix we directly use the mediator here and pass true in the
				//second parameter so that we don't save the record and lose the undo history. -naylor 2011-11-03
				var rni = new RecordNavigationInfo(this, true, SkipShowRecord, suppressFocusChange);
				m_mediator.BroadcastMessage("RecordNavigation", rni);
				return;
			}
			try
			{
				m_list.CurrentIndex = index;
			}
			catch(IndexOutOfRangeException error)
			{
				throw new IndexOutOfRangeException("The RecordClerk tried to jump to a record which is not in the current active set of records.", error);
			}
			//This broadcast will often cause a save of the record, which clears the undo stack.
			BroadcastChange(suppressFocusChange);
		}
Example #2
0
		/// <summary>
		/// Shows the record.
		/// </summary>
		/// <param name="rni">The record navigation info.</param>
		protected virtual void ShowRecord(RecordNavigationInfo rni)
		{
			if (!rni.SkipShowRecord)
				ShowRecord();
		}
Example #3
0
		/// <summary>
		/// update the status bar, selected node of the tree bar, etc.
		/// </summary>
		public void SelectedRecordChanged(bool fSkipRecordNavigation, bool suppressFocusChange)
		{
			CheckDisposed();

			if (CurrentObjectHvo != 0 && !m_list.CurrentObjectIsValid)
			{
				m_list.ReloadList(); // clean everything up
			}
			bool fIgnore = m_mediator.PropertyTable.GetBoolProperty("IgnoreStatusPanel", false);
			if (fIgnore)
				return;
			if (IsControllingTheRecordTreeBar)
			{
				// JohnT: if we're not controlling the record list, we probably have no business trying to
				// control the status bar. But we may need a separate control over this.
				// Note that it can be definitely wrong to update it; this Clerk may not have anything
				// to do with the current window contents.
				UpdateStatusBarRecordNumber();
			}

			//this is used by DependantRecordLists
			var rni = new RecordNavigationInfo(this, m_suppressSaveOnChangeRecord || FwXWindow.InUndoRedo,
				SkipShowRecord, suppressFocusChange);
			m_mediator.PropertyTable.SetProperty(ClerkSelectedObjectPropertyId(Id), rni);
			m_mediator.PropertyTable.SetPropertyPersistence(ClerkSelectedObjectPropertyId(Id), false);

			// save the selected record index.
			string propName = PersistedIndexProperty;
			m_mediator.PropertyTable.SetProperty(propName, CurrentIndex, PropertyTable.SettingsGroup.LocalSettings);
			m_mediator.PropertyTable.SetPropertyPersistence(propName, true, PropertyTable.SettingsGroup.LocalSettings);

			if (IsControllingTheRecordTreeBar)
			{
				if (m_recordBarHandler != null)
					m_recordBarHandler.UpdateSelection(CurrentObject);
				//used to enable certain dialogs, such as the "change entry type dialog"
				m_mediator.PropertyTable.SetProperty("ActiveClerkSelectedObject", CurrentObject);
				m_mediator.PropertyTable.SetPropertyPersistence("ActiveClerkSelectedObject", false);
			}

			// We want an auto-save when we process the change record UNLESS we are deleting or inserting an object,
			// or performing an Undo/Redo.
			// Note: Broadcasting "OnRecordNavigation" even if a selection doesn't change allows the browse view to
			// scroll to the right index if it hasn't already done so.
			if (!fSkipRecordNavigation)
			{
				m_mediator.BroadcastMessage("RecordNavigation", rni);
			}
		}
Example #4
0
		/// <summary>
		/// If this is not the focused pane in a multipane suppress, or if the navigation info requested
		/// a suppression of the focus change then return true (suppress)
		/// </summary>
		/// <param name="rni"></param>
		/// <returns></returns>
		private bool ShouldSuppressFocusChange(RecordNavigationInfo rni)
		{
			return !IsFocusedPane || rni.SuppressFocusChange;
		}
Example #5
0
		/// <summary>
		/// Schedules the record to be shown when the application is idle.
		/// </summary>
		/// <param name="rni">The record navigation info.</param>
		protected override void ShowRecord(RecordNavigationInfo rni)
		{
			if (!rni.SkipShowRecord)
			{
				if (m_mediator.PropertyTable.GetBoolProperty("DoingAutomatedTest", false))
					ShowRecordOnIdle(rni.SuppressSaveOnChangeRecord);
				else
					m_mediator.IdleQueue.Add(IdleQueuePriority.High, ShowRecordOnIdle, rni);
			}
		}
Example #6
0
		/// <summary>
		/// update the status bar, selected node of the tree bar, etc.
		/// </summary>
		public void SelectedRecordChanged(bool fSkipRecordNavigation)
		{
			CheckDisposed();

			ICmObject currentObj = m_list.CurrentObject;
			if (currentObj != null && !currentObj.IsValidObject())
			{
				m_list.ReloadList(); // clean everything up
			}
			bool fIgnore = m_mediator.PropertyTable.GetBoolProperty("IgnoreStatusPanel", false);
			if (fIgnore)
				return;
			if (IsControllingTheRecordTreeBar)
			{
				// JohnT: if we're not controlling the record list, we probably have no business trying to
				// control the status bar. But we may need a separate control over this.
				// Note that it can be definitely wrong to update it; this Clerk may not have anything
				// to do with the current window contents.
				string s;
				int len = m_list.SortedObjects.Count;
				if (len > 0)
					s = (1 + m_list.CurrentIndex).ToString() + @"/" + len.ToString();
				else
					s = m_mediator.StringTbl.GetString("No Records", "Misc");// FwXApp.XWorksResources.GetString("stidNoRecords");
				ResetStatusBarPanel("StatusPanelRecordNumber", s);
				string msg = "";
				if (currentObj != null)
				{
					// deleted objects don't have a cache (and other properties) so it was crashing.  LT-3160, LT-3121,...
					if (!currentObj.IsValidObject())
					{
						msg = xWorksStrings.ADeletedObject;
					}
					else
					{
						using (CmObjectUi uiObj = CmObjectUi.MakeUi(currentObj))
						{
							msg = uiObj.ToStatusBar();
						}
					}
				}
				ResetStatusBarPanel("StatusPanelMessage", msg);
			}

			//this is used by DependantRecordLists
			RecordNavigationInfo rni = new RecordNavigationInfo(this, m_suppressSaveOnChangeRecord || FwXWindow.InUndoRedo, SkipShowRecord);
			m_mediator.PropertyTable.SetProperty(RecordClerk.ClerkSelectedObjectPropertyId(this.Id), rni);
			m_mediator.PropertyTable.SetPropertyPersistence(RecordClerk.ClerkSelectedObjectPropertyId(this.Id), false);

			// save the selected record index.
			string propName = this.PersistedIndexProperty;
			m_mediator.PropertyTable.SetProperty(propName, this.CurrentIndex, PropertyTable.SettingsGroup.LocalSettings);
			m_mediator.PropertyTable.SetPropertyPersistence(propName, true, PropertyTable.SettingsGroup.LocalSettings);

			if (IsControllingTheRecordTreeBar)
			{
				if (m_recordBarHandler != null)
					m_recordBarHandler.UpdateSelection(currentObj);
				//used to enable certain dialogs, such as the "change entry type dialog"
				m_mediator.PropertyTable.SetProperty("ActiveClerkSelectedObject", currentObj);
				m_mediator.PropertyTable.SetPropertyPersistence("ActiveClerkSelectedObject", false);
			}

			// We want an auto-save when we process the change record UNLESS we are deleting or inserting an object,
			// or performing an Undo/Redo.
			// Note: Broadcasting "OnRecordNavigation" even if a selection doesn't change allows the browse view to
			// scroll to the right index if it hasn't already done so.
			if (!fSkipRecordNavigation)
			{
				m_mediator.BroadcastMessage("RecordNavigation", rni);
			}
		}
Example #7
0
		protected override void ShowRecord(RecordNavigationInfo rni)
		{
			base.ShowRecord(rni);

			// independent of whether base.ShowRecord(rni) skips ShowRecord()
			// we still want to try to put the focus in our control.
			if (InterlinearTabPageIsSelected())
				m_idcPane.Focus();
			else
				this.Focus();
		}