• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to combine groups of filters for a TableModel using setRowFilter

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys.

I have a tablemodel of five columns then I need to apply filters in this order. First I need to filter TAXI in column 0 then to filter OBS in column 2 and finally STATUS in column 3.

I have tree groups of buttons on three JPanels and tree groups of variables for those three JPanels.

Inside every JPanel there is an orFilter:

for TaxiPanel :
column0
filtersTaxi=(TAXI01 or TAXI02 or TAXI03 or TAXI04 or TAXI05 or TAXI06)

for ObsPanel :
column2
filtersObs=(Confort or Mechanical)

for StatusPanel :
column3
filtersStatus=(Process or Finished)
     
So what I'm trying to get is a something like this:

           totalFiltered=(totalFilteredTaxi && totalFilteredObs && totalFilteredStatus)

 

But I can't find a way.

I've been progressing with your help I hope you can help me again.
 
joe encalada
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my code working but not combined.

 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all post a proper SSCCE when asking a code. The reason your last question had 18 replies is because you didn't simplify the code or question.

Your question is about using a filter so there is absolutely no need to post 500 lines of code. All you need is a JFrame with a JTable and some data in the table. A SSCCE can be created in about 20-30 lines of code.

Read the section from the Swing tutorial on Sorting and Filtering for the basics and simple code to learn from.

The following code is modified from the TableFilterDemo and shows how to use the "RowFilter.andFilter(...)".



Change the demo code to get it working. Then once you understand the basics you can fix your real code.

 
joe encalada
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have found a solution creating these to variables to make the AND filtering:

so that from the code I posted:
First group of filters:

Second group of filters:

Third group of filters:

I hope it can help to others.

Rob. Thanks for your suggestions.
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic