Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve TextTable API #69

Closed
remkop opened this issue Mar 18, 2017 · 1 comment
Closed

Improve TextTable API #69

remkop opened this issue Mar 18, 2017 · 1 comment

Comments

@remkop
Copy link
Owner

remkop commented Mar 18, 2017

  • TextTable with custom columns should not require a Layout: client may want to add String values directly, not Options or Parameters field
  • move method TextTable::addRow(String... values) back to TextTable
  • consider moving logic for two-options-per-row (zip usage) into TextTable

Convenience method TextTable::addOption needs fields OptionRenderer and Layout to be set. Can this be refactored?

public void addOption(Field field, IValueLabelRenderer valueLabelRenderer) {
    Option option = field.getAnnotation(Option.class);
    String[][] values = optionRenderer.render(option, field, valueLabelRenderer);
    layout.layout(field, values, this);
}
@remkop remkop added this to the 0.3.0 usage online help milestone Mar 18, 2017
@remkop
Copy link
Owner Author

remkop commented Mar 20, 2017

Ideas:

  • layout decide what option/parameter renderer to use (has fields for them)
  • layout::addOption(Field, TextTable) calls renderer internally before adding resulting string[][] to the table
  • Remove methods TextTable::addOption/Parameter
  • Remove TextTable fields : layout, various renderers (move to Layout)

@remkop remkop closed this as completed in a33cd36 Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant