Skip to content

Commit

Permalink
📖 update TableView metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
MorganKryze committed Mar 3, 2024
1 parent 67e2ee5 commit 24c33ed
Showing 1 changed file with 119 additions and 6 deletions.
125 changes: 119 additions & 6 deletions src/ConsoleAppVisuals/elements/static_elements/TableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ namespace ConsoleAppVisuals.Elements;
/// <summary>
/// The <see cref="TableView{T}"/> class that contains the methods to create a table and display it.
/// </summary>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public class TableView<T> : Element
{
#region Fields: title, headers, lines, display array, rounded corners
Expand Down Expand Up @@ -62,7 +69,13 @@ public class TableView<T> : Element
/// <param name="placement">The placement of the table.</param>
/// <exception cref="ArgumentException">Is thrown when the number of columns in the table is not consistent with itself or with the headers.</exception>
/// <exception cref="NullReferenceException">Is thrown when no body lines were provided.</exception>
/// <remarks>Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/ </remarks>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public TableView(
string? title = null,
List<string>? headers = null,
Expand Down Expand Up @@ -399,7 +412,13 @@ private void BuildTitle()
/// <summary>
/// Toggles the rounded corners of the table.
/// </summary>
/// <remarks>Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/ </remarks>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void SetRoundedCorners(bool rounded = true)
{
_roundedCorners = rounded;
Expand All @@ -410,6 +429,13 @@ public void SetRoundedCorners(bool rounded = true)
/// This method adds a title to the table.
/// </summary>
/// <param name="title">The title to add.</param>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void AddTitle(string title)
{
_title = title;
Expand All @@ -420,6 +446,13 @@ public void AddTitle(string title)
/// This method updates the title of the table.
/// </summary>
/// <param name="title">The title to update.</param>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void UpdateTitle(string title)
{
AddTitle(title);
Expand All @@ -428,6 +461,13 @@ public void UpdateTitle(string title)
/// <summary>
/// This method clears the title of the table.
/// </summary>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void ClearTitle()
{
_title = null;
Expand All @@ -438,6 +478,13 @@ public void ClearTitle()
/// This method adds headers to the table.
/// </summary>
/// <param name="headers">The headers to add.</param>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void AddHeaders(List<string> headers)
{
_rawHeaders = headers;
Expand All @@ -451,6 +498,13 @@ public void AddHeaders(List<string> headers)
/// This method updates the headers of the table.
/// </summary>
/// <param name="headers">The headers to update.</param>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void UpdateHeaders(List<string> headers)
{
AddHeaders(headers);
Expand All @@ -459,6 +513,13 @@ public void UpdateHeaders(List<string> headers)
/// <summary>
/// This method clears the headers of the table.
/// </summary>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void ClearHeaders()
{
_rawHeaders = null;
Expand All @@ -470,7 +531,13 @@ public void ClearHeaders()
/// </summary>
/// <param name="line">The line to add.</param>
/// <exception cref="ArgumentException">Is thrown when the number of columns in the table is not consistent with itself or with the headers.</exception>
/// <remarks>Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/ </remarks>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void AddLine(List<T> line)
{
if (_rawLines?.Count > 0 && line.Count != _rawLines[0].Count)
Expand All @@ -497,7 +564,13 @@ public void AddLine(List<T> line)
/// <param name="line">The new line.</param>
/// <exception cref="ArgumentOutOfRangeException">Is thrown when the index is out of range.</exception>
/// <exception cref="ArgumentException">Is thrown when the number of columns in the table is not consistent with itself or with the headers.</exception>
/// <remarks>Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/ </remarks>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void UpdateLine(int index, List<T> line)
{
if (_rawLines?.Count > 0)
Expand All @@ -523,7 +596,13 @@ public void UpdateLine(int index, List<T> line)
/// </summary>
/// <param name="index">The index of the line to remove.</param>
/// <exception cref="ArgumentOutOfRangeException">Is thrown when the index is out of range.</exception>
/// <remarks>Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/ </remarks>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void RemoveLine(int index)
{
if (_rawLines?.Count > 0 && (index < 0 || index >= _rawLines.Count))
Expand All @@ -538,6 +617,13 @@ public void RemoveLine(int index)
/// <summary>
/// This method clears the lines of the table.
/// </summary>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void ClearLines()
{
_rawLines = null;
Expand All @@ -550,7 +636,13 @@ public void ClearLines()
/// <param name="index">The index of the line to return.</param>
/// <returns>The line at the specified index.</returns>
/// <exception cref="ArgumentOutOfRangeException">Is thrown when the index is out of range.</exception>
/// <remarks>Refer to the example project to understand how to implement it available at https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/ </remarks>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public List<T> GetLine(int index)
{
if (index < 0 || index >= _rawLines?.Count)
Expand All @@ -566,6 +658,13 @@ public List<T> GetLine(int index)
/// <param name="index">The index of the column.</param>
/// <returns>The elements of the column.</returns>
/// <exception cref="ArgumentOutOfRangeException">Is thrown when the index is out of range.</exception>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public List<T>? GetColumnData(int index)
{
if (_rawLines is null)
Expand Down Expand Up @@ -593,6 +692,13 @@ public List<T> GetLine(int index)
/// <returns>The elements of the column.</returns>
/// <exception cref="InvalidOperationException">Is thrown when the table is empty.</exception>
/// <exception cref="ArgumentOutOfRangeException">Is thrown when the header is invalid.</exception>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public List<T>? GetColumnData(string header)
{
if (_rawHeaders is null)
Expand All @@ -614,6 +720,13 @@ public List<T> GetLine(int index)
/// <summary>
/// This method clears the table.
/// </summary>
/// <remarks>
/// For more information, refer to the following resources:
/// <list type="bullet">
/// <item><description><a href="https://morgankryze.github.io/ConsoleAppVisuals/">Documentation</a></description></item>
/// <item><description><a href="https://github.com/MorganKryze/ConsoleAppVisuals/blob/main/example/">Example Project</a></description></item>
/// </list>
/// </remarks>
public void Reset()
{
_title = null;
Expand Down

0 comments on commit 24c33ed

Please sign in to comment.