Bob et al.,
Progress has been made on a popup menu for JSmol. I've implemented
PopupMenu, MenuItem, CheckboxMenuItem, and RadioButtonMenuItem, among other
things. Check it out:

http://www.metallacycle.com/play/netmol/tests/popupMenu/jmolPopupMenu.js

The demo is still functional as well:

http://www.metallacycle.com/play/netmol/tests/popupMenu/popupMenu.html

Two things I'm struggling with:
1) What's the difference between a ButtonGroup and a set of
RadioButtonMenuItems?
2) Event handling in general. For example, a checkbox menu item doesn't
"know" its parent, so when it's clicked, it can't run commands on its
parent applet without bubbling an event up to its parent jmol object. I
will continue to work on this, but event handling in JS is not one of my
specialties. I'll look into custom events mediated by jQuery, but in the
meantime, if there are any JS event experts out there, help would be
appreciated! :-)

Is this what you had in mind, Bob?

Cheers, Mike


---
Michael Evans
Organic Chemistry Graduate Student, Moore Group
University of Illinois, Urbana-Champaign


On Wed, Dec 19, 2012 at 9:10 AM, Michael Evans <[email protected]> wrote:

> Thanks, Bob. I got the sense objects would be the way to go. Working on
> this this morning. Stay tuned!
>
>
> ---
> Michael Evans
> Organic Chemistry Graduate Student, Moore Group
> University of Illinois, Urbana-Champaign
>
>
> On Wed, Dec 19, 2012 at 8:56 AM, Robert Hanson <[email protected]> wrote:
>
>> OK, Michael, here's what we actually need from the JavaScript side. From
>> org.jmol.awt2d.JSPopup:
>>
>>   //TODO: jQuery menu actions, entry, and exit need to come back here
>>   //      to execute checkMenuClick, checkMenuFocus, and
>> checkBoxStateChanged
>>
>>   //  (on mouse up)       checkMenuClick(e.getSource(),
>> e.getSource().getActionCommand());
>>   //  (on entry)          checkMenuFocus(item.getName(),
>> item.getActionCommand(), true);
>>   //  (on exit)           checkMenuFocus(item.getName(),
>> item.getActionCommand(), false);
>>   //  (on checkbox click) checkBoxStateChanged(e.getSource());
>>
>>   //TODO: JavaScript objects:
>>   //     new Jmol.Menu.PopupMenu(name)
>>   //     new Jmol.Menu.SubMenu(entry)
>>   //     new Jmol.Menu.MenuItem(entry)
>>   //     new Jmol.Menu.ButtonGroup()
>>   //     new Jmol.Menu.CheckBoxMenuItem(entry)
>>   //     new Jmol.Menu.RadioButtonMenuItem(entry)
>>   //
>>   //TODO: Jmol given in j2sNative blocks, for example:  setText,
>> setActionCommand
>>
>> see
>> http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/awtjs2d/JSPopup.java?content-type=text%2Fplain
>>
>> I'll help. The interface I gave you before is actually for Java; what we
>> need to implement in JavaScript is a bit different. Look in that file for
>> @j2sNative blocks, and you will at least be able to construct a list of
>> needed functions. Many of these methods will be called from
>>
>>
>> http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/popup/GenericPopup.java?content-type=text%2Fplain
>>
>> Bob
>>
>>
>>
>> On Tue, Dec 18, 2012 at 11:57 AM, Michael Evans <[email protected]>wrote:
>>
>>> Jmol community,
>>> Here's a simple example of a context menu in JSmol:
>>>
>>> http://www.metallacycle.com/play/netmol/tests/popupMenu/popupMenu.html
>>>
>>> Dig into the document ready function and jmolPopupMenu.js for details.
>>> The whole kit and kaboodle (including jQueryUI menu, which I used to handle
>>> the visuals) is 165 KB at the moment. The JS file adds Jmol.Menu with its
>>> associated functions:
>>>
>>> initializeMenu
>>> menuAddItem(menu, item)
>>> menuRemoveItem(menu, itemId)
>>> menuAddSubmenu(menu, submenu)
>>> menuAddSeparator(menu)
>>> menuEnableItem(menu, itemId, boolEnable)
>>>
>>> Should the "items" sent to menuAddItem, etc. just be HTML, or something
>>> more abstract like Javascript objects? There are no jQueryUI objects for
>>> things like radio groups and checkboxes...these would have to be handled by
>>> us somewhere on the path from abstract menu object to final rendered menu.
>>> Would be interested to hear your thoughts on the best way to implement
>>> addItem.
>>>
>>> Cheers, Mike
>>>
>>> ---
>>> Michael Evans
>>> Organic Chemistry Graduate Student, Moore Group
>>> University of Illinois, Urbana-Champaign
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>>> Remotely access PCs and mobile devices and provide instant support
>>> Improve your efficiency, and focus on delivering more value-add services
>>> Discover what IT Professionals Know. Rescue delivers
>>> http://p.sf.net/sfu/logmein_12329d2d
>>> _______________________________________________
>>> Jmol-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>>
>>>
>>
>>
>> --
>> Robert M. Hanson
>> Larson-Anderson Professor of Chemistry
>> Chair, Chemistry Department
>> St. Olaf College
>> Northfield, MN
>> http://www.stolaf.edu/people/hansonr
>>
>>
>> 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
>>
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> Jmol-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to