def bodyCells(self, row, yAxisParentObj, xFilters, zFilters, yChildrenFirst):
     dimDefaults = self.modelXbrl.qnameDimensionDefaults
     priItemQnameErrors = set()
     dimQnameErrors = set()
     memQnameErrors = set()
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         if yChildrenFirst:
             row = self.bodyCells(row, yAxisHdrObj, xFilters, zFilters, yChildrenFirst)
         if yAxisHdrObj.abstract == "false":
             yAxisPriItemQname = inheritedPrimaryItemQname(self, yAxisHdrObj)
             yAxisExplicitDims = inheritedExplicitDims(self, yAxisHdrObj)
                 
             gridSpacer(self.gridBody, self.dataFirstCol, row, LEFTBORDER)
             # data for columns of row
             ignoreDimValidity = self.ignoreDimValidity.get()
             zPriItemQname = None
             zDims = set()
             for zIndex in self.zFilterIndex:
                 zFilter = zFilters[zIndex]
                 if zFilter[0]: zPriItemQname = zFilter[0] # inherit pri item
                 zDims |= zFilter[1] # or in z-dims
             for i, colFilter in enumerate(xFilters):
                 colPriItemQname = colFilter[0] # y axis pri item
                 if not colPriItemQname: colPriItemQname = yAxisPriItemQname # y axis
                 if not colPriItemQname: colPriItemQname = zPriItemQname # z axis
                 fp = FactPrototype(self,
                                    colPriItemQname,
                                    yAxisExplicitDims | colFilter[1] | zDims)
                 from arelle.ValidateXbrlDimensions import isFactDimensionallyValid
                 value = None
                 objectId = None
                 justify = None
                 for fact in self.modelXbrl.facts:
                     if fact.qname == fp.qname:
                         factDimMem = fact.context.dimMemberQname
                         defaultedDims = _DICT_SET(dimDefaults.keys()) - fp.dimKeys
                         if (all(factDimMem(dim,includeDefaults=True) == mem 
                                 for dim, mem in fp.dims) and
                             all(factDimMem(dim,includeDefaults=True) in (dimDefaults[dim], None)
                                 for dim in defaultedDims)):
                             value = fact.effectiveValue
                             objectId = fact.objectId()
                             justify = "right" if fact.isNumeric else "left"
                             break
                 if value is not None or ignoreDimValidity or isFactDimensionallyValid(self, fp):
                     if objectId is None:
                         objectId = "f{0}".format(len(self.factPrototypes))
                         self.factPrototypes.append(fp)  # for property views
                     gridCell(self.gridBody, self.dataFirstCol + i, row, value, justify=justify, 
                              width=12, # width is in characters, not screen units
                              objectId=objectId, onClick=self.onClick)
                 else:
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, CENTERCELL)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row, RIGHTBORDER)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row, BOTTOMBORDER)
             row += 1
         if not yChildrenFirst:
             row = self.bodyCells(row, yAxisHdrObj, xFilters, zFilters, yChildrenFirst)
     return row
Beispiel #2
0
 def bodyCells(self, row, indent, tupleFacts, xFilters, zFilters):
     for modelTupleFact in tupleFacts:
         if modelTupleFact.concept == self.tupleConcept:
             for i, xColConcept in enumerate(xFilters):
                 fact = self.tupleDescendant(modelTupleFact, xColConcept)
                 if fact is not None:
                     value = fact.effectiveValue
                     objectId = fact.objectId()
                     justify = "right" if fact.isNumeric else "left"
                 else:
                     value = None
                     objectId = None
                 if value is not None:
                     gridCell(self.gridBody,
                              self.dataFirstCol + i,
                              row,
                              value,
                              justify=justify,
                              width=12,
                              objectId=objectId,
                              onClick=self.onClick)
                 else:
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                                CENTERCELL)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                            RIGHTBORDER)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                            BOTTOMBORDER)
             row += 1
     return row
