C# Class SIL.FieldWorks.Common.Controls.BulkEditBar

Summary description for BulkEditBar2.
Inheritance: System.Windows.Forms.UserControl, IFWDisposable
Mostra file Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
m_beItems BulkEditItem[]
m_bv BrowseViewer
m_currentTargetCombo FwOverrideComboBox
m_deleteTab TabPage
m_itemIndex int
m_listChoiceControl Control
m_listChoiceTargetCombo FwOverrideComboBox
m_operationsTabControl VSTabControl
m_setupOrRestoredBulkEditBarTab bool

Private Properties

Property Type Description
AddStringFieldItemsToCombo FieldComboItem
AllowDeleteItem int
BrowseViewFilterChanged void
BrowseViewSorterChanged void
CanDeleteItemOfClassOrGhostOwner bool
CanFindReplace bool
CheckForAndSetupSuggestButton void
CheckMultiDeleteConditionsAndReport bool
ClearPreview void
CommitChanges void
CommitClickChanges void
CreateSimpleProgressState SIL.FieldWorks.Common.Controls.ProgressState
DeleteSelectedObjects void
DisposeBulkEditItems void
DoClearPreviewTask void
DoPreviewTask void
DoSuggestTask void
EnablePreviewApplyForBulkCopy void
EnablePreviewApplyForFindReplace void
EnablePreviewApplyForTransduce void
ExtractFormattingPieces List
FixReplacedItems void
GetColumnLabel string
GetExpectedListItemsClassAndTargetFieldFromSelectedItem int
GetExpectedListItemsClassFromSelectedItem int
GetFlidFromClassDotName int
GetFlidFromClassDotName int
GetFlidFromClassDotName int
GetGhostHelper SIL.FieldWorks.Common.Controls.GhostParentHelper
GetListInfo void
GetNamedList ICmPossibilityList
GetNamedList ICmPossibilityList
GetNamedListHvo int
GetNamedListHvo int
GetPathInfoFromColumnSpec void
GetString string
HandlePreviewOrSuggestTask void
InitBulkCopyTab void
InitClickCopyTab void
InitConverterCombo void
InitDeleteTab void
InitFindReplaceTab void
InitListChoiceTab void
InitTransduce void
InitializeComponent void
ItemsToChangeSet Set
LaunchPreview void
ListItemsClassesInfo List
MakeBulkCopyMethod BulkCopyMethod
MakeClearMethod ClearMethod
MakeItem BulkEditItem
MakeReplaceWithMethod ReplaceWithMethod
MakeSuggestions void
MakeTransduceMethod TransduceMethod
OnTargetComboItemChanged void
RemoveOldChoiceControl void
RequiresDialogChooser bool
ResumeRecordListRowChanges void
SetEditColumn void
SetEnabledForAllItems void
SetEnabledForListChoiceTab void
SetEnabledIfShowing void
SetStyleSheet void
SetTabEnabled void
SuspendRecordlistRowChanges void
UpdateCheckedItems void
UpdateCurrentGhostParentHelper GhostParentHelper
UpdateEnableItems void
UpdateFindReplaceSummary void
VerifyRowDeleteAllowable bool
besc_ValueChanged void
m_bulkCopyTab_Enter void
m_bulkCopyTargetCombo_SelectedIndexChanged void
m_clickCopySepBox_GotFocus void
m_clickCopyTab_Enter void
m_clickCopyTargetCombo_SelectedIndexChanged void
m_closeButton_Click void
m_deleteTab_Enter void
m_deleteWhatCombo_SelectedIndexChanged void
m_findReplaceSetupButton_Click void
m_findReplaceTab_Enter void
m_findReplaceTargetCombo_SelectedIndexChanged void
m_helpButton_Click void
m_listChoiceTab_Enter void
m_listChoiceTargetCombo_SelectedIndexChanged void
m_operationsTabControl_Deselecting void
m_operationsTabControl_SelectedIndexChanged void
m_transduceSetupButton_Click void
m_transduceTab_Enter void
m_transduceTargetCombo_SelectedIndexChanged void
populateListChoiceTargetCombo void
xbv_ClickCopy void

