Re: [OpenMap Users] layer not responding to mouse input

From: Robert Najlis <rnajlis_at_cs.indiana.edu>
Date: Fri, 10 Sep 2004 19:40:23 -0400

Thanks a lot Don.

-- Robert



On Sep 10, 2004, at 6:10 PM, Don Dietrick wrote:

>
> On Sep 10, 2004, at 5:53 PM, Robert Najlis wrote:
>
>>
>> From: Robert Najlis <rnajlis_at_cs.indiana.edu>
>> Date: September 10, 2004 5:43:56 PM EDT
>> To: Don Dietrick <dietrick_at_bbn.com>, <openmap-users_at_bbn.com>
>> <openmap-users_at_bbn.com> <openmap-users_at_bbn.com>
>> Subject: layer not responding to mouse input
>>
>> Hi,
>>
>> I am having troubles getting a layer to respond to mouse inputs.
>>
>> I have subclassed OMGraphicHandleraLayer and implemented
>> MapMouseListener (I even tried implementing ActionListener which had
>> worked for me in the past).
>>
>> I don't get a response at all. I have tried many variations (at
>> first I had not set the consumeEvents, , setMouseModeIDsforEvents and
>> setMouseEventInterpreter functions, but even when I did, no change).
>
> These are the ones you want.
>
>> I also tried removing all other layers and also moving my layer to
>> the top, both through the gui.
>>
>> Code details are provided below.
>>
>> thanks a lot for your help.
>>
>>
>> -- Robert
>>
>>
>>
>>
>> here is how I am creating the layer and adding it to Openmap:
>>
>>
>> RepastOMLayer layer = new RepastOMLayer();
>
>
> This is done by default if the mouse mode IDs are set.
>> layer.setMouseEventInterpreter(new
>> StandardMapMouseInterpreter());
>
>
>
>> String[] mmi = new String[1];
>> mmi[0] = "Gestures";
>> layer.setMouseModeIDsForEvents(mmi);
>
> OK, good.
>
>> layer.setName(title);
>> layer.setList(omList);
>> layer.setVisible(true);
>> layer.setConsumeEvents(true);
>> layer.doPrepare();
>>
>>
>> layerHandler.addLayer(layer, 0);
>> layerHandler.setLayers();
>> mapHandler.add(layer);
>> // layer.setVisible(true);
>>
>>
>> here is the basic code for the layer:
>
> It doesn't matter that the layer is a MapMouseInterpreter, you don't
> want it to be. The interpreter is the MapMouseListener.
>
>> public class RepastOMLayer extends OMGraphicHandlerLayer implements
>> MapMouseListener {
>>
>> public boolean mouseClicked(MouseEvent e) {
>> System.out.println("cliked - " );//
>> }
>
>
> You won't get a mouseClicked() call. Using the MapMouseInterpreter
> moves things up a level.
>
> see:
>
> http://openmap.bbn.com/mailArchives/openmap-users/2004-09/3377.html
>
>
>> I don't get any response whatsoever, except for, on occasion - if I
>> keep clicking for a while, the following error:
>
> You probably won't, if your list is empty. Look at the last part of
> the referenced message about receivesMapEvents() for more raw events.
>
> Of course, if you want to receive the mouseClicked(), mouseMoved() etc
> calls directly, have your layer extend MapMouseListener and return the
> "Gestures" string in getMouseModeServiceList(). But if you are just
> going to be going over OMGraphics with those events, the interpreter
> does that work for you.
>
> - Don
>
>
>
>>
>> java.lang.ClassCastException
>> at
>> sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransfer
>> er.java:1189)
>> at
>> apple.awt.CDataTransferer.translateTransferable(CDataTransferer.java:
>> 125)
>> at
>> sun.awt.datatransfer.DataTransferer$5.run(DataTransferer.java:2018)
>> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
>> at java.awt.EventQueue.dispatchEvent(EventQueue.java:479)
>> at
>> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThr
>> ead.java:234)
>> at
>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
>> d.java:184)
>> at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
>> at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
>> at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>>
>> --
>> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
>> with the following text in the BODY of the message "unsubscribe
>> openmap-users"]
>>
>>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Sep 10 2004 - 19:44:13 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT