Esempio n. 1
0
        internal int AddWidgets(LexEntry entry, int insertAtRow)
        {
            DetailList.SuspendLayout();
            Debug.Assert(DetailList.RowCount == 0);
            Debug.Assert(DetailList.ColumnCount == 3);
            Debug.Assert(DetailList.RowStyles.Count == 0);
            FirstRow = 0;
            int   rowCount = 0;
            Field field    = ActiveViewTemplate.GetField(Field.FieldNames.EntryLexicalForm.ToString());

            if (field != null && field.GetDoShow(entry.LexicalForm, ShowNormallyHiddenFields))
            {
                Control formControl = MakeBoundControl(entry.LexicalForm, field);
                DetailList.AddWidgetRow(StringCatalog.Get(field.DisplayName),
                                        true,
                                        formControl,
                                        insertAtRow,
                                        false);
                insertAtRow = DetailList.GetRow(formControl);
                ++rowCount;
            }
            rowCount += AddCustomFields(entry, insertAtRow + rowCount);

            var rowCountBeforeSenses = rowCount;

            LastRow = insertAtRow + rowCount;
            foreach (var lexSense in entry.Senses)
            {
                var layouter = new LexSenseLayouter(
                    DetailList,
                    rowCount,
                    ActiveViewTemplate,
                    RecordListManager,
                    _serviceProvider,
                    lexSense
                    )
                {
                    ShowNormallyHiddenFields = ShowNormallyHiddenFields,
                    Deletable             = _sensesAreDeletable,
                    ShowMinorMeaningLabel = ShowMinorMeaningLabel,
                    ParentLayouter        = this
                };
                layouter.DeleteClicked += OnSenseDeleteClicked;
                rowCount += AddChildrenWidgets(layouter, lexSense, rowCount);
                ChildLayouts.Add(layouter);
            }

            //see: WS-1120 Add option to limit "add meanings" task to the ones that have a semantic domain
            //also: WS-639 ([email protected]) In Add meanings, don't show extra meaning slots just because a sense was created for the semantic domain
            var ghostingRule = ActiveViewTemplate.GetGhostingRuleForField(LexEntry.WellKnownProperties.Sense);

            if (rowCountBeforeSenses == rowCount || ghostingRule.ShowGhost)
            {
                AddSenseGhost(entry, rowCount);
                rowCount++;
            }

            DetailList.ResumeLayout(false);
            return(rowCount);
        }
Esempio n. 2
0
        /// <summary>
        /// Create an appropriate LexSenseLayouter for a new LexSense created from a ghost,
        /// and insert it at the right place in the Layouter tree.
        /// </summary>
        protected override Layouter CreateAndInsertNewLayouter(int row, PalasoDataObject wsdo)
        {
            Debug.Assert(ParentLayouter is LexEntryLayouter);
            var lexEntryLayouter = ParentLayouter as LexEntryLayouter;
            var newLayouter      = new LexSenseLayouter(DetailList, row, ActiveViewTemplate, RecordListManager,
                                                        _serviceProvider, wsdo as LexSense)
            {
                ShowNormallyHiddenFields = ShowNormallyHiddenFields,
                Deletable      = lexEntryLayouter.SensesAreDeletable,
                ParentLayouter = ParentLayouter
            };

            newLayouter.DeleteClicked += lexEntryLayouter.OnSenseDeleteClicked;
            var idx = ParentLayouter.ChildLayouts.IndexOf(this);

            if (idx >= 0)
            {
                ParentLayouter.ChildLayouts.Insert(idx, newLayouter);
            }
            else
            {
                ParentLayouter.ChildLayouts.Add(newLayouter);
            }
            return(newLayouter);
        }
Esempio n. 3
0
		internal int AddWidgets(LexEntry entry, int insertAtRow)
		{
			DetailList.SuspendLayout();
			int rowCount = 0;
			Field field = ActiveViewTemplate.GetField(Field.FieldNames.EntryLexicalForm.ToString());
			if (field != null && field.GetDoShow(entry.LexicalForm, ShowNormallyHiddenFields))
			{
				Control formControl = MakeBoundControl(entry.LexicalForm, field);
				DetailList.AddWidgetRow(StringCatalog.Get(field.DisplayName),
										true,
										formControl,
										insertAtRow,
										false);
				insertAtRow = DetailList.GetRow(formControl);
				++rowCount;
			}
			rowCount += AddCustomFields(entry, insertAtRow + rowCount);

			LexSenseLayouter layouter = new LexSenseLayouter(DetailList,
															 ActiveViewTemplate,
															 RecordListManager);
			layouter.ShowNormallyHiddenFields = ShowNormallyHiddenFields;
			rowCount = AddChildrenWidgets(layouter, entry.Senses, insertAtRow, rowCount);
			//add a ghost
			rowCount += layouter.AddGhost(entry.Senses, true);

			DetailList.ResumeLayout();
			return rowCount;
		}
Esempio n. 4
0
        private void AddSenseGhost(LexEntry entry, int row)
        {
            var layouter = new LexSenseLayouter(
                DetailList,
                row,
                ActiveViewTemplate,
                RecordListManager,
                _serviceProvider,
                null
                )
            {
                ParentLayouter = this
            };

            layouter.AddGhost(null, entry.Senses, true, row);
            layouter.Deletable      = false;
            layouter.DeleteClicked += OnSenseDeleteClicked;
            ChildLayouts.Add(layouter);
        }