Beispiel #3
0
    def bodyCells(self, row, indent, yAxisParentObj, xFilters, zFilters, yChildrenFirst):
        for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
            yAxisHdrObj = axisMbrRel.toModelObject
            if yChildrenFirst:
                row = self.bodyCells(row, indent + 20, yAxisHdrObj, xFilters, zFilters, yChildrenFirst)
            if yAxisHdrObj.abstract == "false":
                yAxisPriItemQname = self.inheritedPrimaryItemQname(yAxisHdrObj)
                yAxisExplicitDims = self.inheritedExplicitDims(yAxisHdrObj)

                # data for columns of row
                ignoreDimValidity = self.ignoreDimValidity.get()
                zFilter = zFilters[self.zFilterIndex]
                for i, colFilter in enumerate(xFilters):
                    colPriItemQname = colFilter[0]  # y axis pri item
                    if not colPriItemQname:
                        colPriItemQname = yAxisPriItemQname  # y axis
                    if not colPriItemQname:
                        colPriItemQname = zFilter[0]  # z axis
                    fp = FactPrototype(self, colPriItemQname, yAxisExplicitDims | colFilter[1] | zFilter[1])
                    from arelle.ValidateXbrlDimensions import isFactDimensionallyValid

                    value = None
                    objectId = None
                    justify = None
                    for fact in self.modelXbrl.facts:
                        if fact.qname == fp.qname and all(
                            fact.context.dimMemberQname(dim, includeDefaults=True) == mem for dim, mem in fp.dims
                        ):
                            value = fact.effectiveValue
                            objectId = fact.objectId()
                            justify = "right" if fact.isNumeric else "left"
                            break
                    if value is not None or ignoreDimValidity or isFactDimensionallyValid(self, fp):
                        gridCell(
                            self.gridBody,
                            self.dataFirstCol + i,
                            row,
                            value,
                            justify=justify,
                            width=12,
                            objectId=objectId,
                            onClick=self.onClick,
                        )
                    else:
                        gridSpacer(self.gridBody, self.dataFirstCol + i, row, CENTERCELL)
                    gridSpacer(self.gridBody, self.dataFirstCol + i, row, RIGHTBORDER)
                    gridSpacer(self.gridBody, self.dataFirstCol + i, row, BOTTOMBORDER)
                row += 1
            if not yChildrenFirst:
                row = self.bodyCells(row, indent + 20, yAxisHdrObj, xFilters, zFilters, yChildrenFirst)
        return row
 def bodyCells(self, row, indent, yAxisParentObj, xFilters, zFilters, yChildrenFirst):
     for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
         yAxisHdrObj = axisMbrRel.toModelObject
         if yChildrenFirst:
             row = self.bodyCells(row, indent + 20, yAxisHdrObj, xFilters, zFilters, yChildrenFirst)
         if yAxisHdrObj.abstract == "false":
             yAxisPriItemQname = self.inheritedPrimaryItemQname(yAxisHdrObj)
             yAxisExplicitDims = self.inheritedExplicitDims(yAxisHdrObj)
                 
             # data for columns of row
             ignoreDimValidity = self.ignoreDimValidity.get()
             zFilter = zFilters[self.zFilterIndex]
             for i, colFilter in enumerate(xFilters):
                 colPriItemQname = colFilter[0] # y axis pri item
                 if not colPriItemQname: colPriItemQname = yAxisPriItemQname # y axis
                 if not colPriItemQname: colPriItemQname = zFilter[0] # z axis
                 fp = FactPrototype(self,
                                    colPriItemQname,
                                    yAxisExplicitDims | colFilter[1] | zFilter[1])
                 from arelle.ValidateXbrlDimensions import isFactDimensionallyValid
                 value = None
                 objectId = None
                 justify = None
                 for fact in self.modelXbrl.facts:
                     if (fact.qname == fp.qname and
                         all(fact.context.dimMemberQname(dim,includeDefaults=True) == mem 
                             for dim, mem in fp.dims)):
                             value = fact.effectiveValue
                             objectId = fact.objectId()
                             justify = "right" if fact.isNumeric else "left"
                             break
                 if value is not None or ignoreDimValidity or isFactDimensionallyValid(self, fp):
                     gridCell(self.gridBody, self.dataFirstCol + i, row, value, justify=justify, width=12,
                              objectId=objectId, onClick=self.onClick)
                 else:
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, CENTERCELL)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row, RIGHTBORDER)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row, BOTTOMBORDER)
             row += 1
         if not yChildrenFirst:
             row = self.bodyCells(row, indent + 20, yAxisHdrObj, xFilters, zFilters, yChildrenFirst)
     return row
