/// <summary> /// Instantiates a new mapper /// </summary> /// <param name="comboBox">The ComboBox to map</param> /// <param name="propName">The property name</param> /// <param name="isReadOnly">Whether this control is read only</param> /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param> public EnumComboBoxMapper(IComboBox comboBox, string propName, bool isReadOnly, IControlFactory factory) : base(comboBox, propName, isReadOnly, factory) { _mapperStrategy = factory.CreateLookupComboBoxDefaultMapperStrategy(); if (_mapperStrategy == null) return; _mapperStrategy.AddHandlers(this); }
private void InitializeViewElements() { dialogManager = new DialogManager("NUnit Project Editor"); messageDisplay = new MessageDisplay("NUnit Project Editor"); browseProjectBaseCommand = new ButtonElement(projectBaseBrowseButton); editConfigsCommand = new ButtonElement(editConfigsButton); browseConfigBaseCommand = new ButtonElement(configBaseBrowseButton); addAssemblyCommand = new ButtonElement(addAssemblyButton); removeAssemblyCommand = new ButtonElement(removeAssemblyButton); browseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton); projectPath = new TextElement(projectPathLabel); projectBase = new TextElement(projectBaseTextBox); processModel = new ComboBoxElement(processModelComboBox); domainUsage = new ComboBoxElement(domainUsageComboBox); runtime = new ComboBoxElement(runtimeComboBox); runtimeVersion = new ComboBoxElement(runtimeVersionComboBox); activeConfigName = new TextElement(activeConfigLabel); configList = new ComboBoxElement(configComboBox); applicationBase = new TextElement(applicationBaseTextBox); configurationFile = new TextElement(configFileTextBox); binPathType = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton); privateBinPath = new TextElement(privateBinPathTextBox); assemblyPath = new TextElement(assemblyPathTextBox); assemblyList = new ListBoxElement(assemblyListBox); }
public Lister(IWebDriver driver) { InputBaseElement = driver.FindElement(By.ClassName("lister")); ListerSort = new ComboBox(InputBaseElement, "lister-sort-by"); ListerList = new Table(InputBaseElement, "chart"); }
public void Test_SetBusinessObj_ShouldSetTheSelectedItemToCorrectRelatedCar() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookupID"; CollectionComboBoxMapper mapper = CreateCollectionComboBoxMapper(cmbox, propName); Car car1; Car car2; mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); Sample s = new Sample { SampleLookupID = car1.CarID }; //---------------Assert Precondition---------------- Assert.AreEqual(2, mapper.BusinessObjectCollection.Count); Assert.AreEqual(3, cmbox.Items.Count); Assert.IsNull(cmbox.SelectedItem); Assert.IsNull(mapper.OwningBoPropertyName); //---------------Execute Test ---------------------- mapper.BusinessObject = s; //---------------Test Result ----------------------- Assert.IsNotNull(cmbox.SelectedItem); Assert.AreEqual(car1, cmbox.SelectedItem, "Combo Box selected item is not set."); Assert.AreEqual(s.SampleLookupID.ToString(), cmbox.SelectedValue.ToString(), "Combo Box Value is not set"); }
///<summary> /// Constructor for <see cref="InputFormComboBox"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="message"></param> ///<param name="choices"></param> public InputFormComboBox(IControlFactory controlFactory, string message, List <object> choices) { _controlFactory = controlFactory; _message = message; _comboBox = _controlFactory.CreateComboBox(); choices.ForEach(item => _comboBox.Items.Add(item)); }
/// <summary> /// Constructs a <see cref="RelationshipComboBoxMapper"/> with the <paramref name="comboBox"/> /// <paramref name="relationshipName"/> /// </summary> /// <param name="comboBox">The combo box that is being mapped to</param> /// <param name="relationshipName">The name of the relation that is being mapped to</param> /// <param name="isReadOnly">Whether the Combo box can be used to edit from or whether it is only viewable</param> /// <param name="controlFactory">A control factory that is used to create control mappers etc</param> public RelationshipComboBoxMapper (IComboBox comboBox, string relationshipName, bool isReadOnly, IControlFactory controlFactory) { if (comboBox == null) { throw new ArgumentNullException("comboBox"); } if (relationshipName == null) { throw new ArgumentNullException("relationshipName"); } if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } IsReadOnly = isReadOnly; ControlFactory = controlFactory; Control = comboBox; RelationshipName = relationshipName; _boRelationshipMapper = new BORelationshipMapper(relationshipName); _boRelationshipMapper.RelationshipChanged += (sender, e) => OnMappedRelationshipChanged(); _mapperStrategy = ControlFactory.CreateLookupComboBoxDefaultMapperStrategy(); _mapperStrategy.AddHandlers(this); UpdateIsEditable(); _comboBoxCollectionSelector = new ComboBoxCollectionSelector(comboBox, controlFactory, false) { PreserveSelectedItem = true }; this.IncludeBlankItem = true; }
public void Test_BusinessObjectRemovedFromCollection() { IComboBox cmbox = GetControlFactory().CreateComboBox(); DisposeOnTearDown(cmbox); IControlFactory controlFactory = GetControlFactory(); ComboBoxCollectionSelector selectorManager = new ComboBoxCollectionSelector(cmbox, controlFactory) { IncludeBlankItem = false }; DisposeOnTearDown(selectorManager); MyBO.LoadDefaultClassDef(); MyBO removedBo = new MyBO(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> { new MyBO(), removedBo, new MyBO() }; selectorManager.SetCollection(myBoCol); //---------------Execute Test ---------------------- selectorManager.BusinessObjectCollection.Remove(removedBo); //---------------Test Result ----------------------- Assert.AreEqual(2, selectorManager.Control.Items.Count); }
///<summary> /// Constructor form <see cref="ListComboBoxMapper"/> ///</summary> ///<param name="ctl"></param> ///<param name="propName"></param> ///<param name="isReadOnly"></param> ///<param name="factory"></param> public ListComboBoxMapper(IControlHabanero ctl, string propName, bool isReadOnly, IControlFactory factory) : base(ctl, propName, isReadOnly, factory) { _comboBox = (IComboBox)ctl; _mapperStrategy = factory.CreateListComboBoxMapperStrategy(); _mapperStrategy.AddItemSelectedEventHandler(this); }
public void TestChangePropValueUpdatesBusObj() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookupID"; LookupComboBoxMapper mapper = new LookupComboBoxMapper(cmbox, propName, false, GetControlFactory()); Sample s = new Sample(); mapper.LookupList = Sample.LookupCollection; Guid guidResult; StringUtilities.GuidTryParse(Sample.LookupCollection[LOOKUP_ITEM_1], out guidResult); s.SampleLookupID = guidResult; mapper.BusinessObject = s; //---------------Test Preconditions------------------- Assert.AreEqual(3, Sample.LookupCollection.Count); Assert.IsNotNull(mapper.LookupList); Assert.IsNotNull(cmbox.SelectedItem, "There should be a selected item to start with"); //---------------Execute Test ---------------------- s.SampleLookupID = (Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_2); mapper.UpdateControlValueFromBusinessObject(); //---------------Test Result ----------------------- Assert.IsNotNull(cmbox.SelectedItem); Assert.AreEqual(LOOKUP_ITEM_2, cmbox.SelectedItem, "Value is not set after changing bo prop Value"); }
public void TestUsingPropWithBOLookupList() { //---------------Set up test pack------------------- DataStoreInMemory store = new DataStoreInMemory(); BORegistry.DataAccessor = new DataAccessorInMemory(store); IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookup2ID"; LookupComboBoxMapper mapper = new LookupComboBoxMapper(cmbox, propName, false, GetControlFactory()); Dictionary <string, string> collection = getLookupList(); Sample sample = new Sample(); sample.Save(); string boId = collection[LOOKUP_ITEM_2]; Assert.AreEqual(4, store.Count); IBusinessObject businessObject = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObjectByValue <Sample>(boId); Sample sampleToSelect = (Sample)businessObject; sample.SetPropertyValue(propName, sampleToSelect); //--------------Assert Preconditions ------------- Assert.AreEqual(3, collection.Count); Assert.AreEqual(4, store.Count); //---------------Execute Test ---------------------- mapper.LookupList = collection; mapper.BusinessObject = sample; //---------------Test Result ----------------------- Assert.AreEqual(4, cmbox.Items.Count); Assert.AreEqual(LOOKUP_ITEM_2, cmbox.SelectedItem); Assert.AreEqual(sampleToSelect.ToString(), cmbox.SelectedValue); }
public IComboBox GetComboBox(string id, IButton dropDownButton, ITextBox textBox, Func <IButton> itemButtonFactory, bool addToUi = true) { TypedParameter idParam = new TypedParameter(typeof(string), id); IComboBox comboBox = _resolver.Resolve <IComboBox>(idParam); float defaultHeight = dropDownButton != null ? dropDownButton.Height : textBox != null ? textBox.Height : 20f; float itemWidth = textBox != null ? textBox.Width : 100f; dropDownButton = dropDownButton ?? GetButton(id + "_DropDownButton", (string)null, null, null, 0f, 0f, width: 20f, height: defaultHeight); dropDownButton.SkinTags.Add(AGSSkin.DropDownButtonTag); if (dropDownButton.Skin != null) { dropDownButton.Skin.Apply(dropDownButton); } textBox = textBox ?? GetTextBox(id + "_TextBox", 0f, 0f, width: itemWidth, height: defaultHeight); textBox.Enabled = false; itemButtonFactory = itemButtonFactory ?? (() => GetButton(id + "_" + Guid.NewGuid().ToString(), (string)null, null, null, 0f, 0f, width: itemWidth, height: defaultHeight)); comboBox.DropDownButton = dropDownButton; comboBox.TextBox = textBox; comboBox.ItemButtonFactory = itemButtonFactory; comboBox.TreeNode.AddChild(textBox); comboBox.TreeNode.AddChild(dropDownButton); if (addToUi) { _gameState.UI.Add(comboBox); } return(comboBox); }
public void TestChangePropValueUpdatesBusObj() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookupID"; CollectionComboBoxMapper mapper = new CollectionComboBoxMapper(cmbox, propName, true, GetControlFactory()); Car car1; Car car2; mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); Sample s = new Sample { SampleLookupID = car1.CarID }; mapper.BusinessObject = s; //---------------Test Preconditions------------------- Assert.AreEqual(3, Sample.LookupCollection.Count); Assert.IsNotNull(mapper.BusinessObjectCollection); Assert.IsNotNull(cmbox.SelectedItem, "There should be a selected item to start with"); //---------------Execute Test ---------------------- s.SampleLookupID = car2.CarID; mapper.UpdateControlValueFromBusinessObject(); //---------------Test Result ----------------------- Assert.IsNotNull(cmbox.SelectedItem); Assert.AreEqual(s.SampleLookupID.ToString(), cmbox.SelectedItem.ToString(), "Value is not set after changing bo prop Value"); }
public void Test_SetBusinessObject_WhenHasNullCollection_ShouldRaiseError() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookupID"; CollectionComboBoxMapper mapper = CreateCollectionComboBoxMapper(cmbox, propName); mapper.BusinessObjectCollection = null; Car car1 = new Car(); Sample s = new Sample { SampleLookupID = car1.CarID }; //---------------Assert Precondition---------------- Assert.IsNull(cmbox.SelectedItem); Assert.IsNull(mapper.BusinessObjectCollection); //---------------Execute Test ---------------------- try { mapper.BusinessObject = s; Assert.Fail("expected developer exception"); } //---------------Test Result ----------------------- catch (HabaneroDeveloperException ex) { StringAssert.Contains( "The BusinessObjectCollection is null in the CollectionComboBoxMapper when the BusinessObject is set ", ex.Message); StringAssert.Contains( "The BusinessObjectCollection is null in the CollectionComboBoxMapper when the BusinessObject is set ", ex.DeveloperMessage); } }
public void Test_LookupList_AddItemToComboBox_SelectAdditionalItem_SetsBOPropValueToNull() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookup2ID"; CollectionComboBoxMapper mapper = CreateCollectionComboBoxMapper(cmbox, propName); Car car1; Car car2; mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); Sample sample = new Sample { SampleLookupID = car1.CarID }; mapper.BusinessObject = sample; cmbox.Items.Add("SomeItem"); //---------------Assert Preconditions--------------- Assert.AreEqual(4, cmbox.Items.Count); Assert.AreEqual("SomeItem", LastComboBoxItem(cmbox).ToString()); //---------------Execute Test ---------------------- cmbox.SelectedIndex = cmbox.Items.Count - 1; mapper.ApplyChangesToBusinessObject(); //---------------Test Result ----------------------- object value = sample.GetPropertyValue(propName); Assert.IsNull(value); }
public void Test_SetBusinessObj_WhenSpecificGuidPropUsed_ShouldSetTheSelectedItemToCorrectRelatedCar() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); Sample.CreateClassDefWithAGuidProp(); IComboBox cmbox = GetControlFactory().CreateComboBox(); const string sampleBOProp = "GuidProp"; const string owningBoPropertyName = "CarId"; CollectionComboBoxMapper mapper = new CollectionComboBoxMapper(cmbox, sampleBOProp, false, GetControlFactory()) { OwningBoPropertyName = owningBoPropertyName }; Car car1; Car car2; mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); Sample sample = new Sample(); sample.SetPropertyValue(sampleBOProp, car1.CarID); //---------------Assert Precondition---------------- Assert.AreEqual(2, mapper.BusinessObjectCollection.Count); Assert.AreEqual(3, cmbox.Items.Count); Assert.IsNull(cmbox.SelectedItem); Assert.AreEqual(owningBoPropertyName, mapper.OwningBoPropertyName); Assert.IsNotNull(sample.GetPropertyValue(sampleBOProp)); //---------------Execute Test ---------------------- mapper.BusinessObject = sample; //---------------Test Result ----------------------- Assert.IsNotNull(cmbox.SelectedItem); Assert.AreEqual(car1, cmbox.SelectedItem, "Combo Box selected item is not set."); }
Test_ResetBusinessObj_WhenHasNullValueForProperty_WhenPreviousBOHadAValue_ShouldSetSelectedItemNull_BUGFIX() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookupID"; CollectionComboBoxMapper mapper = CreateCollectionComboBoxMapper(cmbox, propName); Car car1; Car car2; mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); Sample s = new Sample { SampleLookupID = car1.CarID }; mapper.BusinessObject = s; Sample sWithNullPropValue = new Sample(); //---------------Assert Precondition---------------- Assert.IsNotNull(cmbox.SelectedItem); Assert.AreEqual(car1, cmbox.SelectedItem, "Combo Box selected item is not set."); Assert.AreEqual(s.SampleLookupID.ToString(), cmbox.SelectedValue.ToString(), "Combo Box Value is not set"); Assert.IsNull(sWithNullPropValue.SampleLookupID); //---------------Execute Test ---------------------- mapper.BusinessObject = sWithNullPropValue; //---------------Test Result ----------------------- // Assert.IsNull(cmbox.SelectedItem); TestUtil.AssertStringEmpty(Convert.ToString(cmbox.SelectedItem), "cmbox.SelectedItem", "there should be no item selected"); }
public void Test_SetBusinessObj_WhenSpecificPropUsed_ShouldSetTheSelectedItemToCorrectRelatedCar() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleText"; CollectionComboBoxMapper mapper = CreateCollectionComboBoxMapper(cmbox, propName); mapper.OwningBoPropertyName = "CarRegNo"; Car car1; Car car2; mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); string carRegNo = "MySelectedRegNo " + TestUtil.GetRandomString().Substring(0, 4); car1.CarRegNo = carRegNo; car2.CarRegNo = TestUtil.GetRandomString(); Sample sample = new Sample { SampleText = carRegNo }; //---------------Assert Precondition---------------- Assert.AreEqual(2, mapper.BusinessObjectCollection.Count); Assert.AreEqual(3, cmbox.Items.Count); Assert.IsNull(cmbox.SelectedItem); Assert.AreEqual("CarRegNo", mapper.OwningBoPropertyName); //---------------Execute Test ---------------------- mapper.BusinessObject = sample; //---------------Test Result ----------------------- Assert.IsNotNull(cmbox.SelectedItem); Assert.AreEqual(car1, cmbox.SelectedItem, "Combo Box selected item is not set."); }
public void AddEditorUI(string id, ITreeNodeView view, IProperty property) { _property = property; var label = view.TreeItem; var panel = _factory.UI.GetPanel(id, 0f, 0f, 0f, 0f, label.TreeNode.Parent); _combobox = SelectEditor.GetCombobox($"{id}_Combobox", _factory, panel, 200f); _text = _combobox.TextBox; _combobox.DropDownPanelList.MinWidth = 200f; _combobox.DropDownPanelList.Items.AddRange(_colorList); _combobox.Z = label.Z; _colorLabel = _factory.UI.GetLabel($"{id}_ColorLabel", "", 50f, 25f, 250f, 0f, panel); _colorLabel.TextVisible = false; var layout = view.HorizontalPanel.GetComponent <ITreeTableRowLayoutComponent>(); if (layout != null) { layout.RestrictionList.RestrictionList.AddRange(new List <string> { panel.ID }); } RefreshUI(); _text.OnPressingKey.Subscribe(onTextboxPressingKey); _combobox.SuggestMode = ComboSuggest.Suggest; _combobox.DropDownPanelList.OnSelectedItemChanged.Subscribe(args => { setColor(Color.FromHexa(NamedColorsMap.NamedColors[args.Item.Text])); }); }
public void Test_WhenUseToStringSet_ShouldUseBoToString() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleText"; CollectionComboBoxMapper mapper = new CollectionComboBoxMapper(cmbox, propName, false, GetControlFactory()); Car car1; Car car2; IBusinessObjectCollection collection = mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2); car1.CarRegNo = "MyCarRegNo"; Sample sample = new Sample { SampleLookupID = car1.CarID }; mapper.BusinessObjectCollection = collection; mapper.BusinessObject = sample; //---------------Assert Precondition---------------- Assert.AreEqual(3, cmbox.Items.Count); //---------------Execute Test ---------------------- mapper.OwningBoPropertyName = "CarRegNo"; cmbox.SelectedItem = car1; //---------------Test Result ----------------------- Assert.AreEqual(car1.CarRegNo, sample.SampleText); }
///<summary> /// Constructor for <see cref="InputFormComboBox"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="message"></param> ///<param name="choices"></param> public InputFormComboBox(IControlFactory controlFactory, string message, List<object> choices) { _controlFactory = controlFactory; _message = message; _comboBox = _controlFactory.CreateComboBox(); choices.ForEach(item => _comboBox.Items.Add(item)); }
public FeaturesLabelsPanel(IGame game, IObject parent) { _game = game; var factory = game.Factory; _label = factory.UI.GetLabel("FeaturesLabel", LABEL_TEXT, 200f, 50f, 25f, parent.Height - 25f, parent, factory.Fonts.GetTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight), false); _label.RenderLayer = parent.RenderLayer; _label.Pivot = (0f, 1f); _label.Tint = Colors.DarkOliveGreen; _label.Border = factory.Graphics.Borders.SolidColor(Colors.LightSeaGreen, 3f); _label.MouseEnter.Subscribe(_ => _label.Tint = Colors.DarkGoldenrod); _label.MouseLeave.Subscribe(_ => _label.Tint = Colors.DarkOliveGreen); _label.Enabled = true; float autoFitX = _label.X; float autoFitY = _label.Y - _label.Height - 100f; _featuresAutoFitCombobox = factory.UI.GetComboBox("FeaturesAutoFitCombo", null, null, null, parent, false); _featuresAutoFitCombobox.TextBox.Text = nameof(AutoFit.TextShouldWrapAndLabelShouldFitHeight); _featuresAutoFitCombobox.Position = (autoFitX, autoFitY); var autoFitList = _featuresAutoFitCombobox.DropDownPanelList; foreach (var autoFitOption in Enum.GetValues(typeof(AutoFit))) { autoFitList.Items.Add(new AGSStringItem { Text = autoFitOption.ToString() }); } autoFitList.OnSelectedItemChanged.Subscribe(args => _label.TextConfig.AutoFit = (AutoFit)Enum.Parse(typeof(AutoFit), args.Item.Text)); }
protected void AssertAutoCompleteSourcesSame(IComboBox comboBox) { AutoCompleteSource AutoCompleteSource = comboBox.AutoCompleteSource; string AutoCompleteSourceToString = GetUnderlyingAutoCompleteSourceToString(comboBox); Assert.AreEqual(AutoCompleteSource.ToString(), AutoCompleteSourceToString); }
public void Test_SelectedBusinessObject_EdgeCase_SelectCustomStringItem_ShouldReturnNull() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); DisposeOnTearDown(cmbox); IControlFactory controlFactory = GetControlFactory(); var selectorManager = new ComboBoxCollectionSelector(cmbox, controlFactory); DisposeOnTearDown(selectorManager); selectorManager.IncludeBlankItem = false; MyBO.LoadDefaultClassDef(); MyBO selectedBO = new MyBO(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> { new MyBO(), selectedBO, new MyBO() }; selectorManager.IncludeBlankItem = false; selectorManager.SetCollection(myBoCol); selectorManager.Control.SelectedIndex = 1; cmbox.Items.Add("SomeItem"); //---------------Assert Preconditions--------------- Assert.AreEqual(selectedBO, selectorManager.SelectedBusinessObject); //---------------Execute Test ---------------------- cmbox.SelectedIndex = cmbox.Items.Count - 1; IBusinessObject selectedBusinessObject = selectorManager.SelectedBusinessObject; //---------------Test Result ----------------------- Assert.IsNull(selectedBusinessObject); }
public void Add(Position position, IObject parent, IGameFactory factory) { _combobox = factory.UI.GetComboBox($"{Name}_SimpleCombobox", parent: parent); _combobox.Position = position; _combobox.DropDownPanelList.Items.AddRange(_values.Select(v => new AGSStringItem { Text = v }).Cast <IStringItem>().ToList()); }
private void Expect_ArchDatasourceSet() { ddlArchitecture = mr.StrictMock<IComboBox>(); ddlArchitecture.Expect(d => d.DataSource = null) .IgnoreArguments() .WhenCalled(m => { this.archNames = ((IEnumerable) m.Arguments[0]).OfType<ListOption>().ToArray(); }); dlg.Expect(d => d.Architectures).Return(ddlArchitecture); }
private void Expect_PlatformDataSourceSet() { ddlPlatform = mr.StrictMock <IComboBox>(); ddlPlatform.Expect(d => d.DataSource = null) .IgnoreArguments() .WhenCalled(m => { this.platformNames = ((IEnumerable)m.Arguments[0]).OfType <ListOption>().ToArray(); }); dlg.Expect(d => d.Platforms).Return(ddlPlatform); }
private void Expect_ArchDatasourceSet() { ddlArchitecture = mr.StrictMock <IComboBox>(); ddlArchitecture.Expect(d => d.DataSource = null) .IgnoreArguments() .WhenCalled(m => { this.archNames = ((IEnumerable)m.Arguments[0]).OfType <ListOption>().ToArray(); }); dlg.Expect(d => d.Architectures).Return(ddlArchitecture); }
/// <summary> /// Constructor to initialise the mapper /// </summary> /// <param name="cbx">The ComboBox to map</param> /// <param name="propName">The property name</param> /// <param name="isReadOnly">Whether this control is read only</param> /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param> public CollectionComboBoxMapper(IComboBox cbx, string propName, bool isReadOnly, IControlFactory factory) : base(cbx, propName, isReadOnly, factory) { _comboBox = cbx; _mapperStrategy = factory.CreateLookupComboBoxDefaultMapperStrategy(); _mapperStrategy.AddHandlers(this); _comboBoxCollectionSelector = new ComboBoxCollectionSelector(cbx, factory, false); _comboBoxCollectionSelector.PreserveSelectedItem = true; }
override public void Run() { //To do your work. //Example: IComboBox baseItem = this.Caller as IComboBox; SuperMap.Desktop.Application.ActiveApplication.Output.Output("This ComboBox Select Item: " + baseItem.SelectedIndex); }
/// <summary> /// Constructor to initialise the mapper /// </summary> /// <param name="cbx">The ComboBox to map</param> /// <param name="propName">The property name</param> /// <param name="isReadOnly">Whether this control is read only</param> /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param> public LookupComboBoxMapper(IComboBox cbx, string propName, bool isReadOnly, IControlFactory factory) : base(cbx, propName, isReadOnly, factory) { _comboBox = cbx; _mapperStrategy = factory.CreateLookupComboBoxDefaultMapperStrategy(); if (_mapperStrategy == null) return; _mapperStrategy.AddHandlers(this); _collection = new Dictionary<string, string>(); }
public IncidentsView(IIncidentsGridView incidentsGridView, IIncidentsRSSReader incidentsReader, IFormClosedListener formClosedListener, IComboBox regionsComboBox, int viewID) : this() { this.incidentsReader = incidentsReader; this.formClosedListener = formClosedListener; incidentsGridViewPlaceHolder.AddControl((Control)incidentsGridView); regionPlaceHolder.AddControl(regionsComboBox); }
public LowLevelView() { InitializeComponent(); txtAddressWrapped = new ToolStripTextBoxWrapper(txtAddress); btnBackWrapped = new ToolStripButtonWrapper(btnBack); btnFwdWrapped = new ToolStripButtonWrapper(btnForward); btnGoWrapped = new ToolStripButtonWrapper(btnGo); ddlVisualizerWrapped = new ComboBoxWrapper(ddlVisualizer); }
private ComboBoxCollectionSelector CreateComboBoxCollectionSelector() { IComboBox cmbox = GetControlFactory().CreateComboBox(); DisposeOnTearDown(cmbox); IControlFactory controlFactory = GetControlFactory(); return(new ComboBoxCollectionSelector(cmbox, controlFactory)); }
public void _initControl() { PlatformSingleton platformSingleton_ = __singleton<PlatformSingleton>._instance(); string panelUrl_ = @"uid://program.optimal.window:window.optimal.Panel"; string cprojectUrl_ = @"rid://program.optimal.cprojectPropertyUrl"; mPanel = platformSingleton_._loadHeadstream<IPanel>(panelUrl_, cprojectUrl_); mApplicationTypeComboBox = mPanel._childControl("comboBox1") as IComboBox; mApplicationTypeComboBox.m_tSelectTextSlot += this._getApplicationTypeStr; }
public IncidentsView(IIncidentsGridView incidentsGridView, IIncidentsRSSReader incidentsReader, IFormClosedListener formClosedListener, IComboBox regionsComboBox, int viewID) : this() { this.incidentsReader = incidentsReader; this.formClosedListener = formClosedListener; incidentsGridViewPlaceHolder.AddControl((Control) incidentsGridView); regionPlaceHolder.AddControl(regionsComboBox); }
///<summary> /// Constructor with the controlFactory, propertyName, filterClauseOperator. ///</summary> ///<param name="controlFactory"></param> ///<param name="propertyName"></param> ///<param name="filterClauseOperator"></param> public StringComboBoxFilter(IControlFactory controlFactory, string propertyName, FilterClauseOperator filterClauseOperator) { _controlFactory = controlFactory; _propertyName = propertyName; _filterClauseOperator = filterClauseOperator; _comboBox = _controlFactory.CreateComboBox(); _comboBox.SelectedIndexChanged += (sender, e) => FireValueChanged(); _comboBox.TextChanged += (sender, e) => FireValueChanged(); }
private void Expect_RawFilesDatasourceSet() { ddlRawFiles = mr.Stub <IComboBox>(); ddlRawFiles.Expect(d => d.DataSource = null) .IgnoreArguments() .WhenCalled(m => { this.rawFileNames = ((IEnumerable)m.Arguments[0]).OfType <ListOption>().ToArray(); }); dlg.Expect(d => d.RawFileTypes).Return(ddlRawFiles); ddlRawFiles.Stub(d => d.TextChanged += null).IgnoreArguments(); }
public RegionsComboBoxController(IComboBox comboBox, ICfaRegions cfaRegions) { this.comboBox = comboBox; this.cfaRegions = cfaRegions; comboBox.MaxDropDownItems = 25; comboBox.Sorted = false; comboBox.DropDownStyle = ComboBoxStyle.DropDownList; comboBox.DataSource = cfaRegions; }
///<summary> /// Constructor with controlFactory, propertyName and filterClauseOperator ///</summary> ///<param name="controlFactory"></param> ///<param name="propertyName"></param> ///<param name="filterClauseOperator"></param> ///<param name="enumType"></param> public EnumComboBoxFilter(IControlFactory controlFactory, string propertyName , FilterClauseOperator filterClauseOperator) { _controlFactory = controlFactory; _propertyName = propertyName; _filterClauseOperator = filterClauseOperator; _comboBox = _controlFactory.CreateComboBox(); _comboBox.SelectedIndexChanged += (sender, e) => FireValueChanged(); _comboBox.TextChanged += (sender,e) => FireValueChanged(); }
///<summary> /// Constructs the <see cref="ExtendedComboBoxWin"/> with the specified <see cref="IControlFactory"/>. ///</summary> public ExtendedComboBoxWin(IControlFactory controlFactory) { _controlFactory = controlFactory; IUserControlHabanero userControlHabanero = this; _comboBox = _controlFactory.CreateComboBox(); _button = _controlFactory.CreateButton("..."); _button.MinimumSize = new Size(0, 0); BorderLayoutManager borderLayoutManager = controlFactory.CreateBorderLayoutManager(userControlHabanero); borderLayoutManager.AddControl(_comboBox, BorderLayoutManager.Position.Centre); borderLayoutManager.AddControl(_button, BorderLayoutManager.Position.East); }
ExportDialog(string title, string filePath, bool useDepth) { int h = 8; if (useDepth) ++h; _Dialog = Far.Api.CreateDialog(-1, -1, 77, h); _Dialog.AddBox(3, 1, 0, 0, title); const int x = 16; int y = 1; _Dialog.AddText(5, ++y, 0, "&File name"); _File = _Dialog.AddEdit(x, y, 71, string.Empty); _File.History = "NewEdit"; _File.IsPath = true; _File.UseLastHistory = true; if (filePath != null) _File.Text = filePath; _Dialog.AddText(5, ++y, 0, "&Encoding"); _Encoding = _Dialog.AddComboBox(x, y, 71, string.Empty); _Encoding.DropDownList = true; _Encoding.Text = "Unicode"; _Encoding.Add("Default"); _Encoding.Add("Unicode"); _Encoding.Add("UTF8"); _Encoding.Add("BigEndianUnicode"); _Encoding.Add("ASCII"); _Encoding.Add("UTF7"); _Encoding.Add("UTF32"); _Encoding.Add("OEM"); if (useDepth) { _Dialog.AddText(5, ++y, 0, "&Depth"); _Depth = _Dialog.AddEdit(x, y, 71, string.Empty); } _Dialog.AddText(5, ++y, 0, string.Empty).Separator = 1; IButton buttonOK = _Dialog.AddButton(0, ++y, "Ok"); buttonOK.CenterGroup = true; _Dialog.Default = buttonOK; IButton buttonCancel = _Dialog.AddButton(0, y, Res.Cancel); buttonCancel.CenterGroup = true; _Dialog.Cancel = buttonCancel; }
/// <summary> /// Constructs a <see cref="RelationshipComboBoxMapper"/> with the <paramref name="comboBox"/> /// <paramref name="relationshipName"/> /// </summary> /// <param name="comboBox">The combo box that is being mapped to</param> /// <param name="relationshipName">The name of the relation that is being mapped to</param> /// <param name="isReadOnly">Whether the Combo box can be used to edit from or whether it is only viewable</param> /// <param name="controlFactory">A control factory that is used to create control mappers etc</param> public RelationshipComboBoxMapper (IComboBox comboBox, string relationshipName, bool isReadOnly, IControlFactory controlFactory) { if (comboBox == null) throw new ArgumentNullException("comboBox"); if (relationshipName == null) throw new ArgumentNullException("relationshipName"); if (controlFactory == null) throw new ArgumentNullException("controlFactory"); IsReadOnly = isReadOnly; ControlFactory = controlFactory; Control = comboBox; RelationshipName = relationshipName; _boRelationshipMapper = new BORelationshipMapper(relationshipName); _boRelationshipMapper.RelationshipChanged += (sender, e) => OnMappedRelationshipChanged(); _mapperStrategy = ControlFactory.CreateLookupComboBoxDefaultMapperStrategy(); _mapperStrategy.AddHandlers(this); UpdateIsEditable(); _comboBoxCollectionSelector = new ComboBoxCollectionSelector(comboBox, controlFactory, false) {PreserveSelectedItem = true}; this.IncludeBlankItem = true; }
/// <summary> /// Constructor to initialise a new ComboBox with a selection of /// date range options that are suited to a timeless system /// </summary> /// <param name="comboBox">The combobox to be managed</param> public DateRangeComboBoxManager(IComboBox comboBox) { _comboBox = comboBox; _optionsToDisplay = new List<DateRangeOptions> { DateRangeOptions.Today, DateRangeOptions.Tommorrow, DateRangeOptions.Yesterday, DateRangeOptions.WeekToDate, DateRangeOptions.PreviousWeek, DateRangeOptions.Previous7Days, DateRangeOptions.MonthToDate, DateRangeOptions.PreviousMonth, DateRangeOptions.Previous30Days, DateRangeOptions.YearToDate, DateRangeOptions.PreviousYear, DateRangeOptions.Previous365Days, DateRangeOptions.Next30Days, DateRangeOptions.Next7Days }; InitialiseValues(); }
public AutoLoadingRelationshipComboBoxMapperSpy(IComboBox comboBox, string relationshipName, bool isReadOnly, IControlFactory controlFactory) : base(comboBox, relationshipName, isReadOnly, controlFactory) { }
public ComboBoxMapperStub(IComboBox cb) : base(cb, "Fdfad", false, new ControlFactoryWin()) { }
protected abstract string GetUnderlyingAutoCompleteSourceToString(IComboBox controlHabanero);
private void Expect_RawFilesDatasourceSet() { ddlRawFiles= mr.StrictMock<IComboBox>(); ddlRawFiles.Expect(d => d.DataSource = null) .IgnoreArguments() .WhenCalled(m => { this.rawFileNames = ((IEnumerable)m.Arguments[0]).OfType<ListOption>().ToArray(); }); dlg.Expect(d => d.RawFileTypes).Return(ddlRawFiles); ddlRawFiles.Stub(d => d.TextChanged += null).IgnoreArguments(); }
protected override string GetUnderlyingAutoCompleteSourceToString(IComboBox controlHabanero) { Gizmox.WebGUI.Forms.ComboBox control = (Gizmox.WebGUI.Forms.ComboBox)controlHabanero; return control.AutoCompleteSource.ToString(); }
/// <summary> /// Constructs an <see cref="AutoLoadingRelationshipComboBoxMapper"/> with the <paramref name="comboBox"/> /// <paramref name="relationshipName"/> /// </summary> /// <param name="comboBox">The combo box that is being mapped to</param> /// <param name="relationshipName">The name of the relation that is being mapped to</param> /// <param name="isReadOnly">Whether the Combo box can be used to edit from or whether it is only viewable</param> /// <param name="controlFactory">A control factory that is used to create control mappers etc</param> public AutoLoadingRelationshipComboBoxMapper(IComboBox comboBox, string relationshipName, bool isReadOnly, IControlFactory controlFactory) : base(comboBox, relationshipName, isReadOnly, controlFactory) { _lastCallTime = DateTime.MinValue; }
private static object LastComboBoxItem(IComboBox cmbox) { return cmbox.Items[cmbox.Items.Count - 1]; }
protected override RelationshipComboBoxMapper GetMapper(IComboBox cmbox, string relationshipName, bool isReadOnly) { return new AutoLoadingRelationshipComboBoxMapper(cmbox, relationshipName, isReadOnly, GetControlFactory()); }
public CProjectDockWidget() { mApplicationTypeComboBox = null; mApplicationType = "library"; mPanel = null; }
private CollectionComboBoxMapper CreateCollectionComboBoxMapper(IComboBox cmbox, string propName) { return new CollectionComboBoxMapper(cmbox, propName, false, GetControlFactory()); }
protected override RelationshipComboBoxMapper GetMapper(IComboBox cmbox, string relationshipName) { return new AutoLoadingRelationshipComboBoxMapper(cmbox, relationshipName, false, GetControlFactory()); }
public RelationshipComboBoxMapperFake(IComboBox comboBox, string relationshipName, bool isReadOnly, IControlFactory controlFactory) : base(comboBox, relationshipName, isReadOnly, controlFactory) { }
private void Expect_PlatformDataSourceSet() { ddlPlatform = mr.StrictMock<IComboBox>(); ddlPlatform.Expect(d => d.DataSource = null) .IgnoreArguments() .WhenCalled(m => { this.platformNames = ((IEnumerable) m.Arguments[0]).OfType<ListOption>().ToArray(); }); dlg.Expect(d => d.Platforms).Return(ddlPlatform); }