C# 클래스 SIL.FieldWorks.Common.Controls.XmlViewsUtils

Utility functions for XmlViews. Some of these may eventually migrate to a more general Utils if relevant.
파일 보기 프로젝트 열기: sillsdev/FieldWorks

보호된 프로퍼티들

프로퍼티 타입 설명
s_cwsMulti int
s_fMultiFirst bool
s_qwsCurrent IWritingSystem
s_sMultiSep string

공개 메소드들

메소드 설명
AlphaCompNumberString ( int val ) : string

Return a string such that ICU alphabetic comparison of the strings will produce the same results as numberic comparison of the values. For positive integers the string is a recognizeable representation of the number (with extra leading zeros); for negative, it is not recognizeable but works.

AlphaCompPosNumString ( int val ) : string

Alphas the comp pos num string.

Assemble ( string items ) : string[]

Return the concatenation of all the input strings as a single string.

CollectBrowseItems ( int hvo, XmlNode colSpec, ArrayList collector, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts ) : void

Given one of the original list items, and the spec of the column we want to sort by, add to collector whatever ManyOnePathSortItems are appropriate.

CopyReplacingParamDefault ( XmlNode input, string paramId, string val ) : XmlNode

Copies the replacing param default.

CopyWithParamDefaults ( XmlNode input ) : XmlNode

If any attributes of input (or its children) are of the form "$param=default", generate a complete copy of input in which "$param=default" is replaced with "default", and return it. Otherwise just return input.

CorrespondingItems ( List sourceNodes, List selectNodes, string attName ) : List

Answer a list containing, for each node in selectNodes, the item in sourceNodes that has the same value for the attribute attName.

DateTimeCompString ( System.DateTime dt ) : string

Return a string such that ICU alphabetic comparison of the strings will produce the same results as DateTime.Compare of the values.

FindIndexOfAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : int

Find the index of the node in nodes that has value attVal for attribute attName. Return -1 if not found.

FindIndexOfMatchingNode ( IEnumerable nodes, XmlNode target ) : int

Find the index of the node in nodes that 'matches' the target node. Return -1 if not found.

FindNodeWithAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : XmlNode

Finds the node with attr val.

FindParams ( XmlNode input ) : string[]

Finds the params.

FindWsParam ( XmlNode node ) : string

Search the node for an element with an attribute that has a value that looks like "$ws=..." and return the "...".

GetDisplayCommandForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : NodeDisplayCommand

This returns a NodeDisplayCommand containing thd node for GetNodeToUseForColumn. However, it distinguishes whether to display the children of this node or the node itself by returning the appropriate kind of NodeDisplayCommand.

GetGuidForUnspecifiedComplexFormType ( ) : System.Guid

Returns a 'fake' Guid used to filter unspecified Complex Form types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.

GetGuidForUnspecifiedVariantType ( ) : System.Guid

Returns a 'fake' Guid used to filter unspecified Variant types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.

GetNodeToUseForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : XmlNode

We want to display the object bvi.KeyObject, or one of its pathobjects, in a column specified by colSpec. Determine the hvo and XmlNode that we should use as the root for the cell. By default, we display the first object in the path, using the base node derived from the colSpec. However, if the colSpec begins with a path compatible with bvi.PathFlid(0), we can use bvi.PathObject(1) and the appropriate derived node. If all flids match we can use bvi.KeyObject itself. If collectOuterStructParts is non-null, it accumulates containing parts that are structural, like para, span, div.

GetWsFromString ( string wsParam, SIL.FieldWorks.FDO.FdoCache cache ) : int

Convert the string found for a writing system to the appropriate integer code (hvo).

GetWsRequiresObject ( XmlNode frag ) : bool

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.

GetWsRequiresObject ( string wsSpec ) : bool

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.

HasParam ( XmlNode input ) : bool

Find the value of the first parameter-like attribute value "$param=default"

StringsFor ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]

Returns an array of string values (keys) for the objects under this layout node.

TryFindPluralFormFromClassId ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int clsId, string &titleStr ) : bool

TryFindPluralFormFromFlid ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int owningFlid, string &titleStr ) : bool

looks up plural form alternative first for given flid, secondly for its destination class.

TryFindString ( SIL.Utils.StringTable tbl, string group, string key, string &result ) : bool

TryMatchExistingAttributes ( XmlNode colSpec1, XmlNode colSpec2, Queue &possibleAttributesToMatch ) : bool

