/** * Returns a future which will deliver the default texture for this image once its loading has * completed. Uses {@link #texture} to create the texture. */ public RFuture<Texture> textureAsync () { return state.map(new Function<Image,Texture>() { public Texture apply (Image image) { return texture(); } }); }
/** * Returns a future which will deliver the default texture for this image once its loading has * completed. Uses {@link #texture} to create the texture. */ public RFuture<Texture> textureAsync () { return state.map(new Function<Image,Texture>() { public Texture apply (Image image) { return texture(); } }); }
@Override public RFuture<Tile> tileAsync () { return image.state.map(new Function<Image,Tile>() { public Tile apply (Image image) { return tile(); } }); }
@Override public RFuture<Tile> tileAsync () { return state.map(new Function<Image,Tile>() { public Tile apply (Image image) { return texture(); } }); }
@Override public RFuture<Tile> tileAsync () { return image.state.map(new Function<Image,Tile>() { public Tile apply (Image image) { return tile(); } }); }
@Override public RFuture<Tile> tileAsync () { return state.map(new Function<Image,Tile>() { public Tile apply (Image image) { return texture(); } }); }
/** Returns a future containing the results of {@code a} and {@code b} if both futures complete * successfully, or a {@link MultiFailureException} aggregating all failures, if either of the * futures fails. */ public static <A,B> RFuture<T2<A,B>> sequence (RFuture<A> a, RFuture<B> b) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; return sequence(Arrays.asList(oa, ob)).map(new Function<List<Object>,T2<A,B>>() { public T2<A,B> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); return new T2<A,B>(a, b); } }); }
/** Returns a future containing the results of {@code a} and {@code b} if both futures complete * successfully, or a {@link MultiFailureException} aggregating all failures, if either of the * futures fails. */ public static <A,B> RFuture<T2<A,B>> sequence (RFuture<A> a, RFuture<B> b) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; return sequence(Arrays.asList(oa, ob)).map(new Function<List<Object>,T2<A,B>>() { public T2<A,B> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); return new T2<A,B>(a, b); } }); }
/** Returns a future containing the results of {@code a}, {@code b}, and {@code c} if all * futures complete successfully, or a {@link MultiFailureException} aggregating all failures, * if any of the futures fails. */ public static <A,B,C> RFuture<T3<A,B,C>> sequence (RFuture<A> a, RFuture<B> b, RFuture<C> c) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; @SuppressWarnings("unchecked") RFuture<Object> oc = (RFuture<Object>)c; return sequence(Arrays.asList(oa, ob, oc)).map(new Function<List<Object>,T3<A,B,C>>() { public T3<A,B,C> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); @SuppressWarnings("unchecked") C c = (C)results.get(2); return new T3<A,B,C>(a, b, c); } }); }
/** Returns a future containing the results of {@code a}, {@code b}, and {@code c} if all * futures complete successfully, or a {@link MultiFailureException} aggregating all failures, * if any of the futures fails. */ public static <A,B,C> RFuture<T3<A,B,C>> sequence (RFuture<A> a, RFuture<B> b, RFuture<C> c) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; @SuppressWarnings("unchecked") RFuture<Object> oc = (RFuture<Object>)c; return sequence(Arrays.asList(oa, ob, oc)).map(new Function<List<Object>,T3<A,B,C>>() { public T3<A,B,C> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); @SuppressWarnings("unchecked") C c = (C)results.get(2); return new T3<A,B,C>(a, b, c); } }); }
/** * Performs an HTTP GET request to the specified URL. */ public RFuture<String> get(String url) { return req(url).execute().map(GET_PAYLOAD); }
/** * Performs an HTTP GET request to the specified URL. */ public RFuture<String> get(String url) { return req(url).execute().map(GET_PAYLOAD); }
@Override public RFuture<Icon> state () { return source.tileAsync().map(Functions.constant((Icon)this)); } };
@Override public RFuture<ByteBuffer> getBytes(final String path) { if (!TypedArrays.isSupported()) return RFuture.failure( new UnsupportedOperationException("TypedArrays not supported by this browser.")); return doXhr(pathPrefix + path, XMLHttpRequest.ResponseType.ArrayBuffer). map(new Function<XMLHttpRequest,ByteBuffer>() { public ByteBuffer apply (XMLHttpRequest xhr) { return TypedArrayHelper.wrap(xhr.getResponseArrayBuffer()); } }); }
@Override public RFuture<ByteBuffer> getBytes(final String path) { if (!TypedArrays.isSupported()) return RFuture.failure( new UnsupportedOperationException("TypedArrays not supported by this browser.")); return doXhr(pathPrefix + path, XMLHttpRequest.ResponseType.ArrayBuffer). map(new Function<XMLHttpRequest,ByteBuffer>() { public ByteBuffer apply (XMLHttpRequest xhr) { return TypedArrayHelper.wrap(xhr.getResponseArrayBuffer()); } }); }
map(new Function<XMLHttpRequest,String>() { public String apply (XMLHttpRequest xhr) { return xhr.getResponseText(); } catch (JavaScriptException e) { if (Window.Navigator.getUserAgent().indexOf("MSIE") != -1) { return doXdr(fullPath).map(new Function<XDomainRequest,String>() { public String apply (XDomainRequest xdr) { return xdr.getResponseText();
map(new Function<XMLHttpRequest,String>() { public String apply (XMLHttpRequest xhr) { return xhr.getResponseText(); } catch (JavaScriptException e) { if (Window.Navigator.getUserAgent().indexOf("MSIE") != -1) { return doXdr(fullPath).map(new Function<XDomainRequest,String>() { public String apply (XDomainRequest xdr) { return xdr.getResponseText();
/** * Performs an HTTP POST request to the specified URL. */ public RFuture<String> post(String url, String data) { return req(url).setPayload(data).execute().map(GET_PAYLOAD); }
/** * Performs an HTTP POST request to the specified URL. */ public RFuture<String> post(String url, String data) { return req(url).setPayload(data).execute().map(GET_PAYLOAD); }
@Override public RFuture<Response> sendSync (int version, Map<String,String> delta) { String payload = encodeRequest(new Request(version, delta)); return _net.post(syncURL(payload), payload).map(new Function<String,Response>() { public Response apply (String payload) { return decodeResponse(payload); } }); }