public static void main(String[] args) { startMillisecond = System.currentTimeMillis(); ctx = BrwsrCtx.findDefault(BenchmarkStarter.class); makeStep(); }
static void makeStep() { ctx.execute(() -> makeStep0()); }
@Override protected BrwsrCtx newContext(CtxImpl impl) { return new BrwsrCtx(impl); }
private FakeModel() { this(net.java.html.BrwsrCtx.findDefault(FakeModel.class)); }
/** Invokes the provided runnable in the {@link #getContext() context} * of the browser. If the caller is already on the right thread, the * <code>run.run()</code> is invoked immediately and synchronously. * Otherwise the method returns immediately and the <code>run()</code> * method is performed later * * @param run the action to execute */ public void runInBrowser(Runnable run) { context.execute(run); }
@Override public void run() { ctx = BrwsrCtx.findDefault(InitializeWebView.class); if (myLoad != null) { myLoad.run(); } }
private void dispatch(final RcvrJSON.MsgEvnt ev) { ctx.execute(new Runnable() { @Override public void run() { ev.dispatch(whenDone); } }); }
@OnReceive(url="{url}") static void fetchPlain(JSONik model, String p) { onCallback = BrwsrCtx.findDefault(model.getClass()); model.setFetchedResponse(p); }
public final void runInContext(Runnable r) { ctx.execute(r); }
@OnReceive(url="{url}") static void fetch(JSONik model, Person p) { model.setFetched(p); onCallback = BrwsrCtx.findDefault(model.getClass()); }
/** Whenever model changes a property. It should notify the * associated technology by calling this method. * Since 0.8.3: This method may be called by any thread - it reschedules * its actual execution into appropriate one by using * {@link BrwsrCtx#execute(java.lang.Runnable)}. * * @param propName name of the changed property */ public void valueHasMutated(final String propName) { context.execute(new Runnable() { @Override public void run() { if (ko != null) { ko.valueHasMutated(propName, null, null); } Observers.valueHasMutated(Proto.this, propName); } }); }
@Function static void assignFirstName(Pair m, String data) { ctx = BrwsrCtx.findDefault(Pair.class); m.setFirstName(data); } }
/** Invokes the specified function index in the {@link #getContext() context} * of the browser. If the caller is already on the right thread, the * index-th function is invoked immediately and synchronously. * Otherwise the method returns immediately and the function is invoked * later. * * @param index the index of the function as will be passed to * {@link Type#call(java.lang.Object, int, java.lang.Object, java.lang.Object)} * method * @param args array of arguments that will be passed as * <code>data</code> argument of the <code>call</code> method. * @since 0.7.6 */ public void runInBrowser(final int index, final Object... args) { context.execute(new Runnable() { @Override public void run() { try { type.call(obj, index, args, null); } catch (Exception ex) { ex.printStackTrace(); } } }); }
@OnReceive(url="{url}", onError = "setMessage") static void fetchArray(JSONik model, Person[] p) { model.setFetchedCount(p.length); model.setFetched(p[0]); onCallback = BrwsrCtx.findDefault(model.getClass()); }
/** Whenever model changes a property it should notify the * associated technology. Either by calling this method * (if the new value is known and different to the old one) or * via (slightly ineffective) {@link #valueHasMutated(java.lang.String)} * method. * Since 0.8.3: This method may be called by any thread - it reschedules * its actual execution into appropriate one by using * {@link BrwsrCtx#execute(java.lang.Runnable)}. * * @param propName name of the changed property * @param oldValue provides previous value of the property * @param newValue provides new value of the property * @since 0.7.6 */ public void valueHasMutated( final String propName, final Object oldValue, final Object newValue ) { context.execute(new Runnable() { @Override public void run() { if (ko != null) { ko.valueHasMutated(propName, oldValue, newValue); } Observers.valueHasMutated(Proto.this, propName); } }); }
BrwsrCtx brwsrCtx = BrwsrCtx.findDefault(AudioClip.class); AudioEnvironment brwsrAE = Contexts.find(brwsrCtx, AudioEnvironment.class); if (brwsrAE != null) {
private void notifyChange() { proto.getContext().execute(new Runnable() { @Override public void run() { proto.valueHasMutated(name); Bindings m = PropertyBindingAccessor.getBindings(proto, false, null); if (m != null) { for (String dependant : deps) { m.valueHasMutated(dependant, null, null); } if (index >= 0) { PropertyBindingAccessor.notifyProtoChange(proto, index); } } } }); }
@Override public void call(final Object data, final Object ev) { final M model = model(); if (model == null) { return; } BrwsrCtx ctx = access.protoFor(model).getContext(); class Dispatch implements Runnable { @Override public void run() { try { access.call(model, index, data, ev); } catch (Throwable ex) { ex.printStackTrace(); } } } ctx.execute(new Dispatch()); } }