Example usage for com.google.gwt.core.client JsArrayString get

List of usage examples for com.google.gwt.core.client JsArrayString get

Introduction

In this page you can find the example usage for com.google.gwt.core.client JsArrayString get.

Prototype

public final native String get(int index) ;

Source Link

Document

Gets the value at a given index.

Usage

From source file:at.ac.fhcampuswien.atom.client.gui.attributes.components.RichTextToolbar.java

License:Open Source License

/** Method called to toggle the style in HTML-Mode **/
private void changeHtmlStyle(String startTag, String stopTag) {
    JsArrayString tx = getSelection(styleText.getElement());
    String txbuffer = styleText.getText();
    Integer startpos = Integer.parseInt(tx.get(1));
    String selectedText = tx.get(0);
    styleText.setText(txbuffer.substring(0, startpos) + startTag + selectedText + stopTag
            + txbuffer.substring(startpos + selectedText.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));
    }/*from www .j av a2  s  . c  om*/
    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();//from  www. ja  v  a2s  .c  om
    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   ww w  .j  av  a2s. 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);
    }/*from  www .  ja va2 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  a  v  a 2s . 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.//from  w w w .j av  a2 s .co m
 * 
 * @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//ww w.  ja  va2  s .  com
        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));//w  w  w .  j  av  a  2s  . c om
    }
    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));/*  ww  w  . j a  v a  2  s .  co  m*/
    }
    return map;
}