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

Allow sorting by file type, file name, file size, and last modified time - p3 #22

Closed
ghost opened this issue Apr 9, 2021 · 3 comments
Closed

Comments

@ghost
Copy link

ghost commented Apr 9, 2021

Users have become accustomed to sorting various file attributes to help them find and select files faster. KeenWrite's FilesView class has code that demonstrates how to provide sorting abilities. Here's a snippet of the relevant parts:

    final var table = new TableView<FilesView.PathEntry>();
    final TableColumn<PathEntry, Path> colType = createColumn( "Type" );
    final TableColumn<PathEntry, String> colName = createColumn( "Name" );

    colType.setCellFactory( new FileCell<>() );

    colType.setCellValueFactory( stat -> stat.getValue().typeProperty() );
    colName.setCellValueFactory( stat -> stat.getValue().nameProperty() );

    final var columns = table.getColumns();
    columns.add( colType );
    columns.add( colName );

    table.getSortOrder().setAll( colName, ... );

    colType.setComparator(
      // Sorts the "type" based on file name extension
      comparing( p -> getExtension( p.getFileName().toString() ) )
    );

The PathEntry is an inner class, very bean-esque in nature. It could probably be changed to a record at some point.

@ghost ghost changed the title Allow sorting by file type, file name, file size, and last modified time Allow sorting by file type, file name, file size, and last modified time - p3 Apr 9, 2021
@io7m
Copy link
Member

io7m commented Apr 9, 2021

Does this not already happen if you click the column headers?

@ghost
Copy link
Author

ghost commented Apr 9, 2021

Does this not already happen if you click the column headers?

Not on Linux/XFCE.

@io7m
Copy link
Member

io7m commented Apr 9, 2021

I'll look into it. I'm on a system that's fairly close to that.

@io7m io7m closed this as completed in 4338eb6 Apr 11, 2021
io7m added a commit that referenced this issue May 18, 2021
Release: com.io7m.jwheatsheaf 3.0.0

A big thanks to @DaveJarvis for suggestions, bug reports, and some
code contributions!

Change: Add the ability to specify custom strings (Ticket: #7)
Change: Add the ability to confirm file selections (Ticket: #17)
Change: Allow for including ".." in directory listings (Ticket: #23)
Change: Improve "select directly" dialog behaviour (Ticket: #29)
Change: Fix the size formatter (Ticket: #30)
Change: Use the default filesystem by default (Ticket: #21)
Change: Add support for glob-based filters (Ticket: #19)
Change: Improve filename field behaviour (Ticket: #28)
Change: Add an optional home directory button (Ticket: #12)
Change: Enable sorting of directory items (Ticket: #22)
Change: Allow for setting a default file filter (Ticket: #9)
Change: Allow the escape key to close file choosers (Ticket: #14)
Change: Allow for specifying an initial filename in choosers (Ticket: #15)
Change: Allow for specifying custom dialog titles (Ticket: #8)
Change: Make the default filters part of the public API (Ticket: #10)
io7m added a commit that referenced this issue May 18, 2021
Release: com.io7m.jwheatsheaf 3.0.0

A big thanks to @DaveJarvis for suggestions, bug reports, and some
code contributions!

Change: Add the ability to specify custom strings (Ticket: #7)
Change: Add the ability to confirm file selections (Ticket: #17)
Change: Allow for including ".." in directory listings (Ticket: #23)
Change: Improve "select directly" dialog behaviour (Ticket: #29)
Change: Fix the size formatter (Ticket: #30)
Change: Use the default filesystem by default (Ticket: #21)
Change: Add support for glob-based filters (Ticket: #19)
Change: Improve filename field behaviour (Ticket: #28)
Change: Add an optional home directory button (Ticket: #12)
Change: Enable sorting of directory items (Ticket: #22)
Change: Allow for setting a default file filter (Ticket: #9)
Change: Allow the escape key to close file choosers (Ticket: #14)
Change: Allow for specifying an initial filename in choosers (Ticket: #15)
Change: Allow for specifying custom dialog titles (Ticket: #8)
Change: Make the default filters part of the public API (Ticket: #10)
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

No branches or pull requests

1 participant