C# Class SIL.FieldWorks.LexText.Controls.PopupTreeManager

Handles a TreeCombo control (Widgets assembly). Subclass must at least implement MakeMenuItems.
Inheritance: IFWDisposable
ファイルを表示 Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
m_isDisposed bool
m_kEmptyNode HvoTreeNode
m_mediator XCore.Mediator
m_selPrior System.Windows.Forms.TreeNode

Private Properties

Property Type Description
Init void
m_treeCombo_BeforeSelect void
popupTree_PopupTreeClosed void

Public Methods

Method Description
CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

Dispose ( ) : void

Must not be virtual.

LoadPopupTree ( int hvoSpecifiedTarget ) : void

Load the PopupTree with HvoTreeNode objects, which represent all POSes in the list. Reloads the PopupTree even if it has been loaded before, since the list may now have new ones in it.

PopupTreeManager ( PopupTree popupTree, SIL.FieldWorks.FDO.FdoCache cache, XCore.Mediator mediator, ICmPossibilityList list, int ws, bool useAbbr, Form parent ) : System

Constructor.

PopupTreeManager ( TreeCombo treeCombo, SIL.FieldWorks.FDO.FdoCache cache, XCore.Mediator mediator, ICmPossibilityList list, int ws, bool useAbbr, Form parent ) : System

Constructor.

SetEmptyLabel ( string label ) : void

Set the label on the empty node.

Protected Methods

Method Description
AddMoreItem ( PopupTree popupTree ) : void

Add a 'More...' item to the tree. Subclass is responsible to implement.

AddNodes ( TreeNodeCollection nodes, int hvoOwner, int flid, int hvoTarget, int tagName ) : TreeNode

Add to the nodes parameter an HvoTreeNode for each hvo in property flid of object hvo. Give it to children (by calling recursively) for each of its subpossibilities.

AddNodes ( TreeNodeCollection nodes, int hvoOwner, int flid, int flidSub, int hvoTarget, int tagName ) : TreeNode

AddNotSureItem ( PopupTree popupTree ) : TreeNode

Add a 'not sure' item to the menu. If the current target is zero, it will be selected. It is saved as m_kEmptyNode. Also returns the new node.

AddPossibilityListItems ( PopupTree popupTree, int hvoTarget ) : TreeNode

AddTimberLine ( PopupTree popupTree ) : void

Add the --- line to the popup (use if adding any 'extra' items).

AppendAdditionalItems ( PopupTree popupTree, int hvoTarget ) : TreeNode

override to add additional nodes to popupTree (e.g. AddNotSureItem, AddTimberline)

Dispose ( bool disposing ) : void

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.

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.

GetPopupTree ( ) : PopupTree

Get the popup tree we are managing. This may be a stand-alone popup tree, or one that is part of the implementation of a tree combo box.

GetTssLabel ( SIL.FieldWorks.FDO.FdoCache cache, int hvoItem, int flidName, int wsName ) : ITsString
MakeMenuItems ( PopupTree popupTree, int hvoTarget ) : TreeNode

Make all the menu items. May well call things like AddTimberline, AddNotSureItem, AddMoreItem.

SelectChosenItem ( TreeNode item, PopupTree popupTree ) : void

Select the specified menu item in the tree.

SetComboTextToLastConfirmedSelection ( ) : void

Make sure the combo text has correct value

m_treeCombo_AfterSelect ( object sender, TreeViewEventArgs e ) : void

Override this to handle any special items like 'More...'.

Private Methods

Method Description
Init ( SIL.FieldWorks.FDO.FdoCache cache, XCore.Mediator mediator, ICmPossibilityList list, int ws, bool useAbbr, Form parent ) : void
m_treeCombo_BeforeSelect ( object sender, System.Windows.Forms.TreeViewCancelEventArgs e ) : void
popupTree_PopupTreeClosed ( object sender, TreeViewEventArgs e ) : void

Method Details

AddMoreItem() protected method

Add a 'More...' item to the tree. Subclass is responsible to implement.
protected AddMoreItem ( PopupTree popupTree ) : void
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
return void

AddNodes() protected method

Add to the nodes parameter an HvoTreeNode for each hvo in property flid of object hvo. Give it to children (by calling recursively) for each of its subpossibilities.
protected AddNodes ( TreeNodeCollection nodes, int hvoOwner, int flid, int hvoTarget, int tagName ) : TreeNode
nodes System.Windows.Forms.TreeNodeCollection
hvoOwner int
flid int
hvoTarget int
tagName int
return System.Windows.Forms.TreeNode

AddNodes() protected method

protected AddNodes ( TreeNodeCollection nodes, int hvoOwner, int flid, int flidSub, int hvoTarget, int tagName ) : TreeNode
nodes System.Windows.Forms.TreeNodeCollection
hvoOwner int
flid int
flidSub int specify a subitems, /// other than CmPossibilityTags.kflidSubPossibilities
hvoTarget int
tagName int
return System.Windows.Forms.TreeNode

