Re: [OpenMap Users] getItemsForMapMenu() not working with multiple layers.

From: Adams Tan <nikida78_at_gmail.com>
Date: Fri, 25 Jul 2008 17:34:39 +0800

Hi Don,

I am facing almost exactly the same issue, and I don't quite understand you
workaround solution. Could you elaborate?

Adams

On Wed, Apr 30, 2008 at 12:32 AM, Don Dietrick <dietrick_at_bbn.com> wrote:

> Hi Kennedy,
>
> The StandardMapMouseInterpreter is limiting you, the object assigned to the
> OMGraphicHandlerLayer to manage MouseEvents. It creates a new JPopupMenu
> for the layer in response to a right click, and there's probably something
> in awt that is getting confused with multiple JPopupMenus being created.
>
> To get what you want, I think the MapMouseSupport and
> StandardMapMouseInterpreter need to be modified so that the MapMouseSupport
> makes the call for the JPopupMenu, based on the items that the
> StandardMapMouseInterpreters return.
>
> What might work well would be to add a variable slot in the MapMouseEvent
> object to contain a list of Components for the menu. If the MouseMode
> detects that list is not null after it has been passed to the layers, it
> would display a popup. So MapMouseSupport, MapMouseEvent and
> StandardMapMouseInterpreter would need to be modified, and that would be it.
>
> If you want to take a shot at these updates, that would be great.
> Otherwise, I'll add them to my todo list.
>
> - Don
>
>
> On Apr 29, 2008, at 9:32 AM, Davidian wrote:
>
>
>> Please hear me out, I've read the other posts on this subject, but they
>> don't
>> seem to be addressing the same exact problem.
>>
>> I have two layers that extend OMGraphicHandlerLayer (let's call them layer
>> Alpha and layer Beta). In both of these layers I have overridden the
>> getItemsForMapMenu() method and return a List of JMenuItem objects from
>> each.
>>
>> The problem is, when I right click on a spot on the map the popup menu
>> that
>> is displayed only contains the menu items for one of the layers (Alpha),
>> not
>> both. If I remove the Alpha layer from the map, the menu items for Beta
>> are
>> displayed in the popup menu.
>>
>> NOTE: This is not a problem with the mouse events being consumed by the
>> Alpha layer. I have put debug (System.out calls) in the
>> getItemsForMapMenu
>> method in the Beta layer, and when I right click on the map I see a menu
>> with the menu items from the Alpha layer, but the System.out calls are
>> getting written out from the Beta layer.
>>
>> So, how do I make my right click menu contain the menu items from all of
>> my
>> layers (in this case, Alpha and Beta)?
>>
>> Thanks in advance...
>>
>> -Kennedy
>> --
>> View this message in context:
>> http://www.nabble.com/getItemsForMapMenu%28%29-not-working-with-multiple-layers.-tp16960449p16960449.html
>> Sent from the OpenMap mailing list archive at Nabble.com.
>>
>> --
>> [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 Jul 25 2008 - 05:38:18 EDT

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