Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6889755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:11:45+00:00 2026-05-27T06:11:45+00:00

I want to create user views (tables) with sorting and filtering capabilities. I use

  • 0

I want to create user views (tables) with sorting and filtering capabilities. I use EventList (Glazed Lists) as source for EventTableModel. There are also Sorted List and some filtering items in GlazedLists, so I can use them for creating view. But I found JXTable and it has methods for sorting and filtering, and this how I want it to work: sorting and filtering must provide UI component and model just can hold data:

EventList<Item> source=new BasicEventList<Item>();
TableModel model=new DefaultEventTableModel<Item>(source,tableFormat); // It'll be
//perfect if I could create model without tableFormat,
//because it's presentation of data,
//but in GlazedLists I can't :( ...
JTalbe ui=new JXTable(model); // UI with sorting and filtering

But GlazedLists also provide SortedList (decorator for EventList with Sorting), and some filtering methods.

EventList<Item> source=new BasicEventList<Item>();
SortedList<Item> sortedSource=new SortedList<Item>(source,comparator);
TableModel model=new DefaultEventTableModel<Item>(sortedSource,tableFormat); 
// model with sorting... not very beautifull for me, but what do you think?

JTable ui=new JTable(model); // UI with sorting provided by model

And the question is: what model is better. Or maybe both are wrong, and what do use for creating views?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:11:46+00:00Added an answer on May 27, 2026 at 6:11 am

    I vote for GlazedLists, because it works. Yes, the TableModel that you use with the table is tightly coupled to the view, but you decouple that table model from your source data.

    GlazedLists’ sorting and filtering features are much more flexible than the one on JXTable. Just make sure you don’t have them both turned on, or things will get confusing. Here’s my usual code snippet for using a SortedList with a JXTable:

    private <T> EventTableModel<T> setupTable(JXTable table, TableFormat<T> tf, EventList<T> displayItems, SortedList<T> sortedItems)
    {
        table.setColumnControlVisible(true);
        table.setSortable(false);
        table.getTableHeader().setDefaultRenderer(new JTableHeader().getDefaultRenderer());
    table.setAutoCreateRowSorter(false);
    table.setRowSorter(null);
    
        EventTableModel<T> etm = new EventTableModel<T>(displayItems, tf);
        table.setModel(etm);
    
        TableComparatorChooser.install(table, sortedItems, AbstractTableComparatorChooser.SINGLE_COLUMN);
        return etm;
    }
    

    What this does:

    • turn on the column picker gadget on the upper right of the JXTable
    • turn off JXTable’s builtin sorting
    • install GlazedLists’ sorting features instead
    • setup the table with an EventTableModel derived from the TableFormat

    Note that you pass in two EventLists, a displayItems which is the list at the end of the pipeline, and a sortedList used for controlling which column is used for sorting, which can be earlier in the pipeline than the displayItems list. (If your last element is the sortedList, without any processing after that, just pass the list in twice.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.Net 3.5 I want to create a user control that contains the ListView and
I have a stored procedure in which i want to create a user defined
I want to create a simple user registration form with First / Last name,
I want to create a program that requests from the user 10 grades and
I want to create a Web app which would allow the user to upload
I want to create a web page where a registered user picks a number
My User object that I want to create and store in the datastore has
I have a user control and I want to create a property of type
I want to create sub-domains using PHP on the fly. Suppose a user registers
I want to create a section in my site, where a user has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.