Re: [OpenMap Users] getItemsForOMGraphicMenu doesn't work on EditorLayer

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 20 Jan 2009 13:09:12 -0500

Hi Adams,

I can't reproduce this behavior. If I add, say, this method from the
com.bbn.openmap.layer.learning.InteractionLayer to EditorLayer:

     public List getItemsForOMGraphicMenu(OMGraphic omg) {
         final OMGraphic chosen = omg;
         List l = new ArrayList();
         JMenuItem which = new JMenuItem("Which");
         which.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent ae) {
                 String classname = chosen.getClass().getName();
                 fireRequestMessage("Which was chosen over "
                         +
classname.substring(classname.lastIndexOf('.') + 1));
             }
         });
         JMenuItem why = new JMenuItem("Why");
         why.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent ae) {
                 String classname = chosen.getClass().getName();
                 fireRequestMessage("Why was chosen over "
                         +
classname.substring(classname.lastIndexOf('.') + 1));
             }
         });

         l.add(which);
         l.add(why);
         return l;
     }

The menu pops up when I right click on the object, when gestures mode
is active. Are you trying to get a pop up menu when you are trying to
define or edit an OMGraphic, i.e when one of the OMGraphic buttons is
activated on the toolbar?

- Don


On Jan 19, 2009, at 1:10 AM, Adams Tan wrote:

> Hi,
>
> I am trying to get the method getItemsForOMGraphicMenu working for
> EditorLayer.
>
> What I want to achieve is a popup menu shown upon right-click on an
> OMGraphic (drawn by EditorLayer).
>
> After overriding the abovementioned method, the menu doesn't show up.
> In fact, the method wasn't even called (I put some print line
> statements).
>
> Incidentally, the getItemsForOMGraphicMenu method works with the
> parent class of EditorLayer (which is DrawingToolLayer). So somehow,
> the EditorLayer has some implementation that voided the
> getItemsForOMGraphicMenu method.
>
> Please help, thank you.
>
> Adams Tan
>
> --
> [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 Tue Jan 20 2009 - 13:10:49 EST

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