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.sigmah.offline.indexeddb.Database.java

License:Open Source License

/**
 * Retrieves every object store in this database.
 * /* w w w . ja  v a 2s .c  o m*/
 * @return A set of the object stores.
 */
public Set<S> getObjectStores() {
    final JsArrayString names = nativeDatabase.getObjectStoreNames();
    final EnumSet<S> result = EnumSet.noneOf(schema);

    for (int index = 0; index < names.length(); index++) {
        try {
            final S store = Enum.valueOf(schema, names.get(index));
            result.add(store);
        } catch (IllegalArgumentException e) {
            // Can happen if a store has been renamed or removed.
        }
    }

    return result;
}

From source file:org.sigmah.offline.js.AutoBoxingJsMap.java

License:Open Source License

@Override
public Set<Entry<K, V>> entrySet() {
    final HashSet<Entry<K, V>> set = new HashSet<Entry<K, V>>();

    final JsArrayString keys = nativeMap.keyArray();
    for (int index = 0; index < keys.length(); index++) {
        final String keyAsString = keys.get(index);
        final Entry<K, V> entry = new JsMapEntry<K, V>(boxer.fromString(keyAsString), keyAsString, nativeMap);
        set.add(entry);//ww w . ja  v  a 2 s.  com
    }

    return set;
}

From source file:org.sigmah.offline.js.CreateEntityJS.java

License:Open Source License

public Map<String, Object> getPropertyMap() {
    if (getProperties() != null) {
        final HashMap<String, Object> map = new HashMap<String, Object>();

        final JsMap<String, String> properties = getProperties();
        final JsArrayString keys = properties.keyArray();

        final ObjectJsMapBoxer boxer = new ObjectJsMapBoxer();

        for (int index = 0; index < keys.length(); index++) {
            final String key = keys.get(index);
            map.put(key, boxer.fromString(properties.get(key)));
        }//from   ww w .ja  v a  2  s  . c o m

        return map;
    }
    return null;
}

From source file:org.sigmah.offline.js.PrepareFileUploadJS.java

License:Open Source License

public Map<String, String> getPropertyMap() {
    if (getProperties() != null) {
        final HashMap<String, String> map = new HashMap<String, String>();

        final JsMap<String, String> properties = getProperties();
        final JsArrayString keys = properties.keyArray();

        for (int index = 0; index < keys.length(); index++) {
            final String key = keys.get(index);
            map.put(key, properties.get(key));
        }//from  w ww  . j  a v  a2s  .  co m

        return map;
    }
    return null;
}

From source file:org.sigmah.offline.js.ProfileJS.java

License:Open Source License

public Set<GlobalPermissionEnum> getGlobalPermissionsSet() {
    final JsArrayString globalPermissions = getGlobalPermissions();
    if (globalPermissions != null) {
        final EnumSet<GlobalPermissionEnum> set = EnumSet.noneOf(GlobalPermissionEnum.class);
        for (int index = 0; index < globalPermissions.length(); index++) {
            set.add(GlobalPermissionEnum.valueOf(globalPermissions.get(index)));
        }//from   ww  w.  j  av a2s  . c  om
        return set;
    }
    return null;
}

From source file:org.sigmah.offline.js.UpdateEntityJS.java

License:Open Source License

public Map<String, Object> getChangeMap() {
    if (getChanges() != null) {
        final HashMap<String, Object> map = new HashMap<String, Object>();

        final JsMap<String, String> changes = getChanges();
        final JsArrayString keys = changes.keyArray();

        final ObjectJsMapBoxer boxer = new ObjectJsMapBoxer();

        for (int index = 0; index < keys.length(); index++) {
            final String key = keys.get(index);
            map.put(key, boxer.fromString(changes.get(key)));
        }//from  ww  w .j av  a  2  s.c o m

        return map;
    }
    return null;
}

From source file:org.thechiselgroup.biomixer.client.core.util.collections.JavaScriptStringSet.java

License:Apache License

@Override
public Iterator<String> iterator() {
    final JsArrayString keyArray = jsStringSet.getAll();

    return new Iterator<String>() {

        private int currentIndex = 0;

        @Override/*from  w  w w.  j ava 2s  .  c  o m*/
        public boolean hasNext() {
            return currentIndex < keyArray.length();
        }

        @Override
        public String next() {
            return keyArray.get(currentIndex++);
        }

        @Override
        public void remove() {
            JavaScriptStringSet.this.remove(keyArray.get(currentIndex - 1));
        }
    };
}

From source file:org.thechiselgroup.biomixer.client.core.util.collections.JavaScriptStringSet.java

License:Apache License

@Override
public Object[] toArray() {
    Object[] result = new Object[size()];
    JsArrayString values = jsStringSet.getAll();
    for (int i = 0; i < result.length; i++) {
        result[i] = values.get(i);
    }/*from   w  w w  . jav a 2  s  .  c o m*/
    return result;
}

From source file:org.thechiselgroup.biomixer.client.core.util.collections.JavaScriptStringSet.java

License:Apache License

@Override
public <T> T[] toArray(T[] a) {
    JsArrayString values = jsStringSet.getAll();
    for (int i = 0; i < a.length; i++) {
        a[i] = (T) values.get(i);
    }/* ww  w  .  ja v  a 2s. c om*/
    return a;
}

From source file:org.thechiselgroup.biomixer.client.core.util.collections.JavaScriptStringSet.java

License:Apache License

@Override
public String toString() {
    String result = "JavaScriptStringSet[";
    JsArrayString values = jsStringSet.getAll();
    for (int i = 0; i < values.length(); i++) {
        result += values.get(i);
        result += " ; ";
    }/* w ww. ja v a  2  s.c o m*/
    result += "]";
    return result;
}