Beispiel #5
0
 def bodyCells(self, row, indent, tupleFacts, xFilters, zFilters):
     for modelTupleFact in tupleFacts:
         if modelTupleFact.concept == self.tupleConcept:
             for i, xColConcept in enumerate(xFilters):
                 fact = self.tupleDescendant(modelTupleFact, xColConcept)
                 if fact:
                     value = fact.effectiveValue
                     objectId = fact.objectId()
                     justify = "right" if fact.isNumeric else "left"
                 else:
                     value = None
                     objectId = None
                 if value is not None:
                     gridCell(self.gridBody, self.dataFirstCol + i, row, value, justify=justify, width=12,
                              objectId=objectId, onClick=self.onClick)
                 else:
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, CENTERCELL)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row, RIGHTBORDER)
                 gridSpacer(self.gridBody, self.dataFirstCol + i, row, BOTTOMBORDER)
             row += 1
     return row
Beispiel #6
0
 def bodyCells(self, row, yParentStructuralNode, xStructuralNodes, zAspects, yChildrenFirst):
     if yParentStructuralNode is not None:
         rendrCntx = getattr(self.modelXbrl, "rendrCntx", None) # none for EU 2010 tables
         dimDefaults = self.modelXbrl.qnameDimensionDefaults
         for yStructuralNode in yParentStructuralNode.childStructuralNodes:
             if yChildrenFirst:
                 row = self.bodyCells(row, yStructuralNode, xStructuralNodes, zAspects, yChildrenFirst)
             if not yStructuralNode.isAbstract:
                 yAspects = defaultdict(set)
                 for aspect in aspectModels[self.aspectModel]:
                     for ruleAspect in aspectRuleAspects.get(aspect, (aspect,)):
                         if yStructuralNode.hasAspect(ruleAspect):
                             if ruleAspect == Aspect.DIMENSIONS:
                                 for dim in (yStructuralNode.aspectValue(Aspect.DIMENSIONS) or emptyList):
                                     yAspects[dim].add(yStructuralNode)
                             else:
                                 yAspects[ruleAspect].add(yStructuralNode)
                     
                 gridSpacer(self.gridBody, self.dataFirstCol, row, LEFTBORDER)
                 # data for columns of row
                 ignoreDimValidity = self.ignoreDimValidity.get()
                 for i, xStructuralNode in enumerate(xStructuralNodes):
                     xAspects = defaultdict(set)
                     for aspect in aspectModels[self.aspectModel]:
                         for ruleAspect in aspectRuleAspects.get(aspect, (aspect,)):
                             if xStructuralNode.hasAspect(ruleAspect):
                                 if ruleAspect == Aspect.DIMENSIONS:
                                     for dim in (xStructuralNode.aspectValue(Aspect.DIMENSIONS) or emptyList):
                                         xAspects[dim].add(xStructuralNode)
                                 else:
                                     xAspects[ruleAspect].add(xStructuralNode)
                     cellAspectValues = {}
                     matchableAspects = set()
                     for aspect in _DICT_SET(xAspects.keys()) | _DICT_SET(yAspects.keys()) | _DICT_SET(zAspects.keys()):
                         aspectValue = inheritedAspectValue(self, aspect, xAspects, yAspects, zAspects, xStructuralNode, yStructuralNode)
                         if dimDefaults.get(aspect) != aspectValue: # don't include defaulted dimensions
                             cellAspectValues[aspect] = aspectValue
                         matchableAspects.add(aspectModelAspect.get(aspect,aspect)) #filterable aspect from rule aspect
                     cellDefaultedDims = _DICT_SET(dimDefaults) - _DICT_SET(cellAspectValues.keys())
                     priItemQname = cellAspectValues.get(Aspect.CONCEPT)
                         
                     concept = self.modelXbrl.qnameConcepts.get(priItemQname)
                     conceptNotAbstract = concept is None or not concept.isAbstract
                     from arelle.ValidateXbrlDimensions import isFactDimensionallyValid
                     value = None
                     objectId = None
                     justify = None
                     fp = FactPrototype(self, cellAspectValues)
                     if conceptNotAbstract:
                         # reduce set of matchable facts to those with pri item qname and have dimension aspects
                         facts = self.modelXbrl.factsByQname[priItemQname] if priItemQname else self.modelXbrl.factsInInstance
                         for aspect in matchableAspects:  # trim down facts with explicit dimensions match or just present
                             if isinstance(aspect, QName):
                                 aspectValue = cellAspectValues.get(aspect, None)
                                 if isinstance(aspectValue, ModelDimensionValue):
                                     if aspectValue.isExplicit:
                                         dimMemQname = aspectValue.memberQname # match facts with this explicit value
                                     else:
                                         dimMemQname = None  # match facts that report this dimension
                                 elif isinstance(aspectValue, QName): 
                                     dimMemQname = aspectValue  # match facts that have this explicit value
                                 else:
                                     dimMemQname = None # match facts that report this dimension
                                 facts = facts & self.modelXbrl.factsByDimMemQname(aspect, dimMemQname)
                         for fact in facts:
                             if (all(aspectMatches(rendrCntx, fact, fp, aspect) 
                                     for aspect in matchableAspects) and
                                 all(fact.context.dimMemberQname(dim,includeDefaults=True) in (dimDefaults[dim], None)
                                     for dim in cellDefaultedDims)):
                                 if yStructuralNode.hasValueExpression(xStructuralNode):
                                     value = yStructuralNode.evalValueExpression(fact, xStructuralNode)
                                 else:
                                     value = fact.effectiveValue
                                 objectId = fact.objectId()
                                 justify = "right" if fact.isNumeric else "left"
                                 break
                     if (conceptNotAbstract and
                         (value is not None or ignoreDimValidity or isFactDimensionallyValid(self, fp))):
                         if objectId is None:
                             objectId = "f{0}".format(len(self.factPrototypes))
                             self.factPrototypes.append(fp)  # for property views
                         gridCell(self.gridBody, self.dataFirstCol + i, row, value, justify=justify, 
                                  width=12, # width is in characters, not screen units
                                  objectId=objectId, onClick=self.onClick)
                     else:
                         fp.clear()  # dereference
                         gridSpacer(self.gridBody, self.dataFirstCol + i, row, CENTERCELL)
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, RIGHTBORDER)
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, BOTTOMBORDER)
                 row += 1
             if not yChildrenFirst:
                 row = self.bodyCells(row, yStructuralNode, xStructuralNodes, zAspects, yChildrenFirst)
         return row
    def bodyCells(self, row, yParentStructuralNode, xStructuralNodes, zAspects,
                  yChildrenFirst):
        if yParentStructuralNode is not None:
            rendrCntx = getattr(self.modelXbrl, "rendrCntx",
                                None)  # none for EU 2010 tables
            dimDefaults = self.modelXbrl.qnameDimensionDefaults
            for yStructuralNode in yParentStructuralNode.childStructuralNodes:
                if yChildrenFirst:
                    row = self.bodyCells(row, yStructuralNode,
                                         xStructuralNodes, zAspects,
                                         yChildrenFirst)
                if not yStructuralNode.isAbstract:
                    yAspects = defaultdict(set)
                    for aspect in aspectModels[self.aspectModel]:
                        for ruleAspect in aspectRuleAspects.get(
                                aspect, (aspect, )):
                            if yStructuralNode.hasAspect(ruleAspect):
                                if ruleAspect == Aspect.DIMENSIONS:
                                    for dim in (yStructuralNode.aspectValue(
                                            Aspect.DIMENSIONS) or emptyList):
                                        yAspects[dim].add(yStructuralNode)
                                else:
                                    yAspects[ruleAspect].add(yStructuralNode)

                    gridSpacer(self.gridBody, self.dataFirstCol, row,
                               LEFTBORDER)
                    # data for columns of row
                    ignoreDimValidity = self.ignoreDimValidity.get()
                    for i, xStructuralNode in enumerate(xStructuralNodes):
                        xAspects = defaultdict(set)
                        for aspect in aspectModels[self.aspectModel]:
                            for ruleAspect in aspectRuleAspects.get(
                                    aspect, (aspect, )):
                                if xStructuralNode.hasAspect(ruleAspect):
                                    if ruleAspect == Aspect.DIMENSIONS:
                                        for dim in (
                                                xStructuralNode.aspectValue(
                                                    Aspect.DIMENSIONS)
                                                or emptyList):
                                            xAspects[dim].add(xStructuralNode)
                                    else:
                                        xAspects[ruleAspect].add(
                                            xStructuralNode)
                        cellAspectValues = {}
                        matchableAspects = set()
                        for aspect in _DICT_SET(xAspects.keys()) | _DICT_SET(
                                yAspects.keys()) | _DICT_SET(zAspects.keys()):
                            aspectValue = inheritedAspectValue(
                                self, aspect, xAspects, yAspects, zAspects,
                                xStructuralNode, yStructuralNode)
                            if dimDefaults.get(
                                    aspect
                            ) != aspectValue:  # don't include defaulted dimensions
                                cellAspectValues[aspect] = aspectValue
                            matchableAspects.add(
                                aspectModelAspect.get(aspect, aspect)
                            )  #filterable aspect from rule aspect
                        cellDefaultedDims = _DICT_SET(dimDefaults) - _DICT_SET(
                            cellAspectValues.keys())
                        priItemQname = cellAspectValues.get(Aspect.CONCEPT)

                        concept = self.modelXbrl.qnameConcepts.get(
                            priItemQname)
                        conceptNotAbstract = concept is None or not concept.isAbstract
                        from arelle.ValidateXbrlDimensions import isFactDimensionallyValid
                        value = None
                        objectId = None
                        justify = None
                        fp = FactPrototype(self, cellAspectValues)
                        if conceptNotAbstract:
                            # reduce set of matchable facts to those with pri item qname and have dimension aspects
                            facts = self.modelXbrl.factsByQname[
                                priItemQname] if priItemQname else self.modelXbrl.factsInInstance
                            for aspect in matchableAspects:  # trim down facts with explicit dimensions match or just present
                                if isinstance(aspect, QName):
                                    aspectValue = cellAspectValues.get(
                                        aspect, None)
                                    if isinstance(aspectValue,
                                                  ModelDimensionValue):
                                        if aspectValue.isExplicit:
                                            dimMemQname = aspectValue.memberQname  # match facts with this explicit value
                                        else:
                                            dimMemQname = None  # match facts that report this dimension
                                    elif isinstance(aspectValue, QName):
                                        dimMemQname = aspectValue  # match facts that have this explicit value
                                    else:
                                        dimMemQname = None  # match facts that report this dimension
                                    facts = facts & self.modelXbrl.factsByDimMemQname(
                                        aspect, dimMemQname)
                            for fact in facts:
                                if (all(
                                        aspectMatches(rendrCntx, fact, fp,
                                                      aspect)
                                        for aspect in matchableAspects)
                                        and all(
                                            fact.context.dimMemberQname(
                                                dim, includeDefaults=True) in (
                                                    dimDefaults[dim], None)
                                            for dim in cellDefaultedDims)):
                                    if yStructuralNode.hasValueExpression(
                                            xStructuralNode):
                                        value = yStructuralNode.evalValueExpression(
                                            fact, xStructuralNode)
                                    else:
                                        value = fact.effectiveValue
                                    objectId = fact.objectId()
                                    justify = "right" if fact.isNumeric else "left"
                                    break
                        if (conceptNotAbstract
                                and (value is not None or ignoreDimValidity
                                     or isFactDimensionallyValid(self, fp))):
                            if objectId is None:
                                objectId = "f{0}".format(
                                    len(self.factPrototypes))
                                self.factPrototypes.append(
                                    fp)  # for property views
                            gridCell(
                                self.gridBody,
                                self.dataFirstCol + i,
                                row,
                                value,
                                justify=justify,
                                width=
                                12,  # width is in characters, not screen units
                                objectId=objectId,
                                onClick=self.onClick)
                        else:
                            fp.clear()  # dereference
                            gridSpacer(self.gridBody, self.dataFirstCol + i,
                                       row, CENTERCELL)
                        gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                                   RIGHTBORDER)
                        gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                                   BOTTOMBORDER)
                    row += 1
                if not yChildrenFirst:
                    row = self.bodyCells(row, yStructuralNode,
                                         xStructuralNodes, zAspects,
                                         yChildrenFirst)
            return row
