List of usage examples for com.google.gwt.core.client JavaScriptObject createArray
public static native JavaScriptObject createArray() ;
From source file:com.google.mobile.trippy.web.client.db.JsoTripItem.java
License:Apache License
public final void setPhoneNumbers(ArrayList<String> phoneNumbers) { JsArrayString jarr = (JsArrayString) JavaScriptObject.createArray(); for (String ph : phoneNumbers) { jarr.push(ph);/*from w ww . j a v a 2s .c o m*/ } setPhoneNumbers_(jarr); }
From source file:com.google.mobile.trippy.web.client.db.LocalDbManager.java
License:Apache License
public void deleteTrip(final Trip trip) { final String tripKey = KEY_LOCAL_STORE_TRIP_PREFIX + trip.getKey(); LocalDbService.deletePersistent(tripKey); final JsArrayString tripKeys = getIndexKeys(KEY_LOCAL_STORE_TRIPS); final JsArrayString newTripKeys = (JsArrayString) JavaScriptObject.createArray(); for (int i = 0; i < tripKeys.length(); ++i) { if (!tripKeys.get(i).equals(tripKey)) { newTripKeys.push(tripKeys.get(i)); }/*from w w w . j a v a 2s . c o m*/ } setIndexKeys(KEY_LOCAL_STORE_TRIPS, newTripKeys); eventBus.fireEvent(new TripDeletedEvent(trip)); }
From source file:com.google.mobile.trippy.web.client.db.LocalDbManager.java
License:Apache License
public void deleteTripItem(final String tripId, final String tripItemId) { final TripItem tripItem = getTripItem(tripItemId); final String tripItemKey = KEY_LOCAL_STORE_TI_PREFIX + tripItemId; LocalDbService.deletePersistent(tripItemKey); final JsArrayString tripItemKeys = getIndexKeys(KEY_LOCAL_STORE_TIS_PREFIX + tripId); final JsArrayString newTripItemKeys = (JsArrayString) JavaScriptObject.createArray(); for (int i = 0; i < tripItemKeys.length(); ++i) { if (!tripItemKeys.get(i).equals(tripItemKey)) { newTripItemKeys.push(tripItemKeys.get(i)); }/* w ww . j a v a 2s . com*/ } setIndexKeys(KEY_LOCAL_STORE_TIS_PREFIX + tripId, newTripItemKeys); eventBus.fireEvent(new TripItemDeletedEvent(tripItem)); utils.remTripItem(tripItemId); }
From source file:com.google.mobile.trippy.web.client.db.LocalDbManager.java
License:Apache License
public void deleteComment(final String tripId, final String tripItemId, final String commentId) { final Comment comment = getComment(commentId); final String commentKey = KEY_LOCAL_STORE_COMMENT_PREFIX + commentId; LocalDbService.deletePersistent(commentKey); final JsArrayString commentKeys = getIndexKeys(KEY_LOCAL_STORE_COMMENTS_PREFIX + tripId + "_" + tripItemId); final JsArrayString newCommentKeys = (JsArrayString) JavaScriptObject.createArray(); for (int i = 0; i < commentKeys.length(); ++i) { if (!commentKeys.get(i).equals(commentKey)) { newCommentKeys.push(commentKeys.get(i)); }/*from w ww .j a v a 2s. co m*/ } setIndexKeys(KEY_LOCAL_STORE_COMMENTS_PREFIX + tripId + "_" + tripItemId, newCommentKeys); eventBus.fireEvent(new CommentDeletedEvent(comment)); }
From source file:com.google.mobile.trippy.web.client.db.LocalDbManager.java
License:Apache License
/** * Get trip key array from the given index. *//*from w w w . j av a 2 s. co m*/ JsArrayString getIndexKeys(final String indexName) { String jsonString = LocalDbService.getPersistent(indexName); if (jsonString == null) { return (JsArrayString) JavaScriptObject.createArray(); } return (JsArrayString) JSONParser.parse(jsonString).isArray().getJavaScriptObject(); }
From source file:com.google.speedtracer.headlessextension.client.WhitelistTable.java
License:Apache License
/** * Retrieves all entries./*from w w w . j av a 2s.com*/ */ public JsArray<WhitelistEntry> getEntries() { JsArray<WhitelistEntry> results = JavaScriptObject.createArray().cast(); for (WhitelistEntry entry : rows) { results.push(entry); } return results; }
From source file:com.googlecode.gflot.client.jsni.JsArrayUtils.java
License:Apache License
/** * Take a Java array, and produce a JS array that is only used for reading. As * this is actually a reference to the original array in prod mode, the source * must not be modified while this copy is in use or you will get different * behavior between DevMode and prod mode. * * @param array source array/*from w w w . j ava 2 s. c o m*/ * @return JS array, which may be a copy or an alias of the input array */ public static <T extends JavaScriptObject> JsArray<T> readOnlyJsArray(T[] array) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(array).cast(); } JsArray<T> dest = JavaScriptObject.createArray().cast(); for (int i = 0; i < array.length; ++i) { dest.push(array[i]); } return dest; }
From source file:com.googlecode.gflot.client.options.AbstractAxisOptions.java
License:Open Source License
/** * Sets the property of ZoomRange, the interval which zooming can happen, receives as parameters the min and max * values/* ww w . j a va2 s . co m*/ */ public final T setZoomRange(double min, double max) { JsArrayNumber array = JavaScriptObject.createArray().cast(); array.push(min); array.push(max); return setZoomRange(array); }
From source file:com.googlecode.gflot.client.options.AbstractAxisOptions.java
License:Open Source License
/** * Sets the property PanRange, confines the panning to stay within a range, receives as parameters the min and max * values//from w ww .j a va 2 s . co m */ public final T setPanRange(double min, double max) { JsArrayNumber array = JavaScriptObject.createArray().cast(); array.push(min); array.push(max); return setPanRange(array); }
From source file:com.googlecode.gflot.client.options.AxesOptions.java
License:Open Source License
/** * Creates a {@link AxesOptions} */ public static final AxesOptions create() { return JavaScriptObject.createArray().cast(); }