Skip to content

Commit 8f39600

Browse files
mark-silaror92
authored andcommitted
LT-22091: Fix Dictionary Configuration yellow highlighting (#346)
Fixed yellow highlighting in the Configure Dictionary dialog for Lexical Relations and Grammatical Info. Change-Id: Ibbd63d6cf8df2023cd9597bcdb3d8a09a3107a69
1 parent f8cc384 commit 8f39600

5 files changed

Lines changed: 26 additions & 17 deletions

File tree

Src/xWorks/ConfiguredLcmGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ private static IFragment InsertGramInfoBeforeSenses(ILexSense item, List<Configu
18691869
var content = GenerateContentForFieldByReflection(item, nodeList, publicationDecorator, settings);
18701870
if (content.IsNullOrEmpty())
18711871
return settings.ContentGenerator.CreateFragment();
1872-
return settings.ContentGenerator.GenerateGramInfoBeforeSensesContent(content, nodeList);
1872+
return settings.ContentGenerator.GenerateGramInfoBeforeSensesContent(content, nodeList, settings);
18731873
}
18741874

18751875
private static bool IsAllGramInfoTheSame(ConfigurableDictionaryNode config, IEnumerable<ILexSense> collection, bool isSubsense,
@@ -2188,7 +2188,7 @@ private static IFragment GenerateCrossReferenceChildren(List<ConfigurableDiction
21882188
var xBldr = settings.ContentGenerator.CreateFragment();
21892189
using (var xw = settings.ContentGenerator.CreateWriter(xBldr))
21902190
{
2191-
settings.ContentGenerator.BeginCrossReference(xw, config, IsBlockProperty(config), GetCollectionItemClassAttribute(config));
2191+
settings.ContentGenerator.BeginCrossReference(xw, config, settings, IsBlockProperty(config), GetCollectionItemClassAttribute(config));
21922192
var targetInfo = referenceList.FirstOrDefault();
21932193
if (targetInfo == null)
21942194
return settings.ContentGenerator.CreateFragment();

Src/xWorks/ILcmContentGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface ILcmContentGenerator
1919
IFragment GenerateAudioLinkContent(ConfigurableDictionaryNode config, ConfiguredLcmGenerator.GeneratorSettings settings, string classname, string srcAttribute, string caption, string safeAudioId);
2020
IFragment WriteProcessedObject(List<ConfigurableDictionaryNode> nodeList, bool isBlock, IFragment elementContent, string className);
2121
IFragment WriteProcessedCollection(List<ConfigurableDictionaryNode> nodeList, bool isBlock, IFragment elementContent, string className);
22-
IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList);
22+
IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList, ConfiguredLcmGenerator.GeneratorSettings settings);
2323
IFragment GenerateGroupingNode(List<ConfigurableDictionaryNode> nodeList, object field, string className,
2424
DictionaryPublicationDecorator publicationDecorator, ConfiguredLcmGenerator.GeneratorSettings settings,
2525
Func<object, List<ConfigurableDictionaryNode>, DictionaryPublicationDecorator, ConfiguredLcmGenerator.GeneratorSettings, IFragment> childContentGenerator);
@@ -53,14 +53,14 @@ IFragment GenerateGroupingNode(List<ConfigurableDictionaryNode> nodeList, object
5353
void AddEntryData(IFragmentWriter writer, List<ConfiguredLcmGenerator.ConfigFragment> pieces);
5454
void EndEntry(IFragmentWriter writer);
5555
void AddCollection(IFragmentWriter writer, List<ConfigurableDictionaryNode> nodeList, ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string className, IFragment content);
56-
void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string getCollectionItemClassAttribute);
56+
void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config, ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string getCollectionItemClassAttribute);
5757
void EndObject(IFragmentWriter writer);
5858
void WriteProcessedContents(IFragmentWriter writer, ConfigurableDictionaryNode config, IFragment contents);
5959
IFragment AddImage(ConfigurableDictionaryNode config, ConfiguredLcmGenerator.GeneratorSettings settings, string classAttribute, string srcAttribute, string pictureGuid);
6060
IFragment AddImageCaption(ConfigurableDictionaryNode config, IFragment captionContent);
6161
IFragment GenerateSenseNumber(List<ConfigurableDictionaryNode> nodeList, ConfiguredLcmGenerator.GeneratorSettings settings, string formattedSenseNumber, string senseNumberWs);
6262
IFragment AddLexReferences(List<ConfigurableDictionaryNode> nodeList, bool generateLexType, IFragment lexTypeContent, string className, IFragment referencesContent, bool typeBefore);
63-
void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string className);
63+
void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config, ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string className);
6464
void EndCrossReference(IFragmentWriter writer);
6565
void BetweenCrossReferenceType(IFragment content, List<ConfigurableDictionaryNode> nodeList, bool firstItem);
6666
IFragment WriteProcessedSenses(List<ConfigurableDictionaryNode> nodeList, bool isBlock, IFragment senseContent, string className, IFragment sharedCollectionInfo);

