How to trigger own events?

How can you create your own events to be triggered?
For instance, I have an InputStream that I've got through a Socket that's listening for incoming data. I want to signal/trigger an event when data comes in so that the gui (in another class) can take appropriate actions. How can you do this?

The basic idea is this:
public interface SockeListener
    void dataEvent(/* pass a parameter if needed.  Often an event interface is added */);
public class MySocket
     private final List listeners = new ArrayList();
     public void addListener(SocketListener listener)
          listeners.add(listener);
     public void removeListener(SocketListener listener)
          listeners.remove(listener);
     private void triggerEvent()
           for (Iterator i = listeners.iterator(); i.hasNext();)
                ((SocketListener) i).dataEvent();
}Check out the PropertyChangeSupport class also.

Similar Messages

  • How to trigger left_click_run event on ALV GRID

    Hiiiiiiii........
    Can any of u please tell me how to trigger left_click_run event on ALV GRID.
         There is an event LEFT_CLICK_RUN and  its a public accessed event. But the problem is , the corresponding  attribute of this event  "EVENT_LEFT_CLICK_RUN" which is needed to registered that event (We need to register our events through a method set_register_events  using table of type cntl_simple_events...) is protect accessed. So I am unable to use that attribute...Could u please tell  me is there any alternative way to register that event.......ANY POSSIBLE WAY?
    Thanks in advance,
    Rams

    I think you should use event selection_changed. Note that you shouldn't allow multiple selection for the tree at the same time, i.e. use: create object g_tree exporting \[...\] node_selection_mode = cl_gui_column_tree=>node_sel_mode_single.
    For more information, see this thread: Urgently required :  cl_gui_alv_tree single_click event...

  • How to trigger an event in the program

    Hi,
    I have a program. The purpose of the program is to retrieve the data matching the selection criteria and downlod the same to a file.
    In the selection screen, I have a parameter called 'EVENT'. Here, user enters some event name. Generally, they enter the 'Background job processing events'.
    So, my requirement is... once the files are successfully downloaded, the program should trigger the 'EVENT' specified in the selection screen at run time.
    Can someone help me in this regard. How to trigger an EVENT in the program. Is there any Function Module or Method available in SAP which triggers the EVENT at runtime.
    And is there any table available in SAP which stores all the events available in SAP. Because, whenever the user enters an EVENT in the selection screen, we should check whether the event is valid or not. So, if there is any table available which has all the events then, it will be easy I guess. or is there any other way to validate the EVENT name.
    Please help me. Thanks in advance,
    Best Regards,
    Paddu.

    Hello Paddu,
    have a look at tables
    - btcsev, btcsed (system events)
    - btcuev, btcued (user events)
    and use function BP_EVENT_RAISE.
    kind regards
    Walter Habich

  • How to trigger a event when WBS gets changed in Cj02

    Hello,
    I have a requirement where I need to send create an idoc and send the idoc to external system when WBS is created or changed.  Currently, I have the following setup:
       - I have created a YBUS2054 as a subtype of BUS2054 using SWO1
       - YBUS2054 has been delegated to BUS2054
       - created an CHANGED event in the YBUS2054. This event is implemented and then released
       - created a type linkage (object type=YBUS2054, event=CHANGED, receiver type null, and receiver function module = zz_create_wbs_idoc) using SWETYPV. This function is supposed to create an idoc when CHANGED event occurs. I just don't know how to trigger the event to occur.
       - all the port, define idoc type, logical system, and etc are setup
       - when I try to create an entry in "Event for Chagne Document" using SWEC with change doc object=PROJ, business object type = YBUS2054, with on change, I get "Key for change doc object PROJ and business object type YBUS2054 are incompatible".
    I tried various configurations, and I was not successfully in creating an event on CHANGED
    can you please advise what I am missing in getting the changed event to trigger?
    Thank you in advance,
    Shawn

    Hi,
    If the change doc doesnt exist, check if you can create an event using BSVW.
    Also use the event log to see if there are other sap standard events happening.
    I checked the package belonging to CJ02 to see if there is something useable, but didn't find anything: CN_PSP_OPR
    If there are no sap standard ways to get an event, you'll have to find a badi/enhancement spot and include some coding to start the event using fm SAP_WAPI_CREATE_EVENT.
    Kind regards, Rob Dielemans

  • How to trigger an event by using

    Hi all,
    I have created a jbutton and an event for the jbutton, for example,
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)Now, I would like to trigger the event by pressing a hot key, for example "F1", how can i make it? Can anyone help me? Thanks.
    Ning.

    Hi,
    I have read through the information that you provided and tried to integrate it into my coding, but I'm really not so clear about that and i don't know how to apply into my coding correctly......can anyone help me? Thanks.
    I'm creating an application using the J2SE v 1.4.2_10 SDK with NetBeans 4.1 Bundle. By the way, below is a simple testing program that including component jLabel1, jButton1 and jButton2. Both of the button are hold an event each. I would like to create a hotkey for each button, "F1" key for jButtton1, "F2" key for jButton2. If I click on the "F1" key, the jLabel1 will displays the character "ABC", if I click on the "F2" key, the jLabel1 will display the character "123". Can anyone provide the code to me? Thanks.
    * test.java
    public class test extends javax.swing.JFrame {
        /** Creates new form test */
        public test() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jLabel1 = new javax.swing.JLabel();
            getContentPane().setLayout(null);
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("ABC");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            getContentPane().add(jButton1);
            jButton1.setBounds(90, 70, 90, 23);
            jButton2.setText("123");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton2ActionPerformed(evt);
            getContentPane().add(jButton2);
            jButton2.setBounds(191, 70, 80, 23);
            jLabel1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
            getContentPane().add(jLabel1);
            jLabel1.setBounds(110, 134, 150, 20);
            setBounds(20, 20, 400, 300);
        // </editor-fold>
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            jLabel1.setText("123");
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            jLabel1.setText("ABC");
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new test().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JLabel jLabel1;
        // End of variables declaration
    }Ning.

  • How to trigger an event when a job is cancelled

    Hi,
    Can anyone help me out wid a transaction that will trigger an event when a job is
    cancelled....??
    My scenario is :
    When a job is cancelled (SM37) or in cancelled status  i want notify to certain ppl thru emails.
    How do i go abt doing the same??
    Its Urgent...
    Answers will be rewarded.
    regards,
    Rohan

    Hi,
    please check out the link below it might help you
    http://help.sap.com/saphelp_nw2004s/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/97d2e8b3-0b01-0010-b787-b8ce558a51c2
    for table name and list of function please check out the links below it will help you
    http://www.erpgenie.com/sap/abap/tables_system.htm
    http://www.sap-img.com/abap/function-list.htm
    **************please reward points if the information is helpful to you**********

  • How to trigger wd event in flex

    Hi,
    I want to trigger an event in abap web dynpro (e.g. through pressing an button). This event should be handled in flex. Does anyone know how to do this?
    Thank you and best regards, Eddy

    Hi Edger,
    You can have any trigger event on your WebDynpro Abap screen and then on that event you can call swf file from your mime folder or you can even update flex application data.
    for your help you can refer following tutorial which easily explaining all necessary steps nicely as per your required scenario:
    https://wiki.sdn.sap.com/wiki/display/EmTech/IslandsWDATutorial1
    If you are willing to trigger an event in flex then act in WDA that is also possible.
    Refer Bi-directional Data Binding and Eventing in following tutorial:
    https://wiki.sdn.sap.com/wiki/display/EmTech/IslandsWDATutorial2
    Regards,
    Vivek

  • Dictionary Search Help - how to trigger an event after F4 help

    Hi,
    I been searching the web lately to find a way to trigger an event after using the F4 input help.
    Here is an example of what I would like to do:
    - I have a WD form with a inputfield in it.
    - The input field is bound to datalement "LIFNR".
    - In my context I have specified the Input Help Mode to "Dictionary Search Help"
    - And the Dictionay Search Help is set to "KRED"
    A user will the click on F4 to start the Search help, then pick a LIFNR and the WD inputfield wil be filled.
    What I want is to trigger an event when this is happening.
    Does anyone have som tips or guides for me regarding this problem?
    Thanks in advance! =)

    Hi Mathias Hagen
    Actually there is no straight way of doing this , but still you can trigger a event in F4 search help ...  below is very informative blog to trigger the F4 search help by chris
    Firing a WDA event on using a Search Help - how to do it, without an NDA
    regards
    Chinnaiya P

  • How to trigger an event?

    hi,
    could i trigger an event in workflow A by using "Post Internal XML Event"
    workflow B?
    must i use JMS to trigger it?
    Thanks.
    * Name: Gary Wang
    * Tele: 010-65546668-8119
    * Mail: [email protected]

    Gary
    You can use JMS (preferably JMS Header properties for performance, or
    XML document), or you can use the api and invoke a business operation as a
    bean or java class
    Tony
    "Gary" <[email protected]> wrote in message
    news:3c2c0379$[email protected]..
    hi,
    could i trigger an event in workflow A by using "Post Internal XML Event"
    workflow B?
    must i use JMS to trigger it?
    Thanks.
    * Name: Gary Wang
    * Tele: 010-65546668-8119
    * Mail: [email protected]

  • How to trigger another events during one event is running?

    dear all,
    i have two events. both of them are triggered by pussing two different buttuns.
    one has been triggered and at running status.
    right now i can't not trigger the other events. clicking the buttons doesn't give my any response.
    does any one have some ideas?
    thank you very much
    Jack

    Hello Jack
    When you select edit events in the context menu from the event case, a dialog appears. At the bottom is a check box which allows to lock the frontpanel until the event is executed (meaning the event case is finished). If you disable this case, the frontpanel is not locked, but the events are not handled before the event case is called for the next time. Therefore it should be placed in a loop. There are some examples in LabVIEW which might help.
    If you want to trigger the second event when the first is not finished yet, you must create two separe event cases, each in an own loop. And the check box mentioned above must be off for both events.
    I hope this helps. If not, aks again.
    Greetings
    shb

  • How to trigger Process event in Process Chain

    We have a Process chain in which the Event is seen in Yellow ,but it is finished. Down the below Event is not trigerring. How to do that. Please suggest.
    Thanks

    Hi Annapurna,
    Goto SE38 run the function module RSPC_PROCESS_FINISH by providing the entries in LOGID, TYPE, VARIENT, INSTANCE and STATE.
    These entries can be get in the table RSPCPROCESSLOG. To execute the table entries go to SE16 and give table name RSPCPROCESSLOG and press enter. Then in the processchain where the chain got stuck, double click on the varient and goto chain tab and you will get VARIENT and INSTANCE.
    Copy and paste these in the table RSPCPROCESSLOG selection screen and execute. Here you will get  LOGID, TYPE, VARIENT, INSTANCE.
    Enter all these field in function module RSPC_PROCESS_FINISH by providing the STATE as G and execute.
    Your stuck process chain will move further.
    Thanks and regards
    Koushik
    Steps same as described by AP.
    Hope it helps.
    Edited by: koushik gowda on Jul 16, 2009 11:40 AM

  • How to trigger an event web service when a mail received in Exchange Server ?

    Hi,
    I have a requirement of Triggering the event in Web-service with related data (Mail Details) whenever mail received in Exchange Server..
    I have done R&D on this, but I couldn't find answer.
    Is there any possibility of triggering the service ? If Yes, how can I achieve this?
    Thanks in Advance.

    Hi Jason,
    Using above link, I am getting notifications only for the logged in user
    service.Credentials = new NetworkCredential(EmailAddress,Password,domain);
    I want a way to get the notification or callback when a email comes from any user to the server. I tried as above , but i could get the notifications for a logged in user with his credentials.
    Please help me to find out a way to get the notifications from the server irrespective of the user login.

  • How to trigger an event after symbol animation completes?

    Hello,
    I have been trying to figure this out without success.
    On the stage I have a button and a hidden symbol. The symbol has an animation within itself.
    When I click the button, the symbol becomes visible and plays the animation. Its all good so far.
    This is what I am trying to accomplish:
    I want to be able to click the now visible symbol, the animation within itself plays in reverse and then it hides itself.
    How do I make it hide itself after the animation plays in reverse?
    ==================================================================================
    BUTTON CODE (This works for me):
    sym.$("AnimationOne").show();
    var AnimOne = sym.getSymbol("AnimationOne");
    AnimOne.play(0);
    SYMBOL CODE (This needs to hide after animation ends):
    var AnimOne = sym.getSymbol("AnimationOne");
    AnimOne.playReverse();
    sym.$("AnimationOne").hide(); // If I add this, it just hides itself without animating in reverse
    ==================================================================================
    Thank you in advance for any help/suggestions.

    simple work around:
    place a label on your symbol and turn visibility ON
    Then on compostion ready stop your symbol on that label
    var s = sym.getSymbol("shape");
    s.stop("startAni");
    On your click event play the symbol from the label.
    var s = sym.getSymbol("shape");
    s.play("startAni");
    Then on your playReverse it will go all the way to 0 where visibility is OFF.
    sample here:
    https://www.box.com/s/m6zm1lt49bl74iwpva9l

  • Looking for an example VI that shows how to trigger an event in a VI from a subvi based on a value.

    I am looking for an example VI that uses a typical event structure for the GUI, but also has an event that will trigger based on a boolean value changing in a subVI to that VI.
    Thank you.

    You need to Create User Event.  Any Event structure which is registered with the event, whether it be in a subVI or otherwise can trigger the user event by using Generate User Event.
    Right-click an event structure and select Show Dynamic Event Terminal.  This is what you use to register your user (dynamic) events.
    Search for "events" in NI examples within LabVIEW.

  • How to trigger an event every time BSID table is updated?

    Dear all,
    I have a request at my company to develop/implement/configure a trigger to BSID standard table, to catch all records inserted and perform some calculations with the field WRBTR. I must do this whenever a record is inserted.
    Thank you in advance, i hope you will understand my poor english.
    Kind Regards,
    /S. Nuvunga

    You need to do customization for the archivelink. In this you can also set the workflow which should be started. This isn't done using a change document or an event.
    Check the customizing, there are several nodes there you need to customize. Read the help in customizing for those steps. Check in customizing under:
    Application server --> Basic services --> Archivelink
    There are several nodes which need to be configured.
    Regards,
    Martin

