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

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

Introduction

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

Prototype

public final native int length() ;

Source Link

Document

Gets the length of the array.

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 {/*ww  w. ja  va  2  s  .  c o m*/
        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);//  ww w.  j  ava  2 s.  c  o m

    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);//from   w  w  w.  j av a 2  s . c  om
    }
    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();
    }/*  w  w w  . ja  v  a2s. c  o 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  www  . j  a v a2s  . co  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));/*  w w  w  . java 2 s.co m*/
        }
        return result;
    }
    return new ArrayList<String>();
}