/** * If scripts are initialized, then Platypua.ja system will work in full * manner. Otherwise it will not perform some actions, such as data binding. * * @return True if scripts are fully initialized, false otherwise. */ public static boolean isInitialized() { Space space = getSpace(); return space != null && space.copyObjectFunc != null && space.restoreObjectFunc != null; }
public Object executeScriptEvent(final JSObject aHandler, final PublishedSourcedEvent aEvent) { Object res = null; if (aHandler != null) { try { return Scripts.getSpace().toJava(aHandler.call(getPublished(), new Object[]{aEvent.getPublished()})); } catch (Exception ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, ex.getMessage(), ex); } } return res; }
public static void require(String[] aModulesNames, String aCalledFromFile, JSObject onSuccess, JSObject onFailure) throws Exception { Scripts.Space space = Scripts.getSpace(); _require(aModulesNames, aCalledFromFile, space, new HashSet<>(), (Void v) -> { if (onSuccess != null) { onSuccess.call(null, new Object[]{}); } }, (Exception ex) -> { if (onFailure != null) { onFailure.call(null, new Object[]{ex.getMessage()}); } }); }
@Override public void logout(JSObject aOnSuccess, JSObject aOnFailure) throws Exception { if (aOnSuccess != null) { // async style Scripts.getSpace().process(() -> { aOnSuccess.call(null, new Object[]{}); }); } // sync style } }
@ScriptFunction(jsDoc = "" + "/**\n" + " * Value of changed property.\n" + " */") public Object getValue() { return Scripts.getSpace().toJs(value); }
public static ImageIcon load(String aResourceName, String aCalledFromFile, JSObject onSuccess, JSObject onFailure) throws Exception { return load(aResourceName, aCalledFromFile, Scripts.getSpace(), onSuccess != null ? (ImageIcon aLoaded) -> { onSuccess.call(null, new Object[]{aLoaded}); } : null, onFailure != null ? (Exception ex) -> { onFailure.call(null, new Object[]{ex.getMessage()}); } : null); }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; } }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public final JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }
@Override public JSObject getPublished() { if (published == null) { JSObject publisher = Scripts.getSpace().getPublisher(this.getClass().getName()); if (publisher == null || !publisher.isFunction()) { throw new NoPublisherException(); } published = (JSObject) publisher.call(null, new Object[]{this}); } return published; }