TODO: move this to AtomInfo class
968543
public static final String getPdbInfo(Atom a, boolean printResName){
		String aa3 = "";

		String chain1 ="";
		String res1 = "";

		if ( a != null){
			Group g1 = a.getGroup();
			if ( g1 != null){
				aa3 = g1.getPDBName();
				res1 = g1.getResidueNumber().toString();
				Chain ch1 = g1.getChain();
				if (ch1 != null)
					chain1 = ch1.getId();
			}
		}

		StringBuffer buf = new StringBuffer();
		if ( printResName) {
			if ( !aa3.equals("")){
				buf.append("[");
				buf.append(aa3);
				buf.append("]");
			}
		}
		if ( ! res1.equals("")) {

			// let's check if there is an insertion code...
			Matcher matcher = inscodePatter.matcher(res1);

			boolean found = matcher.find();
			if ( ! found) {
				System.err.println("JmolTools: could not parse the residue number string " + res1);
				buf.append(res1);
			} else {
				String residueNumber = matcher.group(1);
				String insCode = matcher.group(2);
				buf.append(residueNumber);
				if ( insCode != null && ! ( insCode.equals(""))) {
					buf.append("^");
					buf.append(insCode);
				}
			}

		}




		if ( ! chain1.equals("")){
			buf.append(":");
			buf.append(chain1);
		}
		return buf.toString();
	}
