Another JTable/buttons in cells query - event forwarding

Hi Everyone.
Apologies in advance for yet another thread on this subject. I realise this has been discussed a number of times but I can't find what seems like a definitive solution.
I understand what the fundamental issue is with putting JComponents in table cells - i.e. that the cells are rendered essentially as static visual entities, that they're not "components" as such and will not receive events.
I'd like to implement JButtons in table cells so that they behave as "normally" as possible - i.e. handle their own roll-over appearance, handle their own pressed appearance, and fire action events when pressed, with as little manual intervention in these mechanisms (e.g. in mouse listener code) as possible. I'm trying to do this by forwarding mouse events from the table to the button, but this doesn't seem to work as I'd hoped and I have various questions...
(Background: I have implemented JButton objects in the data model, and the getTableCellRendererComponent() method returns *(JButton)value*.)
My first question concerns the interception of mouse events. The usual technique would be to add a mouse listener and/or mouse motion listener to the table, and implement mouseClicked(), mousePressed() etc. However, can I override the table's processMouseEvent() and processMouseMotionEvent() methods instead, and from here forward events to buttons where appropriate, or process normally with super.processMouseEvent()? My motivation for doing this would be specifically not to invoke the super methods where events were forwarded to buttons - effectively consuming the event. Is this correct technique?
My second question concerns attempts to reproduce button roll-over appearances. The JTable is of course considered a single entity as far as mouse events are concerned, and MOUSE_ENTERED and MOUSE_EXITED events aren't generated as the pointer moves from cell to cell. Merely forwarding mouse events to buttons - which will mostly be MOUSE_MOVED events - seems to be insufficient and presumably the roll-over appearance change relies upon ENTERED and EXITED events occurring at the proper times.
I mimicked this behaviour in my override of processMouseMotionEvent() by calculating the value (i.e. JButton reference) of the cell under the mouse pointer, and if it wasn't the same as for the previous event, manually creating a MOUSE_ENTERED event and forwarding it to the new button. This seemed to work - the rollovers were happening (provided a table repaint() was performed), but it seemed to work without needing to explicitly sending a MOUSE_EXITED to the previous button before sending MOUSE_ENTERED to the new. I'm unclear why this is so - I was half-expecting both buttons to acquire the roll-over state, and they didn't.
Also, I had assumed that having taken care of this, I should forward MOUSE_MOVED events occurring within the confines of a cell's area to the button verbatim, but this seems to instantly cancel out any roll-over (visually the button would briefly flash a roll-over appearance as the pointer moved into its cell bounds). Why might this be so?
My last question is about the actual pressing of the button. I had hoped that forwarding MOUSE_CLICKED, MOUSE_PRESSED and MOUSE_RELEASED would cause the button to (a) acquire the button-pressed state, and (b) fire an action event to its action listeners. Neither of these things occur, and I don't understand why not.
In summary, is interception and forwarding of events like this a viable technique for implementing table cell buttons? The various solutions that a Google trawl throws up all reproduce button-pressing mechanics in varying degrees, some just detecting a click and calling some user function, others manually manipulating the button model in the mouse handler etc. If possible I'd like to avoid this, and leave as much processing as possible to the button's native code.
Thanks in advance for any suggestions received.
Regards,
A.

try to look on this
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender

