Menu

JUNG2 tutorial and menu mouse plugin...

gregbern
2007-03-26
2013-05-29
  • gregbern

    gregbern - 2007-03-26

    Hi folks I've updated/added more stuff to the running JUNG2 tutorial at http://www.grotto-networking.com/JUNG/
    In addition, based on Tom's suggestion (but probably needing a bunch of polishing) I worked though an example with context sensitive mouse menus.  This means that I wrote a fairly generic graph mouse plugin whose function is to bring up different popup menus depending on whether a node or vertex is right clicked.  I copied several of the notions from other JUNG2 code so the good ideas are from JUNG the bad ideas are from me ;-)

    Pictures of the output are given in section 5.5 of the JUNG2 (unofficial) tutorial (pdf or odt format).

    How this works is that you feed two JPopupMenus to the constructor for the new menu mouse plugin thingy. Under the appropriate mouse click the plugin is activated if a vertex is selected the vertex popup will be brought up, similarly for the edge popup.  Prior to actually showing the popup the components of the popup are scanned to see if they implement a simple "edge listener" or "vertex listener" interface, if so they are fed the selected edge or vertex (and some support info). Note that because mouse menus are also used for deleting edges and vertices, I also implemented to generic (works with user defined edge/vertex) deletion menu items that can be added to the users edge and vertex popups.

    The code for this more elaborate example is in the directory http://www.grotto-networking.com/JUNG/MouseMenu/
    The one example dialog was developed with swing layout extensions (aka Netbeans). This can be changed for more portability if there is sufficient interest in this example/application.

    Regards

    Greg B.

     
    • n-i-c-o

      n-i-c-o - 2007-03-27

      ... looks great.
      mille grazie :)
      maybe it will be linked on the project site.

      Regards
      nico

       
      • Joshua O'Madadhain

        Nico:

        It already has, on the wiki.  Check it out.  :)

        Joshua

         
    • gregbern

      gregbern - 2007-03-27

      Hi Nico, on the JUNG wiki there is a section on JUNG2 (Hmm, maybe we need an entry on the navigation bar for JUNG2 since I just got lost trying to find the link). And on the page http://jung.sourceforge.net/pmwiki/index.php/Main/JUNG2Basics there is a reference.
      A caveat on the material in the tutorial, I've been sync'ing to the CVS code of JUNG2 and building it so the tutorial has stuff a bit different than the JUNG2 alpha of February 20th, 2007(Tom and Joshua have made some nice additional refinements).

      One other caveat is that I don't put complete directory structures up to my web site so that you may need to change the package information in the files or put the example files in a containing directory or two.

      Regards

      Greg

       
    • gregbern

      gregbern - 2007-03-27

      OK, I tried editing the JUNG Wiki to put an entry in the navigation side bar to go directly to the JUNG2 information in case somebody doesn't notice it (like me) on the main Wiki page.
      Hopefully I didn't mess anything up in the process.

      Regards

      Greg B.

       
      • Joshua O'Madadhain

        Good thought, Greg.  Thanks!

        Joshua

         

Log in to post a comment.