1265077
function () {
/*Line 30 - 'AtomYesNoCustom.js' */                this._onUIChanged = true;
/*Line 31 - 'AtomYesNoCustom.js' */                var val = $(this._input).val();
/*Line 32 - 'AtomYesNoCustom.js' */                AtomBinder.setValue(this, "value", val);
/*Line 33 - 'AtomYesNoCustom.js' */                this._onUIChanged = false;
/*Line 34 - 'AtomYesNoCustom.js' */            }
429926
function (element, key, value, twoWays, vf, events) {

/*Line 799 - 'AtomControl.js' */                if (value == null) {
/*Line 800 - 'AtomControl.js' */                    // remove existing binding...
/*Line 801 - 'AtomControl.js' */                    this.clearBinding(element, key);
/*Line 802 - 'AtomControl.js' */                    return;
/*Line 803 - 'AtomControl.js' */                }

/*Line 805 - 'AtomControl.js' */                var target = this;
/*Line 806 - 'AtomControl.js' */                if (value && value.constructor == String && /^window\./g.test(value)) {
/*Line 807 - 'AtomControl.js' */                    target = window;
/*Line 808 - 'AtomControl.js' */                }

/*Line 810 - 'AtomControl.js' */                var thisElement = this.get_element();

/*Line 812 - 'AtomControl.js' */                var jq = thisElement != element;

/*Line 814 - 'AtomControl.js' */                if (!jq) {
/*Line 815 - 'AtomControl.js' */                    var f = this["get_" + key];
/*Line 816 - 'AtomControl.js' */                    if (f == undefined || f == null) {
/*Line 817 - 'AtomControl.js' */                        jq = true;
/*Line 818 - 'AtomControl.js' */                    }
/*Line 819 - 'AtomControl.js' */                }

/*Line 821 - 'AtomControl.js' */                switch (key) {
/*Line 822 - 'AtomControl.js' */                    case "value":
/*Line 823 - 'AtomControl.js' */                        if (/input/gi.test(element.nodeName)) { jq = true; }
/*Line 824 - 'AtomControl.js' */                        this.addBinding(target, element, "value", value, twoWays, jq, vf, events);
/*Line 825 - 'AtomControl.js' */                        break;
/*Line 826 - 'AtomControl.js' */                    case "text":
/*Line 827 - 'AtomControl.js' */                        this.addBinding(target, element, "text", value, false, true, vf, events);
/*Line 828 - 'AtomControl.js' */                        break;
/*Line 829 - 'AtomControl.js' */                    default:
/*Line 830 - 'AtomControl.js' */                        this.addBinding(target, element, key, value, twoWays, jq, vf, events);
/*Line 831 - 'AtomControl.js' */                        break;
/*Line 832 - 'AtomControl.js' */                }

/*Line 834 - 'AtomControl.js' */            }
448992
function () {

/*Line 977 - 'AtomControl.js' */                // first remove all templates ...
/*Line 978 - 'AtomControl.js' */                base.init.apply(this, arguments);

/*Line 980 - 'AtomControl.js' */                // init properties...
/*Line 981 - 'AtomControl.js' */                var element = this.get_element();

/*Line 983 - 'AtomControl.js' */                var amap = AtomUI.attributeMap(element, /^atom\-(name|local\-scope)$/gi);

/*Line 985 - 'AtomControl.js' */                var aname = amap["atom-name"];
/*Line 986 - 'AtomControl.js' */                if (!aname) {
/*Line 987 - 'AtomControl.js' */                    var eid = element.id;
/*Line 988 - 'AtomControl.js' */                    if (!/^\_\_waID/.test(eid)) {
/*Line 989 - 'AtomControl.js' */                        aname = element.id;
/*Line 990 - 'AtomControl.js' */                    }
/*Line 991 - 'AtomControl.js' */                } else {
/*Line 992 - 'AtomControl.js' */                    element.removeAttributeNode(aname.node);
/*Line 993 - 'AtomControl.js' */                    aname = aname.value;
/*Line 994 - 'AtomControl.js' */                }
/*Line 995 - 'AtomControl.js' */                if (aname) {
/*Line 996 - 'AtomControl.js' */                    if (/^(app|window|owner|scope|localScope|parent)$/gi.test(aname))
/*Line 997 - 'AtomControl.js' */                        throw new Error("Invalid Control Name '" + aname + "'");
/*Line 998 - 'AtomControl.js' */                    var s = this.get_scope();
/*Line 999 - 'AtomControl.js' */                    AtomBinder.setValue(s, aname, this);
/*Line 1000 - 'AtomControl.js' */                    this._name = aname;
/*Line 1001 - 'AtomControl.js' */                }


/*Line 1004 - 'AtomControl.js' */                ls = amap["atom-local-scope"];
/*Line 1005 - 'AtomControl.js' */                if (ls) {
/*Line 1006 - 'AtomControl.js' */                    this._localScope = new AtomScope(this, this.get_scope(), atomApplication);
/*Line 1007 - 'AtomControl.js' */                    this._scope = this._localScope;
/*Line 1008 - 'AtomControl.js' */                    if (this._name) {
/*Line 1009 - 'AtomControl.js' */                        this._localScope[this._name] = this;
/*Line 1010 - 'AtomControl.js' */                    }
/*Line 1011 - 'AtomControl.js' */                    element.removeAttributeNode(ls.node);
/*Line 1012 - 'AtomControl.js' */                }

/*Line 1014 - 'AtomControl.js' */                // scope is now ready, set scopeTemplates...
/*Line 1015 - 'AtomControl.js' */                var st = this._scopeTemplates;
/*Line 1016 - 'AtomControl.js' */                if (st) {
/*Line 1017 - 'AtomControl.js' */                    var s = this.get_scope();
/*Line 1018 - 'AtomControl.js' */                    for (var i in st) {
/*Line 1019 - 'AtomControl.js' */                        var t = st[i];
/*Line 1020 - 'AtomControl.js' */                        AtomBinder.setValue(s, i, t);
/*Line 1021 - 'AtomControl.js' */                    }
/*Line 1022 - 'AtomControl.js' */                    //try {
/*Line 1023 - 'AtomControl.js' */                    //    delete this._scopeTemplates;
/*Line 1024 - 'AtomControl.js' */                    //} catch (exx) {

/*Line 1026 - 'AtomControl.js' */                    //}
/*Line 1027 - 'AtomControl.js' */                }

/*Line 1029 - 'AtomControl.js' */                //var fn = Function.createDelegate(this, this.initProperties);
/*Line 1030 - 'AtomControl.js' */                var _this = this;
/*Line 1031 - 'AtomControl.js' */                WebAtoms.dispatcher.callLater(function () {
/*Line 1032 - 'AtomControl.js' */                    _this.initProperties();
/*Line 1033 - 'AtomControl.js' */                });

/*Line 1035 - 'AtomControl.js' */                // init every children..
/*Line 1036 - 'AtomControl.js' */                this.initChildren(this._element);

/*Line 1038 - 'AtomControl.js' */                //fn = Function.createDelegate(this, this.onInitialized);
/*Line 1039 - 'AtomControl.js' */                WebAtoms.dispatcher.callLater(function () {
/*Line 1040 - 'AtomControl.js' */                    _this.onInitialized();
/*Line 1041 - 'AtomControl.js' */                });
/*Line 1042 - 'AtomControl.js' */            }
1293437
function (name, value, forceRefresh) {
/*Line 127 - 'WebAtoms.Core.js' */                if (AtomBinder.getValue(this, name) == value) {
/*Line 128 - 'WebAtoms.Core.js' */                    if (forceRefresh) {
/*Line 129 - 'WebAtoms.Core.js' */                        this._refreshValue(name);
/*Line 130 - 'WebAtoms.Core.js' */                    }
/*Line 131 - 'WebAtoms.Core.js' */                    return;
/*Line 132 - 'WebAtoms.Core.js' */                }
/*Line 133 - 'WebAtoms.Core.js' */                var f = this["set_" + name];
/*Line 134 - 'WebAtoms.Core.js' */                if (f) {
/*Line 135 - 'WebAtoms.Core.js' */                    f.apply(this, [value]);
/*Line 136 - 'WebAtoms.Core.js' */                } else {
/*Line 137 - 'WebAtoms.Core.js' */                    this[name] = value;
/*Line 138 - 'WebAtoms.Core.js' */                }
/*Line 139 - 'WebAtoms.Core.js' */                this._refreshValue(name);
/*Line 140 - 'WebAtoms.Core.js' */            }
397961
function () {
/*Line 89 - 'AtomDataPager.js' */                    var v = this._items;
/*Line 90 - 'AtomDataPager.js' */                    if (v.length === undefined) {
/*Line 91 - 'AtomDataPager.js' */                        var val = v[this._itemsPath];

/*Line 93 - 'AtomDataPager.js' */                        AtomBinder.setValue(this, "total", v[this._totalPath]);
/*Line 94 - 'AtomDataPager.js' */                        AtomBinder.setValue(this, "value", val);
/*Line 95 - 'AtomDataPager.js' */                    } else {
/*Line 96 - 'AtomDataPager.js' */                        if (v.total) {
/*Line 97 - 'AtomDataPager.js' */                            AtomBinder.setValue(this, "total", v.total);
/*Line 98 - 'AtomDataPager.js' */                        } else {
/*Line 99 - 'AtomDataPager.js' */                            AtomBinder.setValue(this, "pages", []);
/*Line 100 - 'AtomDataPager.js' */                        }
/*Line 101 - 'AtomDataPager.js' */                        AtomBinder.setValue(this, "value", v);
/*Line 102 - 'AtomDataPager.js' */                    }

/*Line 104 - 'AtomDataPager.js' */                    this.preparePages();
/*Line 105 - 'AtomDataPager.js' */                }
1209216
function () {
/*Line 10 - 'AtomDispatcher.js' */            this._paused = false;
/*Line 11 - 'AtomDispatcher.js' */            this.queue = [];
/*Line 12 - 'AtomDispatcher.js' */            this.onTimeout = function () {
/*Line 13 - 'AtomDispatcher.js' */                if (this._paused)
/*Line 14 - 'AtomDispatcher.js' */                    return;
/*Line 15 - 'AtomDispatcher.js' */                if (this.queue.length == 0) {
/*Line 16 - 'AtomDispatcher.js' */                    var app = atomApplication._element;
/*Line 17 - 'AtomDispatcher.js' */                    if (app.style.visibility == "hidden" || $(app).css("visibility") == "hidden") {
/*Line 18 - 'AtomDispatcher.js' */                        app.style.visibility = "visible";

/*Line 20 - 'AtomDispatcher.js' */                        app.atomControl.updateUI();
/*Line 21 - 'AtomDispatcher.js' */                    }
/*Line 22 - 'AtomDispatcher.js' */                    return;
/*Line 23 - 'AtomDispatcher.js' */                }
/*Line 24 - 'AtomDispatcher.js' */                var item = this.queue.shift();
/*Line 25 - 'AtomDispatcher.js' */                //try{
/*Line 26 - 'AtomDispatcher.js' */                item();
/*Line 27 - 'AtomDispatcher.js' */                //} catch (ex) {

/*Line 29 - 'AtomDispatcher.js' */                //    if (window.console) {
/*Line 30 - 'AtomDispatcher.js' */                //        window.console.log(item.toString());
/*Line 31 - 'AtomDispatcher.js' */                //        window.console.log(JSON.stringify(ex));
/*Line 32 - 'AtomDispatcher.js' */                //    }
/*Line 33 - 'AtomDispatcher.js' */                //}
/*Line 34 - 'AtomDispatcher.js' */                window.setTimeout(this._onTimeout, 1);
/*Line 35 - 'AtomDispatcher.js' */            };
/*Line 36 - 'AtomDispatcher.js' */            //this._onTimeout = Function.createDelegate(this, this.onTimeout);
/*Line 37 - 'AtomDispatcher.js' */            var _this = this;
/*Line 38 - 'AtomDispatcher.js' */            this._onTimeout = function () {
/*Line 39 - 'AtomDispatcher.js' */                _this.onTimeout();
/*Line 40 - 'AtomDispatcher.js' */            };
/*Line 41 - 'AtomDispatcher.js' */        }
285969
function (instance, methodName, create) {
/*Line 229 - 'AtomUI.js' */        if (methodName && methodName.constructor != String)
/*Line 230 - 'AtomUI.js' */            throw new Error("methodName has to be string");
/*Line 231 - 'AtomUI.js' */        var d = instance.__delegates;
/*Line 232 - 'AtomUI.js' */        if (!d) {
/*Line 233 - 'AtomUI.js' */            if (!create)
/*Line 234 - 'AtomUI.js' */                return null;
/*Line 235 - 'AtomUI.js' */            d = {};
/*Line 236 - 'AtomUI.js' */            instance.__delegates = d;
/*Line 237 - 'AtomUI.js' */        }
/*Line 238 - 'AtomUI.js' */        var m = d[methodName];
/*Line 239 - 'AtomUI.js' */        if (!m) {
/*Line 240 - 'AtomUI.js' */            if (!create)
/*Line 241 - 'AtomUI.js' */                return null;
/*Line 242 - 'AtomUI.js' */            var f = instance[methodName];
/*Line 243 - 'AtomUI.js' */            if (!f) {
/*Line 244 - 'AtomUI.js' */                throw new Error("method " + methodName + " not found");
/*Line 245 - 'AtomUI.js' */            }
/*Line 246 - 'AtomUI.js' */            m = function () {
/*Line 247 - 'AtomUI.js' */                return f.apply(instance, arguments);
/*Line 248 - 'AtomUI.js' */            };
/*Line 249 - 'AtomUI.js' */            d[methodName] = m;
/*Line 250 - 'AtomUI.js' */        }
/*Line 251 - 'AtomUI.js' */        return m;
/*Line 252 - 'AtomUI.js' */    }
641982
private AtomicValue atomize(final AbsAxis mOperand) {

        int type = getNode().getTypeKey();
        AtomicValue atom;

        if (XPATH_10_COMP) {

            atom = new AtomicValue(((ITreeValData)getNode()).getRawValue(), getNode().getTypeKey());
        } else {
            // unatomicType is cast to double
            if (type == NamePageHash.generateHashForString("xs:untypedAtomic")) {
                type = NamePageHash.generateHashForString("xs:double");
                // TODO: throw error, of cast fails
            }

            atom = new AtomicValue(((ITreeValData)getNode()).getRawValue(), getNode().getTypeKey());
        }

        // if (!XPATH_10_COMP && operand.hasNext()) {
        // throw new XPathError(ErrorType.XPTY0004);
        // }

        return atom;
    }
