BGE: Handle {} around ro values

BGE: Added an x-Location of end message for a section
Use x-location of end message for a section; tab format for sequential tabs at 4th level; hls tab spaces; indent in transition format 9
BGE: Use x-location of end message for a section
BGE: support for top continue messages that contain tab for continued step
resolve {Step Text} token in transition; modify code that processes transition format to use collection matches rather than search for ‘{‘
support AllUnits ro flag
support ‘{‘ and ‘}’ around ro value
top continue message with tab; location of top continue message in both AER/RNO columns for dual column; support indent in transition format during print
support two top continue messages (aer/rno) that can have different text; fix bug in splitting procedure title text if it contains hard spaces
This commit is contained in:
2014-04-29 13:12:10 +00:00
parent c62a63b151
commit f332618227
11 changed files with 167 additions and 46 deletions

View File

@@ -428,6 +428,11 @@ namespace VEPROMS.CSLA.Library
itemInfo.ActiveSection = sectionInfo;
itemInfo.MyProcedure = procInfo;
itemInfo.MyDocVersion = docVersionInfo;
if (itemInfo.IsStep)
{
ItemInfo ip = itemParent as ItemInfo;
itemInfo.CombinedTab = (ip == null) ? itemInfo.MyTab.CleanText.Trim() : GetCombinedTab(itemInfo, ip.CombinedTab);
}
if (itemInfo.MyContent.ContentGridCount > 0)
itemInfo.MyContent.LoadNonCachedGrid();
if (itemInfo.MyContent.ContentPartCount > 0)
@@ -500,6 +505,20 @@ namespace VEPROMS.CSLA.Library
// Console.WriteLine("Items: {0}", TimeSpan.FromTicks(ticksItems).TotalSeconds);
// Console.WriteLine("Transitions: {0}", TimeSpan.FromTicks(ticksTrans).TotalSeconds);
//}
internal static string GetCombinedTab(ItemInfo itemInfo, string parTab)
{
string pTab = parTab == null ? "" : parTab;
string thisTab = itemInfo.MyTab.CleanText.Trim();
if (itemInfo.FormatStepData.NumberWithLevel) pTab = itemInfo.MyHLS.MyTab.CleanText.Trim();
// if the parent tab ends with a alphanumeric and this tab is alphanumeric, add a '.' to separate them
bool ms = pTab != "" && char.IsLetterOrDigit(pTab.TrimEnd()[pTab.Length - 1]); // parent tab ends with alphanumeric
bool mn = thisTab.TrimStart().Length > 0 && char.IsLetterOrDigit(thisTab.TrimStart()[0]);// this starts with alpha
if (ms && mn) pTab = pTab.TrimEnd() + ".";
// remove ending '.' (if this is a hls, don't remove the '.')
if (!itemInfo.IsHigh && thisTab.EndsWith(".")) thisTab = thisTab.Substring(0, thisTab.Length - 1);
return pTab + thisTab.Trim();
}
internal static void SetParentSectionAndDocVersion(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo == null) return;
@@ -509,6 +528,11 @@ namespace VEPROMS.CSLA.Library
// itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo;
itemInfo.ActiveSection = sectionInfo;
itemInfo.MyDocVersion = docVersionInfo;
if (itemInfo.IsStep)
{
ItemInfo ip = itemParent as ItemInfo;
itemInfo.CombinedTab = (ip == null) ? itemInfo.MyTab.CleanText.Trim() : GetCombinedTab(itemInfo, ip.CombinedTab);
}
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
//rofstinfo.docVer = docVersionInfo;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
@@ -2298,7 +2322,13 @@ namespace VEPROMS.CSLA.Library
return _MyHLS;
}
}
private string _CombinedTab = null;
public string CombinedTab
{
get { return _CombinedTab; }
set { _CombinedTab = value; }
}
private DocVersionInfo _MyDocVersion = null;
public DocVersionInfo MyDocVersion

View File

