Exemplo n.º 1
0
		public void Create_NullviewTemplate_Throws()
		{
			using (DetailList detailList = new DetailList())
			{
				new LexEntryLayouter(detailList, null, null);
			}
		}
Exemplo n.º 2
0
		public void EmptyViewTemplate()
		{
			LexEntry entry = GetNewEntry();

			using (DetailList dl = new DetailList())
			{
				LexEntryLayouter layout = new LexEntryLayouter(dl, new ViewTemplate(), null);
				_rowCount = layout.AddWidgets(entry);
				Assert.AreEqual(0, _rowCount);
			}
		}
Exemplo n.º 3
0
 public void AddDetailList(DetailList detailList, int insertAtRow)
 {
     SuspendLayout();
     if (insertAtRow >= RowCount)
     {
         RowCount = insertAtRow + 1;
     }
     SetColumnSpan(detailList, 3);
     RowStyles.Add(new RowStyle(SizeType.AutoSize));
     detailList.MouseWheel += OnChildWidget_MouseWheel;
     detailList.Margin      = new Padding(0, detailList.Margin.Top, 0, detailList.Margin.Bottom);
     Controls.Add(detailList, _indexOfLabel, insertAtRow);
     OnLabelsChanged(this, new EventArgs());
     detailList.LabelsChanged += OnLabelsChanged;
     ResumeLayout(false);
 }
Exemplo n.º 4
0
        public void Clear()
        {
            //Debug.WriteLine("VBox " + Name + "   Clearing");

            RowCount = 0;
            RowStyles.Clear();
            while (Controls.Count > 0)
            {
                DetailList list = Controls[0] as DetailList;
                if (list != null)
                {
                    list.LabelsChanged -= OnLabelsChanged;
                    list.Clear();
                }
                Controls[0].Dispose();
            }
            Controls.Clear();
            // Debug.WriteLine("VBox " + Name + "   Clearing DONE");
        }
Exemplo n.º 5
0
		private void RefreshEntryDetail()
		{
			try
			{
				_panelEntry.SuspendLayout();
				DetailList oldDetailList = _detailListControl;
				if (oldDetailList != null)
				{
					oldDetailList.ChangeOfWhichItemIsInFocus -= OnChangeOfWhichItemIsInFocus;
					oldDetailList.KeyDown -= _detailListControl_KeyDown;
				}

				DetailList detailList = new DetailList();
				_detailListControl = detailList;

				detailList.SuspendLayout();
				//
				// _detailListControl
				//
				detailList.BackColor = BackColor;
				detailList.Dock = DockStyle.Fill;
				detailList.Name = "_detailListControl";
				detailList.Size = _panelEntry.Size;
				detailList.TabIndex = 1;

				if (_record != null)
				{
					VerifyHasLexEntryRepository();
					LexEntryLayouter layout = new LexEntryLayouter(detailList,
																   ViewTemplate,
																   _lexEntryRepository);
					layout.ShowNormallyHiddenFields = ShowNormallyHiddenFields;
					layout.AddWidgets(_record);
				}
				detailList.Visible = false;
				_panelEntry.Controls.Add(detailList);
				detailList.ResumeLayout(true);
				detailList.Visible = true;
				_panelEntry.Controls.SetChildIndex(detailList, 0);

				if (oldDetailList != null)
				{
					_panelEntry.Controls.Remove(oldDetailList);
					oldDetailList.Dispose();
				}

				detailList.ChangeOfWhichItemIsInFocus += OnChangeOfWhichItemIsInFocus;
				detailList.KeyDown += _detailListControl_KeyDown;
				_panelEntry.ResumeLayout(false);
			}
			catch (ConfigurationException e)
			{
				ErrorReport.ReportNonFatalMessage(e.Message);
			}
		}
Exemplo n.º 6
0
		public LexExampleSentenceLayouter(DetailList builder, ViewTemplate viewTemplate)
				: base(builder, viewTemplate, null) {}
Exemplo n.º 7
0
		public LexSenseLayouter(DetailList builder,
								ViewTemplate viewTemplate,
								LexEntryRepository lexEntryRepository)
				: base(builder, viewTemplate, lexEntryRepository) {}
Exemplo n.º 8
0
		private static MultiTextControl GetEditControl(DetailList detailList, string labelText)
		{
			MultiTextControl editControl = null;
			for (int i = 0;i < detailList.Count;i++)
			{
				Label label = detailList.GetLabelControlFromRow(i);
				if (label.Text == labelText)
				{
					editControl = (MultiTextControl) detailList.GetEditControlFromRow(i);
					break;
				}
			}
			return editControl;
		}
Exemplo n.º 9
0
		private DetailList MakeDetailList(bool showNormallyHiddenFields)
		{
			string[] analysisWritingSystemIds = new string[]
													{
															BasilProject.Project.WritingSystems.
																	TestWritingSystemAnalId
													};
			string[] vernacularWritingSystemIds = new string[]
													  {
															  BasilProject.Project.WritingSystems.
																	  TestWritingSystemVernId
													  };
			ViewTemplate viewTemplate = new ViewTemplate();
			Field field = new Field(Field.FieldNames.EntryLexicalForm.ToString(),
									"LexEntry",
									vernacularWritingSystemIds);
			field.DisplayName = "Word";
			viewTemplate.Add(field);
#if GlossMeaning
			string meaningFieldName = Field.FieldNames.SenseGloss.ToString();
#else
			string meaningFieldName = LexSense.WellKnownProperties.Definition;
#endif
			viewTemplate.Add(new Field(meaningFieldName, "LexSense", analysisWritingSystemIds));
			viewTemplate.Add(new Field(Field.FieldNames.ExampleSentence.ToString(),
									   "LexExampleSentence",
									   vernacularWritingSystemIds));
			viewTemplate.Add(new Field(Field.FieldNames.ExampleTranslation.ToString(),
									   "LexExampleSentence",
									   analysisWritingSystemIds));

			Field rare = new Field("rare", "LexSense", analysisWritingSystemIds);
			rare.Visibility = CommonEnumerations.VisibilitySetting.NormallyHidden;
			viewTemplate.Add(rare);

			//TODO need tests for other data types when made optional
			//TODO need tests for showing non-empty optional tests in non-show-all mode

			LexEntry entry = GetNewEntry();

			DetailList dl = new DetailList();
			LexEntryLayouter layout = new LexEntryLayouter(dl, viewTemplate, null);
			layout.ShowNormallyHiddenFields = showNormallyHiddenFields;
			_rowCount = layout.AddWidgets(entry);
			return dl;
		}