listener

How granular should you make your Observables/Listenables?

You have a pull-oriented Observable/Listenable which notifies Observers/Listeners when some state changes. The state consists of more than one nugget of data, and some of your Observers/Listeners don't care about the whole state. Do you generally prefer to notify all the Observers/Listeners anyway and allow them to ignore notifications...

Update: How to find event listeners on a DOM node in prototype?

I'm looking for an updated answer to this question. It seems that Event.observers is no longer used (perhaps to avoid memory leaks) in Prototype 1.6+, so how do I track down now what event listeners are attached to an element? I know Firebug has a "break on next" button, but there are several mouse listeners on the body element that e...

Blackberry JDE FieldChangeListener

I'm sort of confused as to how to implement a FieldChangeListener in the Blackberry JDE. One way has me make my main class implement FieldChangeListener, and then have a fieldchanged method inside of it, and another has me do: FieldChangeListener listenerUS = new FieldChangeListener() { public void fieldChanged(Field field, int cont...

Swing: listeners execution order on custom component.

My custom component is composed of three JTrees inside a JPanel. Only one JTree should be selected at a time, so I've added a TreeSelectionListener to each of them that calls clearSelection on the previously selected JTree. I'd like to add other TreeSelectionListeners to the JTrees being sure that the selection- handling listeners alway...

Swing: how can I ignore deselection events?

My custom component is composed of three JTrees inside a JPanel. Only one JTree should be selected at a time, so I've added a TreeSelectionListener to each of them that calls clearSelection() on the previously selected JTree. (See here for more details). That works fine, but I need to prevent the TreeSelectionListeners to trigger when ...

Android: Use a SWITCH statement with setOnClickListener/onClick for more than 1 button ?

Let's say I have a few buttons in a LinearLayout, 2 of them are: mycards_button = ((Button)this.findViewById(R.id.Button_MyCards)); exit_button = ((Button)this.findViewById(R.id.Button_Exit)); I register setOnClickListener() on both of them: mycards_button.setOnClickListener(this); exit_button.setOnClickListener(this); How do I make ...

jQuery dispatch event from a plugin for multiple listeners

I'm looking for a way to dispatch an event from my jQuery plugin so that it can have multiple listeners for that event. I have the plugin setup so that it returns a reference to itself so that I can add listeners later via public methods. The only examples I've seen so far have a single event handler, e.g.: $.fn.foo = function( options...

VB.NET: Building an Event Manager - Listeners

I'm in the research stage of a project that will require the development of a custom event manager for computer game events. In the past, the routing code for polling the correct pieces of code for event consumption has been placed entirely within the Event Manager's ProcessEvents() function. Example: The UI needs to be provided the o...

Is there an event called when a column is moved in a JTable?

I have a JTable with several columns and rows. Once the user has moved the column, I would like to be informed via an event of some sort, so that I can do some calculations. However, since all I needed to do was `table.getTableHeader().setReorderingAllowed(true);` to get the columns to be movable, I am somewhat unsure what I can use ...

Doctrine: How to remove part of a where clause from select query inside listener (preDqlSelect)?

My listener is part of a behavior, that should remove all is_published checks in the where clause of any called select query. Adding a part to a clause is really easy, but how to remove one. There are some functions like Doctrine_Query->removeDqlQueryPart('where'), but that removes the complete where clause, while I only need the 'is_...

Why JOptionPane prevents ActionListener on JButton???

PreventingButtonListener.java import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PreventingButtonListener extends JFrame implements ActionListener{ JTextField fld = new JTextField(5) ; PreventingButtonListener(){ super("PreventingButtonListener") ; setSize(300, 250) ; setDefaultClos...

How to find which objects are listening to my event?

I have a class with an event: public event MyEventHandler MyEvent; Is there any way of getting a handle to the collection of objects (by reflection or otherwise) that are listening to this event? EDIT - Um, sorry to move the goalposts - I need to be able to do this using reflection bc I have a string value representing the event nam...

SecurityFlushSessionListener in jboss

In jboss-web.deployer/conf/web.xml there is a listener defined called SecurityFlustSessionListener. This listener searches for the component java:comp/env/security/securityMgr and if not found prints that info in the debug log. It is understood that if this security feature is not needed then, one can simply remove this listener. How h...

How can I configure a JPA EntityListener via a Spring XML configuration file?

Hello, I have two webapps, that are built together and respectively provide a client and admin access to a database. I'd like to register two JPA EntityListeners to a given class, one in each app. To do that, I'm trying to find a way to register the listeners via the Spring XML configuration file that configure each app's JPA context.....

writing global listener

I want the active window (i.e JFrame ot JDialog) to receive specific keyEvent so that whereever the focusing this keyevent is handling by the window such as ALT+F4 if you press it wherever the focusing the active window will close,I try to override postprocesskeyEvent but it doesn't work fine ...

jQuery.scroll "listener" problem

Hey guys, I'am scrolling through a page witch jQuery scrollTo. If the page reaches ssome pixels for exaple y= 300 a div slides in. If i scroll manually i want to slide that div in too. how do i achieve that? I've thought about something like a event listener. jQuery.scroll exists but does'n make a difference between "manual" scrollin...

Select all the components of a array without a loop

I've made a array full of JLabels and would like to add a listener to them. The listener doesn't need to know exactly which one was clicked on, just that one was. Is there a way to add the listener to the whole array instead of using a 'for()' loop ? Thanks for reading. ...

Java: implementation of notification provider vs. hashCode-driven Map

I have implemented abstract generic provider for notification bunch of generic listeners E, descendants have to override notifyListener(E) with specific notification code. For backing list of listeners I choose WeakHashMap<K,V>. Listeners must be held as weak references: abstract public class NotificationProvider<E> { private Map<E...

Problem with mouseListener on JPanel

Hi, I have problem with mouseListener in JPanel. I add JLabel which contain image(size 600 x 600) on JPanel, and I add mouseListener for the JPanel. Everytimes I click on the image, the image should change to another image, and this is working fine. However, the problem is that, only if I click on the right side or at the center of the ...

ClickListener for Composite Widget

Hi, I have a composite widget made of a textbox and a custom widget, which are then added to a verticalPanel. I created this custom widget using Raphael JS. Now i want this Composite widget to recognize both click event and also the ctrl event. I tried implementing clicklistener in both the classes with no fruitful results. here is t...