1
1
mirror of https://github.com/dgis/xsddiagram.git synced 2024-08-17 06:20:23 +03:00

Merge pull request #6 from Cleric-K/master

Fixed min/maxOccurs for group references.
This commit is contained in:
Regis Cosnier 2015-10-30 16:39:24 +01:00
commit 6df5624cf0

View File

@ -327,6 +327,8 @@ namespace XSDDiagram.Rendering
{
DiagramItem childDiagramGroup = new DiagramItem();
childDiagramGroup.ItemType = DiagramItemType.group;
XMLSchema.group referenceGroup = null;
if (childGroup.@ref != null)
{
childDiagramGroup.IsReference = true;
@ -337,7 +339,10 @@ namespace XSDDiagram.Rendering
{
XMLSchema.group group = grpObject.Tag as XMLSchema.group;
if (group != null)
{
referenceGroup = childGroup;
childGroup = group;
}
}
}
else if (type == DiagramItemGroupType.Group)
@ -353,13 +358,13 @@ namespace XSDDiagram.Rendering
childDiagramGroup.Diagram = this;
childDiagramGroup.TabSchema = childGroup;
int occurrence;
if (int.TryParse(childGroup.minOccurs, out occurrence))
if (int.TryParse(referenceGroup != null ? referenceGroup.minOccurs : childGroup.minOccurs, out occurrence))
childDiagramGroup.MinOccurrence = occurrence;
else
childDiagramGroup.MinOccurrence = -1;
//try { childDiagramGroup.MinOccurrence = int.Parse(childGroup.minOccurs); }
//catch { childDiagramGroup.MinOccurrence = -1; }
if (int.TryParse(childGroup.maxOccurs, out occurrence))
if (int.TryParse(referenceGroup != null ? referenceGroup.maxOccurs : childGroup.maxOccurs, out occurrence))
childDiagramGroup.MaxOccurrence = occurrence;
else
childDiagramGroup.MaxOccurrence = -1;