/** * @param app * the script's application * @param scriptText * the script's source code */ public GgbScript(App app, String scriptText) { super(app, scriptText); this.proc = app.getKernel().getAlgebraProcessor(); }
private void initKernelVars() { this.kernel = origKernel; this.parser = origParser; this.cons = origKernel.getConstruction(); }
public void previousStep() { if (isViewAttached) { kernel.detach(data); } kernel.previousStep(); if (isViewAttached) { kernel.attach(data); } updateNavBarsAndRepaint(); }
/** * Attach this view to kernel and add all objects created so far */ public void attachView() { view.kernel.notifyAddAll(view); view.kernel.attach(view); }
/** * Creates new command dispatcher * * @param kernel2 * Kernel of current application */ public CommandDispatcher(Kernel kernel2) { this.kernel = kernel2; cons = kernel2.getConstruction(); app = kernel2.getApplication(); }
boolean isSaving = kernel.isSaving(); kernel.setSaving(true); writeConstructionImages(kernel.getConstruction(), zip); if (kernel.hasMacros()) { ArrayList<Macro> macros = kernel.getAllMacros(); osw.write(kernel.getLibraryJavaScript()); osw.flush(); zip.closeEntry(); throw e; } finally { kernel.setSaving(isSaving);
boolean isGGTOrDefaults, boolean mayZoom, boolean settingsBatch, boolean randomize) throws Exception { boolean oldVal = kernel.isNotifyViewsActive(); boolean oldVal2 = kernel.isUsingInternalCommandNames(); kernel.setUseInternalCommandNames(true); kernel.setNotifyViewsActive(false); kernel.clearConstruction(false); kernel.setLoadingMode(true); if (settingsBatch && !isGGTOrDefaults) { try { kernel.setLoadingMode(false); } catch (CommandNotLoadedError e) { throw e; kernel.setUseInternalCommandNames(oldVal2); if (!isGGTOrDefaults && mayZoom) { kernel.updateConstruction(randomize, 1); kernel.setNotifyViewsActive(oldVal); } else { app.getKernel().getConstruction() .setStep(handler.getConsStep());
/** * Creates new command processor * * @param kernel * kernel */ public CommandProcessor(Kernel kernel) { this.kernel = kernel; cons = kernel.getConstruction(); app = kernel.getApplication(); loc = app.getLocalization(); algProcessor = kernel.getAlgebraProcessor(); }
@Override public GeoElement evaluate(StringTemplate tpl) { boolean oldFlag = kernel.getConstruction().isSuppressLabelsActive(); kernel.getConstruction().setSuppressLabelCreation(true); GeoElement ge = kernel.getAlgebraProcessor().processEquation(this, this.wrap(), new EvalInfo(false))[0]; kernel.getConstruction().setSuppressLabelCreation(oldFlag); return ge; }
if (kernel.isSaving()) { return; kernel.notifyBatchUpdate(); kernel.notifyRepaint(); if (kernel.getApplication().getEuclidianView1() != null) { compTime += kernel.getApplication().getEuclidianView1() .getLastRepaintTime(); if (kernel.getApplication().hasEuclidianView2(1)) { compTime += kernel.getApplication().getEuclidianView2(1) .getLastRepaintTime(); kernel.notifyRemoveGroup(); kernel.notifyEndBatchUpdate();
/** * @return XML for or macros and/or Exercise or empty string if there are * none */ public String getMacroXMLorEmpty() { if (!kernel.hasMacros() && kernel.getExercise().isEmpty()) { return ""; } ArrayList<Macro> macros = kernel.getAllMacros(); return getXMLio().getFullMacroXML(macros); }
/** * Resets the Exercise and adds all user defined tools to the Exercise. */ public void initStandardExercise() { reset(); GeoElement correct = app.getKernel().lookupLabel("correct"); if (correct instanceof GeoBoolean) { addAssignment((GeoBoolean) correct); } else if (app.getKernel().hasMacros()) { ArrayList<Macro> macros = app.getKernel().getAllMacros(); for (Macro macro : macros) { addAssignment(macro); } } }
public void setConstructionStep(int step) { if (isViewAttached) { kernel.detach(data); } kernel.setConstructionStep(step); if (isViewAttached) { kernel.attach(data); } updateNavBarsAndRepaint(); }
@Override public TableValues getTableValuesView() { if (tableValues == null) { tableValues = createTableValuesView(); kernel.attach(tableValues); TableValuesModel model = tableValues.getTableValuesModel(); tableValuesPoints = new TableValuesPointsImpl(kernel.getConstruction(), model); model.registerListener(tableValuesPoints); } return tableValues; }
@Override public synchronized void setListValue(String objName, double x, double y) { GeoElement geo = kernel.lookupLabel(objName); if (geo == null || !geo.isGeoList() || !geo.isIndependent()) { return; } Construction cons = kernel.getConstruction(); CmdSetValue.setValue3(kernel, (GeoList) geo, (int) x, new GeoNumeric(cons, y)); }
public void setInspectorVisible(boolean isVisible) { if (isVisible) { Log.debug("setInspectorVisible(true)"); app.getKernel().attach(this); } else { Log.debug("setInspectorVisible(false)"); app.getKernel().detach(this); app.getSelectionManager().removeSelectionListener(sl); getModel().clearGeoList(); } }
/** * Detach this view from kernel */ public void detachView() { kernel.detach(this); clearView(); }