Similar Messages

  • Jtable on cell changed event

    How can i treat an Jtable on cell changed event, not on value changed

    Do you mean cell selection changed? One way is to add a ListSelectionListener to both the table's and the table's ColumnModel's ListSelectionModels. Something likeListSelectionListener lsl = new ListSelectionListener() {
       public void valueChanged(ListSelectionEvent e) {
          System.out.println(e.getSource());
          ListSelectionModel lsm = (ListSelectionModel) e.getSource();
          if (!lsm.getValueIsAdjusting()) {
             System.out.println("Selection changed");
    table.getSelectionModel().addListSelectionListener(lsl);
    table.getColumnModel().getSelectionModel().addListSelectionListener(lsl);Note that simultaneous change of both row and column will generate two valueChanged events.
    If that's not what you wanted to know, ask a better question.
    [http://catb.org/~esr/faqs/smart-questions.html]
    db

  • Record has already been updated by another user. Please re-query and retry

    Hi,
    I want to uncheck the option Send e-mails for canceled notifications in Workflow mailer but getting error in fouth step in workflow Notification mailer:-
    1. Connect to Oracle Applications Manager with SYSADMIN.
    2. select Workflow manager.
    3. Click on EDIT button-->Advanced(Step 1)--->next(step 2)--->next(step 3)---"ERROR"
    This record has already been updated by another user. Please re-query and try again. ORA-06512: at "APPS.FND_SVC_COMP_PARAM_VALS_PKG", line 288 ORA-06512: at line 1
    Regards,

    Pl see if MOS Doc 286418.1 (ORA-06512: At Fnd_svc_comp_param_vals_pkg When Configuring The Java Mailer) can help
    HTH
    Srini

  • Using command button to select query - WAD 7.0

    Hello all
    Can anyone please tell me how to configure a command button (button group) to display a particular query in WAD 7.0?
    Here's what I mean -
    I have a web template with three queries. I have inserted 3 command buttons on the template. I want to assign one button to one query, so that the users can select which of the three they want to view. Which Command do I select in the command wizard to do this? Also, is it possible to hide the other two queries, when one is selected?
    Thanks
    Karen

    Hi,
    Here is one approach - Keep three analysis items in the WT. Assign three different data providers to all three analysis items. If you do not want to show any query when the WT first loads, don't assign any query to the data providers. When a button is pushed, you can use the command SET_DATA_PROVIDER_PARAMATERS to assign a query to a DP so that that query will show up.
    Other commands that will help you would be SET_ITEM_PARAMETERS using which you can hide analysis items and also, you can use the command BACK_TO_INITIAL_DP_STATE on data providers so that they do not show up if they were blank at the start.
    Another way to hide a query is to assign the analysis item to a data provider which is blank.
    For your requirements, you will have to put multiple commands behind each button - you can decide which of the above commands suit you best.

  • Set JTable in another JTable Column

    Hai Java Experts
    Can we Set JTable in another JTable Column
    In jsp we add one table in a column of another table. Like the previous way can we do it in swing?
    Pls Help me with example..
    Thanks

    [http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender]
    db
    edit And adding a table in a column of another table doesn't make any sense at all. Perhaps you meant showing a table in a cell of another table.
    Edited by: DarrylBurke

  • Event Forwarding Subscription Parameters

    Hello,
    You provided a good installation guide to create a source initiated subscription here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb870973%28v=vs.85%29.aspx
    However, I'd like to know how it really works. Here are a few questions:
    Are the logs pulled or pushed? Is this dependent on the Subscription weather it is Normal Mode or Minimize Bandwidth/Latency ? If so, how does the source computer know to push the logs or wait until pulled?
    The XML file of a Subscription is very complex. Here is one from the msdn: 
    <Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
    <SubscriptionId>SampleSISubscription</SubscriptionId>
    <SubscriptionType>SourceInitiated</SubscriptionType>
    <Description>Source Initiated Subscription Sample</Description>
    <Enabled>true</Enabled>
    <Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
    <!-- Use Normal (default), Custom, MinLatency, MinBandwidth -->
    <ConfigurationMode>Custom</ConfigurationMode>
    <Delivery Mode="Push">
    <Batching>
    <MaxItems>1</MaxItems>
    <MaxLatencyTime>1000</MaxLatencyTime>
    </Batching>
    <PushSettings>
    <Heartbeat Interval="60000"/>
    </PushSettings>
    </Delivery>
    <Expires>2018-01-01T00:00:00.000Z</Expires>
    <Query>
    <![CDATA[
    <QueryList>
    <Query Path="Application">
    <Select>Event[System/EventID='999']</Select>
    </Query>
    </QueryList>
    ]]>
    </Query>
    <ReadExistingEvents>true</ReadExistingEvents>
    <TransportName>http</TransportName>
    <ContentFormat>RenderedText</ContentFormat>
    <Locale Language="en-US"/>
    <LogFile>ForwardedEvents</LogFile>
    <AllowedSourceNonDomainComputers></AllowedSourceNonDomainComputers>
    <AllowedSourceDomainComputers>O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS)</AllowedSourceDomainComputers>
    </Subscription>
    What is meant by HeartbeatInterval and Max Latency Time?
    Next: When configuring the source computer i have to configure a Refresh time in the Policy key. (Computer Settings - Policies - Administrative Templates - Windows Components - Event Forwarding). 
    What is meant by that? when is this value being used for what?
    If I do not specify this refresh param, what is the default value?
    I really hope someone here can help me out of my confusion.
    Every Advice is appreciated

    Hi,
    Thanks for your post.
    >>What is meant by HeartbeatInterval and Max Latency Time?
    Heartbeat Interval determines how often collector will check if source is still online,
    MaxItems and MaxLatencyTime determine how source will batch items. In this example it will wait for 1 events or 1 seconds
    <MaxItems>1</MaxItems>
    <MaxLatencyTime>1000</MaxLatencyTime>
    >>Next: When configuring the source computer i have to configure a Refresh time in the Policy key. (Computer Settings - Policies - Administrative Templates - Windows Components - Event Forwarding)
    If you enable this policy setting, you can configure the Source Computer to contact a specific FQDN (Fully Qualified Domain Name) or IP Address and request subscription specifics.
    If you disable or do not configure this policy setting, the Event Collector computer will not be specified.
    >>when is this value being used for what? If I do not specify this refresh param, what is the default value?
    In my view, it is connection refresh time, we must set this parameter, for example,
    Use the following syntax when using the HTTPS protocol:
    Server=https://<FQDN of the collector>:5986/wsman/SubscriptionManager/WEC,Refresh=<Refresh interval in seconds>,IssuerCA=<Thumb print of the client authentication certificate>
    Meanwhile, i think you may ask in MSDN forums for technical support.
    https://social.msdn.microsoft.com/Forums/en-US/home
    Regards.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Command buttons to Assign Query / Query view with variables on Workbooks

    Hi experts,
    We want to have a workbook with buttons that will change the Query/Query view displayed in the unique grid we have.
    We've included command buttons on a workbook, as "<b>Data Provider Specific Command</b>" and chose the Queries, selecting the "<b>Assign Query / Query View</b>" option.
    When using queries without variables or just SAP exit variables it works perfectly, clicking the buttons change the table displayed accordingly. But when using queries that have at least one variable, in our test to select time interval, it doesn't work anymore.
    In our test, we're using just 2 queries and they have the same input variable (to select months interval); but when clicking the button no change/error occurs.
    Any ideas?
    Thanks in advance.

    Hi,
    Here is one approach - Keep three analysis items in the WT. Assign three different data providers to all three analysis items. If you do not want to show any query when the WT first loads, don't assign any query to the data providers. When a button is pushed, you can use the command SET_DATA_PROVIDER_PARAMATERS to assign a query to a DP so that that query will show up.
    Other commands that will help you would be SET_ITEM_PARAMETERS using which you can hide analysis items and also, you can use the command BACK_TO_INITIAL_DP_STATE on data providers so that they do not show up if they were blank at the start.
    Another way to hide a query is to assign the analysis item to a data provider which is blank.
    For your requirements, you will have to put multiple commands behind each button - you can decide which of the above commands suit you best.

  • How do you grey out/disable fields under a radio button if another radio button is selected in Adobe Acrobat XI Pro?

    How do you grey out/disable fields under a radio button if another radio button is selected in Adobe Acrobat XI Pro?
    I’m creating a form where the user has three options to make a payment.
    1. charge to my credit card
    2. charge associated costs to bank account
    3. By cheque or money order
    My Problem is, under each option, there are required fields that has to be filled out. So if the user picks the first option, charge to my credit card, they would fill out the required fields (credit card number, expiration date etc.). But when they click submit button to submit the form, it won’t let them, because there are required fields under the second option. Also, I have the radio buttons for the three options setup so that if the user holds the shift key and clicks a radio button, it unchecks it. So what I'm trying to do is this: If the user selects the radio button for option 1, the other two options are greyed out/disabled. And if the user holds down the shift key and clicks radio button for option one again, it unchecks the radio button and the other two options are available again. Is there a way to grey out or disable the two other payment options when the other one is picked. I’m assuming I will have to use javascript, but what would the coding be and which field do I write it under?
    Thanks in advance guys

    You will have to use custom JavaScript to access the various properties of the field object.
    The radio button group has a value. When no button is selected that value is "Off". When an individual button has been selected the value for the group will be the option or export value for that individual button.
    Once you have determined the button selected, then you will know the form fields that need to be made required. You use JavaScript to access those fields and change the "read only" property to false, and set the "required" property to true. For the fields associated with the other options, those fields should be reset, made read only, and have the "required" property set to false.
    Disabling (graying-out) Form Fields
    >> Also, I have the radio buttons for the three options setup so that if the user holds the shift key and clicks a radio button, it unchecks it.
    Radio button in a PDF do not work that way. Only check boxes can be unchecked by clicking on one that has been checked.
    If you plan the coding for the Mouse UP action to test for all possible options and code for each of those options you should have what you want.
    If you want actual code you need to provide a lot more details.
    It is even possible to perform some credit card and bank routing number validations with JavaScript and some check digit formulas.

  • Create row as next row on click of add another row button not on top of it

    My af:table is based on a transientVO (all the attributes are transient)
    This is just for data entry and not for data retrieval
    So i have placed add another row button on my af:table
    After i enter data in the first row and click add another row button the data is being moved to second row and the new row is created on top of that
    I want the row to be created as next row . not on top of my existing row
    How can we do this

    would this help you:
    http://lucbors.blogspot.com/2010/12/adf-11g-how-to-control-where-new-row-is.html

  • Glass Pane( preventUserInput when user clicks on Search button in af:query)

    Hi,
    We are using glass pane implementation on a search screen.
    When I click on Search button in af:query component (having selectInputDate (Date Picker) components)., glass pane is firing correctly,
    but second time when I am trying to select date using Date Picker (and Change the Month), glass pane is fired (entering into handleBusyState function) and calendar popup is not opening.
    I folled the below article for implementation.
    url: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/27-long-running-queries-169166.pdf used for glassPane implementation.
    Can any one help me for this issue.

    Hi am using the following code (javascript) -- Jdev(11.1.1.3)
    function preventUserInput(evt){   
    var eventSource = evt.getSource();
    var popup1 = eventSource.findComponent("showGlassPanePopup");
    if (popup1 != null){
    AdfPage.PAGE.addBusyStateListener(popup1,handleBusyState);
    evt.preventUserInput();
    //JavaScript call back handler
    function handleBusyState(evt){ 
    var popup = AdfPage.PAGE.findComponentByAbsoluteId('r3:0:r1:0:showGlassPanePopup');
    if(popup!=null){
    if (evt.isBusy()){
    popup.show();
    } else if (popup.isPopupVisible()) {
    popup.hide();
    AdfPage.PAGE.removeBusyStateListener(popup, handleBusyState);
    ... End of Code..
    This line .. (popup.isPopupVisible()) removes the Popup , if popup is visible...
    If u want the view am using..
    SELECT EMPNO , DEPTNO , HIREDATE FROM EMPLOYEE (sample Application i have created), created a view criteria for this..
    ( (EMPNO = :empNum ) AND (DEPTNO = :deptNum ) AND (TO_CHAR( TO_TIMESTAMP(HIREDATE), 'yyyy-mm-dd hh24:mi:ss.ff') = :hireDts ) ) (View Criteria)
    .. <af:clientListener method="enforcePreventUserInput" type="query"/> (added for af:query)
    Popup Used: <af:popup id="showGlassPanePopup" contentDelivery="immediate">
    <af:dialog id="d2" type="none" closeIconVisible="false">
    <af:panelGroupLayout id="panelGroupLayout1" layout="vertical">
    <af:outputText value="Processing......Please Wait.." id="ot97"/>
    </af:panelGroupLayout>
    </af:dialog>
    </af:popup>
    1. When i click search for first time.. it is showing like -- Processing .. Please Wait'
    2. When i click select Date picker it is show -- Processing .. Please Wait'
    and show a calender popup window.. If we change the month ... it will again show like -- Processing .. Please Wait'
    and it will not open calender window.
    Please Help me on this..Am facing trouble due to this.
    Thanks in Advance.
    Edited by: user10115793 on Nov 15, 2011 12:58 AM

  • Using another database table in a query

    Hi,<BR><BR>Iam designing a report in which i have to use a table from another database<BR><BR>my query is <BR><BR>select ev_class_id,ev_id,desc,start_time from tev where start_time > today<BR><BR> and (desc like \'%f\' or desc like \'%m\' or desc like \'%yds\')<BR><BR> and ev_id not in(selct ev_id from ppbrio:race_length)<BR><BR> and ev_class_id = 23<BR><BR> union<BR><BR> select ev_class_id,ev_id,desc,start_time from tev where start_time > today<BR><BR> and ev_id not in (select ev_id from ppbrio:race_length)<BR><BR> and ev_class_id in (3,129,131,132)<BR><BR>"open bet" is a databse am using to design query and have to use a table from ppbrio(pp_race_length)<BR><BR>can some body tell me how to do this.<BR><BR>rajani<BR><BR><BR>

    Put it in the post-query trigger. Post-change is there only for backward compatibility.

  • Create a Button on a Query

    Hello,
    I want to know how can I put a Button on a Query.
    I want to put a Print Button.
    I know that in the left button there is a option to print. I want to know if I can put that option as a Button directly in the web page of the query.
    Thank you in advance & Best regards...
    Pablo Mortera.

    Hi
    Yes you can have that option in WAD template. Please find below link for more information
    Re: WAD (BW 3.5)  - Export to PDF
    In BW 3.5, Export to PDF is not available as a standard setting.
    This feature is provided in BI 7.0.
    With 3.5 you can have an addon like the Camelot Document convertor for exporting to PDF.
    Refer to the below link for more info on this...
    http://www.camelot-idpro.de/fileadmin/content_admin/downloads_en/Document_Conversion_and_Printing_Framework.pdf
    Regards
    Ravi

  • Check Box or  Drow Radio Button on Bex Query

    Hi Experts,
    Does anyone know to how to put a "Check Box" or  "Drow Radio Button" variable on query selection screen?
    The user want to switch the order data between open and completed on a same report by a check box / radio button.
    Thnaks

    Hi Linkzhou,
    Why don't you directly use a var on Actual Delivery Date & include/exclude on # cases to report open/closed shipments.
    Alternatively, You can achieve the same without making changes to backend, if you are ok with using WAD. In WAD 7, you can use a DropDown webitem instead of a RadioButton/Checkbox webitem since you cannot assign a Command on selection from a RadioButton/Checkbox webitem. Also, you would need to design the same in a web template since this will not be made available on your query selection screen.
    In the DropDown webitem, use Data Binding Type -> 'Fixed List of Options' , here you can configure
    Open -> under Action use Command 'SET_SELECTION_STATE_SIMPLE', choose your Actual Delivery Date char, Sign -> INCLUDING, Operator -> Equals, Equals -> Member Name, Member Name -> Direct Input -> # [Not Assigned]
    Closed -> under Action use Command 'SET_SELECTION_STATE_SIMPLE', choose your Actual Delivery Date char, Sign -> EXCLUDING, Operator -> Equals, Equals -> Member Name, Member Name -> Direct Input -> # [Not Assigned]
    Now when the user selects Open option from the DropDown webitem, the data provider query will be filtered for open shipments & vice versa for Closed option.
    --Priya

  • How to hide reset button in af-query panel in ADF

    Hello All,
    i am using Jdeveloper version- 11.1.2.0.38.60.17 ,i am facing problem with hiding reset button in "af-Query panel".
    kindly suggest me how to hide it. it's urgent.
    Thanks & Regards
    AbhijeetPS
    Edited by: 967068 on Oct 23, 2012 12:39 PM

    Hello All
    I have solved this problem.
    Go to Query panel properties inspector and set Display mode = simple
    and drag an af- command button outside of the query panel.
    <af:commandButton text="Search" id="cb6" actionListener="#{bindings.Execute.execute}"/>
    Thanks
    AbhijeetPS
    Edited by: AbhijeetPS on Oct 23, 2012 6:38 PM

  • Can we handle 'GO' button in a 'QUERY' region

    Hi,
    Is it possible to handle 'GO' button in a 'QUERY' region.
    Can we modify its behavior by a controller kind of thing.
    Thanks & Regards,
    Swaroop

    Straight from the devguide :-)
    processFormRequest (OAPageContext pageContext, OAWebBean webBean)
    // Make sure that you are in the right panel
    OAQueryBean queryBean = (OAQueryBean) webBean;
    queryBean.getCurrentSearchPanel();
    // Handle the "Go" button click on the simple search panel
    if (SEARCH.equals (currentPanel) &&
    queryBean.getGoButtonName() != null)
    // retrieve your item and process it here.
    String value = pageContext.getParameter (<projectIdSimpleSearch>);
    // Build the appropriate where clause for projectIdSimpleSearch
    // and set it on your vo and execute its query
    // using the initQuery method.
    // Handle the "Go" button click on the advanced search panel
    if (ADVANCED_SEARCH.equals (currentPanel) &&
    queryBean.getGoButtonName() != null)
    // retrieve your item and process it here.
    String value = pageContext.getParameter(<projectIdAdvSearch>);
    // build the appropriate where clause for projectIdAdvSearch
    // and set it on your vo and execute its query
    // using the initQuery method.
    Thanks
    Tapash

Maybe you are looking for

  • T-SQL - PL/SQL conversion: insert into ... select problem

    Hi! If I have an insert into ... select statement in T-SQL without a 'from' clause: bq. insert into sometable (foo, bar) \\ select 5, case when @bar=5 then 4 else 3 end its translation is: bq. INSERT INTO sometable \\ ( foo, bar ) \\ VALUES ( 5, CASE

  • Byte array to png image conversion

    hi friends i am using a servlet using tomcat server to send multiple images to a client. i have stored all the images in a single byte array.and then encoded using base64. i am sending it to the client side and decoding it. when i extract the byte ar

  • How service order and sales order are linked to Service notification

    Hi I want to link a specific service order type and a specific sales order type to a service notification how to do that. Please help me out

  • Pages iWork 08-making a list- font changes

    When I make a list in Pages the font for the numbers and or letters is different than the font I am using. How do I change the font for the list????

  • Clear recent items is broken in 10.8 (major privacy issue!)

    Clearing recent items is now completely broken under Mountain Lion. Try this experiment: 1. Open an image in Preview.app. 2. File > Open Recent > Clear Menu So is it gone now?  No!!! They are not gone.  You can still see what somebody previous viewed