Maybe you are looking for

  • IPod no longer works with car stereo since upgraded MBA & iTunes

    My iPod classic has worked just fine connected to my car stereo since i bought it last june. I just bought a new Macbook Air (OS 10.7.3) & installed ITUNES 10.6.1. After I synched my ipod for the first time its recognised by the car but i get a "can'

  • Is RoboHelp 9 compatible with Internet Explorer 11

    I am having a problem displaying TOC, Index, Search, and Glosarry when I generate Help using RoboHelp 9 and Internet Explorer 11. When I made FireFox my default browser, the problems went away but my company need to ship Help that can be used with an

  • Problems doing an active Database duplication through RMAN

    Hi, I'm trying to do active Database duplication through RMAN (http://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmdupdb.htm#). My OS is Sun Solaris 5 Oracle version: 11gR1 Database on a 11gR2 Grid. I'm receiving the error RMAN> connect auxiliar

  • Exporting From FCE to IDVD With Chapters How long

    Exporting From FCE to IDVD With Chapters How long will the DVD hold??? if i have an hour and 40 minutes of HD footage all cut together with FCE and has been saved as a movie file, how many hours will IDVD let me burn to it? if i run over the allowed

  • Custom XML worked on 10.2.0.4 after upgrading to 11.2.0.1 it fails

    Hi Our developers had written custom jobs in ebus11i using XML publisher , now we have upgraded to 11.2.0.1 and it stopped working We have logged a TAR and Oracle say they dont support custom code Anyone can help Ahmed Jassat Oracle APPS DBA @ Medsch