/** * Add a single cell with the given text element. * * @param sCellText * The text to be set into the cell. May be <code>null</code>. * @return the created table cell */ @Nonnull @CheckReturnValue public IHCCell <?> addAndReturnCell (@Nullable final String sCellText) { return addCell ().addChild (sCellText); }
/** * Add a single cell with the given text elements. * * @param aCellTexts * The text to be set into the cell. May be <code>null</code>. * @return the created table cell */ @Nonnull @CheckReturnValue public IHCCell <?> addAndReturnCell (@Nullable final String... aCellTexts) { return addCell ().addChildren (aCellTexts); }
public DataTablesServerDataCell (@Nonnull final IHCCell <?> aCell) { if (aCell.hasAnyStyle ()) LOGGER.warn ("Cell has styles assigned which will be lost: " + aCell.getAllStyles ()); if (aCell.hasAnyClass ()) LOGGER.warn ("Cell has classes assigned which will be lost: " + aCell.getAllClasses ()); final IHCNodeList <?> aCellContent = aCell.getAllChildrenAsNodeList (); // Remember cell content setContent (aCellContent); }
@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); } }
@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; }
/** * @return <code>true</code> if at least one contained cell uses a rowspan. */ public boolean isRowspanUsed () { if (hasChildren ()) for (final IHCCell <?> aCell : directGetAllChildren ()) if (aCell.getRowspan () > 1) return true; return false; }
final IHCCell <?> aCell = aRow.addAndReturnCell (aNI.getDisplayName ()); if (nDepth > 0) aCell.addStyle (CCSSProperties.PADDING_LEFT.newValue (ECSSUnit.em (nDepth)));
/** * Count the number of effective cells - including "colspans" - of this row. * * @return The number of effectively contained cells. Always ≥ 0. */ @Nonnegative public int getEffectiveCellCount () { int ret = 0; if (hasChildren ()) for (final IHCCell <?> aCell : directGetAllChildren ()) ret += aCell.getColspan (); return ret; }
for (final IHCCell <?> aCell : aBodyRow.getAllChildren ()) final int nRowSpan = aCell.getRowspan (); aRowRowSpans[nCellIndex++] = nRowSpan; if (nRowSpan != 1)
/** * Add a single new cell and add the passed element. * * @param aCellChild * The element to add. May be <code>null</code>. * @return The created cell. Never <code>null</code>. */ @Nonnull @CheckReturnValue public IHCCell <?> addAndReturnCell (@Nullable final IHCNode aCellChild) { return addCell ().addChild (aCellChild); }
final IHCCell <?> aCell = aRow.addAndReturnCell (aNI.getDisplayName ()); if (nDepth > 0) aCell.addStyle (CCSSProperties.PADDING_LEFT.newValue (ECSSUnit.em (nDepth)));
/** * Add a single new cell and add the passed elements. * * @param aCellChildren * The list of elements to add. May be <code>null</code>. * @return The created cell. Never <code>null</code>. */ @Nonnull @CheckReturnValue public IHCCell <?> addAndReturnCell (@Nullable final IHCNode... aCellChildren) { return addCell ().addChildren (aCellChildren); }
/** * @return <code>true</code> if at least one contained cell uses a colspan. */ public boolean isColspanUsed () { if (hasChildren ()) for (final IHCCell <?> aCell : directGetAllChildren ()) if (aCell.getColspan () > 1) return true; return false; }
/** * Add a single new cell and add the passed element. * * @param aChild * The element to add. May be <code>null</code>. * @return this (the table row) */ @Nonnull public HCRow addCell (@Nullable final IHCNode aChild) { addCell ().addChild (aChild); return this; }
/** * Add a single new cell and add the passed elements. * * @param aCellChildren * The list of elements to add. May be <code>null</code>. * @return this (the table row) */ @Nonnull public HCRow addCell (@Nullable final IHCNode... aCellChildren) { addCell ().addChildren (aCellChildren); return this; }
/** * Get the cell at the specified index in this row. This method does consider * colspans!!!! * * @param nIndex * The index of the cell. Should be ≥ 0. * @return <code>null</code> if no such cell is present */ @Nullable public IHCCell <?> getCellAtEffectiveIndex (final int nIndex) { int i = 0; if (hasChildren ()) for (final IHCCell <?> aCell : directGetAllChildren ()) { if (i >= nIndex) return aCell; i += aCell.getColspan (); } return null; }
/** * Add a single cell with the given text element. * * @param sCellText * The text to be set into the cell. May be <code>null</code>. * @return this (the table row) */ @Nonnull public HCRow addCell (@Nullable final String sCellText) { addCell ().addChild (sCellText); return this; }
/** * Add a single new cell and add the passed texts. * * @param aCellTexts * The list of texts to add. May be <code>null</code>. * @return this (the table row) */ @Nonnull public HCRow addCell (@Nullable final String... aCellTexts) { addCell ().addChildren (aCellTexts); return this; }
/** * Add a single new cell and add the passed element. * * @param nIndex * The index where the cell should be added * @param aCellChild * The element to add. May be <code>null</code>. * @return The created cell. Never <code>null</code>. */ @Nonnull @CheckReturnValue public IHCCell <?> addAndReturnCellAt (@Nonnegative final int nIndex, @Nullable final IHCNode aCellChild) { return addCellAt (nIndex).addChild (aCellChild); }
/** * Add a single new cell and add the passed elements. * * @param aCellChildren * The list of elements to add. May be <code>null</code>. * @return The created cell. Never <code>null</code>. */ @Nonnull @CheckReturnValue public IHCCell <?> addAndReturnCell (@Nullable final Iterable <? extends IHCNode> aCellChildren) { return addCell ().addChildren (aCellChildren); }