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
def zAxis(self, row, zAxisObj, zFilters): for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj): zAxisObj = axisMbrRel.toModelObject zFilters.append((inheritedPrimaryItemQname(self, zAxisObj), inheritedExplicitDims(self, zAxisObj), zAxisObj.genLabel(lang=self.lang))) priorZfilter = len(zFilters) self.zAxis(None, zAxisObj, zFilters) if row is not None: etree.SubElement(self.rowElts[row-1], "{http://www.w3.org/1999/xhtml}th", attrib={"class":"zAxisHdr", "style":"max-width:200pt;text-align:left;border-bottom:.5pt solid windowtext", "colspan": str(self.dataCols)} # "2"} ).text = zAxisObj.genLabel(lang=self.lang) nextZfilter = len(zFilters) if nextZfilter > priorZfilter: # no combo box choices nested ''' self.combobox = gridCombobox( self.gridColHdr, self.dataFirstCol + 2, row, values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]], selectindex=self.zFilterIndex, comboboxselected=self.comboBoxSelected) gridBorder(self.gridColHdr, self.dataFirstCol + 2, row, RIGHTBORDER) ''' row += 1 if not zFilters: zFilters.append( (None,set()) ) # allow empty set operations
def bodyCells(self, row, yAxisParentObj, xFilters, zFilters, yChildrenFirst): dimDefaults = self.modelXbrl.qnameDimensionDefaults 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) # 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 = 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): etree.SubElement(self.rowElts[row - 1], "{http://www.w3.org/1999/xhtml}td", attrib={"class":"cell", "style":"text-align:{0};width:8em".format(justify)} ).text = value if value else "\u00A0" else: etree.SubElement(self.rowElts[row - 1], "{http://www.w3.org/1999/xhtml}td", attrib={"class":"blockedCell", "style":"text-align:{0};width:8em".format(justify)} ).text = "\u00A0\u00A0" row += 1 if not yChildrenFirst: row = self.bodyCells(row, yAxisHdrObj, xFilters, zFilters, yChildrenFirst) return row
def zAxis(self, row, zAxisObj, zFilters): priorZfilter = len(zFilters) for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj): zAxisObj = axisMbrRel.toModelObject zFilters.append( (inheritedPrimaryItemQname(self, zAxisObj), inheritedExplicitDims(self, zAxisObj), zAxisObj.genLabel(lang=self.lang), zAxisObj.objectId())) self.zAxis(None, zAxisObj, zFilters) if row is not None: nextZfilter = len(zFilters) if nextZfilter > priorZfilter + 1: # combo box, use header on zAxis label = axisMbrRel.fromModelObject.genLabel(lang=self.lang) else: # no combo box, use label on coord label = zAxisObj.genLabel(lang=self.lang) etree.SubElement( self.rowElts[row - 1], "{http://www.w3.org/1999/xhtml}th", attrib={ "class": "zAxisHdr", "style": "max-width:200pt;text-align:left;border-bottom:.5pt solid windowtext", "colspan": str(self.dataCols) } # "2"} ).text = label if nextZfilter > priorZfilter + 1: # multiple choices, use combo box zIndex = row - 1 selectIndex = self.zComboBoxIndex[zIndex] ''' combobox = gridCombobox( self.gridColHdr, self.dataFirstCol + 2, row, values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]], selectindex=selectIndex, columnspan=2, comboboxselected=self.comboBoxSelected) combobox.zIndex = zIndex ''' zFilterIndex = priorZfilter + selectIndex self.zFilterIndex[zIndex] = zFilterIndex row += 1 if not zFilters: zFilters.append((None, set())) # allow empty set operations
def zAxis(self, row, zAxisObj, zFilters): priorZfilter = len(zFilters) for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj): zAxisObj = axisMbrRel.toModelObject zFilters.append((inheritedPrimaryItemQname(self, zAxisObj), inheritedExplicitDims(self, zAxisObj), zAxisObj.genLabel(lang=self.lang), zAxisObj.objectId())) self.zAxis(None, zAxisObj, zFilters) if row is not None: nextZfilter = len(zFilters) gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2) gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER) gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2) if nextZfilter > priorZfilter + 1: # combo box, use header on zAxis label = axisMbrRel.fromModelObject.genLabel(lang=self.lang) else: # no combo box, use label on coord label = zAxisObj.genLabel(lang=self.lang) hdr = gridHdr(self.gridColHdr, self.dataFirstCol, row, label, anchor="w", columnspan=2, wraplength=200, # in screen units objectId=zAxisObj.objectId(), onClick=self.onClick) if nextZfilter > priorZfilter + 1: # multiple choices, use combo box zIndex = row - 1 selectIndex = self.zComboBoxIndex[zIndex] combobox = gridCombobox( self.gridColHdr, self.dataFirstCol + 2, row, values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]], selectindex=selectIndex, columnspan=2, comboboxselected=self.comboBoxSelected) combobox.zIndex = zIndex zFilterIndex = priorZfilter + selectIndex self.zFilterIndex[zIndex] = zFilterIndex combobox.objectId = hdr.objectId = zFilters[zFilterIndex][3] gridBorder(self.gridColHdr, self.dataFirstCol + 3, row, RIGHTBORDER) row += 1 if not zFilters: zFilters.append( (None,set()) ) # allow empty set operations
def zAxis(self, row, zAxisObj, zFilters): priorZfilter = len(zFilters) for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj): zAxisObj = axisMbrRel.toModelObject zFilters.append((inheritedPrimaryItemQname(self, zAxisObj), inheritedExplicitDims(self, zAxisObj), zAxisObj.genLabel(lang=self.lang), zAxisObj.objectId())) self.zAxis(None, zAxisObj, zFilters) if row is not None: nextZfilter = len(zFilters) if nextZfilter > priorZfilter + 1: # combo box, use header on zAxis label = axisMbrRel.fromModelObject.genLabel(lang=self.lang) else: # no combo box, use label on coord label = zAxisObj.genLabel(lang=self.lang) etree.SubElement(self.rowElts[row-1], "{http://www.w3.org/1999/xhtml}th", attrib={"class":"zAxisHdr", "style":"max-width:200pt;text-align:left;border-bottom:.5pt solid windowtext", "colspan": str(self.dataCols)} # "2"} ).text = label if nextZfilter > priorZfilter + 1: # multiple choices, use combo box zIndex = row - 1 selectIndex = self.zComboBoxIndex[zIndex] ''' combobox = gridCombobox( self.gridColHdr, self.dataFirstCol + 2, row, values=[zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter]], selectindex=selectIndex, columnspan=2, comboboxselected=self.comboBoxSelected) combobox.zIndex = zIndex ''' zFilterIndex = priorZfilter + selectIndex self.zFilterIndex[zIndex] = zFilterIndex row += 1 if not zFilters: zFilters.append( (None,set()) ) # allow empty set operations
def xAxis(self, leftCol, topRow, rowBelow, xAxisParentObj, xFilters, childrenFirst, renderNow, atTop): parentRow = rowBelow noDescendants = True rightCol = leftCol widthToSpanParent = 0 sideBorder = not xFilters if atTop and sideBorder and childrenFirst: gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow) for axisMbrRel in self.axisMbrRelSet.fromModelObject(xAxisParentObj): noDescendants = False xAxisHdrObj = axisMbrRel.toModelObject rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xAxisHdrObj, xFilters, # nested items before totals childrenFirst, childrenFirst, False) if row - 1 < parentRow: parentRow = row - 1 #if not leafNode: # rightCol -= 1 nonAbstract = xAxisHdrObj.abstract == "false" if nonAbstract: width += 100 # width for this label, in screen units widthToSpanParent += width label = xAxisHdrObj.genLabel(lang=self.lang) if childrenFirst: thisCol = rightCol sideBorder = RIGHTBORDER else: thisCol = leftCol sideBorder = LEFTBORDER if renderNow: columnspan = (rightCol - leftCol + (1 if nonAbstract else 0)) gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan) gridBorder(self.gridColHdr, leftCol, topRow, sideBorder, columnspan=columnspan, rowspan=(rowBelow - topRow + 1) ) gridHdr(self.gridColHdr, leftCol, topRow, label if label else " ", anchor="center", columnspan=(rightCol - leftCol + (1 if nonAbstract else 0)), rowspan=(row - topRow + 1) if leafNode else 1, wraplength=width, # screen units objectId=xAxisHdrObj.objectId(), onClick=self.onClick) if nonAbstract: if self.colHdrDocRow: gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, TOPBORDER) gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, sideBorder) gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, xAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation", lang=self.lang), anchor="center", wraplength=100, # screen units objectId=xAxisHdrObj.objectId(), onClick=self.onClick) if self.colHdrCodeRow: gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER) gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder) gridHdr(self.gridColHdr, thisCol, self.dataFirstRow - 1, xAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code"), anchor="center", wraplength=100, # screen units objectId=xAxisHdrObj.objectId(), onClick=self.onClick) gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER) xFilters.append((inheritedPrimaryItemQname(self, xAxisHdrObj), inheritedExplicitDims(self, xAxisHdrObj))) if nonAbstract: rightCol += 1 if renderNow and not childrenFirst: self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xAxisHdrObj, xFilters, childrenFirst, True, False) # render on this pass leftCol = rightCol if atTop and sideBorder and not childrenFirst: gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow) return (rightCol, parentRow, widthToSpanParent, noDescendants)
def xAxis(self, leftCol, topRow, rowBelow, xAxisParentObj, xFilters, childrenFirst, renderNow, atTop): parentRow = rowBelow noDescendants = True rightCol = leftCol widthToSpanParent = 0 sideBorder = not xFilters for axisMbrRel in self.axisMbrRelSet.fromModelObject(xAxisParentObj): noDescendants = False xAxisHdrObj = axisMbrRel.toModelObject rightCol, row, width, leafNode = self.xAxis(leftCol, topRow + 1, rowBelow, xAxisHdrObj, xFilters, # nested items before totals childrenFirst, childrenFirst, False) if row - 1 < parentRow: parentRow = row - 1 #if not leafNode: # rightCol -= 1 nonAbstract = xAxisHdrObj.abstract == "false" if nonAbstract: width += 100 # width for this label widthToSpanParent += width label = xAxisHdrObj.genLabel(lang=self.lang) if childrenFirst: thisCol = rightCol else: thisCol = leftCol #print ( "thisCol {0} leftCol {1} rightCol {2} topRow{3} renderNow {4} label {5}".format(thisCol, leftCol, rightCol, topRow, renderNow, label)) if renderNow: columnspan = (rightCol - leftCol + (1 if nonAbstract else 0)) if rightCol == self.dataFirstCol + self.dataCols - 1: edgeBorder = "border-right:.5pt solid windowtext;" else: edgeBorder = "" attrib = {"class":"xAxisHdr", "style":"text-align:center;max-width:{0}pt;{1}".format(width,edgeBorder)} colspan = rightCol - leftCol + (1 if nonAbstract else 0) if colspan > 1: attrib["colspan"] = str(colspan) if leafNode and row > topRow: attrib["rowspan"] = str(row - topRow + 1) elt = etree.Element("{http://www.w3.org/1999/xhtml}th", attrib=attrib) elt.text = label if label else "\u00A0" #produces self.rowElts[topRow-1].insert(leftCol,elt) if nonAbstract: if colspan > 1 and rowBelow > topRow: # add spanned left leg portion one row down attrib= {"class":"xAxisSpanLeg", "rowspan": str(rowBelow - row)} if edgeBorder: attrib["style"] = edgeBorder elt = etree.Element("{http://www.w3.org/1999/xhtml}th", attrib=attrib) elt.text = "\u00A0" if childrenFirst: self.rowElts[topRow].append(elt) else: self.rowElts[topRow].insert(leftCol,elt) if self.colHdrDocRow: doc = xAxisHdrObj.genLabel(role="http://www.xbrl.org/2008/role/documentation", lang=self.lang) elt = etree.Element("{http://www.w3.org/1999/xhtml}th", attrib={"class":"xAxisHdr", "style":"text-align:center;max-width:100pt;{0}".format(edgeBorder)}) elt.text = doc if doc else "\u00A0" self.rowElts[self.dataFirstRow - 2 - self.rowHdrCodeCol].insert(thisCol,elt) if self.colHdrCodeRow: code = xAxisHdrObj.genLabel(role="http://www.eurofiling.info/role/2010/coordinate-code") elt = etree.Element("{http://www.w3.org/1999/xhtml}th", attrib={"class":"xAxisHdr", "style":"text-align:center;max-width:100pt;{0}".format(edgeBorder)}) self.rowElts[self.dataFirstRow - 2].insert(thisCol,elt) elt.text = code if code else "\u00A0" xFilters.append((inheritedPrimaryItemQname(self, xAxisHdrObj), inheritedExplicitDims(self, xAxisHdrObj))) if nonAbstract: rightCol += 1 if renderNow and not childrenFirst: self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xAxisHdrObj, xFilters, childrenFirst, True, False) # render on this pass leftCol = rightCol return (rightCol, parentRow, widthToSpanParent, noDescendants)
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
def xAxis(self, leftCol, topRow, rowBelow, xAxisParentObj, xFilters, childrenFirst, renderNow, atTop): parentRow = rowBelow noDescendants = True rightCol = leftCol widthToSpanParent = 0 sideBorder = not xFilters if atTop and sideBorder and childrenFirst: gridBorder(self.gridColHdr, self.dataFirstCol, 1, LEFTBORDER, rowspan=self.dataFirstRow) for axisMbrRel in self.axisMbrRelSet.fromModelObject(xAxisParentObj): noDescendants = False xAxisHdrObj = axisMbrRel.toModelObject rightCol, row, width, leafNode = self.xAxis( leftCol, topRow + 1, rowBelow, xAxisHdrObj, xFilters, # nested items before totals childrenFirst, childrenFirst, False) if row - 1 < parentRow: parentRow = row - 1 #if not leafNode: # rightCol -= 1 nonAbstract = xAxisHdrObj.abstract == "false" if nonAbstract: width += 100 # width for this label, in screen units widthToSpanParent += width label = xAxisHdrObj.genLabel(lang=self.lang) if childrenFirst: thisCol = rightCol sideBorder = RIGHTBORDER else: thisCol = leftCol sideBorder = LEFTBORDER if renderNow: columnspan = (rightCol - leftCol + (1 if nonAbstract else 0)) gridBorder(self.gridColHdr, leftCol, topRow, TOPBORDER, columnspan=columnspan) gridBorder(self.gridColHdr, leftCol, topRow, sideBorder, columnspan=columnspan, rowspan=(rowBelow - topRow + 1)) gridHdr( self.gridColHdr, leftCol, topRow, label if label else " ", anchor="center", columnspan=(rightCol - leftCol + (1 if nonAbstract else 0)), rowspan=(row - topRow + 1) if leafNode else 1, wraplength=width, # screen units objectId=xAxisHdrObj.objectId(), onClick=self.onClick) if nonAbstract: if self.colHdrDocRow: gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, TOPBORDER) gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, sideBorder) gridHdr( self.gridColHdr, thisCol, self.dataFirstRow - 1 - self.rowHdrCodeCol, xAxisHdrObj.genLabel( role= "http://www.xbrl.org/2008/role/documentation", lang=self.lang), anchor="center", wraplength=100, # screen units objectId=xAxisHdrObj.objectId(), onClick=self.onClick) if self.colHdrCodeRow: gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, TOPBORDER) gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, sideBorder) gridHdr( self.gridColHdr, thisCol, self.dataFirstRow - 1, xAxisHdrObj.genLabel( role= "http://www.eurofiling.info/role/2010/coordinate-code" ), anchor="center", wraplength=100, # screen units objectId=xAxisHdrObj.objectId(), onClick=self.onClick) gridBorder(self.gridColHdr, thisCol, self.dataFirstRow - 1, BOTTOMBORDER) xFilters.append( (inheritedPrimaryItemQname(self, xAxisHdrObj), inheritedExplicitDims(self, xAxisHdrObj))) if nonAbstract: rightCol += 1 if renderNow and not childrenFirst: self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xAxisHdrObj, xFilters, childrenFirst, True, False) # render on this pass leftCol = rightCol if atTop and sideBorder and not childrenFirst: gridBorder(self.gridColHdr, rightCol - 1, 1, RIGHTBORDER, rowspan=self.dataFirstRow) return (rightCol, parentRow, widthToSpanParent, noDescendants)
def zAxis(self, row, zAxisObj, zFilters): priorZfilter = len(zFilters) for axisMbrRel in self.axisMbrRelSet.fromModelObject(zAxisObj): zAxisObj = axisMbrRel.toModelObject zFilters.append( (inheritedPrimaryItemQname(self, zAxisObj), inheritedExplicitDims(self, zAxisObj), zAxisObj.genLabel(lang=self.lang), zAxisObj.objectId())) self.zAxis(None, zAxisObj, zFilters) if row is not None: nextZfilter = len(zFilters) gridBorder(self.gridColHdr, self.dataFirstCol, row, TOPBORDER, columnspan=2) gridBorder(self.gridColHdr, self.dataFirstCol, row, LEFTBORDER) gridBorder(self.gridColHdr, self.dataFirstCol, row, RIGHTBORDER, columnspan=2) if nextZfilter > priorZfilter + 1: # combo box, use header on zAxis label = axisMbrRel.fromModelObject.genLabel(lang=self.lang) else: # no combo box, use label on coord label = zAxisObj.genLabel(lang=self.lang) hdr = gridHdr( self.gridColHdr, self.dataFirstCol, row, label, anchor="w", columnspan=2, wraplength=200, # in screen units objectId=zAxisObj.objectId(), onClick=self.onClick) if nextZfilter > priorZfilter + 1: # multiple choices, use combo box zIndex = row - 1 selectIndex = self.zComboBoxIndex[zIndex] combobox = gridCombobox( self.gridColHdr, self.dataFirstCol + 2, row, values=[ zFilter[2] for zFilter in zFilters[priorZfilter:nextZfilter] ], selectindex=selectIndex, columnspan=2, comboboxselected=self.comboBoxSelected) combobox.zIndex = zIndex zFilterIndex = priorZfilter + selectIndex self.zFilterIndex[zIndex] = zFilterIndex combobox.objectId = hdr.objectId = zFilters[zFilterIndex][3] gridBorder(self.gridColHdr, self.dataFirstCol + 3, row, RIGHTBORDER) row += 1 if not zFilters: zFilters.append((None, set())) # allow empty set operations
def bodyCells(self, row, yAxisParentObj, xFilters, zFilters, yChildrenFirst): dimDefaults = self.modelXbrl.qnameDimensionDefaults 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) # 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 = 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): etree.SubElement( self.rowElts[row - 1], "{http://www.w3.org/1999/xhtml}td", attrib={ "class": "cell", "style": "text-align:{0};width:8em".format(justify) }).text = value if value else "\u00A0" else: etree.SubElement( self.rowElts[row - 1], "{http://www.w3.org/1999/xhtml}td", attrib={ "class": "blockedCell", "style": "text-align:{0};width:8em".format(justify) }).text = "\u00A0\u00A0" row += 1 if not yChildrenFirst: row = self.bodyCells(row, yAxisHdrObj, xFilters, zFilters, yChildrenFirst) return row
def xAxis(self, leftCol, topRow, rowBelow, xAxisParentObj, xFilters, childrenFirst, renderNow, atTop): parentRow = rowBelow noDescendants = True rightCol = leftCol widthToSpanParent = 0 sideBorder = not xFilters for axisMbrRel in self.axisMbrRelSet.fromModelObject(xAxisParentObj): noDescendants = False xAxisHdrObj = axisMbrRel.toModelObject rightCol, row, width, leafNode = self.xAxis( leftCol, topRow + 1, rowBelow, xAxisHdrObj, xFilters, # nested items before totals childrenFirst, childrenFirst, False) if row - 1 < parentRow: parentRow = row - 1 #if not leafNode: # rightCol -= 1 nonAbstract = xAxisHdrObj.abstract == "false" if nonAbstract: width += 100 # width for this label widthToSpanParent += width label = xAxisHdrObj.genLabel(lang=self.lang) if childrenFirst: thisCol = rightCol else: thisCol = leftCol #print ( "thisCol {0} leftCol {1} rightCol {2} topRow{3} renderNow {4} label {5}".format(thisCol, leftCol, rightCol, topRow, renderNow, label)) if renderNow: columnspan = (rightCol - leftCol + (1 if nonAbstract else 0)) if rightCol == self.dataFirstCol + self.dataCols - 1: edgeBorder = "border-right:.5pt solid windowtext;" else: edgeBorder = "" attrib = { "class": "xAxisHdr", "style": "text-align:center;max-width:{0}pt;{1}".format( width, edgeBorder) } colspan = rightCol - leftCol + (1 if nonAbstract else 0) if colspan > 1: attrib["colspan"] = str(colspan) if leafNode and row > topRow: attrib["rowspan"] = str(row - topRow + 1) elt = etree.Element("{http://www.w3.org/1999/xhtml}th", attrib=attrib) elt.text = label if label else "\u00A0" #produces self.rowElts[topRow - 1].insert(leftCol, elt) if nonAbstract: if colspan > 1 and rowBelow > topRow: # add spanned left leg portion one row down attrib = { "class": "xAxisSpanLeg", "rowspan": str(rowBelow - row) } if edgeBorder: attrib["style"] = edgeBorder elt = etree.Element("{http://www.w3.org/1999/xhtml}th", attrib=attrib) elt.text = "\u00A0" if childrenFirst: self.rowElts[topRow].append(elt) else: self.rowElts[topRow].insert(leftCol, elt) if self.colHdrDocRow: doc = xAxisHdrObj.genLabel( role="http://www.xbrl.org/2008/role/documentation", lang=self.lang) elt = etree.Element( "{http://www.w3.org/1999/xhtml}th", attrib={ "class": "xAxisHdr", "style": "text-align:center;max-width:100pt;{0}".format( edgeBorder) }) elt.text = doc if doc else "\u00A0" self.rowElts[self.dataFirstRow - 2 - self.rowHdrCodeCol].insert(thisCol, elt) if self.colHdrCodeRow: code = xAxisHdrObj.genLabel( role= "http://www.eurofiling.info/role/2010/coordinate-code" ) elt = etree.Element( "{http://www.w3.org/1999/xhtml}th", attrib={ "class": "xAxisHdr", "style": "text-align:center;max-width:100pt;{0}".format( edgeBorder) }) self.rowElts[self.dataFirstRow - 2].insert( thisCol, elt) elt.text = code if code else "\u00A0" xFilters.append( (inheritedPrimaryItemQname(self, xAxisHdrObj), inheritedExplicitDims(self, xAxisHdrObj))) if nonAbstract: rightCol += 1 if renderNow and not childrenFirst: self.xAxis(leftCol + (1 if nonAbstract else 0), topRow + 1, rowBelow, xAxisHdrObj, xFilters, childrenFirst, True, False) # render on this pass leftCol = rightCol return (rightCol, parentRow, widthToSpanParent, noDescendants)