/// ------------------------------------------------------------------------------------ protected override void WriteTableGroupHeadingGroupField(SilHierarchicalGridRow row) { var grid = m_grid as PaWordListGrid; if (grid == null || !m_isGridGrouped || m_groupByField.Type != FieldType.Phonetic || row.Text == null) { base.WriteTableGroupHeadingGroupField(row); return; } var text = row.Text.Replace("__", "_"); var pieces = text.Split('_'); ProcessHelper.WriteStartElementWithAttrib(m_writer, "th", "class", "Phonetic preceding"); m_writer.WriteAttributeString("scope", "col"); m_writer.WriteString(pieces.Length >= 0 ? pieces[0] : string.Empty); m_writer.WriteEndElement(); ProcessHelper.WriteStartElementWithAttrib(m_writer, "th", "class", "Phonetic item"); m_writer.WriteAttributeString("scope", "col"); m_writer.WriteString("_"); m_writer.WriteEndElement(); ProcessHelper.WriteStartElementWithAttrib(m_writer, "th", "class", "Phonetic following"); m_writer.WriteAttributeString("scope", "col"); m_writer.WriteString(pieces.Length >= 0 ? pieces[1] : string.Empty); m_writer.WriteEndElement(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Calculate the maximum column widths. /// </summary> /// ------------------------------------------------------------------------------------ private void CalculateColumnWidths() { // For testing if (m_grid == null) { return; } m_maxFieldWidths.Clear(); // Calculate the maximum width of the header columns foreach (DataGridViewColumn col in m_sortedColumns.Values) { CalculateWidestColumnHeadingText(col); } // Go through the rows and save the widest text found for each column. foreach (DataGridViewRow row in m_grid.Rows) { if (!row.Visible) { continue; } m_rowValues = new Dictionary <int, object[]>(); SilHierarchicalGridRow shgrow = row as SilHierarchicalGridRow; // Check if the row is a group heading row. if (shgrow != null) { if (shgrow.Expanded) { m_rowValues.Add(kGroupHdgRowToken, new object[] { shgrow.Text, row.Index, row }); m_wordListRows.Add(m_rowValues); } } else { m_numberOfRecords++; // Calculate the maximum width of the fields in the cells in each column foreach (DataGridViewColumn col in m_sortedColumns.Values) { if (row.Cells[col.Index].Value == null) { m_rowValues.Add(col.Index, new object[] { string.Empty, row.Index, null }); } else { CheckWidthOfCellValue(row.Cells[col.Index]); } } m_wordListRows.Add(m_rowValues); } } }
/// ------------------------------------------------------------------------------------ protected virtual void WriteTableGroupHeadingGroupField(SilHierarchicalGridRow row) { ProcessHelper.WriteStartElementWithAttrib(m_writer, "th", "class", m_groupedFieldName); m_writer.WriteAttributeString("scope", "colgroup"); if (!string.IsNullOrEmpty(row.Text)) { m_writer.WriteString(row.Text); } m_writer.WriteEndElement(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Searches backwards for the previous HierarchicalGridRow and expands it. /// </summary> /// <returns>true if a hierarchial grid row was expanded</returns> /// ------------------------------------------------------------------------------------ private static void ExpandPreviousHierarchicalGridRow() { for (int rowIndex = s_iRow; rowIndex >= 0; rowIndex--) { SilHierarchicalGridRow row = s_grid.Rows[rowIndex] as SilHierarchicalGridRow; if (row != null) { row.Expanded = true; return; } } }
/// ------------------------------------------------------------------------------------ protected virtual void WriteTableGroupHeading(SilHierarchicalGridRow row) { ProcessHelper.WriteStartElementWithAttrib(m_writer, "tr", "class", "heading"); ProcessHelper.WriteStartElementWithAttribAndValue(m_writer, "th", "class", "count", row.ChildCount.ToString()); WriteLeftColSpan(); WriteTableGroupHeadingGroupField(row); WriteRightColSpan(); // Close tr m_writer.WriteEndElement(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Searches for first findPattern match with a cell beginning with the last /// matched row and column /// </summary> /// ------------------------------------------------------------------------------------ private static bool FindForward() { s_findBackwards = false; // Start the Find over with the first record when reach the bottom. if (s_iRow == s_grid.Rows.Count) { s_matchedRow = 0; } for (s_iRow = s_matchedRow; s_iRow < s_grid.Rows.Count; s_iRow++) { if (DataNotFound()) { s_firstLoop = true; return(false); } // Save the hierarchical row for later expansion if needed (when searching collapsed recs) if (s_grid.Rows[s_iRow] is SilHierarchicalGridRow) { s_silHierarchicalGridRow = s_grid.Rows[s_iRow] as SilHierarchicalGridRow; } s_iPreviousRow = s_iRow; for (s_iColumn = s_matchedColumn; s_iColumn < ColumnsToSearch.Length; s_iColumn++) { if (ProcessColumns()) { return(true); } } // Didn't find a match, so start searching again in the 1st column on the next row s_matchedRow = s_iRow + 1; SetCurrentColumn(0); // Restart the search from the top if there has been at least 1 match already if (s_matchedRow >= s_grid.Rows.Count) { s_iRow = -1; s_matchedRow = 0; } } return(false); }