105734
function () {

/*Line 266 - 'AtomAutoCompleteBox.js' */                base.init.apply(this, arguments);
/*Line 267 - 'AtomAutoCompleteBox.js' */                this.bindEvent(this._inputBox, "focus", "onInputFocus");
/*Line 268 - 'AtomAutoCompleteBox.js' */                this.bindEvent(this._inputBox, "blur", "onInputBlur");
/*Line 269 - 'AtomAutoCompleteBox.js' */                this.bindEvent(this._inputBox, "keyup", "onKeyUp");
/*Line 270 - 'AtomAutoCompleteBox.js' */            }
489317
function (e) {
/*Line 8 - 'AtomFrameView.js' */            var self = this;
/*Line 9 - 'AtomFrameView.js' */            $(e).addClass("atom-frame-view");
/*Line 10 - 'AtomFrameView.js' */            this._items = [];
/*Line 11 - 'AtomFrameView.js' */            this._layout = WebAtoms.AtomViewBoxLayout.defaultInstance;
/*Line 12 - 'AtomFrameView.js' */            this.backCommand = function () {
/*Line 13 - 'AtomFrameView.js' */                self.onBackCommand.apply(self, arguments);
/*Line 14 - 'AtomFrameView.js' */            };
/*Line 15 - 'AtomFrameView.js' */        }
1286877
function (element) {
/*Line 271 - 'AtomUI.js' */        while (element.hasChildNodes()) {
/*Line 272 - 'AtomUI.js' */            var lc = element.lastChild;
/*Line 273 - 'AtomUI.js' */            if (!lc)
/*Line 274 - 'AtomUI.js' */                break;
/*Line 275 - 'AtomUI.js' */            //element.removeChild(lc);
/*Line 276 - 'AtomUI.js' */            if (lc.atomControl) {
/*Line 277 - 'AtomUI.js' */                lc.atomControl.dispose();
/*Line 278 - 'AtomUI.js' */                delete lc.atomControl;
/*Line 279 - 'AtomUI.js' */            }
/*Line 280 - 'AtomUI.js' */            $(lc).remove();
/*Line 281 - 'AtomUI.js' */            //delete lc;
/*Line 282 - 'AtomUI.js' */        }
/*Line 283 - 'AtomUI.js' */    }
1061568
function (ary, item) {
/*Line 135 - 'AtomBindingHelper.js' */        var l = ary.length;
/*Line 136 - 'AtomBindingHelper.js' */        ary.push(item);
/*Line 137 - 'AtomBindingHelper.js' */        AtomBinder.invokeItemsEvent(ary, "add", l, item);
/*Line 138 - 'AtomBindingHelper.js' */    }
879581
function () {
/*Line 143 - 'AtomNavigatorList.js' */                base.createChildren.call(this);

/*Line 145 - 'AtomNavigatorList.js' */                this.getTemplate("gridTemplate");
/*Line 146 - 'AtomNavigatorList.js' */                this.getTemplate("detailTemplate");
/*Line 147 - 'AtomNavigatorList.js' */                this.getTemplate("searchTemplate");
/*Line 148 - 'AtomNavigatorList.js' */                this.getTemplate("detailHeaderTemplate");
/*Line 149 - 'AtomNavigatorList.js' */                this.getTemplate("newHeaderTemplate");
/*Line 150 - 'AtomNavigatorList.js' */                this.getTemplate("headerTemplate");
/*Line 151 - 'AtomNavigatorList.js' */                this.getTemplate("footerTemplate");

/*Line 153 - 'AtomNavigatorList.js' */                var p = this.get_scope();

/*Line 155 - 'AtomNavigatorList.js' */                this._newView.atomControl._scope = new AtomScope(this, p);
/*Line 156 - 'AtomNavigatorList.js' */                this._detailView.atomControl._scope = new AtomScope(this, p);

/*Line 158 - 'AtomNavigatorList.js' */                var g = AtomUI.cloneNode(this._gridTemplate);
/*Line 159 - 'AtomNavigatorList.js' */                this.addTemplate(this._gridPresenter, g);

/*Line 161 - 'AtomNavigatorList.js' */                var dt = this._detailTemplate;
/*Line 162 - 'AtomNavigatorList.js' */                if (!(AtomUI.attr(dt,"atom-dock"))) {
/*Line 163 - 'AtomNavigatorList.js' */                    AtomUI.attr(dt, "atom-dock", "Fill");
/*Line 164 - 'AtomNavigatorList.js' */                }

/*Line 166 - 'AtomNavigatorList.js' */                if (this._headerTemplate) {
/*Line 167 - 'AtomNavigatorList.js' */                    var hd = AtomUI.cloneNode(this._headerTemplate);
/*Line 168 - 'AtomNavigatorList.js' */                    hd.setAttribute("atom-dock", "Top");
/*Line 169 - 'AtomNavigatorList.js' */                    $(hd).addClass("atom-navigator-list-header");
/*Line 170 - 'AtomNavigatorList.js' */                    hd._templateParent = this;
/*Line 171 - 'AtomNavigatorList.js' */                    this.addTemplate(this._gridPanel, hd);
/*Line 172 - 'AtomNavigatorList.js' */                }

/*Line 174 - 'AtomNavigatorList.js' */                if (this._footerTemplate) {
/*Line 175 - 'AtomNavigatorList.js' */                    var fd = AtomUI.cloneNode(this._footerTemplate);
/*Line 176 - 'AtomNavigatorList.js' */                    fd.setAttribute("atom-dock", "Bottom");
/*Line 177 - 'AtomNavigatorList.js' */                    $(fd).addClass("atom-navigator-list-footer");
/*Line 178 - 'AtomNavigatorList.js' */                    this.addTemplate(this._gridPanel, fd);
/*Line 179 - 'AtomNavigatorList.js' */                }
/*Line 180 - 'AtomNavigatorList.js' */            }
1025439
def intern_atom(self, name, only_if_exists = 0):
        """"""
        r = request.InternAtom(display = self.display,
                               name = name,
                               only_if_exists = only_if_exists)
        return r.atom
1012204
function () {
/*Line 511 - 'AtomControl.js' */                if (this._viewModel === undefined) {
/*Line 512 - 'AtomControl.js' */                    // get parent..
/*Line 513 - 'AtomControl.js' */                    var ap = this.get_atomParent(this._element._logicalParent || this._element.parentNode);
/*Line 514 - 'AtomControl.js' */                    if (ap)
/*Line 515 - 'AtomControl.js' */                        return ap.get_viewModel();
/*Line 516 - 'AtomControl.js' */                }
/*Line 517 - 'AtomControl.js' */                return this._viewModel;
/*Line 518 - 'AtomControl.js' */            }
25791
@Override
    public void setAtoms(IAtom[] atoms) {
        this.atoms = atoms;
        for (IAtom atom : atoms) {
            atom.addListener(this);
        }
        this.atomCount = atoms.length;
        notifyChanged();
    }