Query about event and event handling

hi,
how exactly events are bieng generated. And how they are transmitted and how they
are caught and handled at low level. I want to trigger my own event whcih can be listen
by my own listener or some existing listener (obviously implemented from some java listener).
so help me out.
TIA
bhups

Well, first you create an interface such as FooListener where you define methods, such as foo().
Now you can make classes that have the method addFooListener(FooListener foo). Then in that class, you can for example decide that doing a certain thing (or based on the time of day or whatever) the class calls all the foo()'s of it's FooListeners and there you go.
Example code:
public interface FooListener {
    public void foo(FooEvent evt);
public class FooEvent {
   private String reason;
   public FooEvent(String reason) {
       this.reason = reason;
   public String getReason() {
      return reason;
public class Bar {
    List listeners = new LinkedList();
    public void addFooListener(FooListener foo) {
        listeners.add(foo);
    protected void fireFooEvent(String reason) {
       Iterator itr = listeners.iterator();
       FooEvent evt = new FooEvent(reason);
       while(itr.hasNext())
          ((FooListener)itr.next()).foo(evt);
    public void doBar() {
        // code omitted
        fireFooEvent("Bar done");
}Howzat?

Similar Messages

  • Retrieve event and event parameter in event based background job

    Hi,
    I think it must be possible but I cannot find documentation of it:
    When a batchjob is triggered via an event (defined in SM62) how can I retrieve the event and event parameter from within the triggered job itself. We want to use the event parameter to trigger other batchjobs, but first we must be able to retrieve them...
    Thanks
    Tom

    Standard SAP triggers can be found in TCODE SM64, Background Processing events.

  • How to write events and event handlers?

    Any samples?
    Thanks

    You can generate your custom events and it is very easy.
    You will have to extend the EventObject class in order to make an class representing the event.
    Iam giving a brief eg:
    class MyEvent extends EventObject
    MyEvent(Object source)
    super(source);//source which generated the event.
    //your own code
    interface MyEventListener
    public void myEventPerformed(MyEvent e);
    class abc
    java.util.ArrayList arr;
    abc
    arr = new java.util.ArrayList();
    public synchronized void addMyEventListener (MyEventListener l)
    arr.add(l);
    public synchronized void removeMyEventListener (MyEventListener l)
    arr.remove(arr.indexOf(l));
    protected void notifyTransEvent(Object source)
    MyEvent tEvent = new MyEvent(source);
    Iterator itr = arr.iterator();
    Iterator itr = arr.iterator();
    while(itr.hasNext())
    ((MyEventListener)itr.next()).myEventPerformed(tEvent);
    Now anyone implementing the MyEventListener inetrface can be added in the ArrayList.The ArrayList is the list representing the interesting parties who want to receive the event.When registered they will receive the event.
    This class abc is just like an component which on certain situations generate event.You can call notifyEvent in any case where you want the event to be generated.
    You will then add this class to your main class as this
    class xyz implements MyEventListener
    abc obj;
    xyz()
    obj.addMyEventListener(this);
    public void myEventPerformed(MyEvent e)
    //your handling code
    Hope this example will suffice.

  • Time-zone independent events and events that span timezones

    Hi.
    I use Calendar rather heavily.  In fact, I have events in my calendar that date back from 1995 or so that have migrated forward from my Newton through Palms and Blackberries and now to iPhones - some migration or coexistence between the Mac and these devices was painful, to say the least.  But, I digress...
    For the record, I have Time Zone Support off on my iPhone and iPad.  It's also off in Calendar on my Mac; the Mac is my 'authoritative' source of calendar (and address book) info.  When I move, it changes timezones.  For the most part, the iPhone and iPad do the right thing for events that have actual real times to them such as meetings.  If I'm supposed to be on a phone call at 7AM Seattle time, when I go to Boston, I need to be on at 10AM and it does all the devices do the right thing with those events.
    But, I want to create a recurring (daily) calendar event that happens at the same local time every day, regardless of what timezone I'm in.  For example, I create such an event in Seattle for 9AM Seattle time (PT).  When I go to Boston, I want it to happen there at 9AM ET; and the same if I went to India - 9AM IST.
    Any thoughts?  I live with this inconvenience for other things working quite well.
    My other desire is when, for example, putting airplane trips into the calendar.  I'm in Seattle and putting in Alaska Airlines Flight 12 which departs Seattle at 9:05AM PT and arrives at 5:34PM in Boston (ET).  It would be wonderful, if for the the start and end times for event scheduling, there was a pull-down or scroll-wheel from which one could select the time zone.  Now, I have to do the calculation and do 9:05AM departure and 2:34PM arrival.  It's gets a little more difficult when one is going to places where daylight savings is not observed or if you are unfamiliar with the time differences (as when flying direct from the US to India).
    Any thoughts on this problem??
      aps.

    Hey Armando Stettner,
    Thanks for the question, and what a great question it is!
    With time zone support on, you can edit an individual event and change the time zone for that event. This list will include options for your default time zones, UTC, and "floating" - the latter of which is what you are looking for. Floating changes the event to occur at the specified time, local time.
    For information on changing an event's time zone, see the following resource:
    Calendar: Change an event’s time zone
    http://support.apple.com/kb/PH11531
    I look forward to hearing how this works for you.
    Cheers!
    Matt M.

  • When I open up Calendar it asks about adding and event and gives me the option to choose a calendar, or I can click on cancel.  If I choose cancel, the window pops right back up.  If I click continue thousands of imports start opening...Calendar freezes.

    I would like to get into preferences to shut off calendars, but I cannot get to preferences will these windows are up.

    What you are experiencing is 100% related to Malware.
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • Events and Event Handlers

    Hi,
    I need to get the index of a specific line in a table. Selection mode is set to none. The first column contains a menu with two menuActionItems. When I choose an actionitem my event handler is called with parameter WDEVENT TYPE CL_WD_CUSTOM_EVENT. As I understand you have to use this parameter to get the index from the table line.
    I have tryed with the following code in my event handler method:
    DATA:
            node_lines TYPE REF TO if_wd_context_node,
            elem_lines TYPE REF TO if_wd_context_element,
            l_index TYPE i.
      elem_lines = wdevent->get_context_element( name = 'LINES' ).
      l_index = elem_lines->get_index( ).
    This does not work. The elem_lines is initial after I try to get it.
    Hope that someone can guide me in the right direction.
    Thanks,
    Morten

    hi ;
    this will work
    DATA: mod_cell TYPE  salv_wd_t_table_mod_cell,
            wa_mod_cell TYPE LINE OF salv_wd_t_table_mod_cell,
            msg TYPE string.
      mod_cell =      r_param->t_modified_cells.
      wd_comp_controller->set_material_dtl( ).
    LOOP AT mod_cell INTO wa_mod_cell.
      msg = wa_mod_cell-index .
      msg = mod_cell-index .
    l_message_manager->report_success( msg ).
    Or else try this.
    wd_event is return parameter
    data: index type i.
    index =  wd_event->get_context_elementget_index->get_index( ).

  • Events and event chains

    Hi,
    can anyone mail me screenshots as to how event creation(sm62) and job creation looks like (sm36) at
    [email protected]

    Hi Karthik
    When in doubt, visit help.sap.com and all your questions would be answered!
    anywayz, for SM36, visit
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c4/3a7ede505211d189550000e829fbbd/frameset.htm
    this should set u up
    Prakash
    Assigning points is a way of saying thanks on SDN!!

  • Query about "enable" and output rendering

    Hi - I'm working on what I hope is the penultimate cut of a filmed stage musical. It's a combination of footage from three camera angles over 2 performances. I've allocated a video track to each camera, and I'm using opacity changes to switch from one angle to another, e.g. to switch from one "over-the-shoulder" view to the other, or from a close-up on one performer to a medium wide of the chorus, and so on.
    Except for transitions I'm only using footage from one camera at a time (no split-screen), but the footage from all the cameras is still present in their own tracks. I've changed my mind about one angle vs. another in previous cuts and I want to leave all the footage there because I might make a different choice after feedback from the customer.
    This does put a bit of a load on PPro when having to render output, with roughly two-thirds of the footage not even required in the output - it's still there, but with opacity set to 0%.  If I de-select "Enable" in the clip properties for those clips I've chosen not to use in this cut, does that tell PPro to ignore it when rendering output, and consequently reduce the rendering workload? It might seem obvious, but I'd like to be sure before I start disabling hundreds of clips.
    PPro 5.5.2
    Win 7 Pro SP1
    Core i5
    8GB RAM
    c: - 100GB - OS + programs
    i: - 500GB - media
    n: - 500GB - renders, etc
    cheers
    Bernie Dwyer

    OK - thanks. Maybe I'll try one output with all clips enabled, then another with clips disabled, and compare the results.
    cheers
    Bernie Dwyer

  • Query about min and max and middle row of a table

    suppose i have table emp and field
    v_date date;
    which has data in time stamp
    time
    10:20
    10:25
    10:30
    10:32
    10:33
    10:35
    10:36
    10:38
    I need only min time and max time and two record between min and max

    I need only min time and max time and two record between min and max Like this?
    SQL> create table t (id number);
    Table created.
    SQL>
    SQL> insert into t values (1020);
    1 row created.
    SQL> insert into t values (1025);
    1 row created.
    SQL> insert into t values (1030);
    1 row created.
    SQL> insert into t values (1032);
    1 row created.
    SQL> insert into t values (1033);
    1 row created.
    SQL> insert into t values (1035);
    1 row created.
    SQL> insert into t values (1036);
    1 row created.
    SQL> insert into t values (1038);
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select * from t;
         ID
       1020
       1025
       1030
       1032
       1033
       1035
       1036
       1038
    8 rows selected.
    SQL>
    SQL>
    SQL> select decode(rownum, 1, min_val, 4, max_val, next_val) your_data from (
      2  select first_value (id) over (partition by 'a' order by 'a') min_val,
      3         last_value (id) over (partition by 'a' order by 'a')  max_val,
      4         id,
      5         lead(id) over (partition by 'a' order by id) next_val
      6   from t
      7  order by id
      8   )
      9  where min_val <> next_val and max_val <> next_val
    10  and rownum <= 4;
    YOUR_DATA
         1020
         1030
         1032
         1038
    SQL>

  • Numbers - Query about charts and dates

    I have a simply spreadsheet with 2 columns showing dates and electricity readings.
    Ive added a chart so I can see the electricity usage over time, but its showing each date eqidistant rather than showing them on a timeline.
    Can anyone tell me what Im doing wrong?

    Looks like Numbers cannot plot date data. Please provide Numbers Feedback to Apple.
    Regards,

  • What are object and port handles in CAN communication via labview

    Hi,
    I have just started working on the NI labview...i had a problem that when i changed the bitrate using CAN interface create-->CAN SDO create-->CAN write.after that i am not able to communicate with the device with the new bitrate....i have seen a few similiar forums, which talks about object and port handles as an solution of the problems..
    As
    forums.ni.com/ni/board/message?board.id=30&thread.id=3405......
    So i want ask that is this object and port handles....

    Thanks your code.
    I try the code you posted, It still no work, I found you has improved the "Get data.vi",It works better,but the second frame still no shown.
    I used the  NI CAN monitor in MAX to monitor the CAN bus,there is no second frame shown in the monitor,See attach pictures.but It shown in the Vector CAN monitor and the code call the Vector DLL.
    Have a great day.
    帖子被iwanttofly014在 12-16-2009 08:02 PM
    时编辑过了
    Flying...
    www.vihome.com.cn 虚拟仪器家园
    Attachments:
    LabVIEW VS Monitor(Vector CAN).JPG ‏70 KB
    LabVIEW VS Monitor(NI CAN).JPG ‏40 KB

  • [JS] Basic question about event listeners and event handlers

    I am very new to the whole topic of event listeners and event handlers.  I'd run the test for the following problem myself, but I don't know where to start, and I just want to know if it's impossible -- that is, if I'm misunderstanding what event listeners and event handlers do.
    Say I have an InDesign document with a text frame that is linked to an InCopy story.  Can I use an "afterImport" event listener on the text frame to perform some action any time the link to the InCopy story gets updated?  And will the event handler have access to both the story that is imported, and the pathname of the InCopy file?
    Thanks.

    Thank you, Kasyan.
    Both of those are good solutions.
    We are currently using InDesign CS4 and InCopy CS5.  I'm hoping to get them to purchase the whole CS5 suite soon, since I'd like to start writing scripts for InDesign CS5 as soon as possible, as long as I'm going to have to be doing it in the not too distant future anyway.  The greater variety of event handlers sounds like it might be something that is crucial to the project I'm working on, so that adds to the argument for getting CS5.
    Thanks again.  You have no idea how helpful this is.  I made some promises to my boss yesterday that I later realized were  based on assumptions of mine about the InDesign/InCopy system that didn't make any sense, and I was going  to have to retract my promises.  But after reading your response I think I can still deliver, in a slightly different way that I had been thinking before.
    Richard

  • What is the SAFEST SEQUENCE to convert from a Outlook/iPad/iPhone synced with MobileMe to syncing with iCloud (I have 10 years of calendar diary events and 3000 contacts) - I am worried about the data issues that have been posted about iCloud.

    What is the SAFEST SEQUENCE to convert from a Outlook/iPad/iPhone synced with MobileMe to syncing with iCloud (I have 10 years of calendar diary events and 3000 contacts) - I am worried about the data issues that have been posted about iCloud.
    This has worked fine with MobileMe with only a couple of minor glitches in the past.
    Any experience doing this the "right" way?

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.

  • Alarm and Event Query Very Slow

    Group,
    I am using the DSC Alarm and Event Query vi to pull data from the SQL database (not the Citadel).  I have a filter set up that specifies the "Alarm Area" and the start and stop dates with maximun results set to 22.  These dates are set to only pull the last 24 hrs.  This vi will return around 10 to 20 entries out of perhaps 80-90 total events in the last 24 hours in the database.   This database is ~2M in size.   I have to set the timeout to almost 10 min for this vi to not produce a timeout error.  The results returned are correct but it just seems that the time to run this vi is excessive.  It is quering a database on the same system that the quering vi is running on.  Should I expect better preformance?
    Thanks
    Todd

    Verne,
    I have boiled down the code to this attachment.  This query took almost 7 min to return 22 results from a database size that is listed as 2.09877E+6.  I have also tried the Alarms and Event Query to spreadsheet vi also and it takes the same amount of time.  I am wondering if I place the Alarms and Events into the same (Citidel) database that the traces are going if it would be much faster.  I seem to get trace data back very fast.  If I recall correctly I seperated the alarms from the trace because I was having some sort of problem accessing the alarm data in the combined database...but that was several labVIEW versions ago.  Anyone else having this problem?
    Thanks
    Todd
    Attachments:
    Generate Alarm Log General Test.vi ‏19 KB

  • Table View MULTI SELECT option and Event handling problems

    Hello All,
    I am facing problem while giving miltselect option in a table view. When i mention multiselect attribute in Select option in table view, i am unable to select all the rows which i want to select,because i have an event onRowSelection event activated so when i select a row then it will automatically go to the event and i am unable to do multiple select.
    Can you guys pl tell me is there any way thtat i can put check boxes in a table column and by that i can get values of row seelct and can perform my subsequent SQL operation.
    Also i am not able to navigate in table view through BYPAGE or BYLINE option. When I click on navigate button then page got refreshed and i lost data.
    One more query guys , can you pl tell me how can i store my internal table values from one event for the another event. I have used EXport/Import but internal table values get refreshed as page got refreshed on event switching/selection.
    Please respond.

    hye rahul.
      as i told you my second solution, will help you . the values remain in the corresponding UI elements.
    For example , you have a drop down and table view. both will trigger events. bind the data of the table at drop down event and bind the dat of the drop down at table event.
    event = cl_htmlb_manager=>get_event( runtime->server->request ).
    CASE event->id.
    when 'dd1'.                   drop down event is fired.
    bind data for drop down
    dd ?= cl_htmlb_manager=>get_data(
                                          request = runtime->server->request
                                          name    = 'dropdown'
                                          id      = dd_id'           " name of the drop down id
    along with drop down bind data for table view
        tbv ?= cl_htmlb_manager=>get_data(
                                          request = runtime->server->request
                                          name    = 'tableView'
                                          id      = 'tbv_id'           " name of the table view
    when 'tbv_id'.                   drop down event is fired.
    bind data for drop down
    dd ?= cl_htmlb_manager=>get_data(
                                          request = runtime->server->request
                                          name    = 'dropdown'
                                          id      = dd_id'           " name of the drop down id
    along with drop down bind data for table view
        tbv ?= cl_htmlb_manager=>get_data(
                                          request = runtime->server->request
                                          name    = 'tableView'
                                          id      = 'tbv_id'           " name of the table view
    This is how data should be binded in case of Stateless application. All the UI elemets must b binded again.. as the global data is refresed again.
    Hope this helps.
    Regards,
    Imran.

Maybe you are looking for