Beispiel #8
0
 def bodyCells(self, row, yParentStructuralNode, xStructuralNodes, zAspectStructuralNodes, yChildrenFirst):
     if yParentStructuralNode is not None:
         rendrCntx = getattr(self.modelXbrl, "rendrCntx", None) # none for EU 2010 tables
         dimDefaults = self.modelXbrl.qnameDimensionDefaults
         for yStructuralNode in yParentStructuralNode.childStructuralNodes:
             if yChildrenFirst:
                 row = self.bodyCells(row, yStructuralNode, xStructuralNodes, zAspectStructuralNodes, yChildrenFirst)
             if not (yStructuralNode.isAbstract or 
                     (yStructuralNode.childStructuralNodes and
                      not isinstance(yStructuralNode.definitionNode, (ModelClosedDefinitionNode, ModelEuAxisCoord)))) and yStructuralNode.isLabeled:
                 isEntryPrototype = yStructuralNode.isEntryPrototype(default=False) # row to enter open aspects
                 yAspectStructuralNodes = defaultdict(set)
                 for aspect in aspectModels[self.aspectModel]:
                     if yStructuralNode.hasAspect(aspect):
                         if aspect == Aspect.DIMENSIONS:
                             for dim in (yStructuralNode.aspectValue(Aspect.DIMENSIONS) or emptyList):
                                 yAspectStructuralNodes[dim].add(yStructuralNode)
                         else:
                             yAspectStructuralNodes[aspect].add(yStructuralNode)
                 yTagSelectors = yStructuralNode.tagSelectors
                 gridSpacer(self.gridBody, self.dataFirstCol, row, LEFTBORDER)
                 # data for columns of row
                 #print ("row " + str(row) + "yNode " + yStructuralNode.definitionNode.objectId() )
                 ignoreDimValidity = self.ignoreDimValidity.get()
                 for i, xStructuralNode in enumerate(xStructuralNodes):
                     xAspectStructuralNodes = defaultdict(set)
                     for aspect in aspectModels[self.aspectModel]:
                         if xStructuralNode.hasAspect(aspect):
                             if aspect == Aspect.DIMENSIONS:
                                 for dim in (xStructuralNode.aspectValue(Aspect.DIMENSIONS) or emptyList):
                                     xAspectStructuralNodes[dim].add(xStructuralNode)
                             else:
                                 xAspectStructuralNodes[aspect].add(xStructuralNode)
                     cellTagSelectors = yTagSelectors | xStructuralNode.tagSelectors
                     cellAspectValues = {}
                     matchableAspects = set()
                     for aspect in _DICT_SET(xAspectStructuralNodes.keys()) | _DICT_SET(yAspectStructuralNodes.keys()) | _DICT_SET(zAspectStructuralNodes.keys()):
                         aspectValue = xStructuralNode.inheritedAspectValue(yStructuralNode,
                                            self, aspect, cellTagSelectors, 
                                            xAspectStructuralNodes, yAspectStructuralNodes, zAspectStructuralNodes)
                         # value is None for a dimension whose value is to be not reported in this slice
                         if (isinstance(aspect, _INT) or  # not a dimension
                             dimDefaults.get(aspect) != aspectValue or # explicit dim defaulted will equal the value
                             aspectValue is not None): # typed dim absent will be none
                             cellAspectValues[aspect] = aspectValue
                         matchableAspects.add(aspectModelAspect.get(aspect,aspect)) #filterable aspect from rule aspect
                     cellDefaultedDims = _DICT_SET(dimDefaults) - _DICT_SET(cellAspectValues.keys())
                     priItemQname = cellAspectValues.get(Aspect.CONCEPT)
                         
                     concept = self.modelXbrl.qnameConcepts.get(priItemQname)
                     conceptNotAbstract = concept is None or not concept.isAbstract
                     from arelle.ValidateXbrlDimensions import isFactDimensionallyValid
                     value = None
                     objectId = None
                     justify = None
                     fp = FactPrototype(self, cellAspectValues)
                     if conceptNotAbstract:
                         # reduce set of matchable facts to those with pri item qname and have dimension aspects
                         facts = self.modelXbrl.factsByQname[priItemQname] if priItemQname else self.modelXbrl.factsInInstance
                         for aspect in matchableAspects:  # trim down facts with explicit dimensions match or just present
                             if isinstance(aspect, QName):
                                 aspectValue = cellAspectValues.get(aspect, None)
                                 if isinstance(aspectValue, ModelDimensionValue):
                                     if aspectValue.isExplicit:
                                         dimMemQname = aspectValue.memberQname # match facts with this explicit value
                                     else:
                                         dimMemQname = None  # match facts that report this dimension
                                 elif isinstance(aspectValue, QName): 
                                     dimMemQname = aspectValue  # match facts that have this explicit value
                                 elif aspectValue is None: # match typed dims that don't report this value
                                     dimMemQname = ModelXbrl.DEFAULT
                                 else:
                                     dimMemQname = None # match facts that report this dimension
                                 facts = facts & self.modelXbrl.factsByDimMemQname(aspect, dimMemQname)
                         for fact in facts:
                             if (all(aspectMatches(rendrCntx, fact, fp, aspect) 
                                     for aspect in matchableAspects) and
                                 all(fact.context.dimMemberQname(dim,includeDefaults=True) in (dimDefaults[dim], None)
                                     for dim in cellDefaultedDims)):
                                 if yStructuralNode.hasValueExpression(xStructuralNode):
                                     value = yStructuralNode.evalValueExpression(fact, xStructuralNode)
                                 else:
                                     value = fact.effectiveValue
                                 objectId = fact.objectId()
                                 justify = "right" if fact.isNumeric else "left"
                                 break
                     if (conceptNotAbstract and
                         (value is not None or ignoreDimValidity or isFactDimensionallyValid(self, fp) or
                          isEntryPrototype)):
                         if objectId is None:
                             objectId = "f{0}".format(len(self.factPrototypes))
                             self.factPrototypes.append(fp)  # for property views
                             for aspect, aspectValue in cellAspectValues.items():
                                 if isinstance(aspectValue, str) and aspectValue.startswith(OPEN_ASPECT_ENTRY_SURROGATE):
                                     self.factPrototypeAspectEntryObjectIds[objectId].add(aspectValue) 
                         gridCell(self.gridBody, self.dataFirstCol + i, row, value, justify=justify, 
                                  width=12, # width is in characters, not screen units
                                  objectId=objectId, onClick=self.onClick)
                     else:
                         fp.clear()  # dereference
                         gridSpacer(self.gridBody, self.dataFirstCol + i, row, CENTERCELL)
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, RIGHTBORDER)
                     gridSpacer(self.gridBody, self.dataFirstCol + i, row, BOTTOMBORDER)
                 row += 1
             if not yChildrenFirst:
                 row = self.bodyCells(row, yStructuralNode, xStructuralNodes, zAspectStructuralNodes, yChildrenFirst)
         return row
