120 likes | 240 Views
Visualizing HIV Envelope Proteins: Week 7 Project Status . Phil Heller CMP 261 Spring 2010. Jmol. Open source 498 source files 190,000 lines Mean ~400 lpf but Biggest file is 14,523 lines Several > 3k lines Many > 2k lines. Tasks. ~ 6 main frames rather than 1
E N D
Visualizing HIV Envelope Proteins: Week 7 Project Status Phil Heller CMP 261 Spring 2010
Jmol • Open source • 498 source files • 190,000 lines • Mean ~400 lpf but • Biggest file is 14,523 lines • Several > 3k lines • Many > 2k lines
Tasks • ~ 6 main frames rather than 1 • Multiplex all spatial events • Inject markup scripts • Generate markup scripts from lab data
Java’s Event Model • Class XXXEvent • Source • Low-level details • Semantics • Interface XXXListener • 1 method for each semantic category • No convention for method names • Method args are events • Event source • addXXXListener() • removeXXXListener()
Using the Model class ReportingListener implements MouseListener { public void mouseClicked(MouseEvente) { System.out.println(“CLICK at “ + e.getX() + e.getY()); } // other event handlers } class SamplePanel extends JPanel { SamplePanel() { ReportingListenerrl = new ReportingListener (); addMouseListener(rl); } }
How to share Jmol events? • Modify existing event handlers • High degree of convolution • Evidence of “black-box maintenance” • Hard to prove correctness of my changes • LBTW bugs • Preserve existing event handlers, add my own • Can’t break what I don’t touch
My Solution: Event Echoing public class MouseEventEcho extends MouseEvent { // Just a little housekeeping here } Class EchoingListener implements MouseListener { // You’ll see … }
addActionListener (theEchoingListener) EchoingListener
The Echoing Listener Receives an Event Done Echo Event? yes no Build echo event from original For each Jmol except the sender Inject echo into Jmol’sdispatcher
Scenario: Mouse Event in Green Jmol • Green dispatcher sends event to green handler • Green dispatcher sends event to echoing listener • Echoing listener makes echo event • Echoing listener sends echo event to red dispatcher : • Red dispatcher sends event to red handler • Red dispatcher sends event to echoing listener (no-op) • Echoing listener sends echo event to yellow dispatcher • … and to blue dispatcher • … and to purple dispatcher • … and to orange dispatcher 0 changes to Jmol
What’s next • Map features to molecule colors • Convert Hxb2 coordinates to 2B4c coordinates • Predicate view