java - How to add two filters in different level to the same GlazedList
table? -
Get link
Facebook
X
Pinterest
Email
Other Apps
I have created a table that I want to filter it into two different levels. First filter it with the radio button on the file extension (such as .jpg, .doc, rest). To do some search within the first filter, filter the second with the textfield as below You can see in the demo. I can filter the table with the radio button but I do not know the second level of filter on the table (Jetextfield) How to Apply
Does any body know how to do this?
< Code> public class extends two lenghttertable panels OeVubPanel {Private Static Last File Directory Engine = New File ("C: \\ User \\ Public \\ Picture \\ Sample Image"); Private JRadioButton jpg, doctor, other; Private button group radio set; Private JTextField txtFilter; Private JTable GlazedTable; Private Basic Event List & lt; MyCode & gt; event list; Private Jeppel filter panels, radiosat panels; Public TransactionalPublic (Baccalaureate LIST & lt; MyCode> Eventalist) {this.eventList = eventList; CreateComponents (); LayoutComponents (); } Public Zero Making Company () {jpg = New Geributton ("jpg"); Doctor = new gerardabutton ("doctor"); Other = New Gerabutton ("Other"); Radiate = new button group (); RadioSet.add (jpg); RadioSet.add (doc); RadioSet.add (other); TxtFilter = new JTextField (); RadioSatPanel = new zpn (); Radio EstPanel.Setlightout (new box layout (RadioSatPanel, BoxLayout.x_AXIS)); RadioSetPanel.add (jpg); RadioSetPanel.add (doc); RadioSetPanel.add (other); FilterPanel = new JPanel (); FilterPanel.setLayout (New BoxLayout (Filter Panel, BoxLayout.Y_AXIS)); FilterPanel.add (radioSetPanel); FilterPanel.add (txtFilter); Last barcode matcher editor barcode master editor = new barcode matcher editor (jpg, doctor, other); Final Filterlist Filtered RadiusSet = New Filter List (Event List, Barcode Matter Editor); // Create a Joint String [] attribute name = name = new string [] {"name", "size", "date"}; String [] columnLabels = new string [] {"name", "size", "date"}; TableFormat TF = Glazed Liquid Formatt (Mycoda Class, Property Name, Column Labels); GlazedTable = New JTable (New EventTable Model (Filtered RadioSet, TF)); } Public Zero Layout Coordinator () {Set Layout (New Boxline (It, BoxLayout.Y_AXIS)); Add (filterPanel); Addition (new WebScrollPane (glazedTable)); } Public static zero main (string [] args) {BasicEventList & lt; MyCode & gt; EventList = New Basic Event List & lt; MyCode & gt; (); (File file: DirectoryEngine.listFiles ()) {eventList.add (New MyCode (file.getName (), file.length (), New Date (file.lastModified ()));} Two LevelfilterTablePanel Demo = New DolilWelcomeTablePanel (Eventilist); Jeffre Frame = New Gefram (); Container cp = frame.getContentPane (); cp.add (demo); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); Frame.setSize (500, 500); Frame.Set Location (500, 500); frame.setVisible (true);}}
MatcherEditor class:
Expands the public class barcode matcher editor abstractMatcherEditor ActionListener { Private JRadioButton jpg, doc, Other; Public Barcode Maitier Editor (JRDO Button JPG, JRDO Button Dock, JRDObutton Other) {this.jpg = jpg; this.doc = document; it; other = others; this.jpg.addActionListener (this); this.doc.addActionListener (this }; This.others.addActionListener (this);} Public Zero ActionPerfed (Action Event E) {Final String Filters = (JRDObutton) e.getSource (). GetText (); if (filter == faucet) this.fireMatchAll (); Else this.fireChanged (new barcode filter meter (filter)); } Private static class barcode filter Matter michor {Private Final String Filter; Public barcode filter meter (string filter) {this.filter = filter; } Public Boolean matches (item items) {last MyCode code = (MyCode) items; Return return filter.equals ("Other") || . Code.getName () endsWith (this.filter); }}}}
You just have two FilterList s Together: event list & lt; Person & gt; Person list = ... ... filter list & lt; Person & gt; FilterListByGender = New Filter List & lt; Person & gt; (Person list, gender booklet); FilterList & LT; Person & gt; FilterListBySurname = New filter list & lt; Person & gt; (Filter biker, text lesson mettech); // Filters usually use you as ... LISTBySurname ...
Comments
Post a Comment