AddNotSureItem() protected method

Add a 'not sure' item to the menu. If the current target is zero, it will be selected. It is saved as m_kEmptyNode. Also returns the new node.
protected AddNotSureItem ( PopupTree popupTree ) : TreeNode
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
return System.Windows.Forms.TreeNode

AddPossibilityListItems() protected method

protected AddPossibilityListItems ( PopupTree popupTree, int hvoTarget ) : TreeNode
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
hvoTarget int
return System.Windows.Forms.TreeNode

AddTimberLine() protected method

Add the --- line to the popup (use if adding any 'extra' items).
protected AddTimberLine ( PopupTree popupTree ) : void
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
return void

AppendAdditionalItems() protected method

override to add additional nodes to popupTree (e.g. AddNotSureItem, AddTimberline)
protected AppendAdditionalItems ( PopupTree popupTree, int hvoTarget ) : TreeNode
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
hvoTarget int
return System.Windows.Forms.TreeNode

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

Dispose() public method

Must not be virtual.
public Dispose ( ) : void
return void

Dispose() protected method

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.
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.
protected Dispose ( bool disposing ) : void
disposing bool
return void

GetPopupTree() protected method

Get the popup tree we are managing. This may be a stand-alone popup tree, or one that is part of the implementation of a tree combo box.
protected GetPopupTree ( ) : PopupTree
return SIL.FieldWorks.Common.Widgets.PopupTree

GetTssLabel() protected static method

protected static GetTssLabel ( SIL.FieldWorks.FDO.FdoCache cache, int hvoItem, int flidName, int wsName ) : ITsString
cache SIL.FieldWorks.FDO.FdoCache
hvoItem int
flidName int
wsName int
return ITsString

LoadPopupTree() public method

Load the PopupTree with HvoTreeNode objects, which represent all POSes in the list. Reloads the PopupTree even if it has been loaded before, since the list may now have new ones in it.
public LoadPopupTree ( int hvoSpecifiedTarget ) : void
hvoSpecifiedTarget int
return void

MakeMenuItems() protected abstract method

Make all the menu items. May well call things like AddTimberline, AddNotSureItem, AddMoreItem.
protected abstract MakeMenuItems ( PopupTree popupTree, int hvoTarget ) : TreeNode
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
hvoTarget int
return System.Windows.Forms.TreeNode

PopupTreeManager() public method

Constructor.
public PopupTreeManager ( PopupTree popupTree, SIL.FieldWorks.FDO.FdoCache cache, XCore.Mediator mediator, ICmPossibilityList list, int ws, bool useAbbr, Form parent ) : System
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
cache SIL.FieldWorks.FDO.FdoCache
mediator XCore.Mediator
list ICmPossibilityList
ws int
useAbbr bool
parent System.Windows.Forms.Form
return System

PopupTreeManager() public method

Constructor.
public PopupTreeManager ( TreeCombo treeCombo, SIL.FieldWorks.FDO.FdoCache cache, XCore.Mediator mediator, ICmPossibilityList list, int ws, bool useAbbr, Form parent ) : System
treeCombo SIL.FieldWorks.Common.Widgets.TreeCombo
cache SIL.FieldWorks.FDO.FdoCache
mediator XCore.Mediator
list ICmPossibilityList
ws int
useAbbr bool
parent System.Windows.Forms.Form
return System

SelectChosenItem() protected method

Select the specified menu item in the tree.
protected SelectChosenItem ( TreeNode item, PopupTree popupTree ) : void
item System.Windows.Forms.TreeNode
popupTree SIL.FieldWorks.Common.Widgets.PopupTree
return void

SetComboTextToLastConfirmedSelection() protected method

Make sure the combo text has correct value
protected SetComboTextToLastConfirmedSelection ( ) : void
return void

SetEmptyLabel() public method

Set the label on the empty node.
public SetEmptyLabel ( string label ) : void
label string
return void

m_treeCombo_AfterSelect() protected method

Override this to handle any special items like 'More...'.
protected m_treeCombo_AfterSelect ( object sender, TreeViewEventArgs e ) : void
sender object
e System.Windows.Forms.TreeViewEventArgs
return void

Property Details

m_isDisposed protected_oe property

True, if the object has been disposed.
protected bool m_isDisposed
return bool

m_kEmptyNode protected_oe property

"" node, or sometimes 'Any' node.
protected HvoTreeNode m_kEmptyNode
return HvoTreeNode

m_mediator protected_oe property

protected Mediator,XCore m_mediator
return XCore.Mediator

m_selPrior protected_oe property

Sometimes we need to revert to the previous selection, so save it just in case. (See FWR-3082.)
protected TreeNode,System.Windows.Forms m_selPrior
return System.Windows.Forms.TreeNode