/// <summary> /// Renders a table cell for a <see cref="BocValueColumnDefinition"/>. /// </summary> protected override void RenderCellContents( BocColumnRenderingContext <TBocColumnDefinition> renderingContext, BocListDataRowRenderEventArgs dataRowRenderEventArgs, int rowIndex, bool showIcon) { ArgumentUtility.CheckNotNull("renderingContext", renderingContext); ArgumentUtility.CheckNotNull("dataRowRenderEventArgs", dataRowRenderEventArgs); int originalRowIndex = dataRowRenderEventArgs.ListIndex; IBusinessObject businessObject = dataRowRenderEventArgs.BusinessObject; IEditableRow editableRow = renderingContext.Control.EditModeController.GetEditableRow(originalRowIndex); bool hasEditModeControl = editableRow != null && editableRow.HasEditControl(renderingContext.ColumnIndex); bool showEditModeControl = hasEditModeControl && !editableRow.GetEditControl(renderingContext.ColumnIndex).IsReadOnly; string valueColumnText = null; if (!showEditModeControl) { valueColumnText = renderingContext.ColumnDefinition.GetStringValue(businessObject); } bool enforceWidth = RenderCropSpanBeginTag(renderingContext, showEditModeControl, valueColumnText); bool isCommandEnabled = RenderBeginTag(renderingContext, originalRowIndex, businessObject, valueColumnText); if (!hasEditModeControl) { if (showIcon) { RenderCellIcon(renderingContext, businessObject); } RenderOtherIcons(renderingContext, businessObject); } if (showEditModeControl) { RenderCellDataForEditMode(renderingContext, businessObject, editableRow); } else { RenderValueColumnCellText(renderingContext, valueColumnText); } RenderEndTag(renderingContext, isCommandEnabled); RenderCropSpanEndTag(renderingContext, enforceWidth); }
/// <summary> /// Renders a command control with an icon, text, or both. /// </summary> /// <remarks> /// A <see cref="BocCommandColumnDefinition"/> can contain both an object icon and a command icon. The former is rendered according to /// <paramref name="showIcon"/>, the latter if the column defintion's <see cref="BocCommandColumnDefinition.Icon"/> property contains /// an URL. Furthermore, the command text in <see cref="BocCommandColumnDefinition.Text"/> is rendered after any icons. /// </remarks> protected override void RenderCellContents( BocColumnRenderingContext <BocCommandColumnDefinition> renderingContext, BocListDataRowRenderEventArgs dataRowRenderEventArgs, int rowIndex, bool showIcon) { ArgumentUtility.CheckNotNull("renderingContext", renderingContext); ArgumentUtility.CheckNotNull("dataRowRenderEventArgs", dataRowRenderEventArgs); int originalRowIndex = dataRowRenderEventArgs.ListIndex; IBusinessObject businessObject = dataRowRenderEventArgs.BusinessObject; IEditableRow editableRow = renderingContext.Control.EditModeController.GetEditableRow(originalRowIndex); bool hasEditModeControl = editableRow != null && editableRow.HasEditControl(renderingContext.ColumnIndex); bool isCommandEnabled = RenderBeginTag(renderingContext, originalRowIndex, businessObject); RenderCellIcon(renderingContext, businessObject, hasEditModeControl, showIcon); RenderCellCommand(renderingContext); RenderEndTag(renderingContext, isCommandEnabled); }