Public Methods

Method Description
BulkEditBar ( ) : System

Initializes a new instance of the BulkEditBar class.

BulkEditBar ( BrowseViewer bv, XmlNode spec, XCore.Mediator mediator, SIL.FieldWorks.FDO.FdoCache cache ) : System

Create one

CheckDisposed ( ) : void

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

MakeItems ( ) : void

Makes the items.

OnEnableBulkEditButtons ( object value ) : void

Called when [enable bulk edit buttons].

OnTargetComboSelectedIndexChanged ( ) : void

triggers TargetComboSelectedIndexChanged to tell delegates that TargetComboItem has changed.

UpdateColumnList ( ) : void

Update when the user reconfigures the set of columns.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

EnablePreviewApplyForListChoice ( ) : void

Enables the preview apply for list choice.

InitStringCombo ( SIL.FieldWorks.Common.Controls.FwOverrideComboBox combo, bool fIsSourceCombo ) : void

Initialize a combo box with the columns that can be sources or targets for string manipulations. If possible select an item with the same name. If not select the first item if any. If none set the Text to 'no choices'.

ItemsToChange ( bool fOnlyIfSelected ) : IEnumerable

Return the items that should be changed by the current bulk-edit operation. If the flag is set, (which also means we will really do it), return only the ones the user has checked. Also in that case, we force a partial sort by homograph number for any lexical entries. This helps preserve the homograph numbers in the case where the change causes more than one item to move from one homograph set to another.

SaveSettings ( ) : void

ShowPreviewItems ( ProgressState state ) : void
m_ApplyButton_Click ( object sender, EventArgs e ) : void

m_previewButton_Click ( object sender, EventArgs e ) : void

Handles a click on the Preview (or Clear [Preview]) button

m_suggestButton_Click ( object sender, EventArgs e ) : void

Handles searching for Semantic Domain suggestions to put in the Preview

Private Methods

Method Description
AddStringFieldItemsToCombo ( ComboBox combo, FieldComboItem selectedItem, bool fIsSourceCombo ) : FieldComboItem
AllowDeleteItem ( int hvoItem ) : int

Return 1 if the item is allowed to be deleted, 0 if not. NOTE: in some cases, UpdateCurrentGhostParentHelper() needs to be called prior to calling AllowDeleteItem.

BrowseViewFilterChanged ( object sender, SIL.FieldWorks.Filters.FilterChangeEventArgs e ) : void
BrowseViewSorterChanged ( object sender, EventArgs e ) : void
CanDeleteItemOfClassOrGhostOwner ( int hvoItem, int clsid ) : bool
CanFindReplace ( ) : bool
CheckForAndSetupSuggestButton ( BulkEditItem bei ) : void
CheckMultiDeleteConditionsAndReport ( Set idsToDelete, bool &fUndo ) : bool

Check whether deleting these objects will be undoable. In any case, pops up a message asking the user whether to proceed. The type of message depends somewhat on the situation.

ClearPreview ( ) : void
CommitChanges ( int hvo, string commitChanges, SIL.FieldWorks.FDO.FdoCache cache, int ws ) : void
CommitClickChanges ( object sender, EventArgs e ) : void

When we switch rows or lose focus in the main browse view, commit any changes made in click copy mode. TODO (DamienD): I don't think this is used anymore, so it can probably be removed.

CreateSimpleProgressState ( XCore.Mediator mediator ) : SIL.FieldWorks.Common.Controls.ProgressState

Create a default progress state that we can update simply by setting PercentDone and calling Breath. Note that most of the methods for doing this are methods of FwXWindow. But we can't use those because this project can't reference XWorks. Possibly all of them could be moved to the project that defines StatusBarProgressPanel?

DeleteSelectedObjects ( SIL.FieldWorks.Common.Controls.ProgressState state ) : void

Delete ALL the checked objects!!

