I want table list selection listener to be called ONCE

Today I have found that JTable - ListSelectionModel's ListSelectionListener, specifically its
valueChanged() method, is called twice by a single selection. One for mouse press and
another is for the subsequent mouse release.
How could I prevent that and have them call the method only once, for mouse press only?

Here's a small demo:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
public class TableSelection{
  JFrame frame;
  JTable table;
  JScrollPane jsp;
  public TableSelection(){
    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container con = frame.getContentPane();
    table = new JTable(10, 5);
    jsp = new JScrollPane(table);
    ListSelectionModel lsm = table.getSelectionModel();
    lsm.addListSelectionListener(new LsListener());
    con.add(jsp);
    frame.setBounds(50, 50, 400, 200);
    frame.setVisible(true);
  public static void main(String[] args){
    new TableSelection();
  class LsListener implements ListSelectionListener{
    public void valueChanged(ListSelectionEvent e){
      System.out.println("selected : " + table.getSelectedRow() + ", "
       + table.getSelectedColumn());
}

Similar Messages

  • Issue with Selection Listener when the table has only one row

    Hi All ,
    I have developed a table in which I am using Selection Listener to perform some task when any row is selected.
    It is working fine when I have more than 1 row in the table, but when I have only one row in the table , the selection listener do not call the corresponding method in bean.
    I understand that selection event will be raised only when the row is changed, but in the use case when only one row is there, what should be done to make the selection listener work ?
    In the selection listener I have written code to make the selected row as current row , and perform the required task.
    Please suggest a way out for this situation.
    Thanks in advance.

    Hi,
    try removing this attr from table
    selectedRowKeys="#{bindings.xxx_VO1.collectionModel.selectedRow}"

  • Af:Table retains rows selected and selection listener doesnt work

    Hi
    I have a table with a list of objects passed to it to be rendered. When the user selects an object and clicks on the launch button above the table, it launches a new page and on the new page when the user clicks on cancel it brings back to the same page where the table is present. While coming back to this page, the row that was earlier selected by the user is highlighted and a click on the same row doesnt enable the selection listener. I have to click on some other row and then click the old row if I want to relaunch the old page
    <af:table var="row" rowBandingInterval="0" id="tblProcedures" emptyText="#{dbProcedureMsg.TABLE_EMPTY_TEXT}"
    summary="#{dbProcedureMsg.TABLE_SUMMARY_TEXT}"
    value="#{pageFlowScope.db_provisioning_DeploymentProcedurePageModel.collectionModel}" filterVisible="false"
    columnStretching="column:colDescription" rowSelection="single" width="99.7%"
    selectionListener="#{pageFlowScope.db_provisioning_DeploymentProcedurePageModel.processSelection}">
    There is one more table which behaves the same way. But other tables which are part of my application work correctly.
    Any idea on what I might be doing wrong ?
    Thanks in advance

    Hi,
    To be honest Million rows in excel its questionable for me
    I would try to find alternate solution rather than killing ADF on client and then your DBA will call you for a urgent meeting. Even if you make it work with ADF, people will not going use it due to huge amount of data load.
    What you can do is to call external report like Jasper, BIRT etc. etc. and provide option there to export to Excel based on your criteria (but million rows is again questionable)
    OR
    one idea is to give option at client side to request a report with button at af:TABLE toolbar ...then you can schedule a job at database server level using PL/SQL dbms_scheduler package with OS script to generate text file on server and FTP it to some machine.
    Hope it help,
    ZB

  • Want to display selected rows of table in another table

    Hello all,
    On jspx page their is quick query search component clcking on it popup gives result in table format
    user can select multiple rows for this I have provided checkbox column which transit variable in my view..
    now I want to display selected rows into another table
    how I can achieve this functionality...

    Hi,
    You can add the method in the AM, expose them as client interface. In the action listener of the button (of the popup where you are selecting the rows and clicking to continue), execute the method from AM.
    Sample,
    AM method
    public void filterMyTableRows(){
    this.getMyViewObject().setWhereClause("transient_attribute='Y'");  // Change according to your view object name and transient attribute name
    this.getMyViewObject().executeQuery();
    }In your actionListener, add something like
        public String commandButtonActionListener() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("filterMyTableRows");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            /* your rest of the code goes here..
            return null;
        }-Arun

  • Multi Row Selection in Table list

    Hi All,
    Currently in our scenorio, we are able to select only one row at a time from the table list, but we need to select multiple row at a time.
    Even we have tried to select multi row using CTRL key but if we select another row previous selection got removed.
    Kindly suggest where we need to make modification.
    Thank you,
    Cha

    Balan,
    I have a Search Result View which allows users to select multiple rows. To process, user clicks the custom button "Submit" added on the Tool bar. In the event handler i wrote the below code. This is selecting only last record. But i want to read all selected rows.
    --- htm page
    <chmlb:configTable id         
    = "Table"
    reset      
    = "<%= controller->get_reset_flag( ) %>"
    actions    
    = "<%= controller->gt_button %>"
    navigationMode  = "BYPAGE"
    table      
    = "//RESULT/Table"
    visibleRowCount = "<%= lv_visiblerows %>"
    usage      
    = "SEARCHRESULT"
    downloadToExcel = "<%= lv_export %>"
    selectedRowIndexTable = "<%= RESULT->SELECTION_TAB %>"
    selectionMode    
    = "<%= RESULT->SELMODE_MULTI %>"
    onRowSelection   
    = "SELECT"
    showNoMatchText = "FALSE" />
    method submit.
      data: lv_collection TYPE REF TO if_bol_bo_col,
          lv_property_access TYPE REF TO if_bol_bo_property_access.
         lv_collection ?= me->typed_context->result->collection_wrapper->get_marked( ).
         lv_property_access = lv_collection->get_first( ).
         WHILE lv_property_access IS not INITIAL.
             lv_property_access = lv_collection->get_next( ).
         endwhile.
    endmethod.
    Thanks
    Tim

  • Query to find out list of the tables getting selected frequently

    Hi All,
    Please tell me Is there any way to find out list of the tables getting selected frquently, ( please exclude the insert+updates+deletes+truncate+drop).
    Regards

    Hi Sameer
    You can check V$SQL_PLAN to see the objects being accessed by your SQL statements. If you have diagnostic licence, you can also check DBA_HIST_SQL_PLAN
    select distinct object_owner, object_name from v$sql_plan;
    select object_name, count(*) from v$sql_plan group by object_nameRemeber, this is only a crude way of finding this information.
    Regards
    Venkat

  • Creating a generic selection listener for af:table

    Hi,
    I'm using JDeveloper 11.1.1.5.0, and I have a simple requirement to set up a custom selection listener for an af:table component.
    So far, I was doing this by using a custom function to invoke the EL to perform the makeCurrent operation. However, I came across Frank Nimphius' PDF on how to build a generic selection listener, and this seemed like a better way to go about it. The problem is, the CollectionModel class used in the sample code is now deprecated. Is anyone aware of the currently supported way to implement a generic selection listener?
    Thanks,
    Gill

    this snap shot of the code i write it to get the current employee id whcich is selected
        public void select(SelectionEvent selectionEvent) {
            // Add event code here...
             RichTable  _table = (RichTable)selectionEvent.getSource();
             CollectionModel _tableModel = (CollectionModel)((RichTable)selectionEvent.getSource()).getValue();
            JUCtrlHierBinding _adfTableBinding = (JUCtrlHierBinding)_tableModel.getWrappedData();
            DCIteratorBinding _tableIteratorBinding = _adfTableBinding.getDCIteratorBinding();
            //Acess the ADF iterator binding that is used with ADF table binding
            Object _selectedRowData = _table.getSelectedRowData();
            JUCtrlHierNodeBinding _nodeBinding =
                (JUCtrlHierNodeBinding)_selectedRowData; //get the row key from the node binding and set it //as the current row in the iterator
              Key _rwKey = _nodeBinding.getRowKey();
              _tableIteratorBinding.setCurrentRowWithKey( _rwKey.toStringFormat(true));
            DCIteratorBinding it = _adfTableBinding.getDCIteratorBinding();
           System.out.println( it.getCurrentRow().getAttribute("EmployeeId"));
        }this code i written 11.1.2

  • Problem getting the Table Data with the selection listener

    Hi All,
    I am working on a tree and table components. I wrote a logic in the backing bean in such a way that when I expand a node the child nodes for the tree are getting added dynamically and also getting the data in the table for the node expanded in the tree using the same Toplink Query . I added the selection listener for the table and when I am selecting a row in the table I am getting the Null Pointer Exception as the RowKeySet Value for the row selected is coming null.
    Can any one please help me out with this problem
    I will be very thankful
    Regards,
    Madhavi.

    Hi All,
    I am working on a tree and table components. I wrote a logic in the backing bean in such a way that when I expand a node the child nodes for the tree are getting added dynamically and also getting the data in the table for the node expanded in the tree using the same Toplink Query . I added the selection listener for the table and when I am selecting a row in the table I am getting the Null Pointer Exception as the RowKeySet Value for the row selected is coming null.
    Can any one please help me out with this problem
    I will be very thankful
    Regards,
    Madhavi.

  • How to list selected parent and child rows with values from ADF TreeTable

    I created one tree table having three levels using DepartmentsVO, EmployeesVO and
    JobHistoryVO where these tables contains parent and child relationship on database.
    Then i added one more column to the tree table which displays selectBooleanCheckBox. This
    check box is available for parent and child rows in that column.
    My first concern is i
    want to list out all the parentids and its child ids from three levels where the check
    box is selected.
    second concern is
    if i select the check box for a parent row, then the remaining check boxes for child rows also select automatically which are comes under the parent row.
    Thanks in advance.
    jk

    hi Frank,
    Thanks for the quick reply...
    As I mentioned before I am able to get the children using JUCtrlHierNodeBinding. but wanted to change the value of child row which have specific data.
    Is it possible through JUCtrlHierNodeBinding to update data of child and parent?? If so then can you please post the code snippet for the same???
    Viral

  • I want table for PP

    Hello friends i want cor2 tables name in that there is one option for operation button in that all phases of production and other details stored.i want to knw it table in which that data is stored..Thanks in Advance.

    Hi,
    Please find below link for PP tables:
    http://www.sap-img.com/production/sap-production-planning-table.htm
    Engineering Change Management
    AENR - Customer and priority
    AEOI - Revision Numbers
    Work Center
    CRHD - Workcenter Header Data
    CRCA - Workcenter Capacity Allocation
    CRCO - Workcenter Cost Center Assignment
    CRHH - Hierarchy Header
    CRHS - Hierarchy Structure
    CRTX - Workcenter Text
    KAKO - Capacity Header
    KAZY - Intervals of Capacity
    Demand Management
    PBED          Independent Requirements Data
    PBIM          Independent Requirements by Material
    Repetitive Manufacturing
    SAFK         RS Header Master Data
    S025           LIS -- Run Schedule Quantities
    S026           LIS -- Material Usage
    S028           LIS -- Reporting Point Statistics
    CEZP          Reporting Point Document Logs
    CPZP          Reporting Points - Periodic Totals
    MRP Records
    MDKP        MRP Document Header Data
    MDTB         MRP Table Structure (no data)
    PLSC          Planning Scenario (Long-term Planning)
    MDFD        MRP Firming Dates
    MDVM       Planning File Entries
    S094           LIS -- Stock/Requirements Analysis
    Reservations
    RESB          Reservations/Dependent Requirements
    Planned Orders
    PLAF          Planned Orders
    Discrete Production
    AFKO         Order Header
    AFPO          Order Item Detail
    AFVC          Order Operations Detail
    AFFL           Order Sequence Details
    AFFH          Order PRT Assignment
    AFBP          Order Batch Print Requests
    AFRU          Order Completion Confirmations
    AFFW         Confirmations -- Goods Movements with Errors
    AFRC          Confirmations -- Incorrect Cost Calculations
    AFRD          Confirmations -- Defaults for Collective Confirmation
    AFRH          Confirmations -- Header Info for Confirmation Pool
    AFRV          Confirmation Pool
    AFWI          Confirmations -- Subsequently Posted Goods Movements
    Classification
    KLAH          Class Detail
    CABN          Characteristic Detail
    AUSP          Characteristic Values
    CAWN          Characteristic Values
    CAWNT         Characteristic Value Texts
    KSML          Characteristic Allocation to Class
    KSSK          Material Allocation to Class
    Routing
    PLPO - Routing Operation Details
    PLKO - Routing Header Details
    MAPL - Routing Link to Material
    PLAB - Relationships - Standard Network
    PLAS - Task List - Selection of Operations
    PLMZ - Component Allocation
    PLPH - CAPP Sub-operations
    PLFH - PRT Allocation
    PLWP - Maintenance Package Allocation
    PLMK - Inspection Characteristics
    Bill of Material
    STPO - BOM Item Details
    STPU - BOM Sub Items (designators)
    STKO - BOM Header Details
    MAST - BOM Group to Material
    STZU - BOM History Records
    STAS - BOM Item Selection
    STPF - BOM Explosion Structure
    Line Design
    LDLH - Line Hierarchy Header
    LDLP - Line Hierarchy Items
    LDLT - Line Hierarchy Takt Times
    LDLBC - Takts/No. Individual Capacities per Line
    LDLBH - Line Balance Header
    LDLBP - Line Balance Items
    LDLBT - Line Hierarchy Entry and Exit Takts
    PRT's
    CRFH - PRT Master Data
    CRVD_A - Link of PRT to Document
    CRVD_B - Link of Document to PRT
    CRVE_A - Assignment of PRT data to Equipment
    CRVE_B - Assignment of equipment to PRT data
    CRVM_A - Link of PRT data to Material
    CRVM_B - Link of Material to PRT data
    CRVS_A - Link of PRT Internal number to PRT External number
    CRVS_B - Link of PRT External number to PRT Internal number
    MAST Material BOM
    STKO BOM Header
    STPO BOM Positions (detail)
    MAPL Assignment fo Task Lists to Materials
    PLKO Routing Group Header
    PLSO Routing Group Sequence
    PLPO Routing Group Operations
    AFKO Production Order Header
    AFPO Production Order Position (details)
    Hope this may be useful..
    Regards,
    Prashant Gaikwad

  • Issue while writing a query in table type select.in the physical layer

    Hi gurus,
    I am actually trying to create a table using select in the physical layer..... i acutally am not aware what it is called but its when i click a table in the physical layer i have an option table type and i chose select which allows me type my query..the query is
    Select
    coln name(which is a lengthly list of conversion) AS column_name
    From Table name.
    when i view the data rom the physical layer everthing seems to be fine. but when i try to view the data in the frnt end it gives me an error maximum length is too long than 128....
    i am aware of this issue the sql server allows only column of length 128..but none of my column length is greater than 128..
    Could you please help me in this
    Many thanks in advance

    hi veeravalli ,
    Thanks for the reply....actually the corresponding reports for this have already been prepared...i created a view in the backend with the same select which i wrote before and and tried calling the view from her.. i have viewed the data and all is perfect...but when i try viewing it from the front end it error saying invaild object name select * from databasename.dbo.View_name...but i have checked the view exists in the backend...
    Thanks in advance....

  • Error while retrieving data from PL/SQL Table using SELECT st. (Urgent!!!)

    Hi Friends,
    I am using Oracle 8.1.6 Server, & facing problems while retrieving data from a PL/SQL Table:
    CREATE or REPLACE PROCEDURE test_proc IS
    TYPE tP2 is TABLE of varchar2(10); --declared a collection
    dt2 tP2 := tP2('a','b','c');
    i NUMBER(8);
    begin
    SELECT COUNT(*) INTO i FROM TABLE(CAST(dt2 as tP2));
    DBMS_OUTPUT.PUT_LINE('**'||i);
    end;
    While executing the above procedure, I encountered foll. error:
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [],
    ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [], [], [], [], []
    ORA-06553: PLS-801: internal error [0]
    Can anyone please help me, where the problem is??
    Is it Possible to retrieve data from PL/SQL TABLE using SELECT statement? & How ?
    Thanks in advance.
    Best Regards,
    Jay Raval.

    Thanks Roger for the Update.
    It means that have to first CREATE TYPE .. TABLE in database then only I can fire a Select statement on that TYPE.
    Actually I wanted to fire a Select statement on the TABLE TYPE, defined & declared in PLSQL stored procedure using DECLARE TYPE .. TABLE & not using CREATE TYPE .. TABLE.
    I was eager to know this, because my organization is reluctant in using CREATE TYPE .. TABLE defined in the database, so I was looking out for another alternative to access PL/SQL TABLE using Select statement without defining it database. It would have been good if I could access a PLSQL TABLE using Select statement Declared locally in the stored procedure.
    Can I summarize that to access a PL/SQL TABLE using SELECT statement, I have to first CREATE TYPE .. TABLE?
    If someone have any other idea on this, please do let me know.
    Thanks a lot for all help.
    Best Regards,
    Jay Raval.
    You have to define a database type...
    create type tP2 is table of varchar2(10)
    CREATE OR REPLACE PROCEDURE TEST_PROC
    IS
    dt2 tP2 := tP2('a','b','c');
    i NUMBER(8);
    begin
    SELECT COUNT(*) INTO i FROM TABLE(CAST (dt2 AS tP2));
    DBMS_OUTPUT.PUT_LINE('**'||i);
    end;
    This will work.
    Roger

  • UI - How to make Columns in a Drop Down List Selection?

    I am altering a code from Peter Kahrel "Beginning Script UI". I am trying to make a searchable drop down list that will have 4 columns. So far, the search works and I have headings in the search, but I cannot seem to make the columns for the actual data. I believe I need to change the type_ahead since the array is looking at this data. I'm stuck in the water. Can someone tell me what I need to do to get the list to show up as columns? How do I turn the picked = type_ahead data into four columns? Code and Screenshot below:
    picked = type_ahead (["bat", "bear", "beaver", "bee", "cat", "cats_and_dogs",
    "dog", "maggot", "moose", "moth", "mouse"]);
    function type_ahead (array)
    var w = new Window ("dialog", "Quick select");
    var entry = w.add ("edittext", [0, 0, 800, 22]);
    entry.active = true;
    var list = w.add ("listbox",  [0, 0,800, 500], "",
    {numberOfColumns: 4, showHeaders: true,
    columnTitles: ["Non-Approved Word", "Approved Alternative", "Approved Use", "Non-Approved Use"], columnWidths: [200,200,200,200]});
    list.selection = 0;
    entry.onChanging = function ()
    var temp = this.text;
    list.removeAll ();
    for (var i = 0; i < array.length; i++)
    if (array[i].toLowerCase().indexOf (temp) == 0)
    list.add ("item", array[i]);
    if (list.items.length > 0)
    list.selection = 0;
    entry.onChange = function () {w.close (1)}
    if (w.show () != 2)
    return list.selection.text;
    else
    w.close ();

    Hi Peter,
    This is one of those developments that push the limits of my knowledge-base and when things do that, I lose sleep until I figure it out. With that said :-) here is where I have ended up.
    Basically I made a new array for the table data.  I then use an array lookup to sort the array in the listbox based on the 0 array item. See the code below. Once it is loaded type in "b" and the list will start to sort.
    I need to try to get this to work as a pallete instead of a dialog box. Do palletes support this type of functionality?
    var newarray = new Array(
    new Array('Butterfly ','has wings','can fly'),
    new Array('bohemith moth','has wings','cannot fly very good'),
    new Array('word 3','replacement word','use case'));
    picked = type_ahead (newarray);
    function type_ahead (array)
    var w = new Window ("dialog", "STE Checker");
    var entry = w.add ("edittext", [0, 0, 800, 22]);
    entry.active = true;
    var list = w.add ("listbox",  [0, 0,800, 500], "",
    {numberOfColumns: 3, showHeaders: true,
    columnTitles: ["Column 1",  "Column 2", "Column 3" ], columnWidths: [200,200,400]});
    list.selection = 0;
    entry.onChanging = function ()
    var temp = this.text;
    list.removeAll ();
    for (var i = 0; i < array.length; i++)
    if (array[i][0].toLowerCase().indexOf (temp) == 0)
    with (list.add ("item", array[i][0]))
    subItems[0].text = array[i][1];
    subItems[1].text = array[i][2];
    if (list.items.length > 0)
    list.selection = 0;
    entry.onChange = function () {}
    if (w.show () != 2)
    return list.selection.text;
    else
    w.close ();

  • Unable to view table list in sql developer

    I am able to connect to the database through sql developer but unable to view tables list.
    Select query is displaying the contents though.
    Any Help ???

    Using SQL Developer, I log in using the owner user id and password. I can see all but one of my materialized views. It was definitely created by the user id I'm logged in as. A query of user_objects in sql+ shows all MVs, including the one that's missing in SQL Developer. If I log in using the same credentials in TOAD, the MV is displayed in the current schema, as I'd expect. The super weird thing is that if I use the previous version of SQL Developer, I see that MV! Any thoughts?
    Edited by: [email protected] on Feb 25, 2009 9:19 AM

  • Query Report - To display additional column in list selection box.

    Hi,
    There is query report where i want to display the additional column in list selection.
    Below is the system query report, where parameter passed is card code.
    When the cardcode - list selection is clicked system displays 2 columns i.e. Customer Code & No. of Records.
    Now in the same list selection; is it possible to display the customer name along with cardcode only for reference.
    SELECT T0.DocDate, T1.SlpName, T2.Name, T0.DocDueDate, T0.DocNum,    (CASE WHEN T0.DocStatus = 'O' THEN 'Open' ELSE 'Closed' END) AS Status,    T0.DocTotal FROM OQUT T0 LEFT JOIN OSLP T1    ON T0.SlpCode = T1.SlpCode LEFT JOIN OCPR T2 ON T0.CntctCode = T2.CntctCode WHERE T0.CardCode = N'[%0]'    ORDER BY T0.DocNum DESC
    Kindly let me know the details.
    Thanks & Regards,
    Yogesh Jadav

    Hi Yogesh Jadav,
    The answer is NO.  You may only display either code or name but not both.
    Thanks,
    Gordon

Maybe you are looking for

  • "new selection", restricted key figure and basic key figure

    Hi, I have a test report and i have a basic keyfigure "ZRevenue" and "restricted key figure"(its defined over "ZRevenue") and a "new selection"(its defined over "ZRevenue"). Now that i have "material number" and "material color" and "request id" in t

  • JMX Connector using SSL

    Hi, I have an multi MBean servers running on diffrent JBoss(not JBoss Mbean server).(server) I have another MBean server running also on another JBoss (client) Server Side private CSAPLMBeanFactory()     // aachour for SSL enabling     // Get the JBo

  • Is there an air print app?

    I'm trying to print from my iPad to my printer. The printer is in HP 6300 . This printer does not automatically air print is there an app that can do so?

  • Cant get ipod to allow me to autofill songs from my computer to my ipod

    like i said before i am having trouble getting my ipod and computer to work with each other the ipod is plugged in to the front usb port of my computer which is only about 6 months old. The ipod just sits there with a flashing orange light and will n

  • Adding Container in the selection screen

    Hi , I have a special requirement,  I need to place a long text editor in the selection screen. can any one explain it. this requirement is in HR report  including PNP Logical database. is it possible to add the Long text container ? Thanks In Advanc