protected override void DrawCell(long row, long col, Rect r, long index, bool selected, ref GUIPipelineState pipe) { var s = m_TableDisplay.GetCellExpandState(row, (int)col); if (s.isColumnExpandable) { int indent = s.expandDepth * 16; r.x += indent; r.width -= indent; if (s.isExpandable) { Rect rToggle = new Rect(r.x, r.y, 16, r.height); bool newExpanded = GUI.Toggle(rToggle, s.isExpanded, GUIContent.none, Styles.styles.foldout); if (newExpanded != s.isExpanded) { pipe.processMouseClick = false; SetCellExpandedState(row, col, newExpanded); } } r.x += 16; r.width -= 16; } Database.LinkRequest link = null; if (onClickLink != null) { link = m_TableDisplay.GetCellLink(new Database.CellPosition(row, (int)col)); } if (Event.current.type == EventType.Repaint) { var column = m_TableDisplay.GetColumnByIndex((int)col); if (column != null) { #if MEMPROFILER_DEBUG_INFO string str; if (m_DataRenderer.showDebugValue) { //str = "\"" + column.GetRowValueString(row) + "\" " + column.GetDebugString(row); str = column.GetDebugString(row); } else { str = column.GetRowValueString(row); } #else var str = column.GetRowValueString(row); #endif DrawTextEllipsis(str, r, link == null ? Styles.styles.numberLabel : Styles.styles.clickableLabel , EllipsisStyleMetricData, selected); } } if (link != null) { if (Event.current.type == EventType.Repaint) { EditorGUIUtility.AddCursorRect(r, MouseCursor.Link); } } }
public GroupedTable(Database.Table table, ArrayRange range, int colToGroupFirst, int colToGroupLast, int[] colGroupOrder, SortOrder[] sortOrder) : base(table.Schema) { m_table = table; if (m_table is ExpandTable) { m_expandTable = (ExpandTable)m_table; } m_Meta = m_table.GetMetaData(); m_GroupedColumnFirst = colToGroupFirst; m_GroupedColumnLast = colToGroupLast; m_ColumnOrder = colGroupOrder; m_SortOrder = sortOrder; int sourceGroupedColumnIndex = m_ColumnOrder[colToGroupFirst]; var col = m_table.GetColumnByIndex(sourceGroupedColumnIndex); var metaCol = m_Meta.GetColumnByIndex(sourceGroupedColumnIndex); if (metaCol.DefaultGroupAlgorithm != null) { m_GroupCollection = metaCol.DefaultGroupAlgorithm.Group(col, range, m_SortOrder[colToGroupFirst]); } else { throw new Exception("Trying to group a column without grouping algorithm. Column '" + metaCol.Name + "' from table '" + m_table.GetName() + "'"); } InitializeFromGroupCollection(col, sourceGroupedColumnIndex); }
private void InitializeFromGroupCollection(Database.Column col, long sourceColToGroup) { //create groups long groupCount = m_GroupCollection.GetGroupCount(); m_Groups = new Group[groupCount]; for (long i = 0; i < groupCount; ++i) { m_Groups[i] = new Group(m_GroupCollection.GetGroup(i).GetIndices(m_GroupCollection)); } //create columns m_Columns = new System.Collections.Generic.List <Column>(m_Meta.GetColumnCount()); for (int i = 0; i != m_Meta.GetColumnCount(); ++i) { var metaCol = m_Meta.GetColumnByIndex(i); IGroupedColumn newCol = (IGroupedColumn)ColumnCreator.CreateColumn(typeof(GroupedColumnTyped <>), metaCol.Type); newCol.Initialize(this, m_table.GetColumnByIndex(i), i, metaCol.DefaultMergeAlgorithm, i == sourceColToGroup); m_Columns.Add((Column)newCol); } InitGroup(groupCount); }
// colToGroup is an index from aNewColumnOrder. public GroupedTable(Database.Table table, ArrayRange range, int colToGroup, SortOrder sortOrder, FnCreateGroupTable subTable) : base(table.Schema) { m_table = table; if (m_table is ExpandTable) { m_expandTable = (ExpandTable)m_table; } m_Meta = m_table.GetMetaData(); m_GroupedColumnFirst = 0; m_GroupedColumnLast = 0; m_ColumnOrder = new int[] { colToGroup };// colGroupOrder; m_SortOrder = new SortOrder[1] { sortOrder }; m_createGroupTable = subTable; var col = m_table.GetColumnByIndex(colToGroup); var metaCol = m_Meta.GetColumnByIndex(colToGroup); if (metaCol.DefaultGroupAlgorithm != null) { m_GroupCollection = metaCol.DefaultGroupAlgorithm.Group(col, range, sortOrder); } else { throw new Exception("Trying to group a column without grouping algorithm. Column '" + metaCol.Name + "' from table '" + m_table.GetName() + "'"); } InitializeFromGroupCollection(col, colToGroup); }
protected override void DrawCell(long row, long col, Rect r, long index, bool selected, ref GUIPipelineState pipe) { var s = m_TableDisplay.GetCellExpandState(row, (int)col); if (s.isColumnExpandable) { int indent = s.expandDepth * 16; r.x += indent; r.width -= indent; if (s.isExpandable) { Rect rToggle = new Rect(r.x, r.y, Styles.FoldoutWidth, r.height); bool newExpanded = GUI.Toggle(rToggle, s.isExpanded, GUIContent.none, Styles.Foldout); if (newExpanded != s.isExpanded) { pipe.processMouseClick = false; SetCellExpandedState(row, col, newExpanded); } } r.x += 16; r.width -= 16; } Database.LinkRequest link = null; if (onClickLink != null) { link = m_TableDisplay.GetCellLink(new Database.CellPosition(row, (int)col)); } if (Event.current.type == EventType.Repaint) { var column = m_TableDisplay.GetColumnByIndex((int)col); var metaColumn = m_TableDisplay.GetMetaData().GetColumnByIndex((int)col); if (column != null) { var str = column.GetRowValueString(row, m_FormattingOptions.GetFormatter(metaColumn.FormatName)); DrawTextEllipsis(str, r, link == null ? Styles.NumberLabel : Styles.ClickableLabel , EllipsisStyleMetricData, selected); } } if (link != null) { if (Event.current.type == EventType.Repaint) { EditorGUIUtility.AddCursorRect(r, MouseCursor.Link); } } }