Creating custom event listener ?

Hello,
Is there anyone that have a link to a tutorial or have some information on what is needed to be able to create a custom event listener on a component ?
I am creating an interactive JSF chart library (JSFlot) and I would like to have events such as ChartDraggedEvent and ChartClickedEvent. I can create the events fine (and I can even queue them fine throught the standard action and actionListener interfaces), but I would like for the component to have attributes like chartDraggedListener and chartClickedListener, so that I can fire off the appropriate event to the appropriate listener.
Any help would be very much appreciated!

Well, that is what I am doing. The Renderer:
if (event != null && event.equalsIgnoreCase("drag")) {
                    String componentValue = request.getParameter("componentValue");
                    //Cut out logic irrelevant for this example
                    FlotChartDraggedEvent dragEvent = new FlotChartDraggedEvent(component, dragValue);
                    dragEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                    dragEvent.queue();
               } else if (event != null && event.equalsIgnoreCase("click")) {
                    //Cut out logic irrelevant for this example                    
                    FlotChartClickedEvent clickEvent = new FlotChartClickedEvent(component, clickedPoint, clickIndexInt, clickSeriesIndexInt, clickSeriesLabel);
                    clickEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                    clickEvent.queue();
               }The problem though, is that both of these events gets delivered to the actionListener attribute of my component. What I assume is missing is functionality to register a custom listener for each event, and some code in the Tag-class and TLD to supply these listeners, and its these issues that I am unsure how is done. I may be missing something very basic here though :)

