Inheritance: FieldComboItem
Ejemplo n.º 1
0
		private void OnTargetComboItemChanged(FieldComboItem selectedItem)
		{
			if (TargetComboSelectedIndexChanged == null)
				return;
			int flid;
			m_expectedListItemsClassId = GetExpectedListItemsClassAndTargetFieldFromSelectedItem(selectedItem, out flid);
			if (m_expectedListItemsClassId != 0)
			{
				using (var targetFieldItem = new TargetFieldItem(selectedItem.ToString(),
					selectedItem.ColumnIndex, m_expectedListItemsClassId, flid))
				{
					var args = new TargetColumnChangedEventArgs(targetFieldItem);
					//REFACTOR: the BrowseView should not know about BulkEdit - They appear to be too highly coupled.
					m_bv.BulkEditTargetComboSelectedIndexChanged(args); // may set ForceReload flag on args.
					if (TargetComboSelectedIndexChanged != null)
						TargetComboSelectedIndexChanged(this, args);
				}
			}
		}
Ejemplo n.º 2
0
		internal TargetColumnChangedEventArgs(TargetFieldItem selectedTargetFieldItem)
		{
			m_tfi = selectedTargetFieldItem;
		}
Ejemplo n.º 3
0
		// Initialize the delete tab.
		private void InitDeleteTab()
		{
			m_deleteWhatCombo.SuspendLayout();
			m_deleteWhatCombo.ClearItems();
			// Add the string related fields
			AddStringFieldItemsToCombo(m_deleteWhatCombo, null, false);
			// Add support for deleting "rows" only for the classes
			// that have associated columns installed (LT-9128).
			Set<int> targetClassesNeeded = new Set<int>();
			// Always allow deleting the primary row (e.g. Entries)
			targetClassesNeeded.Add(m_bulkEditListItemsClasses[0]);
			// Go through each of the column-deletable string fields, and add rows to delete.
			foreach (FieldComboItem fci in m_deleteWhatCombo.Items)
			{
				int targetClass = GetExpectedListItemsClassFromSelectedItem(fci);
				targetClassesNeeded.Add(targetClass);
			}
			int icol = -1; // will increment at start of loop.
			// Add all the List related fields
			foreach (BulkEditItem bei in m_beItems)
			{
				icol++;
				if (bei != null && bei.BulkEditControl.CanClearField)
				{
					XmlNode colSpec = m_bv.ColumnSpecs[icol] as XmlNode;
					string label = GetColumnLabel(m_mediator, colSpec);
					TargetFieldItem tfi = null;
					try
					{
						tfi = new TargetFieldItem(label, icol);
						// still want to allow deleting item rows, even if column is not deletable.
						int targetClass = GetExpectedListItemsClassFromSelectedItem(tfi);
						targetClassesNeeded.Add(targetClass);
						bool allowBulkDelete = XmlUtils.GetOptionalBooleanAttributeValue(colSpec, "bulkDelete", true);
						if (!allowBulkDelete)
							continue;
						m_deleteWhatCombo.Items.Add(tfi);
						tfi = null; // well be disposed by m_deleteWhatCombo
					}
					finally
					{
						if (tfi != null)
							tfi.Dispose();
					}
				}
			}
			foreach (ListClassTargetFieldItem rootClassOption in ListItemsClassesInfo(targetClassesNeeded))
				m_deleteWhatCombo.Items.Add(rootClassOption);

			// Default to deleting rows if that's all we have in the combo box list.
			m_deleteWhatCombo.ResumeLayout();
			bool enabled = m_deleteTab.Enabled;
			m_ApplyButton.Enabled = enabled;
		}