go through possible attributes to match, and return true when the ones that exist match the same attributes in another node.

비공개 메소드들

메소드 설명
AddMultipleAlternatives ( SIL.FieldWorks.FDO.FdoCache cache, ISilDataAccess sda, IEnumerable wsIds, int hvo, int flid, XmlNode frag ) : string
AddSeparator ( string &item, int ichInsert, XmlNode layout ) : void
AddStringFromOtherObj ( XmlNode frag, int hvoTarget, SIL.FieldWorks.FDO.FdoCache cache, ISilDataAccess sda ) : string[]
AppendInt ( int sofar, int add ) : int[]
AssembleChildKeys ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]
ChildKeys ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]

Returns an array of string values (keys) for the objects under the layout child nodes.

CollectBrowseItems ( int hvo, XmlNode node, ArrayList collector, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, XmlNode caller, int hvos, int flids ) : void

Main (recursive) part of CollectBrowseItems. Given that hvo is to be displayed using node, figure what objects to put in the list.

Concatenate ( string first, string second ) : string[]
DisplayMultiSep ( XmlNode frag ) : string
DisplayWsLabel ( IWritingSystem ws, SIL.FieldWorks.FDO.FdoCache cache ) : string
FindMainChild ( XmlNode node ) : XmlNode

Finds the main child.

FoundStringTableString ( string key, string result ) : bool

determine if string table query gave a significant result (i.e. not *{key}* format).

GetArrayLength ( string items ) : int
GetDisplayCommandForColumn1 ( IManyOnePathSortItem bvi, XmlNode node, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int depth, int &hvo, List collectOuterStructParts ) : NodeDisplayCommand

Recursive implementation method for GetDisplayCommandForColumn.

GetFlid ( ISilDataAccess sda, XmlNode frag, int hvo ) : int

This is a simplified version of XmlVc.GetFlid. It does not look for a flid attr, nor try to cache the result. It looks for a "field" property, and optionally a "class" one, and uses them (or the class of hvo, if "class" is missing) to figure the flid. Virtual properties are assumed already created.

GetLayoutNodeForChild ( ISilDataAccess sda, int hvoTarget, int flid, string targetLayoutName, XmlNode layout, LayoutCache layoutCache ) : XmlNode
GetNodeForRelatedObject ( int hvoDst, XmlNode caller, XmlNode node, LayoutCache layouts, ISilDataAccess sda ) : XmlNode

The node argument is an "obj" or "seq" element, and caller (if not null) is a part element that invoked the node and may override its "layout" attribute. Apply the same logic used by XmlVc to determine the node that will be used to display the destination object hvoDst

ProcessMultiLingualChildren ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode frag, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]

Process a fragment's children against multiple writing systems.

XmlViewsUtils ( ) : System

메소드 상세

AlphaCompNumberString() 공개 정적인 메소드

Return a string such that ICU alphabetic comparison of the strings will produce the same results as numberic comparison of the values. For positive integers the string is a recognizeable representation of the number (with extra leading zeros); for negative, it is not recognizeable but works.
public static AlphaCompNumberString ( int val ) : string
val int
리턴 string

AlphaCompPosNumString() 공개 정적인 메소드

Alphas the comp pos num string.
public static AlphaCompPosNumString ( int val ) : string
val int The val.
리턴 string

Assemble() 정적인 공개 메소드

Return the concatenation of all the input strings as a single string.
static public Assemble ( string items ) : string[]
items string
리턴 string[]

CollectBrowseItems() 공개 정적인 메소드

Given one of the original list items, and the spec of the column we want to sort by, add to collector whatever ManyOnePathSortItems are appropriate.
public static CollectBrowseItems ( int hvo, XmlNode colSpec, ArrayList collector, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts ) : void
hvo int The hvo.
colSpec System.Xml.XmlNode The col spec.
collector System.Collections.ArrayList The collector.
mdc IFwMetaDataCache The MDC.
sda ISilDataAccess The sda.
layouts LayoutCache The layouts.
리턴 void

CopyReplacingParamDefault() 공개 정적인 메소드

Copies the replacing param default.
public static CopyReplacingParamDefault ( XmlNode input, string paramId, string val ) : XmlNode
input System.Xml.XmlNode The input.
paramId string The param id.
val string The val.
리턴 System.Xml.XmlNode

CopyWithParamDefaults() 공개 정적인 메소드