DisposeBulkEditItems ( ) : void
DoClearPreviewTask ( SIL.FieldWorks.Common.Controls.ProgressState state ) : void
DoPreviewTask ( SIL.FieldWorks.Common.Controls.ProgressState state ) : void
DoSuggestTask ( SIL.FieldWorks.Common.Controls.ProgressState state ) : void
EnablePreviewApplyForBulkCopy ( ) : void
EnablePreviewApplyForFindReplace ( ) : void
EnablePreviewApplyForTransduce ( ) : void
ExtractFormattingPieces ( string fmt ) : List

Split the string into pieces separated by the embedded "format items". The input string is a format specifier like those used by String.Format(). Since TsString doesn't have a compatible Format method, and since the provided arguments that match the "format items" may need a different writing system than the literal characters in the string, we return a list of pieces of the input string. These pieces include all of the characters of the original string in order, including a separate piece for each "format item". For example, consider the input "This {0} is {1}!" The method would break this into five pieces: "This ", "{0}", " is ", "{1}", and "!". The caller is expected to know what to do with each piece to put together the desired TsString.

TODO: think about whether this might be a useful utility method of general import, and if so move it (and the static Regex variable) to the appropriate utility class.

FixReplacedItems ( object doItObject ) : void
GetColumnLabel ( XCore.Mediator mediator, XmlNode colSpec ) : string
GetExpectedListItemsClassAndTargetFieldFromSelectedItem ( FieldComboItem selectedItem, int &field ) : int
GetExpectedListItemsClassFromSelectedItem ( FieldComboItem selectedItem ) : int
GetFlidFromClassDotName ( SIL.FieldWorks.FDO.FdoCache cache, XmlNode node, string attrName ) : int

Given a string that is supposed to identify a particular list, return the flid.

GetFlidFromClassDotName ( SIL.FieldWorks.FDO.FdoCache cache, string descriptor ) : int
GetFlidFromClassDotName ( XmlNode node, string attrName ) : int
GetGhostHelper ( IFdoServiceLocator locator, XmlNode colSpec ) : SIL.FieldWorks.Common.Controls.GhostParentHelper
GetListInfo ( XmlNode colSpec, string &owningClass, string &property ) : void

Extracts the class.property information for a CmPossibilityList from a columnSpec.

GetNamedList ( SIL.FieldWorks.FDO.FdoCache cache, XmlNode node, string attrName ) : ICmPossibilityList

Get a specification of a list from the specified attribute of the specified node, and return the indicated list. The descriptor is the name of one of the lists that is an attribute of LangProject, or else LexDb. followed by the name of a list that is an attribute of that class.

GetNamedList ( XmlNode node, string attrName ) : ICmPossibilityList
GetNamedListHvo ( SIL.FieldWorks.FDO.FdoCache cache, XmlNode node, string attrName ) : int

Return Hvo of a named list. If the list does not yet exist, then this will return SpecialHVOValues.kHvoUninitializedObject.

GetNamedListHvo ( XmlNode node, string attrName ) : int

Return Hvo of a named list. If the list does not yet exist, then this will return zero.

GetPathInfoFromColumnSpec ( XmlNode node, string attrName, string defaultOwningClass, string &owningClass, string &property ) : void

GetString ( ITsString tss ) : string
HandlePreviewOrSuggestTask ( Action previewOrSuggestTask ) : void
InitBulkCopyTab ( ) : void
InitClickCopyTab ( ) : void

Initialize the Click Copy tab.

InitConverterCombo ( ) : void

Load the available (relevant) converters. Adapted from WritingSystemPropertiesDialog.LoadAvailableConverters.

InitDeleteTab ( ) : void
InitFindReplaceTab ( ) : void
InitListChoiceTab ( ) : void

Initialize the List Choice tab.

InitTransduce ( ) : void

Initialize the transduce tab.

InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

ItemsToChangeSet ( bool fOnlyIfSelected ) : Set
LaunchPreview ( ) : void
ListItemsClassesInfo ( Set classes ) : List
MakeBulkCopyMethod ( int &newCol ) : BulkCopyMethod