Similar Messages

  • How does custom event listener work.

    Hi,
    With reference to Custom Event Listener, I wanted to know the behaviour of Custom Listener whether they are sync or async.
    For Example :
    Suppose i have a method1() which has the listener1() get invoked at some operation at line #1 of method();
    The task of listener1() takes 2 minutes aprox.
    Then my question is does method1() waits until listener1() finishes its task(2 Minutes) ?
    What is he default behavior of listner1()
    Can we change the default behavior of custom listners ?
    Thanks & Regards,

    jwenting wrote:
    rephrase your question in gramatically (and preferably syntactically) correct English so people can actually understand what you're asking.You took the words straight out of my mouth
    Mel

  • How to create custom events in OIM

    Hi
    We have a requirement to create new notification templates with custom events to send email notifications.
    How should I create a custom event, any pointers are highly appreciated.
    Thanks
    Nagendra

    I am still unclear about the relationship between this report and OIM; as stated OIM allows you to create [url http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/notevents.htm#BEIBDIAA]Custom Notification Events however generally the invocation of them is tied to the [url http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/oper.htm#CCHFBGAA]custom event handler which in turn are tied to OIM operations. In this case AFAIK there is no OIM operation rather the HCM application is querying user data combined with data from HCM. Is the requirement to use the OIM notification feature or can you use other alternatives e.g. [url http://fmwdocs.us.oracle.com/doclibs/fmw/E10285_01/dev.1111/e10224/ns_ws_api.htm#SOASE87208]UMS ?
    I think you could invoke a custom OIM event using the [url http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/apis.htm]OIM APIs specifically using the [url http://docs.oracle.com/cd/E21764_01/apirefs.1111/e17334/oracle/iam/notification/api/NotificationService.html]notification service (for details of related classes refer to the [url http://docs.oracle.com/cd/E21764_01/apirefs.1111/e17334/toc.htm]javadoc).
    However I have not tested this and was unable to find a concrete example from the documentation. Pseudo logic should be something like this:
      Hashtable env = new Hashtable();
      env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
      env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, http://OIM_HOSTNAME:OIM_PORT);
      OIMClient oimClient = new OIMClient(env);
      oimClient.login(OIM_USERNAME, OIM_PASSWORD);
      NotificationEvent event = new NotificationEvent();
      event.setUserIds(new String[]{"receiverUserId"});
      event.setTemplateName("Template Name");
      event.setSender(null);
      NotificationService notificationService = oimClient.getService(NotificationService.class);
      notificationService.notify(event);Do note that this is provided as illustration and if adopted you will need to implement proper exception handling, store credentials in [url http://docs.oracle.com/cd/E29505_01/core.1111/e10043/devcsf.htm]CSF etc.
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • IS IT POSSIBLE TO  CREATE CUSTOM EVENT IN CONTENTDB?

    Hi,
    Is it possible to create a timely event in contentdb, which could trigger based on time like daily or weekly once? if yes
    then, can we register a custom bpel workflow to it? so that when event triggers
    then that workflow should also gets executed.
    thanks,
    Parkar

    Yes,
    basically you can create a custom agent that will run e.g. once a day.
    Regards
    - TS

  • Query regarding creating a Custom Event and Firing.

    I have created a custom event,a custom listener and a custom button.
    But when I click on custom button,my event is not being fired.
    When and how do I need to invoke the fireEvent() ?
    Please can any body tell me if I have overlooked any thing ?
    Thanks,
    // 1 Custom Event
    import java.util.EventObject;
    public class MyActionEvent extends EventObject{
            public MyActionEvent(Object arg0) {
         super(arg0);
    // 2 Custom Listener
    import java.util.EventListener;
    public interface MyActionListener extends EventListener {
          public void myActionPerformed(MyActionEvent myEvent);
    // 3 Custom Button
    public class MyButton extends JButton {
        // Create the listener list
        protected javax.swing.event.EventListenerList listenerList = new javax.swing.event.EventListenerList();
          public MyButton(String str){
         super(str);
         public void addMyActionEventListener(MyActionListener listener) {
             listenerList.add(MyActionListener.class, listener);
        protected void fireMyActionEvent() {
            MyActionEvent evt = new MyActionEvent(this);
            Object[] listeners = listenerList.getListenerList();
           for (int i = 0; i < listeners.length; i = i+2) {
                 if (listeners[i] == MyActionListener.class) {
                      ((MyActionListener) listeners[i+1]).myActionPerformed(evt);
    } // end of class MyButton.
    // 4 Test my Custom Event,Listener and Button
    public class MyButtonDemo extends JPanel {
        protected MyButton b1;
        public MyButtonDemo() {
            b1 = new MyButton("Disable Button");
            b1.setToolTipText("Click this button to disable the middle button.");
            b1.addMyActionEventListener(new MyActionListener() {
         @Override
         public void myActionPerformed(MyActionEvent myEvent) {
         System.out.println("My ActionEvent....");
            add(b1);
        private static void createAndShowGUI() {
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            MyButtonDemo newContentPane = new MyButtonDemo();
            newContentPane.setOpaque(true);
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

    Hi Stan,
    I would like to use my custom action listener rather that using the the normal actionPerformed(ActionEvent e)
    But some how this event is not being fired.
    Any suggestions to fire this?
    b1.addMyActionEventListener(new MyActionListener() {
             @Override
             public void myActionPerformed(MyActionEvent myEvent) {
         System.out.println("My ActionEvent triggered....");
    });

  • Custom Event for Purchase Requisition Create, Change & Delete

    Hello Experts,
    I want to create a custom event which triggers on Purchase Requisition Create, SAP provide's standard event's for purchase requisition release but not for create.
    What are all the steps and how to create a new event.
    Thanks in Adavance,
    Sandhya.

    Hi Sandhya,
    may i know the reason why you are trying to create custom methods.
    You have business object BUS2009(for PR line item wise release) and BUS2105(for PR overall release).
    Both those business object have events RELEASESTEPCREATED (for PR creation) and SIGNIFICANTLYCHANGED(For PR change).
    Even then if you want to create custom events, create a subtype of the standard business object, then click on events, and then select create. Now create your Z-events, say ZCREATED (For creation), ZCHANGED (for changed) and ZDELETED (for deleted). Now select each event, click on edit -> Change release status -> object type component -> to be implemented. Follow the same for all the events. Then select each event, click on edit -> Change release status -> object type component -> to be released.
    Now click on your custom object, click on edit -> Change release status -> object type component -> to be implemented.Then click on your custom object, click on edit -> Change release status -> object type component -> to be released.
    After this in SWEC tcode, click on new entries. Select change document object as BANF, business object as say ZBUS2105 and event as ZCREATED. make sure radio button on create is checked.
    Similary create entries for ZCHANGED event and ZDELETED.
    Select on change and on delete radio button for event ZCHANGED and ZDELETED event respectively.
    let me know if you have any queries.
    Regards,
    Raj

  • Creating a Custom Event Log View Shortcut on a server desktop for an admin

    Good morning,
    We have a new admin starting and I would like to create custom event log view shortcut on there desktop for each server they need to check. Is there a way to do this in Server 2012 and Server 2008?
     I have figured out how to create a shortcut of the Application and System log, but not Custom Views. Thanks.

    Hi,
    Based on my research, you can create a custom view like
    this.However, I tried miltiple ways to create a shortcut of the custom view of the event viewer and no result. I can only create a shortcut of the event viewer. You may need a script can achieve that.
    Best regards,
    Susie

  • Event Listening across two components?

    Let's say I have two components. One of them has a button.
    The other will post an Alert once it detects that the button has
    been pressed.
    How can the Alert component detect the button press of the
    other component? I figured an eventListener would been needed, but
    I am not sure how to write it.

    Something like that might work, but from a programming
    standpoint, your components should be designed in such a way that
    they know absolutely nothing about the outside world (parent or
    other components). For all it knows, it's the only component in
    existence. But, using events, he could send out a message (event),
    that if someone else (another component) happened to hear it, they
    could do something in response to it. Think of the movie "Contact"
    (if you've ever seen it).
    Anyway, your best bet is to make a custom event that is able
    to encapsulate an ArrayCollection. Then when the button is clicked,
    you wrap up the AC in the event and send it out. Your other
    component will be listening for events that are of that type (your
    custom event). Then he can unwrap the AC in it and use it. If you
    do not know how to create custom events and/or send data in events,
    look up a tutorial on it. It's not that difficult to implement if
    you can follow the concept I just talked about. However, I've also
    personally tried to make a custom event to pass an ArrayCollection,
    and for some reason it never worked (even though I followed some
    tutorials down to the letter).

  • Newbe: Redirect from an event listener

    We are using WLP 10.
    I have created an event listener and I want to redirect the user when the attached event is triggered. I see that the handleEvent function receives a parameter of type Event, which has the session_id as a string parameter. But how do I actually make the redirection using that Event object? Or is there any way to retrieve the request?
    I have looked through the documentation and searched for examples but without any luck...
    Many thanks,
    Dan

    Having a look at the Interaction documentation for WLP 10, apparently this should be possible. And it should also be possible to have real-time response from the listeners:
    Understanding When to Create a Custom Event Listener
    http://edocs.bea.com/wlp/docs100/interaction/interaction.html#wp1010357
    Extact:
    Create a custom event listener if you want to execute functionality not provided by the Campaign listener or the Behavior Tracking listener. For example, if you want to perform your own event data persistence, modify a User Profile, redirect the user to another part of a Page Flow, or provide any other type of real-time response to the event, create a custom event listener that provides the functionality you want.

  • Create Component that Listens for Custom Event

    I've read a lot of tutorials and posts in this forum but still seem to be missing something.
    I want to be able to create an arbitrary number of instances of a custom class (based on Button) that each listen to a custom event dispatched in the application.  Eventually the event will carry data (including information that will let each Button determine whether it should react to the event), but for now I just want them to be able to hear the event.
    What's supposed to happen is
    1) Clicking the button labeled "I Make the Button" creates an instance of EventHearingButton using this.addElement.
    2) Clicking the button labeled "I Send the Event" dispatches the SuperCustomEvent custom event, with the additional information "I heard that" stored in the Information string
    3) The created EventHearingButton hears the event and updates its label to the value in the Information string.
    What actually happens is the EventHearingButton is created OK, but nothing happens when the "I Send the Event" button is clicked.
    Main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/halo">
         <fx:Metadata>
              [Event(name="SuperCustomEvent", type="Classes.SuperCustomEvent")]
         </fx:Metadata>
         <fx:Script>
              <![CDATA[
                   import Classes.EventHearingButton;
                   import Classes.SuperCustomEvent;
                   protected function EventDispatcherButton_clickHandler(event:MouseEvent):void
                        var NewEvent:SuperCustomEvent = new SuperCustomEvent("I heard that");
                        this.dispatchEvent(NewEvent);
                   protected function button1_clickHandler(event:MouseEvent):void
                        var NewButton:EventHearingButton = new EventHearingButton();
                        NewButton.x=270;
                        NewButton.y=130;
                        this.addElement(NewButton);
              ]]>
         </fx:Script>
         <s:Button x="270" y="90" label="I Send The Event" id="EventDispatcherButton" click="EventDispatcherButton_clickHandler(event)"/>
         <s:Button x="270" y="50" label="I Make the Button" click="button1_clickHandler(event)"/>
    </s:Application>
    Classes.EventHearingButton.as
    package Classes
         import spark.components.Button;
         import flash.events.Event;
         import Classes.SuperCustomEvent;
         public class EventHearingButton extends Button
              public function EventHearingButton()
                   super();
                   this.label="I haven't heard yet";
                   this.addEventListener(SuperCustomEvent.SUPERCUSTOMEVENT,SuperCustomEventHandler);
              private function SuperCustomEventHandler(event:SuperCustomEvent):void {
                   this.label=event.EventInformation;
    Classes.SuperCustomEvent.as
    package Classes
         import flash.events.Event;
         public class SuperCustomEvent extends Event
              public var EventInformation:String;
              public static const SUPERCUSTOMEVENT:String = "SuperCustomEvent";
              public function SuperCustomEvent(Information:String)
                   super(SuperCustomEvent.SUPERCUSTOMEVENT, true);
                   this.EventInformation=Information;
              override public function clone():Event{
                   return new SuperCustomEvent(EventInformation);

    "nikos101" <[email protected]> wrote in
    message
    news:ga59t5$8nh$[email protected]..
    >I tried something like what AMy described in a custom
    component
    >
    > dispatchEvent(new Event("Cancelled_Form"));
    >
    > I then added the following Listener in my application
    file;
    >
    > this.addEventListener("Cancelled_Form",cancelledForm);
    >
    > but it is never heard. Does anyone know what I have done
    wrong?
    Try attaching the event listener to your component rather
    than the
    application.
    HTH;
    Amy

  • Dispatching & listening for custom events from custom component [Flex 4.1]

    I'm giving this a try for the first time and I'm not sure I have the recipe correct!
    I have a custom component - it contains a data grid where I want to double click a row and dispatch an event that a row has been chosen.
    I created a custom event
    package oss
        import flash.events.Event;
        public class PersonChosenEvent extends Event
            public function PersonChosenEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
            // Define static constant.
            public static const PERSON_CHOSEN:String = "personChosen";
            // Define a public variable to hold the state of the enable property.
            public var isEnabled:Boolean;
            // Override the inherited clone() method.
            override public function clone():Event {
                return new PersonChosenEvent(type);
    Then I try to dispatch the event within the component when the datagrid is doubleclicked:
    import oss.PersonChosenEvent
    dispatchEvent(new PersonChosenEvent(PersonChosenEvent.PERSON_CHOSEN, true, false));
    And in the parent application containing the component I do on creationComplete
    addEventListener(PersonChosenEvent.PERSON_CHOSEN,addPersonToList);
    The event does not seem to fire though. And if I try to evaluate the "new PersonChosenEvent(..." code it tells me "no such variable".
    What am I doing wrong?
    (It was so easy in VisualAge for Java, what have we done in the last 10 years?? )
    Martin

    I've done this kind of thing routinely, when I want to add information to the event.  I never code the "clone" method at all.
    Be sure that you are listening to the event on a parent of the dispatching component.
    You can also have the dispatching component listen for the event too, and use trace() to get a debug message.
    I doubt if it has anything to to with "bubbles" since the default is true.
    Sample code
    In a child (BorderContainer)
    dispatchEvent(new ActivationEvent(ActivationEvent.CREATION_COMPLETE,null,window));
    In the container parent (BorderContainer)
    activation.addEventListener(ActivationEvent.CREATION_COMPLETE,activationEvent);
    package components.events
        import components.containers.SemanticWindow;
        import components.triples.SemanticActivation;
        import flash.events.Event;
        public class ActivationEvent extends Event
            public static const LOADED:String = "ActivationEvent: loaded";
            public static const CREATION_COMPLETE:String = "ActivationEvent: creation complete";
            public static const RELOADED:String = "ActivationEvent: reloaded";
            public static const LEFT_SIDE:String = "ActivationEvent: left side";
            public static const RIGHT_SIDE:String = "ActivationEvent: right side";
            private var _activation:SemanticActivation;
            private var _window:SemanticWindow;
            public function ActivationEvent(type:String, activation:SemanticActivation, window:SemanticWindow)
                super(type);
                _activation = activation;
                _window = window
            public function get activation():SemanticActivation {
                return _activation;
            public function get window():SemanticWindow{
                return _window;

  • Creating a Custom event for my Component

    Hi All,
    im currently working in a swing component, and i would like to know how to give to my component the ability to react to some user changes.
    Basically im creating a DateTime Picker using NetBeans, im able to see any new property justed created on the Property Editor but i would like to know how to add my custom events on the Event Editor as well, i.e:
    monthChanged - (when the user just change the month dropdown)
    yearChanged - (when the user just change the year box)
    dayChanged - (when the user just change the selection day)
    Thanks in advance

    Thanks, i just found it also here:
    http://www.exampledepot.com/egs/java.util/CustEvent.html
    i need to define the following class:
    - Custom Listener extending the EventListener interface
    - Custom Event extending EventObject class
    and then finally add the corresponding:
    addXXXListener
    removeXXXListener
    fireXXXEvent
    in my component.
    This work Great in the NetBeans GUI Builder.
    Thanks,

  • How to create custom infotype for training and event management

    hai freinds can any one tell me how to create custom infotype for training and event managment with following fields
    PS No – PA0000-> PERNR
    Name   - PA0001 -> ENAME
    IS PS.No. – PA0001-> PS no. of Immediate Superior
    IS name PA0001 -> ENAME
    thanx in advance
    afzal

    Hi,
    Your question is not clear for me. Since it is a TEM infotype, it could be a PD infotype.
    If you wish to create a PD infotype, use transaction PPCI to create the infotype.
    But before that you need to create a structure HRInnnn (where nnnn is the infotype number) with all the fields relevant for the infotype.
    If you wish to create a PA infotype, use transaction PM01 to create the infotype.
    But before that you may be required to create a strcuture PSnnnn  (where nnnn is the infotype number) with all the fields relevant for the infotype.
    Regards,
    Srini

  • Custom event in popup w/ dynamic region does not reach its server listener

    Here's the situation:
    I have a fragment taskflow. Inside this taskflow's fragment, I am firing 2 custom client event that is being listened to by 2 server listeners. All of these are working fine when I use the taskflow as a region on a page. But when I use it as a dynamic region inside a popup, only the first event gets processed, the second one(and all subsequent ones) don't reach their respective server listeners.
    Additional detail, all 2 custom events are on the same component(an inputText).
    Is this an ADF bug or am I doing something wrong?
    Edited by: Hyangelo on Aug 3, 2011 5:12 AM

    bump

  • How to create an update listener using event notification in MDM Java2 API.

    Hi folks,
    I need some help on how to create an update listener for Customer updates in MDM using notification API. Could some one point me to where I should start. We are still using SP5.
    Thanks
    -Sai

    Hi All,
    I need to create update listener with notifications and it is giving this error.
    Nov 14, 2008 12:26:21 PM com.sap.mdm.internal.net.ConnectionImpl finalize
    INFO: Disconnect was not called. Cleaning up connection in finalize.
    Nov 14, 2008 12:26:21 PM com.sap.mdm.internal.net.ConnectionImpl finalize
    INFO: Disconnect was not called. Cleaning up connection in finalize.
    Nov 14, 2008 12:26:21 PM com.sap.mdm.internal.net.ConnectionImpl finalize
    INFO: Disconnect was not called. Cleaning up connection in finalize.
    I am still using SP05 and noticed that some mentioned that MDM4J.jar has to be used. Can someone throw some pointers how to do this with MDM4J.jar. Can I  include MDM4J.jar in the same project along with mdm-admin.jar, mdm-core.jar, mdm-common.jar, mdm-protocol.jar or I shoudl have only MDM4j.jar to create this listener. Any help is appreciated.
    Thanks
    -sai

Maybe you are looking for