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:org.turbogwt.core.collections.JsArrays.java

License:Apache License

public static String[] toArray(JsArrayString values) {
    if (GWT.isScript()) {
        return reinterpretCast(values);
    } else {//from w w  w  . j  ava  2  s.com
        int length = values.length();
        String[] ret = new String[length];
        for (int i = 0, l = length; i < l; i++) {
            ret[i] = values.get(i);
        }
        return ret;
    }
}

From source file:org.turbogwt.core.collections.LightMap.java

License:Apache License

@Override
public boolean containsValue(Object o) {
    checkNotNull(o);//from  w ww  .  j ava  2s  .  c om

    JsArrayString keys = innerMap.keys();
    for (int i = 0; i < keys.length(); i++) {
        String key = keys.get(i);
        T t = innerMap.get(key);
        if (o.equals(t))
            return true;
    }
    return false;
}

From source file:org.turbogwt.core.util.Util.java

License:Apache License

static String[] toArray(JsArrayString values) {
    int length = values.length();
    String[] ret = new String[length];
    for (int i = 0; i < length; i++) {
        ret[i] = values.get(i);
    }/*  w w  w . j a v a 2  s  .  c  o m*/
    return ret;
}

From source file:org.uberfire.client.splash.JSNativeSplashScreen.java

License:Apache License

private Collection<String> toCollection(final JsArrayString interceptionPoints) {
    if (interceptionPoints == null || interceptionPoints.length() == 0) {
        return emptyList();
    }//from   w  ww  .j ava 2s. co  m

    final Collection<String> result = new ArrayList<String>();
    for (int i = 0; i < interceptionPoints.length(); i++) {
        result.add(interceptionPoints.get(i));
    }

    return result;
}

From source file:org.waveprotocol.box.common.comms.jso.DocumentSnapshotJsoImpl.java

License:Apache License

@Override
@SuppressWarnings("unchecked")
public String getContributor(int n) {
    initArray(this, keyContributor);
    JsArrayString array = getPropertyAsObject(this, keyContributor).cast();
    if (n < 0)
        throw new IllegalArgumentException("index " + n + " < 0");
    if (array.length() <= n)
        throw new IllegalArgumentException("index " + n + ">= array length " + array.length());
    return array.get(n);
}

From source file:org.waveprotocol.box.common.comms.jso.ProtocolOpenRequestJsoImpl.java

License:Apache License

@Override
@SuppressWarnings("unchecked")
public String getWaveletIdPrefix(int n) {
    initArray(this, keyWaveletIdPrefix);
    JsArrayString array = getPropertyAsObject(this, keyWaveletIdPrefix).cast();
    if (n < 0)
        throw new IllegalArgumentException("index " + n + " < 0");
    if (array.length() <= n)
        throw new IllegalArgumentException("index " + n + ">= array length " + array.length());
    return array.get(n);
}

From source file:org.waveprotocol.box.common.comms.jso.WaveletSnapshotJsoImpl.java

License:Apache License

@Override
@SuppressWarnings("unchecked")
public String getParticipantId(int n) {
    initArray(this, keyParticipantId);
    JsArrayString array = getPropertyAsObject(this, keyParticipantId).cast();
    if (n < 0)
        throw new IllegalArgumentException("index " + n + " < 0");
    if (array.length() <= n)
        throw new IllegalArgumentException("index " + n + ">= array length " + array.length());
    return array.get(n);
}

From source file:org.waveprotocol.box.profile.jso.ProfileRequestJsoImpl.java

License:Apache License

@Override
@SuppressWarnings("unchecked")
public String getAddresses(int n) {
    initArray(this, keyAddresses);
    JsArrayString array = getPropertyAsObject(this, keyAddresses).cast();
    if (n < 0)
        throw new IllegalArgumentException("index " + n + " < 0");
    if (array.length() <= n)
        throw new IllegalArgumentException("index " + n + ">= array length " + array.length());
    return array.get(n);
}

From source file:org.waveprotocol.box.webclient.stat.gwtevent.GwtStatisticsEvent.java

License:Apache License

public final StatisticsEvent asEvent() {
    return new StatisticsEvent() {
        //@Override
        public String getModuleName() {
            return GwtStatisticsEvent.this.getModuleName();
        }//from w w  w.  jav a 2 s.  c o m

        //@Override
        public String getSubSystem() {
            return GwtStatisticsEvent.this.getSubSystem();
        }

        //@Override
        public String getEventGroupKey() {
            return GwtStatisticsEvent.this.getEventGroupKey();
        }

        //@Override
        public double getMillis() {
            return GwtStatisticsEvent.this.getMillis();
        }

        //@Override
        public Iterator<String> getExtraParameterNames() {
            final JsArrayString names = getExtraParameterNames0();
            return new Iterator<String>() {
                private int idx = 0;

                //@Override
                public boolean hasNext() {
                    return idx < names.length();
                }

                //@Override
                public String next() {
                    return names.get(idx++);
                }

                //@Override
                public void remove() {
                    throw new RuntimeException("parameter names are read-only");
                }
            };
        }

        //@Override
        public Object getExtraParameter(String name) {
            return GwtStatisticsEvent.this.getExtraParameter(name);
        }
    };
}

From source file:org.waveprotocol.wave.client.common.util.JsRegExp.java

License:Apache License

@Override
public List<String> getMatches(String test) {
    JsArrayString matches = matches(regExp, test);
    if (matches != null && matches.length() > 0) {
        List<String> result = new ArrayList<String>(matches.length());
        for (int i = 0; i < matches.length(); ++i) {
            result.add(matches.get(i));
        }/*from  ww  w .ja v a2  s.com*/
        return result;
    }
    return new ArrayList<String>();
}