File size: 8,282 Bytes
233f6d4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | Clazz.declarePackage ("JSV.popup");
Clazz.load (["JSV.api.JSVPopupMenu", "J.popup.GenericSwingPopup"], "JSV.popup.JSVGenericPopup", ["JU.PT", "JSV.common.JSVersion", "JSV.popup.JSVPopupResourceBundle"], function () {
c$ = Clazz.decorateAsClass (function () {
this.vwr = null;
this.updateMode = 0;
this.cnmrPeaks = null;
this.hnmrPeaks = null;
this.aboutComputedMenuBaseCount = 0;
this.allowMenu = false;
this.zoomEnabled = false;
this.pd = null;
this.thisJsvp = null;
Clazz.instantialize (this, arguments);
}, JSV.popup, "JSVGenericPopup", J.popup.GenericSwingPopup, JSV.api.JSVPopupMenu);
Clazz.makeConstructor (c$,
function () {
Clazz.superConstructor (this, JSV.popup.JSVGenericPopup, []);
});
Clazz.defineMethod (c$, "initialize",
function (viewer, bundle, title) {
this.vwr = viewer;
this.initSwing (title, bundle, viewer.getApplet (), viewer.isJS, viewer.isSigned, false);
}, "JSV.common.JSViewer,J.popup.PopupResource,~S");
Clazz.overrideMethod (c$, "jpiDispose",
function () {
this.helper.menuClearListeners (this.popupMenu);
this.popupMenu = this.thisPopup = null;
});
Clazz.overrideMethod (c$, "jpiGetMenuAsObject",
function () {
return this.popupMenu;
});
Clazz.overrideMethod (c$, "jpiShow",
function (x, y) {
this.show (x, y, false);
this.appRestorePopupMenu ();
this.menuShowPopup (this.popupMenu, this.thisx, this.thisy);
}, "~N,~N");
Clazz.overrideMethod (c$, "jpiUpdateComputedMenus",
function () {
if (this.updateMode == -1) return;
this.updateMode = 0;
this.getViewerData ();
this.updateFileMenu ();
this.updateFileTypeDependentMenus ();
this.updateMode = 1;
this.updateAboutSubmenu ();
});
Clazz.overrideMethod (c$, "appCheckItem",
function (item, newMenu) {
}, "~S,javajs.awt.SC");
Clazz.overrideMethod (c$, "appCheckSpecialMenu",
function (item, subMenu, word) {
}, "~S,javajs.awt.SC,~S");
Clazz.overrideMethod (c$, "appFixLabel",
function (label) {
if (label.startsWith ("_")) label = label.substring (label.indexOf ("_", 2) + 1);
else if (label.equals ("VERSION")) label = JSV.common.JSVersion.VERSION;
label = JU.PT.rep (label, "JAVA", "");
label = JU.PT.rep (label, "CB", "");
label = JU.PT.rep (label, "Menu", "");
label = JU.PT.rep (label, "_", " ");
return label;
}, "~S");
Clazz.overrideMethod (c$, "appFixScript",
function (id, script) {
return script;
}, "~S,~S");
Clazz.overrideMethod (c$, "appGetMenuAsString",
function (title) {
return ( new JSV.popup.JSVPopupResourceBundle ()).getMenuAsText (title);
}, "~S");
Clazz.overrideMethod (c$, "appGetBooleanProperty",
function (name) {
return false;
}, "~S");
Clazz.overrideMethod (c$, "appIsSpecialCheckBox",
function (item, basename, what, TF) {
return false;
}, "javajs.awt.SC,~S,~S,~B");
Clazz.overrideMethod (c$, "appRestorePopupMenu",
function () {
this.thisPopup = this.popupMenu;
});
Clazz.overrideMethod (c$, "appRunScript",
function (script) {
this.vwr.runScript (script);
}, "~S");
Clazz.overrideMethod (c$, "appUpdateForShow",
function () {
this.thisJsvp = this.vwr.selectedPanel;
this.setEnables (this.thisJsvp);
if (this.updateMode == -1) return;
this.getViewerData ();
this.updateMode = 2;
this.updateSpectraMenu ();
this.updateAboutSubmenu ();
});
Clazz.overrideMethod (c$, "appUpdateSpecialCheckBoxValue",
function (item, what, TF) {
}, "javajs.awt.SC,~S,~B");
Clazz.defineMethod (c$, "getViewerData",
function () {
});
Clazz.defineMethod (c$, "updateFileTypeDependentMenus",
function () {
});
Clazz.defineMethod (c$, "updateFileMenu",
function () {
var menu = this.htMenus.get ("fileMenu");
if (menu == null) return;
});
Clazz.defineMethod (c$, "updateSpectraMenu",
function () {
var menuh = this.htMenus.get ("hnmrMenu");
var menuc = this.htMenus.get ("cnmrMenu");
if (menuh != null) this.menuRemoveAll (menuh, 0);
if (menuc != null) this.menuRemoveAll (menuc, 0);
var menu = this.htMenus.get ("spectraMenu");
if (menu == null) return;
this.menuRemoveAll (menu, 0);
var isOK = new Boolean (this.setSpectraMenu (menuh, this.hnmrPeaks) | this.setSpectraMenu (menuc, this.cnmrPeaks)).valueOf ();
if (isOK) {
if (menuh != null) this.menuAddSubMenu (menu, menuh);
if (menuc != null) this.menuAddSubMenu (menu, menuc);
}this.menuEnable (menu, isOK);
});
Clazz.defineMethod (c$, "setSpectraMenu",
function (menu, peaks) {
if (menu == null) return false;
this.menuEnable (menu, false);
var n = (peaks == null ? 0 : peaks.size ());
if (n == 0) return false;
for (var i = 0; i < n; i++) {
var peak = peaks.get (i);
var title = JU.PT.getQuotedAttribute (peak, "title");
var atoms = JU.PT.getQuotedAttribute (peak, "atoms");
if (atoms != null) this.menuCreateItem (menu, title, "select visible & (@" + JU.PT.rep (atoms, ",", " or @") + ")", "Focus" + i);
}
this.menuEnable (menu, true);
return true;
}, "javajs.awt.SC,JU.Lst");
Clazz.defineMethod (c$, "updateAboutSubmenu",
function () {
var menu = this.htMenus.get ("aboutComputedMenu");
if (menu == null) return;
this.menuRemoveAll (menu, this.aboutComputedMenuBaseCount);
});
Clazz.overrideMethod (c$, "getSelected",
function (key) {
return false;
}, "~S");
Clazz.overrideMethod (c$, "setCompoundMenu",
function (panelNodes, allowCompoundMenu) {
}, "JU.Lst,~B");
Clazz.overrideMethod (c$, "setEnabled",
function (allowMenu, zoomEnabled) {
this.allowMenu = allowMenu;
this.zoomEnabled = zoomEnabled;
this.enableMenus ();
}, "~B,~B");
Clazz.defineMethod (c$, "enableMenus",
function () {
this.setItemEnabled ("_SIGNED_FileMenu", this.allowMenu);
this.setItemEnabled ("ViewMenu", this.pd != null && this.allowMenu);
this.setItemEnabled ("Open_File...", this.allowMenu);
this.setItemEnabled ("Open_Simulation...", this.allowMenu);
this.setItemEnabled ("Open_URL...", this.allowMenu);
this.setItemEnabled ("Save_AsMenu", this.pd != null && this.allowMenu);
this.setItemEnabled ("Export_AsMenu", this.pd != null && this.allowMenu);
this.setItemEnabled ("Append_File...", this.pd != null && this.allowMenu);
this.setItemEnabled ("Append_Simulation...", this.pd != null && this.allowMenu);
this.setItemEnabled ("Append_URL...", this.pd != null && this.allowMenu);
this.setItemEnabled ("Views...", this.pd != null && this.allowMenu);
this.setItemEnabled ("Script", this.allowMenu);
this.setItemEnabled ("Print...", this.pd != null && this.allowMenu);
this.setItemEnabled ("ZoomMenu", this.pd != null && this.zoomEnabled);
});
Clazz.defineMethod (c$, "setEnables",
function (jsvp) {
this.pd = (jsvp == null ? null : jsvp.getPanelData ());
var spec0 = (this.pd == null ? null : this.pd.getSpectrum ());
var isOverlaid = this.pd != null && this.pd.isShowAllStacked ();
var isSingle = this.pd != null && this.pd.haveSelectedSpectrum ();
this.setItemEnabled ("Integration", this.pd != null && this.pd.getSpectrum ().canIntegrate ());
this.setItemEnabled ("Measurements", true);
this.setItemEnabled ("Peaks", this.pd != null && this.pd.getSpectrum ().is1D ());
this.setItemEnabled ("Predicted_Solution_Colour_(fitted)", isSingle && spec0.canShowSolutionColor ());
this.setItemEnabled ("Predicted_Solution_Colour_(interpolated)", isSingle && spec0.canShowSolutionColor ());
this.setItemEnabled ("Toggle_Trans/Abs", isSingle && spec0.canConvertTransAbs ());
this.setItemEnabled ("Show_Overlay_Key", isOverlaid && this.pd.getNumberOfGraphSets () == 1);
this.setItemEnabled ("Overlay_Offset...", isOverlaid);
this.setItemEnabled ("JDXMenu", this.pd != null && spec0.canSaveAsJDX ());
this.setItemEnabled ("Export_AsMenu", this.pd != null);
this.enableMenus ();
}, "JSV.api.JSVPanel");
Clazz.defineMethod (c$, "setItemEnabled",
function (key, TF) {
this.menuEnable (this.htMenus.get (key), TF);
}, "~S,~B");
Clazz.overrideMethod (c$, "setSelected",
function (key, TF) {
var item = this.htMenus.get (key);
if (item == null || item.isSelected () == TF) return;
this.menuEnable (item, false);
item.setSelected (TF);
this.menuEnable (item, true);
}, "~S,~B");
Clazz.overrideMethod (c$, "menuSetCheckBoxOption",
function (item, name, what) {
return null;
}, "javajs.awt.SC,~S,~S");
Clazz.defineStatics (c$,
"dumpList", false,
"UPDATE_NEVER", -1,
"UPDATE_ALL", 0,
"UPDATE_CONFIG", 1,
"UPDATE_SHOW", 2);
});
|