JAL-1807 test
[jalviewjs.git] / bin / jalview / structure / StructureSelectionManager.js
1 Clazz.declarePackage ("jalview.structure");
2 Clazz.load (["java.util.ArrayList", "$.HashMap", "$.LinkedHashSet", "$.Vector"], "jalview.structure.StructureSelectionManager", ["MCview.PDBfile", "jalview.analysis.AlignSeq", "jalview.commands.EditCommand", "$.OrderCommand", "jalview.datamodel.Mapping", "$.SearchResults", "jalview.io.AppletFormatAdapter", "jalview.structure.AtomSpec", "$.SecondaryStructureListener", "$.SequenceListener", "$.StructureListener", "$.StructureMapping", "$.VamsasListener", "jalview.util.MappingUtils", "$.MessageManager", "java.lang.Error", "$.NullPointerException", "$.StringBuilder", "java.util.Arrays", "$.Collections", "$.IdentityHashMap"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.mappings = null;
5 this.processSecondaryStructure = false;
6 this.secStructServices = false;
7 this.addTempFacAnnot = false;
8 this.seqmappings = null;
9 this.seqMappingRefCounts = null;
10 this.commandListeners = null;
11 this.sel_listeners = null;
12 this.pdbIdFileName = null;
13 this.pdbFileNameId = null;
14 this.relaySeqMappings = true;
15 this.listeners = null;
16 this.handlingVamsasMo = false;
17 this.lastmsg = 0;
18 this.view_listeners = null;
19 Clazz.instantialize (this, arguments);
20 }, jalview.structure, "StructureSelectionManager");
21 Clazz.prepareFields (c$, function () {
22 this.mappings =  new java.util.ArrayList ();
23 this.seqmappings =  new java.util.LinkedHashSet ();
24 this.seqMappingRefCounts =  new java.util.HashMap ();
25 this.commandListeners =  new java.util.ArrayList ();
26 this.sel_listeners =  new java.util.ArrayList ();
27 this.pdbIdFileName =  new java.util.HashMap ();
28 this.pdbFileNameId =  new java.util.HashMap ();
29 this.listeners =  new java.util.Vector ();
30 this.view_listeners =  new java.util.Vector ();
31 });
32 Clazz.defineMethod (c$, "isSecStructServices", 
33 function () {
34 return this.secStructServices;
35 });
36 Clazz.defineMethod (c$, "setSecStructServices", 
37 function (secStructServices) {
38 this.secStructServices = secStructServices;
39 }, "~B");
40 Clazz.defineMethod (c$, "isAddTempFacAnnot", 
41 function () {
42 return this.addTempFacAnnot;
43 });
44 Clazz.defineMethod (c$, "setAddTempFacAnnot", 
45 function (addTempFacAnnot) {
46 this.addTempFacAnnot = addTempFacAnnot;
47 }, "~B");
48 Clazz.defineMethod (c$, "isProcessSecondaryStructure", 
49 function () {
50 return this.processSecondaryStructure;
51 });
52 Clazz.defineMethod (c$, "setProcessSecondaryStructure", 
53 function (enable) {
54 this.processSecondaryStructure = enable;
55 }, "~B");
56 Clazz.defineMethod (c$, "reportMapping", 
57 function () {
58 if (this.mappings.isEmpty ()) {
59 System.err.println ("reportMapping: No PDB/Sequence mappings.");
60 } else {
61 System.err.println ("reportMapping: There are " + this.mappings.size () + " mappings.");
62 var i = 0;
63 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
64 System.err.println ("mapping " + i++ + " : " + sm.pdbfile);
65 }
66 }});
67 Clazz.defineMethod (c$, "registerPDBFile", 
68 function (idForFile, absoluteFile) {
69 this.pdbIdFileName.put (idForFile, absoluteFile);
70 this.pdbFileNameId.put (absoluteFile, idForFile);
71 }, "~S,~S");
72 Clazz.defineMethod (c$, "findIdForPDBFile", 
73 function (idOrFile) {
74 var id = this.pdbFileNameId.get (idOrFile);
75 return id;
76 }, "~S");
77 Clazz.defineMethod (c$, "findFileForPDBId", 
78 function (idOrFile) {
79 var id = this.pdbIdFileName.get (idOrFile);
80 return id;
81 }, "~S");
82 Clazz.defineMethod (c$, "isPDBFileRegistered", 
83 function (idOrFile) {
84 return this.pdbFileNameId.containsKey (idOrFile) || this.pdbIdFileName.containsKey (idOrFile);
85 }, "~S");
86 c$.getStructureSelectionManager = Clazz.defineMethod (c$, "getStructureSelectionManager", 
87 function (context) {
88 if (context == null) {
89 if (jalview.structure.StructureSelectionManager.nullProvider == null) {
90 if (jalview.structure.StructureSelectionManager.instances != null) {
91 throw  new Error (jalview.util.MessageManager.getString ("error.implementation_error_structure_selection_manager_null"),  new NullPointerException (jalview.util.MessageManager.getString ("exception.ssm_context_is_null")));
92 } else {
93 jalview.structure.StructureSelectionManager.nullProvider =  new jalview.structure.StructureSelectionManager ();
94 }return jalview.structure.StructureSelectionManager.nullProvider;
95 }}if (jalview.structure.StructureSelectionManager.instances == null) {
96 jalview.structure.StructureSelectionManager.instances =  new java.util.IdentityHashMap ();
97 }var instance = jalview.structure.StructureSelectionManager.instances.get (context);
98 if (instance == null) {
99 if (jalview.structure.StructureSelectionManager.nullProvider != null) {
100 instance = jalview.structure.StructureSelectionManager.nullProvider;
101 } else {
102 instance =  new jalview.structure.StructureSelectionManager ();
103 }jalview.structure.StructureSelectionManager.instances.put (context, instance);
104 }return instance;
105 }, "jalview.api.StructureSelectionManagerProvider");
106 Clazz.defineMethod (c$, "setRelaySeqMappings", 
107 function (relay) {
108 this.relaySeqMappings = relay;
109 }, "~B");
110 Clazz.defineMethod (c$, "isRelaySeqMappingsEnabled", 
111 function () {
112 return this.relaySeqMappings;
113 });
114 Clazz.defineMethod (c$, "addStructureViewerListener", 
115 function (svl) {
116 if (!this.listeners.contains (svl)) {
117 this.listeners.addElement (svl);
118 }}, "~O");
119 Clazz.defineMethod (c$, "alreadyMappedToFile", 
120 function (pdbid) {
121 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
122 if (sm.getPdbId ().equals (pdbid)) {
123 return sm.pdbfile;
124 }}
125 return null;
126 }, "~S");
127 Clazz.defineMethod (c$, "setMapping", 
128 function (sequence, targetChains, pdbFile, protocol) {
129 return this.setMapping (true, sequence, targetChains, pdbFile, protocol);
130 }, "~A,~A,~S,~S");
131 Clazz.defineMethod (c$, "setMapping", 
132 function (forStructureView, sequence, targetChains, pdbFile, protocol) {
133 var parseSecStr = this.processSecondaryStructure;
134 if (this.isPDBFileRegistered (pdbFile)) {
135 for (var sq, $sq = 0, $$sq = sequence; $sq < $$sq.length && ((sq = $$sq[$sq]) || true); $sq++) {
136 var ds = sq;
137 while (ds.getDatasetSequence () != null) {
138 ds = ds.getDatasetSequence ();
139 }
140 ;if (ds.getAnnotation () != null) {
141 for (var ala, $ala = 0, $$ala = ds.getAnnotation (); $ala < $$ala.length && ((ala = $$ala[$ala]) || true); $ala++) {
142 if (MCview.PDBfile.isCalcIdForFile (ala, this.findIdForPDBFile (pdbFile))) {
143 parseSecStr = false;
144 }}
145 }}
146 }var pdb = null;
147 try {
148 pdb =  new MCview.PDBfile (this.addTempFacAnnot, parseSecStr, this.secStructServices, pdbFile, protocol);
149 if (pdb.id != null && pdb.id.trim ().length > 0 && jalview.io.AppletFormatAdapter.FILE.equals (protocol)) {
150 this.registerPDBFile (pdb.id.trim (), pdbFile);
151 }} catch (ex) {
152 if (Clazz.exceptionOf (ex, Exception)) {
153 ex.printStackTrace ();
154 return null;
155 } else {
156 throw ex;
157 }
158 }
159 var targetChain;
160 for (var s = 0; s < sequence.length; s++) {
161 var infChain = true;
162 var seq = sequence[s];
163 if (targetChains != null && targetChains[s] != null) {
164 infChain = false;
165 targetChain = targetChains[s];
166 } else if (seq.getName ().indexOf ("|") > -1) {
167 targetChain = seq.getName ().substring (seq.getName ().lastIndexOf ("|") + 1);
168 if (targetChain.length > 1) {
169 if (targetChain.trim ().length == 0) {
170 targetChain = " ";
171 } else {
172 targetChain = "";
173 }}} else {
174 targetChain = "";
175 }var max = -10;
176 var maxAlignseq = null;
177 var maxChainId = " ";
178 var maxChain = null;
179 var first = true;
180 for (var chain, $chain = pdb.chains.iterator (); $chain.hasNext () && ((chain = $chain.next ()) || true);) {
181 if (targetChain.length > 0 && !targetChain.equals (chain.id) && !infChain) {
182 continue;
183 }var type = chain.isNa ? "dna" : "pep";
184 var as = jalview.analysis.AlignSeq.doGlobalNWAlignment (seq, chain.sequence, type);
185 if (first || as.maxscore > max || (as.maxscore == max && chain.id.equals (targetChain))) {
186 first = false;
187 maxChain = chain;
188 max = as.maxscore;
189 maxAlignseq = as;
190 maxChainId = chain.id;
191 }}
192 if (maxChain == null) {
193 continue;
194 }var mappingDetails =  new StringBuilder (128);
195 mappingDetails.append (jalview.structure.StructureSelectionManager.NEWLINE).append ("PDB Sequence is :").append (jalview.structure.StructureSelectionManager.NEWLINE).append ("Sequence = ").append (maxChain.sequence.getSequenceAsString ());
196 mappingDetails.append (jalview.structure.StructureSelectionManager.NEWLINE).append ("No of residues = ").append (maxChain.residues.size ()).append (jalview.structure.StructureSelectionManager.NEWLINE).append (jalview.structure.StructureSelectionManager.NEWLINE);
197 var ps = ((Clazz.isClassDefined ("jalview.structure.StructureSelectionManager$1") ? 0 : jalview.structure.StructureSelectionManager.$StructureSelectionManager$1$ ()), Clazz.innerTypeInstance (jalview.structure.StructureSelectionManager$1, this, Clazz.cloneFinals ("mappingDetails", mappingDetails), System.out));
198 maxAlignseq.printAlignment (ps);
199 mappingDetails.append (jalview.structure.StructureSelectionManager.NEWLINE).append ("PDB start/end ");
200 mappingDetails.append (String.valueOf (maxAlignseq.seq2start)).append (" ");
201 mappingDetails.append (String.valueOf (maxAlignseq.seq2end));
202 mappingDetails.append (jalview.structure.StructureSelectionManager.NEWLINE).append ("SEQ start/end ");
203 mappingDetails.append (String.valueOf (maxAlignseq.seq1start + seq.getStart () - 1)).append (" ");
204 mappingDetails.append (String.valueOf (maxAlignseq.seq1end + seq.getEnd () - 1));
205 maxChain.makeExactMapping (maxAlignseq, seq);
206 var sqmpping = maxAlignseq.getMappingFromS1 (false);
207 var omap =  new jalview.datamodel.Mapping (sqmpping.getMap ().getInverse ());
208 maxChain.transferRESNUMFeatures (seq, null);
209 var mapping =  Clazz.newIntArray (seq.findPosition (seq.getLength ()) + 2, 2, 0);
210 var resNum = -10000;
211 var index = 0;
212 do {
213 var tmp = maxChain.atoms.elementAt (index);
214 if (resNum != tmp.resNumber && tmp.alignmentMapping != -1) {
215 resNum = tmp.resNumber;
216 mapping[tmp.alignmentMapping + 1][0] = tmp.resNumber;
217 mapping[tmp.alignmentMapping + 1][1] = tmp.atomIndex;
218 }index++;
219 } while (index < maxChain.atoms.size ());
220 if (protocol.equals (jalview.io.AppletFormatAdapter.PASTE)) {
221 pdbFile = "INLINE" + pdb.id;
222 }var newMapping =  new jalview.structure.StructureMapping (seq, pdbFile, pdb.id, maxChainId, mapping, mappingDetails.toString ());
223 if (forStructureView) {
224 this.mappings.add (newMapping);
225 }maxChain.transferResidueAnnotation (newMapping, sqmpping);
226 }
227 return pdb;
228 }, "~B,~A,~A,~S,~S");
229 Clazz.defineMethod (c$, "removeStructureViewerListener", 
230 function (svl, pdbfiles) {
231 this.listeners.removeElement (svl);
232 if (Clazz.instanceOf (svl, jalview.structure.SequenceListener)) {
233 for (var i = 0; i < this.listeners.size (); i++) {
234 if (Clazz.instanceOf (this.listeners.elementAt (i), jalview.structure.StructureListener)) {
235 (this.listeners.elementAt (i)).releaseReferences (svl);
236 }}
237 }if (pdbfiles == null) {
238 return;
239 }var pdbs =  new java.util.ArrayList (java.util.Arrays.asList (pdbfiles));
240 var sl;
241 for (var i = 0; i < this.listeners.size (); i++) {
242 if (Clazz.instanceOf (this.listeners.elementAt (i), jalview.structure.StructureListener)) {
243 sl = this.listeners.elementAt (i);
244 for (var pdbfile, $pdbfile = 0, $$pdbfile = sl.getPdbFile (); $pdbfile < $$pdbfile.length && ((pdbfile = $$pdbfile[$pdbfile]) || true); $pdbfile++) {
245 pdbs.remove (pdbfile);
246 }
247 }}
248 if (pdbs.size () > 0) {
249 var tmp =  new java.util.ArrayList ();
250 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
251 if (!pdbs.contains (sm.pdbfile)) {
252 tmp.add (sm);
253 }}
254 this.mappings = tmp;
255 }}, "~O,~A");
256 Clazz.defineMethod (c$, "mouseOverStructure", 
257 function (pdbResNum, chain, pdbfile) {
258 var atomSpec =  new jalview.structure.AtomSpec (pdbfile, chain, pdbResNum, 0);
259 var atoms = java.util.Collections.singletonList (atomSpec);
260 this.mouseOverStructure (atoms);
261 }, "~N,~S,~S");
262 Clazz.defineMethod (c$, "mouseOverStructure", 
263 function (atoms) {
264 if (this.listeners == null) {
265 return;
266 }var hasSequenceListener = false;
267 for (var i = 0; i < this.listeners.size (); i++) {
268 if (Clazz.instanceOf (this.listeners.elementAt (i), jalview.structure.SequenceListener)) {
269 hasSequenceListener = true;
270 }}
271 if (!hasSequenceListener) {
272 return;
273 }var results =  new jalview.datamodel.SearchResults ();
274 for (var atom, $atom = atoms.iterator (); $atom.hasNext () && ((atom = $atom.next ()) || true);) {
275 var lastseq = null;
276 var lastipos = -1;
277 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
278 if (sm.pdbfile.equals (atom.getPdbFile ()) && sm.pdbchain.equals (atom.getChain ())) {
279 var indexpos = sm.getSeqPos (atom.getPdbResNum ());
280 if (lastipos != indexpos && lastseq !== sm.sequence) {
281 results.addResult (sm.sequence, indexpos, indexpos);
282 lastipos = indexpos;
283 lastseq = sm.sequence;
284 for (var acf, $acf = this.seqmappings.iterator (); $acf.hasNext () && ((acf = $acf.next ()) || true);) {
285 acf.markMappedRegion (sm.sequence, indexpos, results);
286 }
287 }}}
288 }
289 for (var li, $li = this.listeners.iterator (); $li.hasNext () && ((li = $li.next ()) || true);) {
290 if (Clazz.instanceOf (li, jalview.structure.SequenceListener)) {
291 (li).highlightSequence (results);
292 }}
293 }, "java.util.List");
294 Clazz.defineMethod (c$, "mouseOverSequence", 
295 function (seq, indexpos, index, source) {
296 var hasSequenceListeners = this.handlingVamsasMo || !this.seqmappings.isEmpty ();
297 var results = null;
298 if (index == -1) {
299 index = seq.findPosition (indexpos);
300 }for (var i = 0; i < this.listeners.size (); i++) {
301 var listener = this.listeners.elementAt (i);
302 if (listener === source) {
303 continue;
304 }if (Clazz.instanceOf (listener, jalview.structure.StructureListener)) {
305 this.highlightStructure (listener, seq, index);
306 } else {
307 if (Clazz.instanceOf (listener, jalview.structure.SequenceListener)) {
308 var seqListener = listener;
309 if (hasSequenceListeners && seqListener.getVamsasSource () !== source) {
310 if (this.relaySeqMappings) {
311 if (results == null) {
312 results = jalview.util.MappingUtils.buildSearchResults (seq, index, this.seqmappings);
313 }if (this.handlingVamsasMo) {
314 results.addResult (seq, index, index);
315 }seqListener.highlightSequence (results);
316 }}} else if (Clazz.instanceOf (listener, jalview.structure.VamsasListener) && !this.handlingVamsasMo) {
317 (listener).mouseOverSequence (seq, indexpos, source);
318 } else if (Clazz.instanceOf (listener, jalview.structure.SecondaryStructureListener)) {
319 (listener).mouseOverSequence (seq, indexpos, index);
320 }}}
321 }, "jalview.datamodel.SequenceI,~N,~N,jalview.structure.VamsasSource");
322 Clazz.defineMethod (c$, "highlightStructure", 
323 function (sl, seq, index) {
324 if (!sl.isListeningFor (seq)) {
325 return;
326 }var atomNo;
327 var atoms =  new java.util.ArrayList ();
328 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
329 if (sm.sequence === seq || sm.sequence === seq.getDatasetSequence ()) {
330 atomNo = sm.getAtomNum (index);
331 if (atomNo > 0) {
332 atoms.add ( new jalview.structure.AtomSpec (sm.pdbfile, sm.pdbchain, sm.getPDBResNum (index), atomNo));
333 }}}
334 sl.highlightAtoms (atoms);
335 }, "jalview.structure.StructureListener,jalview.datamodel.SequenceI,~N");
336 Clazz.defineMethod (c$, "mouseOverVamsasSequence", 
337 function (sequenceI, position, source) {
338 this.handlingVamsasMo = true;
339 var msg = sequenceI.hashCode () * (1 + position);
340 if (this.lastmsg != msg) {
341 this.lastmsg = msg;
342 this.mouseOverSequence (sequenceI, position, -1, source);
343 }this.handlingVamsasMo = false;
344 }, "jalview.datamodel.SequenceI,~N,jalview.structure.VamsasSource");
345 Clazz.defineMethod (c$, "colourSequenceFromStructure", 
346 function (seq, pdbid) {
347 return null;
348 }, "jalview.datamodel.SequenceI,~S");
349 Clazz.defineMethod (c$, "structureSelectionChanged", 
350 function () {
351 });
352 Clazz.defineMethod (c$, "sequenceSelectionChanged", 
353 function () {
354 });
355 Clazz.defineMethod (c$, "sequenceColoursChanged", 
356 function (source) {
357 var sl;
358 for (var i = 0; i < this.listeners.size (); i++) {
359 if (Clazz.instanceOf (this.listeners.elementAt (i), jalview.structure.StructureListener)) {
360 sl = this.listeners.elementAt (i);
361 sl.updateColours (source);
362 }}
363 }, "~O");
364 Clazz.defineMethod (c$, "getMapping", 
365 function (pdbfile) {
366 var tmp =  new java.util.ArrayList ();
367 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
368 if (sm.pdbfile.equals (pdbfile)) {
369 tmp.add (sm);
370 }}
371 return tmp.toArray ( new Array (tmp.size ()));
372 }, "~S");
373 Clazz.defineMethod (c$, "printMappings", 
374 function (pdbfile, seqs) {
375 if (pdbfile == null || seqs == null || seqs.isEmpty ()) {
376 return "";
377 }var sb =  new StringBuilder (64);
378 for (var sm, $sm = this.mappings.iterator (); $sm.hasNext () && ((sm = $sm.next ()) || true);) {
379 if (sm.pdbfile.equals (pdbfile) && seqs.contains (sm.sequence)) {
380 sb.append (sm.mappingDetails);
381 sb.append (jalview.structure.StructureSelectionManager.NEWLINE);
382 sb.append ("=====================");
383 sb.append (jalview.structure.StructureSelectionManager.NEWLINE);
384 }}
385 sb.append (jalview.structure.StructureSelectionManager.NEWLINE);
386 return sb.toString ();
387 }, "~S,java.util.List");
388 Clazz.defineMethod (c$, "removeMappings", 
389 function (set) {
390 if (set != null) {
391 for (var acf, $acf = set.iterator (); $acf.hasNext () && ((acf = $acf.next ()) || true);) {
392 this.removeMapping (acf);
393 }
394 }}, "java.util.Set");
395 Clazz.defineMethod (c$, "removeMapping", 
396 function (acf) {
397 if (acf != null && this.seqmappings.contains (acf)) {
398 var count = (this.seqMappingRefCounts.get (acf)).intValue ();
399 count--;
400 if (count > 0) {
401 this.seqMappingRefCounts.put (acf, new Integer (count));
402 } else {
403 this.seqmappings.remove (acf);
404 this.seqMappingRefCounts.remove (acf);
405 }}}, "jalview.datamodel.AlignedCodonFrame");
406 Clazz.defineMethod (c$, "addMappings", 
407 function (set) {
408 if (set != null) {
409 for (var acf, $acf = set.iterator (); $acf.hasNext () && ((acf = $acf.next ()) || true);) {
410 this.addMapping (acf);
411 }
412 }}, "java.util.Set");
413 Clazz.defineMethod (c$, "addMapping", 
414 function (acf) {
415 if (acf != null) {
416 if (this.seqmappings.contains (acf)) {
417 this.seqMappingRefCounts.put (acf, new Integer ((this.seqMappingRefCounts.get (acf)).intValue () + 1));
418 } else {
419 this.seqmappings.add (acf);
420 this.seqMappingRefCounts.put (acf, new Integer (1));
421 }}}, "jalview.datamodel.AlignedCodonFrame");
422 Clazz.defineMethod (c$, "addSelectionListener", 
423 function (selecter) {
424 if (!this.sel_listeners.contains (selecter)) {
425 this.sel_listeners.add (selecter);
426 }}, "jalview.structure.SelectionListener");
427 Clazz.defineMethod (c$, "removeSelectionListener", 
428 function (toremove) {
429 if (this.sel_listeners.contains (toremove)) {
430 this.sel_listeners.remove (toremove);
431 }}, "jalview.structure.SelectionListener");
432 Clazz.defineMethod (c$, "sendSelection", 
433 function (selection, colsel, source) {
434 for (var slis, $slis = this.sel_listeners.iterator (); $slis.hasNext () && ((slis = $slis.next ()) || true);) {
435 if (slis !== source) {
436 slis.selection (selection, colsel, source);
437 }}
438 }, "jalview.datamodel.SequenceGroup,jalview.datamodel.ColumnSelection,jalview.structure.SelectionSource");
439 Clazz.defineMethod (c$, "sendViewPosition", 
440 function (source, startRes, endRes, startSeq, endSeq) {
441 if (this.view_listeners != null && this.view_listeners.size () > 0) {
442 var listeners = this.view_listeners.elements ();
443 while (listeners.hasMoreElements ()) {
444 var slis = listeners.nextElement ();
445 if (slis !== source) {
446 slis.viewPosition (startRes, endRes, startSeq, endSeq, source);
447 };}
448 }}, "jalview.api.AlignmentViewPanel,~N,~N,~N,~N");
449 c$.release = Clazz.defineMethod (c$, "release", 
450 function (jalviewLite) {
451 {
452 if (jalview.structure.StructureSelectionManager.instances == null) {
453 return;
454 }var mnger = (jalview.structure.StructureSelectionManager.instances.get (jalviewLite));
455 if (mnger != null) {
456 jalview.structure.StructureSelectionManager.instances.remove (jalviewLite);
457 try {
458 mnger.finalize ();
459 } catch (x) {
460 }
461 }}}, "jalview.api.StructureSelectionManagerProvider");
462 Clazz.defineMethod (c$, "registerPDBEntry", 
463 function (pdbentry) {
464 if (pdbentry.getFile () != null && pdbentry.getFile ().trim ().length > 0) {
465 this.registerPDBFile (pdbentry.getId (), pdbentry.getFile ());
466 }}, "jalview.datamodel.PDBEntry");
467 Clazz.defineMethod (c$, "addCommandListener", 
468 function (cl) {
469 if (!this.commandListeners.contains (cl)) {
470 this.commandListeners.add (cl);
471 }}, "jalview.structure.CommandListener");
472 Clazz.defineMethod (c$, "hasCommandListener", 
473 function (cl) {
474 return this.commandListeners.contains (cl);
475 }, "jalview.structure.CommandListener");
476 Clazz.defineMethod (c$, "removeCommandListener", 
477 function (l) {
478 return this.commandListeners.remove (l);
479 }, "jalview.structure.CommandListener");
480 Clazz.defineMethod (c$, "commandPerformed", 
481 function (command, undo, source) {
482 for (var listener, $listener = this.commandListeners.iterator (); $listener.hasNext () && ((listener = $listener.next ()) || true);) {
483 listener.mirrorCommand (command, undo, this, source);
484 }
485 }, "jalview.commands.CommandI,~B,jalview.structure.VamsasSource");
486 Clazz.defineMethod (c$, "mapCommand", 
487 function (command, undo, mapTo, gapChar) {
488 if (Clazz.instanceOf (command, jalview.commands.EditCommand)) {
489 return jalview.util.MappingUtils.mapEditCommand (command, undo, mapTo, gapChar, this.seqmappings);
490 } else if (Clazz.instanceOf (command, jalview.commands.OrderCommand)) {
491 return jalview.util.MappingUtils.mapOrderCommand (command, undo, mapTo, this.seqmappings);
492 }return null;
493 }, "jalview.commands.CommandI,~B,jalview.datamodel.AlignmentI,~S");
494 c$.$StructureSelectionManager$1$ = function () {
495 Clazz.pu$h ();
496 c$ = Clazz.declareAnonymous (jalview.structure, "StructureSelectionManager$1", java.io.PrintStream);
497 Clazz.defineMethod (c$, "print", 
498 function (x) {
499 this.f$.mappingDetails.append (x);
500 }, "~S");
501 Clazz.defineMethod (c$, "println", 
502 function () {
503 this.f$.mappingDetails.append (jalview.structure.StructureSelectionManager.NEWLINE);
504 });
505 c$ = Clazz.p0p ();
506 };
507 c$.NEWLINE = c$.prototype.NEWLINE = System.lineSeparator ();
508 Clazz.defineStatics (c$,
509 "instances", null,
510 "nullProvider", null);
511 });