@@ -516,6 +516,7 @@ namespace VEPROMS.CSLA.Library
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber);
_AppendMethods.Add("{Sect Number}", AddTranGetSectionNumber); // WCN2, tran type 6
_AppendMethods.Add("{Page Num}", AddPageNumber);
_AppendMethods.Add("{Step Text}", AddStepText);
}
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool hasPageNum)
{
@@ -599,14 +600,20 @@ namespace VEPROMS.CSLA.Library
return "?";
int startIndex = 0;
int index = -1;
int rexIndex = -1;
string prefix = null;
string prevToken = null;
bool lastAdded = false;
while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1)
MatchCollection mc = Regex.Matches(tb._TransFormat, @"{(Proc Num|\?\.Proc Num|Proc Title|\?\.Proc Title|" +
@"First Step|Step Number|Last Step|\.|Sect Hdr|\?\.Sect Hdr|Sect Title|\?\.Sect Title|\?\.Sect Num|Sect Num|" +
@"Sect Number|Page Num|Step Text)}");
foreach (Match m in mc)
{
string tmppref = prefix;
prefix = null;
if (index > startIndex) prefix = tb._TransFormat.Substring(startIndex, index - startIndex);
rexIndex = m.Index;
int rexEndToken = m.Index + m.Length - 1;
if (rexIndex > startIndex) prefix = tb._TransFormat.Substring(startIndex, rexIndex - startIndex);
if (prefix == null) prevToken = null;
// if the last token did not add anything to the buffer, still want to put the text prefix in:
if (!lastAdded && prefix == null) prefix = tmppref;
@@ -615,20 +622,19 @@ namespace VEPROMS.CSLA.Library
tb.Append(prefix);
prefix = "";
}
int endtokn = tb._TransFormat.IndexOf("}", index);
string token = tb._TransFormat.Substring(index, endtokn - index + 1);
string token = tb._TransFormat.Substring(rexIndex, rexEndToken - rexIndex + 1);
// we need to flag condition where the step number already has the section number in it. For example, Wolf Creek
// using WCN2, has some sections whose section number is 'D' and the step number is 'D1', or 'D2'. The resolved
// transition text was coming out as 'DD1'. The format's HLS tab format contains '{Section Prefix}' whose implementation
// adds the section number to the tab.
if (token.Contains("Sect Num") && tb._TransFormat.Length > endtokn + 1)
if (token.Contains("Sect Num") && tb._TransFormat.Length > rexEndToken + 1)
{
int nxtTokenS = tb._TransFormat.IndexOf("{", endtokn);
if (nxtTokenS > -1 && nxtTokenS == endtokn+1) // the {step} token has to immediately follow the section num token
int nxtTokenS = tb._TransFormat.IndexOf("{", rexEndToken);
if (nxtTokenS > -1 && nxtTokenS == rexEndToken + 1) // the {step} token has to immediately follow the section num token
{
int nxtTokenE = tb._TransFormat.IndexOf("}", nxtTokenS);
string nxtToken = tb._TransFormat.Substring(nxtTokenS, nxtTokenE - nxtTokenS + 1);
tb.SectNumWithStepNum = tb._ToItem.IsStep && nxtToken.Contains("Step")
tb.SectNumWithStepNum = tb._ToItem.IsStep && nxtToken.Contains("Step")
&& tb._ToItem.MyHLS.FormatStepData.TabData.IdentPrint.Contains("{Section Prefix}");
}
}
@@ -648,7 +654,7 @@ namespace VEPROMS.CSLA.Library
}
else
tb.Append("\\" + token.Substring(0, token.Length - 1) + "\\}");
startIndex = endtokn + 1;
startIndex = rexEndToken + 1;
prevToken = token;
if (startIndex >= tb._TransFormat.Length) break;
}
@@ -926,6 +932,13 @@ namespace VEPROMS.CSLA.Library
tb._UsedRangeAncestor = usedRangeAncestor;
return true;
}
private static bool AddStepText(TransitionBuilder tb)
{
tb.AppendPrefix();
string txt = tb._ToItem.MyContent.Text;
tb.Append(txt);
return true;
}
private static Dictionary<int, ItemInfo> GetAncestors(ItemInfo itemInfo)
{
Dictionary<int, ItemInfo> retval = new Dictionary<int,ItemInfo>();