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

Sort output #577

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Sort output #577

wants to merge 2 commits into from

Conversation

rout39574
Copy link

Heya. Thanks for the awesome tool!

I wanted to check your generated site into a repository. Having the generated pages be stable across builds helps keep chaff down in the changes, and makes actual drift much easier to identify.

I'm no java coder, but I think I made some reasonably idiomatic suggestions here, and it Works For Me so far.

Would you consider this or similar changes?

This is my first stab at a PR; if I've blown the etiquette somehow, please let me know and I'll try to go back and do it right. :)

@npetzall
Copy link
Member

npetzall commented Aug 4, 2019

Only thing I directly can think of is that we might need to add sorting in more places.

This also seems to be the most natural sorting. So I think we should implement Comparable on MustacheTableColumn and simply add sorted() to the stream and finally collected it as a LinkedHashSet.

But now you've made me go down the rabbit hole. MustachTableColumn is just a decorator class for TableColumn. Which has a private innerclass named ColumnComparator.
ColumnComparator is only used once, and as stated before the most natural ordering of TableColumns is by TableName and ColumnName.

So really TableColumn should implement Comparable thus removing the ColumnComparator and it's usage.
MustachTableColumn should implement Comparable and delegate to TableColumn.

Give it a shot, and if you feel it's to much let me know.
In short TableColum should implement Comparable, compareTo should have same logic as it's inner class ColumComparator. ColumComparator should be removed.
MustacheTableColumn should implement Comparable and compareTo should delegate to TableColumn.
Stream in HtmlColumnPage should include .sorted() and finally collected as a LinkedHashSet.

@rout39574
Copy link
Author

rout39574 commented Aug 5, 2019 via email

@Fryguy Fryguy mentioned this pull request Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants