List of usage examples for com.google.gwt.core.client JsArrayString length
public final native int length() ;
From source file:cc.alcina.framework.gwt.client.util.ClientUtils.java
License:Apache License
public static List<String> jsStringArrayAsStringList(JsArrayString arrayString) { List<String> result = new ArrayList<String>(); for (int i = 0; i < arrayString.length(); i++) { result.add(arrayString.get(i));// w w w. ja v a 2 s .c o m } return result; }
From source file:cc.kune.gadget.client.statecookie.CookieStateStore.java
License:GNU Affero Public License
@Inject public CookieStateStore(final Wave wave, final EventBus eventBus, @Named(COOKIE_NAME) final String cookieName) { this.wave = wave; this.cookieName = cookieName; factory = GWT.create(StateLocalFactory.class); restoreStateFromCookie();//w ww . j ava2 s .c o m eventBus.addHandler(StateUpdateEvent.TYPE, new StateUpdateEventHandler() { @Override public void onUpdate(final StateUpdateEvent event) { // Storing state in a cookie final AutoBean<StateLocal> stateLocal = factory.getStateLocal(); final Map<String, String> map = new HashMap<String, String>(); final State state = wave.getState(); final JsArrayString keys = state.getKeys(); for (int i = 0; i < keys.length(); i++) { final String key = keys.get(i); final String value = state.get(key); map.put(key, value); } stateLocal.as().setMap(map); // Saving the cookie Cookies.setCookie(cookieName, AutoBeanCodex.encode(stateLocal).getPayload()); } }); }
From source file:com.ait.toolkit.gmaps.client.controls.MapTypeControlOptions.java
License:Open Source License
/** * IDs of map types to show in the control. * //from w w w . jav a 2 s . c o m */ public final ArrayList<MapTypeId> getMapTypeIds() { ArrayList<MapTypeId> ids = new ArrayList<MapTypeId>(); JsArrayString values = _getMapTypeIds(); for (int index = 0; index < values.length(); index++) { ids.add(MapTypeId.fromValue(values.get(index))); } return ids; }
From source file:com.ait.toolkit.gmaps.client.services.DirectionsRoute.java
License:Open Source License
public String[] getWarnins() { JsArrayString values = _getWarnings(); String[] warnings = new String[values.length()]; for (int i = 0; i < values.length(); i++) { warnings[i] = values.get(i);//w w w .jav a 2 s. co m } return warnings; }
From source file:com.ait.toolkit.gmaps.client.services.DistanceMatrixResponse.java
License:Open Source License
/** * The formatted destination addresses./* w w w .j av a 2 s . c o m*/ * * @return */ public String[] getDestinationAdresses() { JsArrayString values = _getDestinationAdresses(); String[] destinationAdresses = new String[values.length()]; for (int i = 0; i < values.length(); i++) { destinationAdresses[i] = values.get(i); } return destinationAdresses; }
From source file:com.ait.toolkit.gmaps.client.services.DistanceMatrixResponse.java
License:Open Source License
/** * The formatted origin addresses./* w w w . j ava2 s .c om*/ * * @return */ public String[] getOriginAddresses() { JsArrayString values = _getOriginAddresses(); String[] originAdresses = new String[values.length()]; for (int i = 0; i < values.length(); i++) { originAdresses[i] = values.get(i); } return originAdresses; }
From source file:com.ait.toolkit.node.core.NodeJsBootstrap.java
License:Open Source License
@Override public final void onModuleLoad() { Process.get().nextTick(new ParameterlessEventHandler() { @Override/* w w w.j a v a 2 s .c o m*/ public void onEvent() { // grab the arguments JsArrayString nativeArgs = Process.get().argv(); // well, the best I can do right now is find the arguments // after the .js argument // TODO: be smarter than this int jsArgIndex; for (jsArgIndex = 0; jsArgIndex < nativeArgs.length(); jsArgIndex++) { if (nativeArgs.get(jsArgIndex).endsWith(".js")) { break; } } // make the final native string array String[] args; if (jsArgIndex == nativeArgs.length()) { Util.get().log("Unable to find argument ending with .js"); args = new String[0]; } else { args = new String[nativeArgs.length() - jsArgIndex - 1]; for (int i = 0; i < args.length; i++) { args[i] = nativeArgs.get(jsArgIndex + i + 1); } } // call the main method Runner runner = GWT.create(Runner.class); runner.run(NodeJsBootstrap.this, new Closure<Integer>() { @Override public void call(Integer result) { if (result != null) { Process.get().exit(result); } } }, args); } }); }
From source file:com.akjava.gwt.api.hangout.client.js.StateMetadataMap.java
License:Apache License
public final Map<String, StateMetadata> getAsMap() { JsArrayString keys = keys(); Map<String, StateMetadata> map = new HashMap<String, StateMetadata>(); for (int i = 0; i < keys.length(); i++) { String key = keys.get(i); map.put(key, get(key));/*ww w . j a v a 2s. c o m*/ } return map; }
From source file:com.akjava.gwt.api.hangout.client.js.StringMap.java
License:Apache License
public final Map<String, String> getAsMap() { JsArrayString keys = keys(); Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < keys.length(); i++) { String key = keys.get(i); map.put(key, get(key));/*from ww w . j ava 2s . co m*/ } return map; }
From source file:com.akjava.gwt.volumegraph.client.VolumeGraph.java
License:Apache License
private void addVolumesChangedListener() { colors.add(alphaColor(200, 255, 0, 0.7)); colors.add(alphaColor(0, 200, 255, 0.7)); colors.add(alphaColor(200, 0, 255, 0.7)); colors.add(alphaColor(255, 200, 200, 0.7)); colors.add(alphaColor(255, 200, 200, 0.7)); colors.add(alphaColor(200, 255, 200, 0.7)); colors.add(alphaColor(0, 0, 255, 0.7)); colors.add(alphaColor(0, 255, 0, 0.7)); colors.add(alphaColor(255, 0, 0, 0.7)); colors.add(alphaColor(255, 255, 0, 0.7)); colors.add(alphaColor(255, 0, 255, 0.7)); colors.add(alphaColor(0, 255, 255, 0.7)); colors.add(alphaColor(255, 200, 0, 0.7)); colors.add(alphaColor(255, 0, 200, 0.7)); colors.add(alphaColor(0, 255, 200, 0.7)); final ColorPainter painter = new ColorPainter(canvas, 80); volumeChangeListener = new VolumesChangedListener() { @Override/*from w w w. j a v a2s . com*/ public void volumeChanged(NumberMap volumeMap) { painter.clear(); //dummys for (int i = 0; i < dummyParticipant; i++) { volumeMap.put("dummy" + i, (int) (Math.random() * 5)); } JsArrayString keys = volumeMap.keys(); for (int i = 0; i < keys.length(); i++) { String key = keys.get(i); int num = (int) volumeMap.get(keys.get(i)); painter.update(num, getColor(key)); } painter.increment(); } }; Av.addVolumesChangedListener(volumeChangeListener); }