If any attributes of input (or its children) are of the form "$param=default", generate a complete copy of input in which "$param=default" is replaced with "default", and return it. Otherwise just return input.
public static CopyWithParamDefaults ( XmlNode input ) : XmlNode
input System.Xml.XmlNode
리턴 System.Xml.XmlNode

CorrespondingItems() 공개 정적인 메소드

Answer a list containing, for each node in selectNodes, the item in sourceNodes that has the same value for the attribute attName.
public static CorrespondingItems ( List sourceNodes, List selectNodes, string attName ) : List
sourceNodes List
selectNodes List
attName string
리턴 List

DateTimeCompString() 공개 정적인 메소드

Return a string such that ICU alphabetic comparison of the strings will produce the same results as DateTime.Compare of the values.
public static DateTimeCompString ( System.DateTime dt ) : string
dt System.DateTime
리턴 string

FindIndexOfAttrVal() 공개 정적인 메소드

Find the index of the node in nodes that has value attVal for attribute attName. Return -1 if not found.
public static FindIndexOfAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : int
nodes List The nodes.
attName string Name of the att.
attVal string The att val.
tbl SIL.Utils.StringTable The TBL.
리턴 int

FindIndexOfMatchingNode() 공개 정적인 메소드

Find the index of the node in nodes that 'matches' the target node. Return -1 if not found.
public static FindIndexOfMatchingNode ( IEnumerable nodes, XmlNode target ) : int
nodes IEnumerable The nodes.
target System.Xml.XmlNode The target.
리턴 int

FindNodeWithAttrVal() 공개 정적인 메소드

Finds the node with attr val.
public static FindNodeWithAttrVal ( List nodes, string attName, string attVal, SIL.Utils.StringTable tbl ) : XmlNode
nodes List The nodes.
attName string Name of the att.
attVal string The att val.
tbl SIL.Utils.StringTable The TBL.
리턴 System.Xml.XmlNode

FindParams() 공개 정적인 메소드

Finds the params.
public static FindParams ( XmlNode input ) : string[]
input System.Xml.XmlNode The input.
리턴 string[]

FindWsParam() 공개 정적인 메소드

Search the node for an element with an attribute that has a value that looks like "$ws=..." and return the "...".
public static FindWsParam ( XmlNode node ) : string
node System.Xml.XmlNode
리턴 string

GetDisplayCommandForColumn() 공개 정적인 메소드

This returns a NodeDisplayCommand containing thd node for GetNodeToUseForColumn. However, it distinguishes whether to display the children of this node or the node itself by returning the appropriate kind of NodeDisplayCommand.
public static GetDisplayCommandForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : NodeDisplayCommand
bvi IManyOnePathSortItem
colSpec System.Xml.XmlNode
mdc IFwMetaDataCache
sda ISilDataAccess
layouts LayoutCache
hvo int
collectOuterStructParts List
리턴 NodeDisplayCommand

GetGuidForUnspecifiedComplexFormType() 공개 정적인 메소드

Returns a 'fake' Guid used to filter unspecified Complex Form types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.
public static GetGuidForUnspecifiedComplexFormType ( ) : System.Guid
리턴 System.Guid

GetGuidForUnspecifiedVariantType() 공개 정적인 메소드

Returns a 'fake' Guid used to filter unspecified Variant types in XmlVc. Setup in configuration files by XmlDocConfigureDlg.
public static GetGuidForUnspecifiedVariantType ( ) : System.Guid
리턴 System.Guid

GetNodeToUseForColumn() 공개 정적인 메소드

We want to display the object bvi.KeyObject, or one of its pathobjects, in a column specified by colSpec. Determine the hvo and XmlNode that we should use as the root for the cell. By default, we display the first object in the path, using the base node derived from the colSpec. However, if the colSpec begins with a path compatible with bvi.PathFlid(0), we can use bvi.PathObject(1) and the appropriate derived node. If all flids match we can use bvi.KeyObject itself. If collectOuterStructParts is non-null, it accumulates containing parts that are structural, like para, span, div.
public static GetNodeToUseForColumn ( IManyOnePathSortItem bvi, XmlNode colSpec, IFwMetaDataCache mdc, ISilDataAccess sda, LayoutCache layouts, int &hvo, List collectOuterStructParts ) : XmlNode
bvi IManyOnePathSortItem The bvi.
colSpec System.Xml.XmlNode The col spec.
mdc IFwMetaDataCache The MDC.
sda ISilDataAccess The sda.
layouts LayoutCache The layouts.
hvo int The hvo.
collectOuterStructParts List The collect outer struct parts.
리턴 System.Xml.XmlNode

