JTable and filtering

Hi,
is it possible to filter data in a JTable? For example, if the user only wants to view data that contains "TOM" in the firstname column, then only rows with TOM will be displayed on the table.
How can implement that? Would I need different tablemodels for different user's selections?

Yes, it is possible. I've actually used two methods. In the first (and most complex), I built another (filter) jtable which contained field, operator, operand values for each field(column) in my other (data) jtable. The data jtable was actually populated from a SQL table which contained values which were not in the (data) jtable. The rows from the (filter) jtable were saved to the database and a stored procedure parsed it to create a query while was run against the data, which populated the (filter) jtable. The rows were joined by 'and'. They now want me to change this into a full blown query tool ((col1 > 14 or col1<3) and (col2=6 or col2=8)). EEK!
In the second, I had a predefined filter (i.e. somecolumn > 14) which was turned on & off via a checkbox. In this one, I passed a vector to the tablemodel and the tablemodel built another vector which was used to display.
Hope this helps.

Similar Messages

  • JTable allows sorting and filtering at same time

    Hi All:
    Any one has experience about having a JTable allows column sorting and row filtering at same time ?
    I've got JTable allows sorting, as well as a JTable allows filtering; but had a hard time to combine these functionality together. It seems I can't use separate TableModel since I need perform these two operations together on on JTable.
    any help is going to be greatly appreciated!

    Have a look at the QuoteTableModel at www.javapractices.com/Topic162.cjp
    (almost at the bottom of the page)

  • Using transforms and filters without device drivers

    Hello,
    I came across NIMS as a possible solution for some transforms and filtering, possibly even generating test signal data, for a seismic application. I'm in the process of evaluating NIMS for best possible fit for what we need/want to accomplish.
    Basically, we've got some seismic data, and we want to process that data through a series of transforms and filters to denoise and pick the data for seismic analysis. No sense reinventing the wheel if we can adopt and then adapt a third-party library like NIMS into our app.
    We do not necessarily need any device drivers, although I noticed installing NIMS requires them. Hopefully we can opt in or out depending on what's actually required. Can someone help clarify the nature of the driver dependency?
    Anyhow, like I said I am evaluating it for best possible fit in our application, but in the meantime if someone can shed some light on the above concerns, questions, etc, would begreat.
    Thank you...
    Best regards.
    Solved!
    Go to Solution.

    Glad to hear it!
    -Mike
    Applications Engineer
    National Instuments

  • Problem with sorting and filtering of table

    Hello,
    using VC 7.1 SP5 I have created [this|http://img232.imageshack.us/img232/2460/screenshotsr0.png] model. The webservice returns a collection of structured elements. The table is meant to display values of top-level attributes. This works as expected.
    However, the table cannot be sorted or filtered. What is the reason for this? How can I fix that?
    I tried to store the result of the web service in a data bridge. That did not succeed.
    Best regards
    Alexander

    Hi Natty,
    How are you trying to sort it?
    I want to be able to sort the table by clicking on the table column headers. Furthermore, I want be able to filter the table by using the built-in table feature. However, table sorting and filtering seem to be disabled for this particular table, whereas other tables in my model provide the desired features.
    Best regards
    Alexander

  • JTable and clipboard...

    Hi all!
    I'm trying to copy data from JTable to system clipboard. Here's my code that is
    supposed to do that except it doesn't work. Nothing happens. The system is
    Windows, rigth click invokes menu with only one position - COPY, which is served
    by a appopriate ActionListener. I want to copy entire table (all data):
    private class NotEditableTable extends JTable
    NotEditableTable(Object[][] data, Object[] columnNames)
    super(data, columnNames);
    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    setCellSelectionEnabled(true);
    getTableHeader().setReorderingAllowed(false);
    NotEditableTableEngine nete = new NotEditableTableEngine();
    this.addMouseListener(nete);
    public boolean isCellEditable(int row, int column)
    return false;
    private class NotEditableTableEngine extends MouseAdapter implements ActionListener
    public void mouseReleased(MouseEvent e)
    if (e.isPopupTrigger())
    JPopupMenu menu = new JPopupMenu();
    JMenuItem menuitem = new JMenuItem(Lang.TABLE_COPY, new ImageIcon("res/Copy16.gif"));
    menuitem.addActionListener(this);
    menu.add(menuitem);
    menu.show(NotEditableTable.this, e.getX(), e.getY());
    public void actionPerformed(ActionEvent e)
    TransferHandler th = new TransferHandler(null);
    NotEditableTable.this.setTransferHandler(th);
    Clipboard clip = NotEditableTable.this.getToolkit().getSystemClipboard();
    th.exportToClipboard(NotEditableTable.this, clip, TransferHandler.COPY);
    }

    I also tried the code above with a simple JTextField, both with text selected and not.Did my sample code use the TransferHandler??? The simple way to do it for a JTextField would be
    Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
    StringSelection testData = new StringSelection( textField.getText );
    //StringSelection testData = new StringSelection( textField.getSelectedText );
    c.setContents(testData, testData);
    As for the table I said that the Ctrl-C KeyStroke will invoke the default Action to copy selected data from the JTable to the Clipboard. This can be tested manually by simply using Ctrl-C. If you want to invoke it in your program then you need to get the corresponding Action from the JTable and invoke the ActionPerformed method of the Action. You can try using the
    getActionForKeyStroke(...) method of JComponent to get the Action.

  • JTable and ResultSet TableModel with big resultset

    Hi, I have a question about JTable and a ResultSet TableModel.
    I have to develop a swing JTable application that gets the data from a ResultSetTableModel where the user can update the jtable data.
    The problem is the following:
    the JTable have to contain the whole data of the source database table. Currently I have defined a
    a TYPE_SCROLL_SENSITIVE & CONCUR_UPDATABLE statement.
    The problem is that when I execute the query the whole ResultSet is "downloaded" on the client side application (my jtable) and I could receive (with big resultsets) an "out of memory error"...
    I have investigate about the possibility of load (in the client side) only a small subset of the resultset but with no luck. In the maling lists I see that the only way to load the resultset incrementally is to define a forward only resultset with autocommit off, and using setFetchSize(...). But this solution doesn't solve my problem because if the user scrolls the entire table, the whole resultset will be downloaded...
    In my opinion, there is only one solution:
    - create a small JTable "cache structure" and update the structure with "remote calls" to the server ...
    in other words I have to define on the server side a "servlet environment" that queries the database, creates the resultset and gives to the jtable only the data subsets that it needs... (alternatively I could define an RMI client/server distribuited applications...)
    This is my solution, somebody can help me?
    Are there others solutions for my problem?
    Thanks in advance,
    Stefano

    The database table currently is about 80000 rows but the next year will be 200000 and so on ...
    I know that excel has this limit but my JTable have to display more data than a simple excel work sheet.
    I explain in more detail my solution:
    whith a distribuited TableModel the whole tablemodel data are on the server side and not on the client (jtable).
    The local JTable TableModel gets the values from a local (limited, 1000rows for example) structure, and when the user scroll up and down the jtable the TableModel updates this structure...
    For example: initially the local JTable structure contains the rows from 0 to 1000;
    the user scroll down, when the cell 800 (for example) have to be displayed the method:
    getValueAt(800,...)
    is called.
    This method will update the table structure. Now, for example, the table structure will contain data for example from row 500 to row 1500 (the data from 0 to 499 are deleted)
    In this way the local table model dimension will be indipendent from the real database table dimension ...
    I hope that my solution is more clear now...
    under these conditions the only solutions that can work have to implement a local tablemodel with limited dimension...
    Another solution without servlet and rmi that I have found is the following:
    update the local limited tablemodel structure quering the database server with select .... limit ... offset
    but, the select ... limit ... offset is very dangerous when the offset is high because the database server have to do a sequential scan of all previuous records ...
    with servlet (or RMI) solution instead, the entire resultset is on the server and I have only to request the data from the current resultset from row N to row N+1000 without no queries...
    Thanks

  • Clarification of Servlet Spec for forwarding and filters

    Hi everybody,
    I'm having a problem trying to use SiteMesh in WebLogic 9.1 vs Tomcat 5.5.17. The issue seems to come up because the two containers have different behavior when it comes to forwarding and filters.
    The scenario is this: A request comes in to a servlet, that servlet forwards to a JSP page using RequestDispatcher.forward(). The SiteMesh filter looks at request.getServletPath() after the chain has executed and determines whether or not to apply the decoration based on the path of the page. The filter's doFilter() method looks something like :
    chain.doFilter(request, response)
    if(request.getServletPath() = matchingPath)
        applyDecoration();
    }Now, in Tomcat, a call to request.getServletPath() before and after the call to chain.doFilter() returns the exact same thing, regardless of whether the target servlet executes a forward. But in WebLogic, the call to getServletPath() after chain.doFilter() returns the forwarded path, not the original path.
    Who is right? Or is this one of those gray areas?
    Thanks,
    Scott

    Thanks for the info. You are correct, I was using 'forward'. I changed it to use 'sendRedirect' and this time the request goes via the filter. However, the request parameters that were in the original request have disappeared after the 'sendRedirect'. I could just add all the request parameters to the string I pass to sendredirect but was wondering if there was a better/simpler way.
    Thanks,
    Paul

  • How to define the order of GROUPBYs, JOINs and FILTERS in an interface?

    Hello,
    I would like to define an interface which implements the following logic:
    Give me a list of all customers with less then 2 orders in status = 'A'.
    SELECT C.Name, o.cnt
    FROM CUSTOMER C
    LEFT OUTER JOIN (SELECT cust_id, count(*) cnt FROM ORDERS WHERE status = 'A' GROUP BY cust_id) O
    ON C.cust_id = O.cust_id
    WHERE O.cnt < 2 OR O.cust_id IS NULL
    In this case, the right order of operations is essential:
    First apply filter, then group, then join, then apply the second filter.
    How can I define this in an ODI interface?
    Thanks in advance for any hints...
    Best regards,
    Karol

    Defining JOINs order :
    1 - Go in topology manager and verify that your technologie support the ISO ordered join ( left inner join ...)
    NB : by default Oracle data sources are configured with the old syntax ( ie : columns(+)=expr )
    - Open technology Oracle: Check SQL ISO
    - Go to the SQL tab
    - select "FROM" in the filter place
    - verify the join syntax
    2 - Define the alias order in the source table
    3 - Check the ordered join (ISO) and a num-order on the join operator
    Defining GROUPBYs and FILTERS orders seems to be impossible
    but you can create a mapping as a view and use this mapping as a source in an other one !

  • Plug ins for burning, dodging, layers and filters

    I have Lightroom 4.4 and I would like to add plugins for burning, dodging, layers and filters.  Which plugins would I need to do this things and where would I get them?
    Thank you, kastenem

    Lightroom has dodge and burn built in through the adjustment brushes.  You can't have layers or PS-style filters in LR.

  • Re-linking Motion assets, templates and filters etc.

    Hi, can anyone help me with re-linking my Motion assets, templates and filters? They're currently stored on an external hard drive. I've now managed to upgrade my macbook pro HD and would like to have then on my internal HD. So which folders do I place them in and how do I link them to their new location so that Motion recognises them?
    Also I will have to do this for my whole Final Cut HD suite so will it be the same process for Soundtrack Pro, DVD studio pro and Livetype etc?
    Thank

    The locations are stored in the file /Library/Preferences/com.apple.proapps.plist. If you don't have the developer tools installed, try something like PlistEdit Pro to open the file.
    http://www.fatcatsoftware.com/plisteditpro/

  • Aggregation level and filters in bi 7.0 reporting

    hi friends,
    what the use of creating aggregation level and filters in reporting in bps.
    if u have any videos for bps, please send me links.
    thanking u
    suneel.

    Aggregation levels and filters are spefic objects used in Integrated Planning; they did ot exist in BPS. Aggregation level is similar to planning level and filter is similar to planning package. Agg levels and filters are the essential objects for planning with Integrated planning.
    Ravi Thothadri

  • EasyDMS: New handling of layouts and filters

    Hi,
    in the past we deployed standard layouts and filters in EasyDMS via registry keys. Now there's a new option to store it in the backend (several tables e.g. EDMS_LAYOUT, EDMS_FILTER, etc.).
    However we've some troubles with these settings - example:
    We've defined default settings in EDMS_PREFS table. As soon as a user creates his own layout or filter the new values override the default - even if he just wants to create a new layout also the filter is gone.
    Does any body have some more details on this stuff? There are (almost) no OSS notes, there is no documentation, there's nothing mentioned in the release notes ...
    Thx
    Alex

    Hi,
    Please refer SAP Note 1405541 and see if this is helpful. If will be helpful if all the issues faced are listed in detail.
    Jomerce
    Edited by: Jomerce PJ on Nov 18, 2009 1:06 PM
    Edited by: Jomerce PJ on Nov 18, 2009 1:06 PM

  • JTables and frequency count report

    Is it possible to use jTable and make the cells un-editable and have it set up where if you click on a cell it could perform a specific action? I�m working on a program that calculates a frequency count report and I want to be able to click on the cell and have it display in another window the observations that contributed to that cells count. Is this possible using jTable or is there a better way to get what I want? Thanks for any suggestions.

    Yes, it looks to me as if it should be possible.

  • ACE WAF XML Gateway 6.1.1 - arbitrarily monitoring and filtering

    Can someone explain why the ACE XML Gateway is monitoring some events and filtering others, when they are the same events?
    I have all mParamAll System Command injection signtatures in monitor mode on the firewall profile that is applied to both of the web applications in the two incidents below, but the firewall sometimes monitors one and sometimes blocks the other. They are both the same and should both be monitored only.
    Please help.
    May 10 2011 08:09:25.603 PM W Matched signature SysCommandInj_m.rm via rule CommandInject.mParamAll in request from ##.###.53.80 for application 'XXX XXX'. Match was in REQUEST_POSTPARAM['__EVENTVALIDATION'], which had value /wEWlwEC6<stripped for size>1sQICoMD1. Request path was: /Kview/CustomCodeBehind/base/courseware/classroom/. Create Exemption (monitor mode) FD0A320100001868DB87435D3D7F9AB0 FBIVAWAP reactor /waf/incident
    May 10 2011 02:13:27.037 PM W Matched signature SysCommandInj_m.tclsh via rule CommandInject.mParamAll in request from ##.###.53.80 for application 'YYYYY YYY'. Match was in REQUEST_POSTPARAM['__VIEWSTATE'], which had value mQjXnQ<stripped for size>laPxd3C8+. Request path was: /XXXX/ApprovalConsole.aspx. Create Exemption FD0A320100001866DA415B3C3D7F9964 FBIVAWAP reactor /waf/incident

    Anyone?
    It looks like multiple ip addresses can be configured through the console, is this all that is required? Do I need to setup listening ports for these new ip addresses or how do I get the WAF to proxy for multiple "virtual ip addresses"?
    Thank you,
    Jim

  • Jtable and database

    hi,
    i am using jdevlopper 10g and oracle 10g express.
    i create a database and a new connection to it.
    in the first frame, i created a new jtable and i want that it containts data from the database.
    is any one can help me.
    thanks

    Hi,
    you have two options:
    - Use ADF and ADF Swing, in which cae the database connect is through a business service (e.g. ADF Business Components or EJB)
    - Create a JDBC connection to the database and populate the JTable model with the data (which is cumbersome). You find tutorials on the web of how to do this.
    Frank

Maybe you are looking for

  • After updating to snow leopard  and trying to delete mackeeper flash player will no longer work. Can anyone help me?

    After updating to snow leopard and trying to delete mackeeper, Flash player is being blocked and will not allow me to view utubes. Can anyone help?

  • Scaled image doesn't appear

    Hi, can someone tell me why the scaling of the image does not work in the code below. I making a board game application with these inherited JLabel components used to display each players piece on a background created using an inherited JPanel. The i

  • Trail Balance Report

    What are the Transaction codes available for Trail balance in SAP or how can we do the customisation. Format Should be like... GL Account Description Debit Amount Credit Amount Opening Balance Closing Balance

  • How to resolve account change issue?

    I have been with Verizon for about 13 years now. I have never filed an issue and have always been able to resolve something via customer phone service. My wife went in to a Verizon Store (http://www.verizonwireless.com/stores/california/carlsbad/carl

  • How long  i need to wait for processing item

    I am buying an Iphone 5 and my  order says     PROCESSING Items.   I am going to south america and I am afraid with the delay