Make a BulkCopyMethod (used in preview and apply click methods for Bulk Copy tab).

MakeClearMethod ( int &newCol ) : ClearMethod

Make a ClearMethod (used in preview and apply click methods for Delete tab for fields).

MakeItem ( XmlNode colSpec ) : BulkEditItem
MakeReplaceWithMethod ( int &newCol ) : ReplaceWithMethod

Make a ReplaceWithMethod (used in preview and apply click methods for Replace tab).

MakeSuggestions ( ProgressState state ) : void
MakeTransduceMethod ( int &newCol ) : TransduceMethod

Make a TransduceMethod (used in preview and apply click methods for Transduce tab).

OnTargetComboItemChanged ( FieldComboItem selectedItem ) : void
RemoveOldChoiceControl ( ) : void

Remove old (bulk edit) choice control

RequiresDialogChooser ( ICmPossibilityList list ) : bool

Return true if the specified list requires us to use a chooser dialog rather than putting a simple combo box in the bulk edit bar. Currently we do this if the list is (actually, not just potentially) hierarchical, or if it has more than 25 items. Note that at least one unit test will break if this method causes the default Locations list to be treated as hierarchical.

ResumeRecordListRowChanges ( ) : void

Only use in BulkEditBar. This method should be private, the coupling with BrowseViewer is too high if the bulkedit code is refactored out of BrowseViewer make this private.

SetEditColumn ( int icol ) : void
SetEnabledForAllItems ( ) : void
SetEnabledForListChoiceTab ( ) : void
SetEnabledIfShowing ( ) : void
SetStyleSheet ( IVwStylesheet value ) : void
SetTabEnabled ( TabPage page, int targetColumnCount, string enableAttrName ) : void

Set the enable state for the specified tab, based on the number of possible target columns (if zero, disable) and the setting specified in the enableBulkEditTabsNode in the specified attribute. Enhance JohnT: possibly there is no reason for the enableBulkEditTabsNode now that we're figuring out whether to enable based on the number of target columns?

SuspendRecordlistRowChanges ( ) : void
UpdateCheckedItems ( ) : void
UpdateCurrentGhostParentHelper ( ) : GhostParentHelper

needed for AllowDeleteItem().

UpdateEnableItems ( int hvoItem ) : void

The selected state of the specified item may be changing, update enable values as appropriate.

UpdateFindReplaceSummary ( ) : void
VerifyRowDeleteAllowable ( int hvo ) : bool
besc_ValueChanged ( object sender, FwObjectSelectionEventArgs e ) : void

The selected item may have changed in the "Change To" comboBox under the List Choice tab therefore enable or disable the Apply and Preview buttons based on the selection.

m_bulkCopyTab_Enter ( object sender, EventArgs e ) : void
m_bulkCopyTargetCombo_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_clickCopySepBox_GotFocus ( object sender, EventArgs e ) : void
m_clickCopyTab_Enter ( object sender, EventArgs e ) : void
m_clickCopyTargetCombo_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_closeButton_Click ( object sender, EventArgs e ) : void
m_deleteTab_Enter ( object sender, EventArgs e ) : void
m_deleteWhatCombo_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_findReplaceSetupButton_Click ( object sender, System e ) : void
m_findReplaceTab_Enter ( object sender, EventArgs e ) : void
m_findReplaceTargetCombo_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_helpButton_Click ( object sender, EventArgs e ) : void
m_listChoiceTab_Enter ( object sender, EventArgs e ) : void
m_listChoiceTargetCombo_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_operationsTabControl_Deselecting ( object sender, TabControlCancelEventArgs e ) : void
m_operationsTabControl_SelectedIndexChanged ( object sender, EventArgs e ) : void
m_transduceSetupButton_Click ( object sender, System e ) : void
m_transduceTab_Enter ( object sender, EventArgs e ) : void
m_transduceTargetCombo_SelectedIndexChanged ( object sender, EventArgs e ) : void
populateListChoiceTargetCombo ( ) : void