GetWsFromString() 공개 정적인 메소드

Convert the string found for a writing system to the appropriate integer code (hvo).
public static GetWsFromString ( string wsParam, SIL.FieldWorks.FDO.FdoCache cache ) : int
wsParam string
cache SIL.FieldWorks.FDO.FdoCache
리턴 int

GetWsRequiresObject() 공개 정적인 메소드

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.
public static GetWsRequiresObject ( XmlNode frag ) : bool
frag System.Xml.XmlNode
리턴 bool

GetWsRequiresObject() 공개 정적인 메소드

Return true if the specified fragment requires an hvo (and possibly flid) for its interpretation. Currently this assumes just the "ws" attribute, since smartws is obsolete.
public static GetWsRequiresObject ( string wsSpec ) : bool
wsSpec string
리턴 bool

HasParam() 공개 정적인 메소드

Find the value of the first parameter-like attribute value "$param=default"
public static HasParam ( XmlNode input ) : bool
input System.Xml.XmlNode
리턴 bool

StringsFor() 정적인 공개 메소드

Returns an array of string values (keys) for the objects under this layout node.
static public StringsFor ( SIL.FieldWorks.FDO.FdoCache fdoCache, ISilDataAccess sda, XmlNode layout, int hvo, LayoutCache layoutCache, XmlNode caller, SIL.Utils.StringTable stringTbl, int wsForce ) : string[]
fdoCache SIL.FieldWorks.FDO.FdoCache The fdo cache.
sda ISilDataAccess The sda.
layout System.Xml.XmlNode The layout.
hvo int The hvo.
layoutCache LayoutCache The layout cache.
caller System.Xml.XmlNode where layout is a component of a 'part' element, caller /// is the 'part ref' that invoked it.
stringTbl SIL.Utils.StringTable The string TBL.
wsForce int if non-zero, "string" elements are forced to use that writing system for multistrings.
리턴 string[]

TryFindPluralFormFromClassId() 공개 정적인 메소드

public static TryFindPluralFormFromClassId ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int clsId, string &titleStr ) : bool
mdc IFwMetaDataCache
tbl SIL.Utils.StringTable
clsId int
titleStr string *{dstClass}* if couldn't find result.
리턴 bool

TryFindPluralFormFromFlid() 공개 정적인 메소드

looks up plural form alternative first for given flid, secondly for its destination class.
public static TryFindPluralFormFromFlid ( IFwMetaDataCache mdc, SIL.Utils.StringTable tbl, int owningFlid, string &titleStr ) : bool
mdc IFwMetaDataCache
tbl SIL.Utils.StringTable
owningFlid int
titleStr string *{dstClass}* if couldn't find result.
리턴 bool

TryFindString() 공개 정적인 메소드

public static TryFindString ( SIL.Utils.StringTable tbl, string group, string key, string &result ) : bool
tbl SIL.Utils.StringTable
group string
key string
result string
리턴 bool

TryMatchExistingAttributes() 공개 정적인 메소드

go through possible attributes to match, and return true when the ones that exist match the same attributes in another node.
public static TryMatchExistingAttributes ( XmlNode colSpec1, XmlNode colSpec2, Queue &possibleAttributesToMatch ) : bool
colSpec1 System.Xml.XmlNode
colSpec2 System.Xml.XmlNode
possibleAttributesToMatch Queue the attributes to try to match, in the order we try to match them. /// if this routine returns true then this the top queue element will be the attribute we matched on.
리턴 bool

프로퍼티 상세

s_cwsMulti 정적으로 보호되어 있는 프로퍼티

static protected int s_cwsMulti
리턴 int

s_fMultiFirst 정적으로 보호되어 있는 프로퍼티

static protected bool s_fMultiFirst
리턴 bool

s_qwsCurrent 정적으로 보호되어 있는 프로퍼티

Current writing system id being used in multilingual fragment. Some methods that refer to this variable are static, so it must be static also. REVIEW (EberhardB/TimS): this probably won't work with different databases that have different default ws!
static protected IWritingSystem s_qwsCurrent
리턴 IWritingSystem

s_sMultiSep 정적으로 보호되어 있는 프로퍼티

static protected string s_sMultiSep
리턴 string