A bulk edit item manages a control (typically a combo) for a column that can handle a list choice bulk edit operation. (The name reflects an original intent that it should handle any kind of bulk edit for its column.)
Inheritance: IFWDisposable
Ejemplo n.º 1
0
		protected virtual BulkEditItem MakeItem(XmlNode colSpec)
		{
			string beSpec = XmlUtils.GetOptionalAttributeValue(colSpec, "bulkEdit", "");
			IBulkEditSpecControl besc = null;
			m_cache = m_bv.Cache; // Just in case not set yet.
			int flid;
			int hvoList;
			int ws;
			string items;
			int flidSub;

			switch (beSpec)
			{
				case "external":
					try
					{
						// NB: colSpec node must have a child node named dynamicloaderinfo.
						besc = (IBulkEditSpecControl)DynamicLoader.CreateObjectUsingLoaderNode(colSpec);
					}
					catch(Exception)
					{
						MessageBox.Show(XMLViewsStrings.ksBarElementFailed);
						return null;
					}
					break;
				case "atomicFlatListItem":
					flid = GetFlidFromClassDotName(colSpec, "field");
					hvoList = GetNamedListHvo(colSpec, "list");
					var list = (ICmPossibilityList) m_cache.ServiceLocator.GetObject(hvoList);
					if (RequiresDialogChooser(list))
					{
						besc = new ComplexListChooserBEditControl(m_cache, m_mediator, colSpec);
						break;
					}
					ws = WritingSystemServices.GetWritingSystem(m_cache, colSpec, null, WritingSystemServices.kwsAnal).Handle;
					besc = new FlatListChooserBEditControl(flid, hvoList, ws, false);
					break;
				case "morphTypeListItem":
					flid = GetFlidFromClassDotName(colSpec, "field");
					flidSub = GetFlidFromClassDotName(colSpec, "subfield");
					hvoList = GetNamedListHvo(colSpec, "list");
					ws = WritingSystemServices.GetWritingSystem(m_cache, colSpec, null, WritingSystemServices.kwsAnal).Handle;
					besc = new MorphTypeChooserBEditControl(flid, flidSub, hvoList, ws, m_bv);
					break;
				case "variantConditionListItem":
					besc = new VariantEntryTypesChooserBEditControl(m_cache, m_mediator, colSpec);
					break;
				case "integer":
					flid = GetFlidFromClassDotName(colSpec, "field");
					string[] stringList = m_bv.BrowseView.GetStringList(colSpec);
					if (stringList != null)
					besc = new IntChooserBEditControl(stringList, flid,
							XmlUtils.GetOptionalIntegerValue(colSpec, "defaultBulkEditChoice", 0));
					else
					{
						items = XmlUtils.GetManditoryAttributeValue(colSpec, "items");
						besc = new IntChooserBEditControl(items, flid);
					}
					break;
				case "integerOnSubfield":
					flid = GetFlidFromClassDotName(colSpec, "field");
					flidSub = GetFlidFromClassDotName(colSpec, "subfield");
					items = XmlUtils.GetManditoryAttributeValue(colSpec, "items");
					besc = new IntOnSubfieldChooserBEditControl(items, flid, flidSub);
					break;
				case "booleanOnSubfield":
					flid = GetFlidFromClassDotName(colSpec, "field");
					flidSub = GetFlidFromClassDotName(colSpec, "subfield");
					items = XmlUtils.GetManditoryAttributeValue(colSpec, "items");
					besc = new BoolOnSubfieldChooserBEditControl(items, flid, flidSub);
					break;
				case "boolean":
					flid = GetFlidFromClassDotName(colSpec, "field");
					items = XmlUtils.GetManditoryAttributeValue(colSpec, "items");
					besc = new BooleanChooserBEditControl(items, flid);
					break;
				case "complexListMultiple":
					besc = new ComplexListChooserBEditControl(m_cache, m_mediator, colSpec);
					break;
				case "semanticDomainListMultiple":
					besc = new SemanticDomainChooserBEditControl(m_cache, m_mediator, this, colSpec);
					break;
				case "variantEntryTypes":
					besc = new VariantEntryTypesChooserBEditControl(m_cache, m_mediator, colSpec);
					break;
				case "complexEntryTypes":
					besc = new ComplexListChooserBEditControl(m_cache, m_mediator, colSpec);
					break;
				default:
					return null;
			}
			besc.Cache = m_bv.Cache;
			besc.DataAccess = m_bv.SpecialCache;
			besc.Stylesheet = m_bv.StyleSheet;
			besc.Mediator = m_mediator;
			if (besc is IGhostable)
				(besc as IGhostable).InitForGhostItems(besc.Cache, colSpec);
			besc.ValueChanged += new FwSelectionChangedEventHandler(besc_ValueChanged);
			BulkEditItem bei = new BulkEditItem(besc);
			return bei;
		}
Ejemplo n.º 2
0
		private void CheckForAndSetupSuggestButton(BulkEditItem bei)
		{
			var button = bei.BulkEditControl.SuggestButton;
			if (button != null)
			{
				m_suggestButton = button;
				m_listChoiceTab.Controls.Add(m_suggestButton);
				m_suggestButton.Location = new Point(m_listChoiceControl.Location.X,
					m_listChoiceControl.Location.Y + SUGGEST_BTN_YOFFSET);
				m_suggestButton.Size = m_listChoiceControl.Size;
				m_suggestButton.Click += m_suggestButton_Click;
				m_suggestButton.Visible = true;
			}
		}