Inheritance: ComplexListChooserBEditControl
Example #1
0
		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 = GetNamedList(colSpec, "list");
					ws = LangProject.GetWritingSystem(colSpec, m_cache, null,
													  LangProject.kwsAnal);
					besc = new FlatListChooserBEditControl(flid, hvoList, ws, false);
					break;
				case "morphTypeListItem":
					flid = GetFlidFromClassDotName(colSpec, "field");
					flidSub = GetFlidFromClassDotName(colSpec, "subfield");
					hvoList = GetNamedList(colSpec, "list");
					ws = LangProject.GetWritingSystem(colSpec, m_cache, null,
													  LangProject.kwsAnal);
					besc = new MorphTypeChooserBEditControl(flid, flidSub, hvoList, ws, m_bv);
					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 "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 "variantEntryTypes":
					besc = new VariantEntryTypesChooserBEditControl(m_cache, m_mediator, colSpec);
					break;
				case "complexEntryTypes":
					besc = new ComplexEntryTypesChooserBEditControl(m_cache, m_mediator, colSpec);
					break;
				default:
					return null;
			}
			besc.Cache = m_bv.Cache;
			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;
		}