RE: ToolTip with LinkLayer

From: Mark Bucciarelli <mark.bucciarelli@peregrine.com>
Date: Thu Jul 05 2001 - 10:46:30 EDT

To get the layer to respond to mouse events in SelectMouseMode, add
that mode to the array returned by the getMouseModeServiceList()
method. I think you have to create your own layer subclass to do
this.

Once the layer responds to SelectMouseMode events you can customize
the MouseMoved(MouseEvent) method for that layer to fire a tool
tip request, something like this:

  public boolean mouseMoved(MouseEvent evt)
  {
    if (!isVisible()) return false;
    Location loc = findClosestLocation(evt);
    if (loc != null)
    {
      InfoDisplayEvent info = new InfoDisplayEvent(this, loc.getName());
      fireRequestToolTip(evt, loc.getName());
    }
    else
      fireHideToolTip(evt);

    return loc == null;
  }

This code is for a location layer, so there may not be an equivalent
method to findClosestLocation() (findClosestLink()?). Also, the
SelectMouseMode is set to consume events, so if some other object is
registered higher in the queue than the layer, and that object consumes
the mouseMoved event, the layer will not get it. What I did to get
around this was to modify the NavMouseMode class to not consume events.
It's a hack, I probably should subclass to do this right.

What's cool about this is that once you dig in this far, you can mess
around with all the other mouse events, and do things like fire pop-up
menu on a right click and whatever else UI candy you can think of.

--
Mark Bucciarelli    Peregrine Systems, Inc.       R&D, Boston
(413) 253-0020      mbucciarelli@peregrine.com    Yahoo: m_bucciarelli
http://www.peregrine.com 
> -----Original Message-----
> From: PRADEEP RAMACHANDRAN [mailto:arpradeep@lycos.com]
> Sent: Thursday, July 05, 2001 10:13 AM
> To: openmap-users@bbn.com
> Subject: ToolTip with LinkLayer 
> 
> 
> Hello,
> 
> Can the LinkLayer be made to fireToolTip messages
> or InfoLine messages when in SelectMouseMode. I am
> looking for a functionality similar to that in the
> AreaShapeLayer where the abbreviated country names
> appear on the InformationDelegator in gesture mode.
> 
> Would it be correct to say that the only way to have
> this done would be to associate an AppObject with the 
> LinkOMGraphicList for the LinkServer and have the  
> names created from reading a CSVFile record for the 
> corresponding shapefile record? 
> 
> I couldn't figure out what to expect when the Gestures
> mode is active in the LinkLayer. Is there some behaviour
> that can be observed for the layer when in gesture mode?
> 
> Thanks,
> Pradeep.
> 
> 
> 
> Get 250 color business cards for FREE!
> http://businesscards.lycos.com/vp/fastpath/
> 
> --
> [To unsubscribe to this list send an email to "majdart@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@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Jul 5 10:48:20 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT