Commons Sandbox
  1. Commons Sandbox
  2. SANDBOX-312

TextTable for printing a fixedlength columns format text tables

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Just to suggest adding a TextTable class for printing in text (ASCII) format fixed columns table. It is usefull for printing information from command line application, that informs about directly on DOS Windows of Xterm direclty.

      I am adding a patch a possible solution for that,

      Thanks,

      David

      1. TextTable.java
        12 kB
        David Leal
      2. TestTextTable.out
        2 kB
        David Leal
      3. TestTextTable.java
        11 kB
        David Leal

        Activity

        Hide
        Matt Benson added a comment -

        My perfunctory glance at this suggests to me that the [flatfile] sandbox component provides support for this type of thing.

        Show
        Matt Benson added a comment - My perfunctory glance at this suggests to me that the [flatfile] sandbox component provides support for this type of thing.
        Hide
        Henri Yandell added a comment -

        Moved to the Sandbox as a potential component idea if anyone feels the urge. Too large for Lang.

        Show
        Henri Yandell added a comment - Moved to the Sandbox as a potential component idea if anyone feels the urge. Too large for Lang.
        Hide
        ggregory@seagullsw.com added a comment -

        I agree with Stephen http://issues.apache.org/jira/browse/LANG-284#action_12461421, this sounds complicated enough and would need enough parameters and customizable features to make it its own component.

        Show
        ggregory@seagullsw.com added a comment - I agree with Stephen http://issues.apache.org/jira/browse/LANG-284#action_12461421 , this sounds complicated enough and would need enough parameters and customizable features to make it its own component.
        Hide
        Stephen Colebourne added a comment -

        I never commented on this at the time. I personally think this is out of scope for [lang]. It has the potential to expand in any number of directions, and has no simple correct implementation.

        Show
        Stephen Colebourne added a comment - I never commented on this at the time. I personally think this is out of scope for [lang] . It has the potential to expand in any number of directions, and has no simple correct implementation.
        Hide
        David Leal added a comment -

        Dear Henri,

        About your comment, that is why I have provided two methods, the method that returns String[][] drawFixedColumnLengthTable() contains the body of matrix, without any adornament, so you can put into any different format (html, xml, etc).

        Regards,

        David

        Show
        David Leal added a comment - Dear Henri, About your comment, that is why I have provided two methods, the method that returns String[][] drawFixedColumnLengthTable() contains the body of matrix, without any adornament, so you can put into any different format (html, xml, etc). Regards, David
        Hide
        Henri Yandell added a comment -

        Yup, XML +1 (which just happens to equal table, tbody, thead, tr, whatever to make life easy)

        Show
        Henri Yandell added a comment - Yup, XML +1 (which just happens to equal table, tbody, thead, tr, whatever to make life easy)
        Hide
        ggregory@seagullsw.com added a comment -

        I think we are going towards a whole new .table package. I like the idea of a table model with an XML and HTML writer classes on the side. TableModel, XmlTableWriter, HtmlTableWriter. As soon as you say HTML, I am thinking that XML is enough since I can just apply an XSLT later. Opening the door to colors, fonts, borders, etc seems like a big job. You'd also might want a TableColumn class to hold name, data type, etc.

        Show
        ggregory@seagullsw.com added a comment - I think we are going towards a whole new .table package. I like the idea of a table model with an XML and HTML writer classes on the side. TableModel, XmlTableWriter, HtmlTableWriter. As soon as you say HTML, I am thinking that XML is enough since I can just apply an XSLT later. Opening the door to colors, fonts, borders, etc seems like a big job. You'd also might want a TableColumn class to hold name, data type, etc.
        Hide
        Henri Yandell added a comment -

        Quick braindump - would be cool to be able to create a Table object and then to print that to multiple formats. Text and HTML being two obvious ones. The current code doesn't split that - though I've only glanced at the unit test so far.

        Show
        Henri Yandell added a comment - Quick braindump - would be cool to be able to create a Table object and then to print that to multiple formats. Text and HTML being two obvious ones. The current code doesn't split that - though I've only glanced at the unit test so far.
        Hide
        David Leal added a comment -

        I have added a feature requets on WordUtils class about that:

        https://issues.apache.org/jira/browse/LANG-280">Jira LANG-280

        Show
        David Leal added a comment - I have added a feature requets on WordUtils class about that: https://issues.apache.org/jira/browse/LANG-280 ">Jira LANG-280
        Hide
        David Leal added a comment -

        Thanks for your interest, just to take into account that the method: splitWrappedLinesInToList wouldn't be necessary if the class WordUtils could provide a new split method that instead of returing a String with the splitted text just returns an Array/List with the splitted lines.

        Show
        David Leal added a comment - Thanks for your interest, just to take into account that the method: splitWrappedLinesInToList wouldn't be necessary if the class WordUtils could provide a new split method that instead of returing a String with the splitted text just returns an Array/List with the splitted lines.
        Hide
        Henri Yandell added a comment -

        Seems like a good new feature - I've got an aborted Table class somewhere so it's something I've needed in the past. Setting to 3.0.

        Show
        Henri Yandell added a comment - Seems like a good new feature - I've got an aborted Table class somewhere so it's something I've needed in the past. Setting to 3.0.
        Hide
        David Leal added a comment -

        Junit test.

        Show
        David Leal added a comment - Junit test.
        Hide
        David Leal added a comment -

        Sample output

        Show
        David Leal added a comment - Sample output
        Hide
        David Leal added a comment -

        Implementation of TextTable.

        Show
        David Leal added a comment - Implementation of TextTable.

          People

          • Assignee:
            Unassigned
            Reporter:
            David Leal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development