Src/xWorks/LcmJsonGenerator.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ private IFragment WriteProcessedContents(IFragment elementContent, string classN
105105
return fragment;
106106
}
107107

108-
public IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList)
108+
public IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList,
109+
ConfiguredLcmGenerator.GeneratorSettings settings)
109110
{
110111
// The grammatical info is generated as a json property on 'senses'
111112
return content;
@@ -317,7 +318,8 @@ private void EndArray(IFragmentWriter writer)
317318
((JsonFragmentWriter)writer).EndArray();
318319
}
319320

320-
public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty,
321+
public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config,
322+
ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty,
321323
string className)
322324
{
323325
((JsonFragmentWriter)writer).InsertPropertyName(className);
@@ -406,7 +408,8 @@ public IFragment AddLexReferences(List<ConfigurableDictionaryNode> nodeList, boo
406408
}
407409
}
408410

409-
public void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string classAttribute)
411+
public void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config,
412+
ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string classAttribute)
410413
{
411414
// In json the context is enough. We don't need the extra 'span' or 'div' with the item name
412415
// If the consumer needs to match up (to use our css) they can assume the child is the collection singular

Src/xWorks/LcmWordGenerator.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,8 @@ private IFragment WriteProcessedElementContent(List<ConfigurableDictionaryNode>
11471147

11481148
return elementContent;
11491149
}
1150-
public IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList)
1150+
public IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList,
1151+
ConfiguredLcmGenerator.GeneratorSettings settings)
11511152
{
11521153
return content;
11531154
}
@@ -1770,7 +1771,8 @@ public void AddCollection(IFragmentWriter writer, List<ConfigurableDictionaryNod
17701771
}
17711772
}
17721773

1773-
public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string getCollectionItemClassAttribute)
1774+
public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config,
1775+
ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string getCollectionItemClassAttribute)
17741776
{
17751777
return;
17761778
}
@@ -1916,7 +1918,8 @@ public IFragment AddLexReferences(List<ConfigurableDictionaryNode> nodeList, boo
19161918
return fragment;
19171919
}
19181920

1919-
public void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode senseConfigNode, bool isBlockProperty, string className)
1921+
public void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode senseConfigNode,
1922+
ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string className)
19201923
{
19211924
return;
19221925
}

Src/xWorks/LcmXhtmlGenerator.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using System.Diagnostics;
1717
using System.IO;
1818
using System.Linq;
19-
using System.Security.Cryptography;
2019
using System.Text;
2120
using System.Web.UI.WebControls;
2221
using System.Xml;
@@ -635,14 +634,16 @@ private IFragment WriteProcessedContents(bool asBlock, IFragment xmlContent, str
635634
return new StringFragment();
636635
}
637636

638-
public IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList)
637+
public IFragment GenerateGramInfoBeforeSensesContent(IFragment content, List<ConfigurableDictionaryNode> nodeList,
638+
ConfiguredLcmGenerator.GeneratorSettings settings)
639639
{
640640
var bldr = new StringBuilder();
641641
var fragment = new StringFragment(bldr);
642642
using (var xw = XmlWriter.Create(bldr, new XmlWriterSettings { ConformanceLevel = ConformanceLevel.Fragment }))
643643
{
644644
xw.WriteStartElement("span");
645645
xw.WriteAttributeString("class", "sharedgrammaticalinfo");
646+
WriteNodeId(xw, nodeList.Last(), settings);
646647
xw.WriteRaw(content.ToString());
647648
xw.WriteEndElement();
648649
xw.Flush();
@@ -921,12 +922,13 @@ public void AddCollection(IFragmentWriter writer, List<ConfigurableDictionaryNod
921922
xw.WriteEndElement();
922923
}
923924

924-
public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty,
925-
string className)
925+
public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config,
926+
ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string className)
926927
{
927928
var xw = ((XmlFragmentWriter)writer).Writer;
928929
xw.WriteStartElement(isBlockProperty ? "div" : "span");
929930
xw.WriteAttributeString("class", className);
931+
WriteNodeId(xw, config, settings);
930932
}
931933

932934
public void EndObject(IFragmentWriter writer)
@@ -1012,9 +1014,10 @@ public IFragment AddLexReferences(List<ConfigurableDictionaryNode> nodeList, boo
10121014
return fragment;
10131015
}
10141016

1015-
public void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string classAttribute)
1017+
public void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config,
1018+
ConfiguredLcmGenerator.GeneratorSettings settings, bool isBlockProperty, string classAttribute)
10161019
{
1017-
BeginObjectProperty(writer, config, isBlockProperty, classAttribute);
1020+
BeginObjectProperty(writer, config, settings, isBlockProperty, classAttribute);
10181021
}
10191022

10201023
public void EndCrossReference(IFragmentWriter writer)

0 commit comments

Comments
 (0)