This is useful functionality, but I see one glitch. This is set up only 
to have a single master and a single set of slaves. I think we need to 
generalize it so that the slaves and master are identified in sets. To 
do this, each master should have a designated array of slaves, and each 
slave should only notify its associated master.

I believe this might be best accomplished using the jmolRadioGroup as a 
basis than the checkBox, which is already set up with a group name. Or, 
we could just add the group name as the first parameter.

Can I try to adapt this? I think there might be a considerably simpler way.


Personally I would prefer not to use the "master/slave" language, though 
I understand why you do so. Is there an alternative? Forgive me if that 
sounds silly.

David, you might think about using "define" and "if" in some of these. 
I'd understand if that would be impractical due to how it is set up as a 
server-based dynamic HTML page. But just in case you hadn't seen use for 
those:

define motif1  6,7,8,9,10
define motif2 94,95,96,97,98
define motif3 95,96,97,98,99

(This just makes the next part easier to read and understand.)

jmolCheckboxMaster("set motif1;set motif2;setmotif3;select 
motif1,motif2,motif3;...."

jmolCheckboxSlave("set motif1;select motif1;background red","set motif1 
false;select motif1;background grey")
jmolCheckboxSlave("set motif2;select motif2;background red","set motif2 
false;if(motif3)select motif2 and not motif3;else;select 
motif2;endif;background grey")
jmolCheckboxSlave("set motif3;select motif3;background red","set motif3 
false;if(motif2)select motif3 and not motif2;else;select 
motif3;endif;background grey")

then you can probably do without that comment:

"[To view a single motif when two that overlap have been displayed: 
first turn off both, then redisplay the one of interest.]"

because turning off one that overlaps will not turn off the other 
overlapping one then.

Or, for that matter, you might as well just dispense with if and just in 
general for the "OFF" on each switch do:

select motif1 and not (motif2,motif3)
select motif2 and not (motif1,motif3)
select motif3 and not (motif1,motif2)

and I think that would accomplish the same result.

Hmm, as I think of it, maybe there's no good solution for that 
overlapping business.


jmolCheckbox
Angel Herraez wrote:

> Do any of you mind or see any trouble if I add David Leader's 
> functions for Master-Slave checkboxes into Jmol.js?
>
> The code would be what I am attaching.
>
> Targets would be
> /trunk/Jmol/appletweb/Jmol.js
> and
> /branches/v11_0/Jmol/appletweb/Jmol.js
>
>
> There is also the question of removing the warning from jmolInitialize 
> when an absolute (http:// ) reference is used (modification also 
> contained in the attached code).
>
>
>
> On 4 Jan 2007 at 22:26, David Leader wrote:
> 1. Back in the summer I produced my own modifications of the 
> jmolCheckbox() function, as indicated by the comments in my modified
> version of Jmol.js for 10.2:
>
>  The jmolCheckbox() function has been cloned and modified to give:
>  jmolCheckboxMaster() and jmolCheckboxSlave(), which have their own
>  counters and generate ids of the type jmolChkboxMaster0 and
>  jmolChkboxSlave0, ..1, ...2. These generate checkboxes with one 
> additional
>  function for onClick(). In the case of the 'master' the updateSlaves()
>  funtion sets all the 'slave' checkboxes to the same state as the master
>  after the master has been clicked. In the case of the 'slaves' the
>  notifyMaster() function determines whether the change of state of 
> the slave
>  has resulted in a situation in which all slaves are now checked 
> (when the
>  master must be likewise updated) or a situation in which not all 
> slaves are
>  checked (in which case the master should be unchecked).
>
> It is in use on my web app at _http://doolittle.ibls.gla.ac.uk/motif_ 
>   and
> notified the developers group about it (unfortunately I have not  the
> email to hand) and was told that it would be incorporated in the  next
> release. It is not in 11.0.RC3. I think it would be a useful  addition,
> but if it is not going to be included, I need to know so  that I can 
> mount
> a branch on my own website and reference it in  publications.
> -----------
>  
>
>------------------------------------------------------------------------
>
>The following section of this message contains a file attachment
>prepared for transmission using the Internet MIME message format.
>If you are using Pegasus Mail, or any other MIME-compliant system,
>you should be able to save it or view it from within your mailer.
>If you cannot, please ask your system administrator for assistance.
>
>   ---- File information -----------
>     File:  expanded_Jmol.js
>     Date:  8 Jan 2007, 2:44
>     Size:  6976 bytes.
>     Type:  Unknown
>
>  
>
>------------------------------------------------------------------------
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share your
>opinions on IT & business topics through brief surveys - and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Jmol-developers mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-developers
>  
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to