Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#4 Context menues with KDE3 and java1.4.0

open
nobody
5
2003-01-16
2003-01-16
joerg feuerhake
No

there seems to be a problem with the right button
menues under kde3 with java140. they just do not
appear. this behavior seems to be reproducable. i'm
going to try to find out what that is but i'm short
with time lately...

Discussion

  • Stefan Bragd
    Stefan Bragd
    2003-06-12

    Logged In: YES
    user_id=799687

    I run touchgraph on linux with KDE.
    One difference between windows and UNIX/Linux (and maybe
    MacOS) is that menus are not activated untill you release
    the menu button. To enable Touchgraphs menus for Linux I
    copied the following from mouseReleased() to mousePressed()
    in the files LBEditUI.java and LBNavigateUI.java:
    public void mouseReleased(MouseEvent e) {
    if (e.isPopupTrigger()) {
    .......
    }

    /Stefan Bragd

     
  • jerry
    jerry
    2004-05-03

    Logged In: YES
    user_id=991920

    Wanted to mention that the touchgraph link browser(java
    client) client starts correctly in Redhat 9, but i found one
    problem when trying to edit links. The problem being that I
    can't open the small popup menu when i right click in linux
    RedHat 9. left clicking while dragging on a selected link
    (in edit mode) lets you create a new link both in microsoft
    windows 95a and in Redhat 9. When i right click in win95a, a
    small menu appears that allows me to edit a link, but this
    menu doesn't appear after right clicking a link in edit mode
    in redhat 9 (which does work with TG link browser in win95).

    I tried using a 2 button mouse with 3 button emulation. I
    also tried to use a 3 button logitech trackball which works
    with the old logitech c7 setting in Redhat. I also tried to
    operate the mouse with it's three buttons using the number
    keypad in linux, which works in other applications under
    linux. The same problem still happens in trying all of these
    methods.

    I was told that unix and windows use different "select,"
    "extend," and "menu" buttons(in relation to the mouse).

    Maybe, microsoft windows is using a different method of
    interpreting the right mouse button than redhat linux 9. if
    so, maybe there is a way to do this in linux (really, i have
    no idea how this could be done, but am open to try).

    If there is a solution, i would appreciate knowing how to go
    about doing it. .

    note: I am using Sun's java 1.4.2_04 in windows 95a and I am
    using Sun's java 1.4.2_03 in Redhat 9. Both are the most
    current, i just downloaded them recently.

    note: touchgraph link browser is an open source java client
    and applet under the GNU general Public License. I think
    that the source code was included with the binary. I am
    using touchgraph link browser v 1.20 . I downloaded from
    sourceforge.net

    i asked the following and received a reply at
    experts-exchange.com:

    http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20974385.html#10976643

    note: i have gnome and kde installed with linux redhat 9

     
  • Logged In: NO

    My code was lost in a disk crach, but I downloaded it again
    and now have the menu functioning again.
    This is how I did. I worked from the command shell.
    I made my own .jar file in the source directory.
    I did not manage to compile proxy.jar this time. It requires
    a package called javax.servlet.
    I don't remember where I found it. I had installed Tomcat
    http-server and NetBeans at that time.
    Or I might have downloaded it from the Internet.

    -------------------------------------------------------------------------------------------
    Put the following in a file TGLB.sh
    #! /bin/sh
    java -cp
    TGLinkBrowser.jar:nanoxml-2.1.1.jar:BrowserLauncher.jar
    com.touchgraph.linkbrowser.TGLinkBrowser&

    To run the linkbrowser, type:
    chmod u+x TGLB.sh
    ./TGLB.sh

    Check that you can run TGLB.sh (The original code)

    First here is how I managed to compile the original source

    To compile the code:
    #-------------------------------------------
    1. Compile files for TGLinkBrowser.jar

    cd src

    mkdir edu
    mkdir edu/stanford
    mkdir edu/stanford/ejalbert
    copy ./BrowserLauncher.java edu/stanford/ejalbert

    javac BrowserLauncher.java
    (cd com/touchgraph/graphlayout/; javac -sourcepath ../../..
    *.java; ll)
    (cd com/touchgraph/graphlayout/interaction/; javac
    -sourcepath ../../../.. *.java; ll)
    (cd com/touchgraph/graphlayout/graphelements/; javac
    -sourcepath ../../../.. *.java; ll)

    mkdir edu/stanford/ejalbert
    copy ./BrowserLauncher.java edu/stanford/ejalbert

    jar xvf ../nanoxml-2.1.1.jar
    (cd com/touchgraph/linkbrowser/; javac -classpath ../../..
    -sourcepath .:../../.. *.java; ll)

    # Compare the outputs from the following two commands.
    Check that all classes has been compiled
    # in directory com/ and below
    jar tvf ../TGLinkBrowser.jar
    find . -name '*.class' -ls

    #-------------------------------------------
    2. Create the file TGLinkBrowser.jar
    jar cvf TGLinkBrowser.jar com
    #-------------------------------------------
    3. Make a start script to run your modified TGLinkBrowser
    Move out from directory src
    cd ..
    Put the following in a file TUX_TGLB.sh
    #! /bin/sh
    java -cp
    src/TGLinkBrowser.jar:nanoxml-2.1.1.jar:BrowserLauncher.jar
    com.touchgraph.linkbrowser.TGLinkBrowser&

    # Note! it should be src/ before TGLinkBrowser.jar

    To run the linkbrowser, type:
    chmod u+x TUX_TGLB.sh
    ./TUX_TGLB.sh

    Check that you can run TUX_TGLB.sh (Your compilation of the
    original source)

    Now edit the following files: (Shown in the samples at the
    end of this letter)
    src/com/touchgraph/linkbrowser/LBEditUI.java
    src/com/touchgraph/linkbrowser/LBNavigateUI.java

    Compile the linkbrowser directory again, or just the two files.
    (cd com/touchgraph/linkbrowser/; javac -classpath ../../..
    -sourcepath .:../../.. *.java; ll)
    Make a new .jar file in the src directory.
    (cd src; jar cvf TGLinkBrowser.jar com)

    Go to the top directory and run the startscript.
    stefan@saturn:~/Desktop/TGLB120> ls *.sh
    TGLB.sh TUX_TGLB.sh

    ./TUX_TGLB.sh

    The menu should now appear when you click the right mouse
    button.

    Good Luck
    /Stefan Bragd

    ############################################################################################
    Sample from LBNavigateUI.java
    ############################################################################################
    class LBNavigateMouseListener extends MouseAdapter {

    public void mousePressed(MouseEvent e) {
    //-----------INSERTED-VVVVVVVVVVVVVVV-------------
    if (e.isPopupTrigger()) {
    popupNode = (LBNode) tgPanel.getMouseOverN();
    popupEdge = (LBEdge) tgPanel.getMouseOverE();
    if (popupNode!=null) {
    tgPanel.setMaintainMouseOver(true);
    lbNodeHintUI.deactivate();
    nodePopup.show(e.getComponent(), e.getX(), e.getY());
    }
    else if (popupEdge!=null) {
    tgPanel.setMaintainMouseOver(true);
    lbNodeHintUI.deactivate();
    edgePopup.show(e.getComponent(), e.getX(),
    e.getY());
    }
    else {
    tgLinkBrowser.lbPopup.show(e.getComponent(),
    e.getX(), e.getY());
    }
    }
    //------------------INSERTED-^^^^^^^^^^^^^^^---------
    LBNode mouseOverN = (LBNode) tgPanel.getMouseOverN();

    if (e.getModifiers() == MouseEvent.BUTTON1_MASK) {
    if (mouseOverN == null)
    hvDragUI.activate(e);
    else
    dragNodeUI.activate(e);
    }
    }

    public void mouseClicked(MouseEvent e) {
    LBNode mouseOverN = (LBNode) tgPanel.getMouseOverN();
    LBNode select = (LBNode) tgPanel.getSelect();
    if ((e.getModifiers() & MouseEvent.BUTTON1_MASK)!=0) {
    if (mouseOverN != null) {
    if (mouseOverN!=select) {
    tgPanel.setSelect(mouseOverN);
    tgPanel.setLocale(mouseOverN, localityScroll.getRadius());
    //hvScrollToCenterUI.activate(e);
    }
    else {
    tgLinkBrowser.processNodeUrl(mouseOverN);
    }
    }
    }
    }

    public void mouseReleased(MouseEvent e) {
    if (e.isPopupTrigger()) {
    popupNode = (LBNode) tgPanel.getMouseOverN();
    popupEdge = (LBEdge) tgPanel.getMouseOverE();
    if (popupNode!=null) {
    tgPanel.setMaintainMouseOver(true);
    lbNodeHintUI.deactivate();
    nodePopup.show(e.getComponent(), e.getX(), e.getY());
    }
    else if (popupEdge!=null) {
    tgPanel.setMaintainMouseOver(true);
    lbNodeHintUI.deactivate();
    edgePopup.show(e.getComponent(), e.getX(),
    e.getY());
    }
    else {
    tgLinkBrowser.lbPopup.show(e.getComponent(),
    e.getX(), e.getY());
    }
    }
    }
    }

    ############################################################################################
    Sample from LBEditUI.java
    ############################################################################################
    class LBEditMouseListener extends MouseAdapter {
    public void mousePressed(MouseEvent e) {
    //-------INSERTED-VVVVVVVVVVVVVVVVVV---------------------
    if (e.isPopupTrigger()) {
    popupNode = (LBNode) tgPanel.getMouseOverN();
    popupEdge = (LBEdge) tgPanel.getMouseOverE();
    if (popupNode!=null) {
    tgPanel.setMaintainMouseOver(true);
    tgPanel.removeMouseListener(ml); //So
    that dismissing popup does not add node
    nodePopup.show(e.getComponent(),
    e.getX(), e.getY());
    }
    else if (popupEdge!=null) {
    tgPanel.setMaintainMouseOver(true);
    tgPanel.removeMouseListener(ml); //So
    that dismissing popup does not add node
    edgePopup.show(e.getComponent(),
    e.getX(), e.getY());
    }
    else {

    tgLinkBrowser.lbPopup.show(e.getComponent(), e.getX(),
    e.getY());
    }
    //else {
    // backPopup.show(e.getComponent(),
    e.getX(), e.getY());
    //}
    }
    //-----INSERTED-^^^^^^^^^^^^^^^------------------
    LBNode mouseOverN = (LBNode) tgPanel.getMouseOverN();
    LBNode select = (LBNode) tgPanel.getSelect();

    if (e.getModifiers() == MouseEvent.BUTTON1_MASK) {
    if (mouseOverN != null) {
    if(mouseOverN!=select)
    dragNodeUI.activate(e);
    else
    dragAddNodeUI.activate(e);
    }
    else {
    hvDragUI.activate(e);
    }

    }
    }

    public void mouseClicked(MouseEvent e) {
    if (e.getModifiers() == MouseEvent.BUTTON1_MASK)
    switchSelectUI.activate(e);

    }

    public void mouseReleased(MouseEvent e) {
    if (e.isPopupTrigger()) {
    popupNode = (LBNode) tgPanel.getMouseOverN();
    popupEdge = (LBEdge) tgPanel.getMouseOverE();
    if (popupNode!=null) {
    tgPanel.setMaintainMouseOver(true);
    tgPanel.removeMouseListener(ml); //So
    that dismissing popup does not add node
    nodePopup.show(e.getComponent(),
    e.getX(), e.getY());
    }
    else if (popupEdge!=null) {
    tgPanel.setMaintainMouseOver(true);
    tgPanel.removeMouseListener(ml); //So
    that dismissing popup does not add node
    edgePopup.show(e.getComponent(),
    e.getX(), e.getY());
    }
    else {

    tgLinkBrowser.lbPopup.show(e.getComponent(), e.getX(),
    e.getY());
    }
    //else {
    // backPopup.show(e.getComponent(),
    e.getX(), e.getY());
    //}
    }
    }
    }