xbv_ClickCopy ( object sender, ClickCopyEventArgs e ) : void

Method Details

BulkEditBar() public method

Initializes a new instance of the BulkEditBar class.
public BulkEditBar ( ) : System
return System

BulkEditBar() public method

Create one
public BulkEditBar ( BrowseViewer bv, XmlNode spec, XCore.Mediator mediator, SIL.FieldWorks.FDO.FdoCache cache ) : System
bv BrowseViewer The BrowseViewer that it is part of.
spec System.Xml.XmlNode The parameters element of the BV, containing the /// 'columns' elements that specify the BE bar (among other things).
mediator XCore.Mediator The mediator.
cache SIL.FieldWorks.FDO.FdoCache The cache.
return System

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() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool
return void

EnablePreviewApplyForListChoice() protected method

Enables the preview apply for list choice.
protected EnablePreviewApplyForListChoice ( ) : void
return void

InitStringCombo() protected method

Initialize a combo box with the columns that can be sources or targets for string manipulations. If possible select an item with the same name. If not select the first item if any. If none set the Text to 'no choices'.
protected InitStringCombo ( SIL.FieldWorks.Common.Controls.FwOverrideComboBox combo, bool fIsSourceCombo ) : void
combo SIL.FieldWorks.Common.Controls.FwOverrideComboBox The combo.
fIsSourceCombo bool if set to true [f is source combo].
return void

ItemsToChange() protected method

Return the items that should be changed by the current bulk-edit operation. If the flag is set, (which also means we will really do it), return only the ones the user has checked. Also in that case, we force a partial sort by homograph number for any lexical entries. This helps preserve the homograph numbers in the case where the change causes more than one item to move from one homograph set to another.
protected ItemsToChange ( bool fOnlyIfSelected ) : IEnumerable
fOnlyIfSelected bool
return IEnumerable

MakeItems() public method

Makes the items.
public MakeItems ( ) : void
return void

OnEnableBulkEditButtons() public method

Called when [enable bulk edit buttons].
public OnEnableBulkEditButtons ( object value ) : void
value object The value.
return void

OnTargetComboSelectedIndexChanged() public method

triggers TargetComboSelectedIndexChanged to tell delegates that TargetComboItem has changed.
public OnTargetComboSelectedIndexChanged ( ) : void
return void

SaveSettings() protected method

protected SaveSettings ( ) : void
return void

ShowPreviewItems() protected method

protected ShowPreviewItems ( ProgressState state ) : void
state ProgressState
return void

UpdateColumnList() public method

Update when the user reconfigures the set of columns.
public UpdateColumnList ( ) : void
return void

m_ApplyButton_Click() protected method

protected m_ApplyButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void

m_previewButton_Click() protected method

Handles a click on the Preview (or Clear [Preview]) button
protected m_previewButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void

m_suggestButton_Click() protected method

Handles searching for Semantic Domain suggestions to put in the Preview
protected m_suggestButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void

Property Details

m_beItems protected_oe property

protected BulkEditItem[] m_beItems
return BulkEditItem[]

m_bv protected_oe property

Browse viewer
protected BrowseViewer m_bv
return BrowseViewer

m_currentTargetCombo protected_oe property

the target combo box curently in use.
protected FwOverrideComboBox m_currentTargetCombo
return FwOverrideComboBox

m_deleteTab protected_oe property

protected TabPage m_deleteTab
return TabPage

m_itemIndex protected_oe property

protected int m_itemIndex
return int

m_listChoiceControl protected_oe property

protected Control m_listChoiceControl
return Control

m_listChoiceTargetCombo protected_oe property

protected FwOverrideComboBox m_listChoiceTargetCombo
return FwOverrideComboBox

m_operationsTabControl protected_oe property

protected VSTabControl m_operationsTabControl
return VSTabControl

m_setupOrRestoredBulkEditBarTab protected_oe property

indicates that we've either finished seting up or restoring bulk edit bar tab during initialization.
protected bool m_setupOrRestoredBulkEditBarTab
return bool