[Egon -- what was the final word on getting right-mouse to work in
Bioclipse?]

Joe, first thing to do is do exactly what is in
examples.org.jmol.Integration.java to see if that is behaving. Oh, I see one
thing:

        viewer = new Viewer(this, adapter);

That is not the way to initiate a viewer. You need to use allocateViewer()
-- see Integration.java.

    JmolSimpleViewer viewer;
    JmolAdapter adapter;
    JmolPanel() {
      adapter = new SmarterJmolAdapter();
      viewer = JmolSimpleViewer.allocateSimpleViewer(this, adapter);
    }


Note that JmolSimpleViewer is just an interface -- it doesn't matter if you
use it or JmolViewer -- the underlying viewer and the popup menu business
are the same. JmolSimpleViewer simply shows some of the basic interface
methods into viewer that are most useful.

All we have in that example Integration is:

  static class JmolPanel extends JPanel {
    JmolSimpleViewer viewer;
    JmolAdapter adapter;
    JmolPanel() {
      adapter = new SmarterJmolAdapter();
      viewer = JmolSimpleViewer.allocateSimpleViewer(this, adapter);
    }

    public JmolSimpleViewer getViewer() {
      return viewer;
    }

    final Dimension currentSize = new Dimension();
    final Rectangle rectClip = new Rectangle();

    public void paint(Graphics g) {
      getSize(currentSize);
      g.getClipBounds(rectClip);
      viewer.renderScreenImage(g, currentSize, rectClip);
    }
  }


Note that there is no popup business there. The popup menu is part of
Viewer. I note that you have:


    public void setStructure(Structure struct) {
        String pdbstr = struct.toPDB();
        viewer.openStringInline(pdbstr);

        String strError = viewer.getErrorMessage();
        if (strError != null) {
            System.out.println("Error  in jmol: "+strError);
        }

        popup.updateComputedMenus();
    }


Effectively what you are doing is setting up two popup menus -- one within
Viewer that Jmol is going to use and one of your own that Jmol is going to
ignore.  The mouse clicks aren't going to have anything to do with your
menu. They will pop up Viewer's version. So, yes, take all that popup stuff
out.

But the real problem is that you are not allocating the viewer properly, I
think. See the note in org.jmol.api.JmolViewer.java.

Also, you must have changed your code, because this:

public class JmolPanel extends JPanel
{
    public JmolEvolvedPanel() {...}
}

isn't possible.


On Mon, Oct 5, 2009 at 3:34 AM, Joe Gatewood <[email protected]> wrote:

> I have my own bug I am trying to find so I am still awake.
>
> You should not need the popup to get the menu to show when right clicking.
> The two parameter constructor is depreciated but I have not looked to see
> what limits that causes.  Thy getting rid of the popup statement and using
> the new viewer constructor.
>
> Joe
>
>
> > -----Original Message-----
> > From: Vincent Le Guilloux [mailto:[email protected]]
> > Sent: Monday, October 05, 2009 2:29 AM
> > To: [email protected]
> > Subject: Re: [Jmol-users] Jmol integration
> >
> > > The time here is 1400 so I am going to take a nap. When you post your
> > code
> > > pls include the echo report that includes the version and OS info. I
> > will
> > > have a look at this again tomorrow if no one else has provided the
> > answer.
> >
> > OS: linux ubuntu last version
> > Jmol version: 11.9.6
> >
> > Here is the code, it's currently really basic & simple.
> >
> > public class JmolPanel extends JPanel
> > {
> >      private JmolViewer viewer;
> >      private JmolPopup popup;
> >      private JmolAdapter adapter;
> >
> >      public JmolEvolvedPanel() {
> >          adapter = new SmarterJmolAdapter();
> >          viewer = new Viewer(this, adapter);
> >          popup = JmolPopup.newJmolPopup(viewer, true, null, true);
> >      }
> >
> >      public void setStructure(Structure struct) {
> >          String pdbstr = struct.toPDB();
> >          viewer.openStringInline(pdbstr);
> >
> >          String strError = viewer.getErrorMessage();
> >          if (strError != null) {
> >              System.out.println("Error  in jmol: "+strError);
> >          }
> >
> >          popup.updateComputedMenus();
> >      }
> >
> >      public void executeCmd(String rasmolScript) {
> >          viewer.evalString(rasmolScript);
> >      }
> >
> >      final Dimension currentSize = new Dimension();
> >      final Rectangle rectClip = new Rectangle();
> >
> >      @Override
> >      public void paint(Graphics g) {
> >          getSize(currentSize);
> >          g.getClipBounds(rectClip);
> >          viewer.renderScreenImage(g, currentSize, rectClip);
> >      }
> > }
> >
> >
> >
> >
> >
> --------------------------------------------------------------------------
> > ----
> > Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> > is the only developer event you need to attend this year. Jumpstart your
> > developing skills, take BlackBerry mobile applications to market and stay
> > ahead of the curve. Join us from November 9&#45;12, 2009. Register
> > now&#33;
> > http://p.sf.net/sfu/devconf
> > _______________________________________________
> > Jmol-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>



-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to