@Nonnegative private static int _getEffectiveCellCount (@Nonnull final HCRow aRow, @Nullable final List <int []> aRowSpans) { int nCellIndex = 0; for (final IHCCell <?> aCell : aRow.getAllChildren ()) nCellIndex += _getApplicableRowspan (nCellIndex, aRowSpans) + aCell.getColspan (); // Any rowspan after the last cell? nCellIndex += _getApplicableRowspan (nCellIndex, aRowSpans); return nCellIndex; }
@Override protected void onConsistencyCheck (@Nonnull final IHCConversionSettingsToNode aConversionSettings) { super.onConsistencyCheck (aConversionSettings); checkInternalConsistency (); }
@Nonnull public final IMPLTYPE setCellSpacing (final int nCellSpacing) { m_nCellSpacing = nCellSpacing; return thisAsT (); }
@Override protected void onFinalizeNodeState (@Nonnull final IHCConversionSettingsToNode aConversionSettings, @Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode) { super.onFinalizeNodeState (aConversionSettings, aTargetNode); /* * bug fix for IE9 table layout bug * (http://msdn.microsoft.com/en-us/library/ms531161%28v=vs.85%29.aspx) IE9 * only interprets column widths if the first row does not use colspan (i.e. * at least one row does not use colspan) */ if (m_aColGroup != null && m_aColGroup.hasColumns () && hasBodyRows () && getFirstBodyRow ().isColspanUsed ()) { // Create a dummy row with explicit widths final HCRow aRow = new HCRow (false).addClass (CSS_FORCE_COLSPAN); for (final IHCCol <?> aCol : m_aColGroup.getAllColumns ()) { final IHCCell <?> aCell = aRow.addAndReturnCell (HCEntityNode.newNBSP ()); final int nWidth = StringParser.parseInt (aCol.getWidth (), -1); if (nWidth >= 0) aCell.addStyle (CCSSProperties.WIDTH.newValue (ECSSUnit.px (nWidth))); } addBodyRowAt (0, aRow); } }
public void checkInternalConsistency () { // Determine number of columns to use int nCols = 0; if (m_aColGroup != null) nCols = m_aColGroup.getColumnCount (); if (nCols == 0 && m_aHead.hasChildren ()) nCols = m_aHead.getFirstChild ().getEffectiveCellCount (); if (nCols == 0 && m_aBody.hasChildren ()) nCols = m_aBody.getFirstChild ().getEffectiveCellCount (); if (nCols == 0 && m_aFoot.hasChildren ()) nCols = m_aFoot.getFirstChild ().getEffectiveCellCount (); String sPrefix = "Table"; if (StringHelper.hasText (getID ())) sPrefix += " with ID " + getID (); _checkConsistency (sPrefix + " header", m_aHead, nCols); _checkConsistency (sPrefix + " body", m_aBody, nCols); _checkConsistency (sPrefix + " footer", m_aFoot, nCols); }
final int nRowCols = _getEffectiveCellCount (aBodyRow, bTotalHasRowSpans ? aTotalRowSpans : null); if (nRowCols != nCols) HCConsistencyChecker.consistencyError (sContext +
@Nonnull final IHCConversionSettingsToNode aConversionSettings) super.fillMicroElement (aElement, aConversionSettings);
@Nonnull public final IMPLTYPE setCellPadding (final int nCellPadding) { m_nCellPadding = nCellPadding; return thisAsT (); }
@Nonnull public final IMPLTYPE removeAllColumns () { m_aColGroup = null; return thisAsT (); }
@Nonnull public final IMPLTYPE removeColumnAt (@Nonnegative final int nColumnIndex) { if (m_aColGroup != null) m_aColGroup.removeColumnAt (nColumnIndex); return thisAsT (); }
@Nonnull public final IMPLTYPE setBody (@Nonnull final HCTBody aBody) { m_aBody = ValueEnforcer.notNull (aBody, "Body"); return thisAsT (); }
@Nonnull public final IMPLTYPE setHead (@Nonnull final HCTHead aHead) { m_aHead = ValueEnforcer.notNull (aHead, "Head"); return thisAsT (); }
@Nonnull public final IMPLTYPE setFoot (@Nonnull final HCTFoot aFoot) { m_aFoot = ValueEnforcer.notNull (aFoot, "Foot"); return thisAsT (); }
@Nonnull public final IMPLTYPE addColumnAt (@Nonnegative final int nIndex, @Nullable final IHCCol <?> aCol) { if (aCol != null) { if (m_aColGroup == null) m_aColGroup = new HCColGroup (); m_aColGroup.addColumnAt (nIndex, aCol); } return thisAsT (); }
@Nonnull public final IMPLTYPE addColumn (@Nullable final IHCCol <?> aCol) { if (aCol != null) { if (m_aColGroup == null) m_aColGroup = new HCColGroup (); m_aColGroup.addColumn (aCol); } return thisAsT (); }