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.sakaiproject.gradebook.gwt.client.gxt.model.EntityModel.java

License:Educational Community License

public Collection<String> getPropertyNames() {
    if (null == overlay)
        return super.getPropertyNames();

    Set<String> set = new FastSet();
    JsArrayString array = overlay.getKeys();

    if (array != null) {
        for (int i = 0; i < array.length(); i++) {
            set.add(array.get(i));//from w ww .j a  v a  2  s .  c  o  m
        }
    }

    return set;
}

From source file:org.sigmah.offline.indexeddb.Database.java

License:Open Source License

/**
 * Retrieves the name of every object store in this database.
 * /* w  w w  .  ja v  a  2 s.  c om*/
 * @return A set of the object stores names.
 */
public Set<String> getObjectStoreNames() {
    final JsArrayString names = nativeDatabase.getObjectStoreNames();
    final HashSet<String> result = new HashSet<String>();

    for (int index = 0; index < names.length(); index++) {
        result.add(names.get(index));
    }

    return result;
}

From source file:org.sigmah.offline.indexeddb.Database.java

License:Open Source License

/**
 * Retrieves every object store in this database.
 * //from w w w . ja v  a2 s  . c  om
 * @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. j  a 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  . j  a  va 2  s . co  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));
        }//  w w  w . ja v  a 2s .  com

        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  . ja v  a 2 s .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 www.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/*ww w  . j a v  a2 s  .  c om*/
        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 String toString() {
    String result = "JavaScriptStringSet[";
    JsArrayString values = jsStringSet.getAll();
    for (int i = 0; i < values.length(); i++) {
        result += values.get(i);/*from   w  w w .ja v a 2  s. co m*/
        result += " ; ";
    }
    result += "]";
    return result;
}