Beispiel #9
0
    def bodyCells(self, row, yAxisParentObj, xFilters, zFilters,
                  yChildrenFirst):
        dimDefaults = self.modelXbrl.qnameDimensionDefaults
        priItemQnameErrors = set()
        dimQnameErrors = set()
        memQnameErrors = set()
        for axisMbrRel in self.axisMbrRelSet.fromModelObject(yAxisParentObj):
            yAxisHdrObj = axisMbrRel.toModelObject
            if yChildrenFirst:
                row = self.bodyCells(row, yAxisHdrObj, xFilters, zFilters,
                                     yChildrenFirst)
            if yAxisHdrObj.abstract == "false":
                yAxisPriItemQname = inheritedPrimaryItemQname(
                    self, yAxisHdrObj)
                yAxisExplicitDims = inheritedExplicitDims(self, yAxisHdrObj)

                gridSpacer(self.gridBody, self.dataFirstCol, row, LEFTBORDER)
                # data for columns of row
                ignoreDimValidity = self.ignoreDimValidity.get()
                zPriItemQname = None
                zDims = set()
                for zIndex in self.zFilterIndex:
                    zFilter = zFilters[zIndex]
                    if zFilter[0]:
                        zPriItemQname = zFilter[0]  # inherit pri item
                    zDims |= zFilter[1]  # or in z-dims
                for i, colFilter in enumerate(xFilters):
                    colPriItemQname = colFilter[0]  # y axis pri item
                    if not colPriItemQname:
                        colPriItemQname = yAxisPriItemQname  # y axis
                    if not colPriItemQname:
                        colPriItemQname = zPriItemQname  # z axis
                    fp = FactPrototype(
                        self, colPriItemQname,
                        yAxisExplicitDims | colFilter[1] | zDims)
                    from arelle.ValidateXbrlDimensions import isFactDimensionallyValid
                    value = None
                    objectId = None
                    justify = None
                    for fact in self.modelXbrl.facts:
                        if fact.qname == fp.qname:
                            factDimMem = fact.context.dimMemberQname
                            defaultedDims = _DICT_SET(
                                dimDefaults.keys()) - fp.dimKeys
                            if (all(
                                    factDimMem(dim, includeDefaults=True) ==
                                    mem for dim, mem in fp.dims) and all(
                                        factDimMem(dim, includeDefaults=True)
                                        in (dimDefaults[dim], None)
                                        for dim in defaultedDims)):
                                value = fact.effectiveValue
                                objectId = fact.objectId()
                                justify = "right" if fact.isNumeric else "left"
                                break
                    if value is not None or ignoreDimValidity or isFactDimensionallyValid(
                            self, fp):
                        if objectId is None:
                            objectId = "f{0}".format(len(self.factPrototypes))
                            self.factPrototypes.append(
                                fp)  # for property views
                        gridCell(
                            self.gridBody,
                            self.dataFirstCol + i,
                            row,
                            value,
                            justify=justify,
                            width=12,  # width is in characters, not screen units
                            objectId=objectId,
                            onClick=self.onClick)
                    else:
                        gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                                   CENTERCELL)
                    gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                               RIGHTBORDER)
                    gridSpacer(self.gridBody, self.dataFirstCol + i, row,
                               BOTTOMBORDER)
                row += 1
            if not yChildrenFirst:
                row = self.bodyCells(row, yAxisHdrObj, xFilters, zFilters,
                                     yChildrenFirst)
        return row