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:com.alkacon.vie.client.Entity.java

License:Open Source License

/**
 * @see com.alkacon.vie.shared.I_Entity#getAttributes()
 *///  w w  w.  ja  v a 2 s .  c om
public List<I_EntityAttribute> getAttributes() {

    List<I_EntityAttribute> result = new ArrayList<I_EntityAttribute>();
    JsArrayString attributeNames = getAttributeNames();
    for (int i = 0; i < attributeNames.length(); i++) {
        I_EntityAttribute attribute = getAttribute(attributeNames.get(i));
        if (attribute != null) {
            result.add(attribute);
        }
    }
    return result;
}

From source file:com.alkacon.vie.client.EntityAttribute.java

License:Open Source License

/**
 * Constructor.<p>/*from w w w  .ja  v a2 s  .  c om*/
 * 
 * @param name the attribute name
 * @param values the values
 */
public EntityAttribute(String name, JsArrayString values) {

    m_name = name;
    m_simpleValues = new ArrayList<String>();
    for (int i = 0; i < values.length(); i++) {
        m_simpleValues.add(values.get(i));
    }
}

From source file:com.arcbees.chosen.client.gwt.ChosenListBox.java

License:Apache License

/**
 * Return the values of all selected options in an array.
 * Usefull to know which options are selected in case of multiple ChosenListBox
 *
 * @return the values of all selected options in an array
 *//*from  w  ww.  java  2s .com*/
public String[] getValues() {
    ChosenImpl impl = getChosenImpl();

    if (impl != null) {
        List<String> selectedValues = impl.getSelectedValues();
        return selectedValues.toArray(new String[selectedValues.size()]);
    } else {
        JsArrayString values = JsArrayString.createArray().cast();
        NodeList<OptionElement> options = SelectElement.as(getElement()).getOptions();
        for (int i = 0; i < options.getLength(); i++) {
            OptionElement option = options.getItem(i);
            if (option.isSelected()) {
                values.push(option.getValue());
            }
        }

        String[] result = new String[values.length()];
        for (int i = 0; i < values.length(); i++) {
            result[i] = values.get(i);
        }

        return result;
    }
}

From source file:com.bramosystems.oss.player.playlist.client.spf.SPFPlaylist.java

License:Apache License

/**
 * Returns this playlist as a Playlist object that can be used with player widgets 
 * with {@link PlaylistSupport}/*w w  w  .j a  va2s  .  c o  m*/
 * 
 * @return Playlist object
 */
public final Playlist toPlaylist() {
    Playlist p = new Playlist();
    p.setName(getTitle());
    p.setAuthor(getCreator());

    JsArray<Track> ts = getTracks();
    for (int i = 0; i < ts.length(); i++) {
        Track t = ts.get(i);

        MRL m = new MRL(t.getTitle(), t.getCreator());
        JsArrayString js = t.getLocation();
        for (int j = 0; j < js.length(); j++) {
            m.addURL(js.get(j));
        }
        p.add(m);
    }
    return p;
}

From source file:com.bramosystems.oss.player.youtube.client.YouTubeBasePlayer.java

License:Apache License

/**
 * Returns the list of quality formats in which the current video is
 * available./*  w w  w  . j av a  2 s.  c o m*/
 *
 * <p>An empty list is returned if no video is loaded.
 *
 * @return a list of quality formats available for the current video
 */
public ArrayList<PlaybackQuality> getAvailableQualityLevels() {
    ArrayList<PlaybackQuality> pqs = new ArrayList<PlaybackQuality>();
    if (impl != null) {
        JsArrayString qua = impl.getAvailableQualityLevels();
        for (int i = 0; i < qua.length(); i++) {
            pqs.add(PlaybackQuality.valueOf(qua.get(i)));
        }
    }
    return pqs;
}

From source file:com.calclab.emite.core.client.xmpp.datetime.gwt.TimeZone.java

License:Open Source License

public static TimeZone createTimeZone(TimeZoneInfo timezoneData) {
    TimeZone tz = new TimeZone();

    tz.timezoneID = timezoneData.getID();
    tz.standardOffset = -timezoneData.getStandardOffset();

    JsArrayString jsTimezoneNames = timezoneData.getNames();

    tz.tzNames = new String[jsTimezoneNames.length()];

    for (int i = 0; i < jsTimezoneNames.length(); i++) {
        tz.tzNames[i] = jsTimezoneNames.get(i);
    }//  www.j a  v a  2s . c o  m

    JsArrayInteger transitions = timezoneData.getTransitions();

    if (transitions == null || transitions.length() == 0) {
        tz.transitionPoints = null;
        tz.adjustments = null;
    } else {
        int transitionNum = transitions.length() / 2;
        tz.transitionPoints = new int[transitionNum];
        tz.adjustments = new int[transitionNum];

        for (int i = 0; i < transitionNum; ++i) {
            tz.transitionPoints[i] = transitions.get(i * 2);
            tz.adjustments[i] = transitions.get(i * 2 + 1);
        }
    }
    return tz;
}

From source file:com.cgxlib.xq.client.js.JsCache.java

License:Apache License

public final int[] indexes() {
    checkNull();/*w w w . jav  a 2s . c o  m*/
    JsArrayString a = keysImpl();
    int[] ret = new int[a.length()];
    for (int i = 0; i < a.length(); i++) {
        try {
            ret[i] = Integer.valueOf(a.get(i));
        } catch (Exception e) {
            ret[i] = i;
        }
    }
    return ret;
}

From source file:com.cgxlib.xq.client.js.JsCache.java

License:Apache License

public final String[] keys() {
    checkNull();//from  ww  w  .j  a  v a2s.c o m
    JsArrayString a = keysImpl();
    String[] ret = new String[a.length()];
    for (int i = 0; i < a.length(); i++) {
        ret[i] = a.get(i);
    }
    return ret;
}

From source file:com.codenvy.ide.ext.java.jdt.core.util.JsUtil.java

License:Open Source License

public static char[] toCharArray(JsArrayString stringArray) {
    char[] result = new char[stringArray.length()];
    for (int i = 0; i < stringArray.length(); i++) {
        result[i] = stringArray.get(i).charAt(0);
    }/*from   w w w.ja v  a2 s  .com*/
    return result;
}

From source file:com.codenvy.ide.ext.java.jdt.core.util.JsUtil.java

License:Open Source License

public static byte[] toByteArray(JsArrayString stringArray) {
    byte[] result = new byte[stringArray.length()];
    for (int i = 0; i < stringArray.length(); i++) {
        result[i] = Byte.valueOf(stringArray.get(i));
    }/*ww  w .  j a  v  a 2  s . c o  m*/
    return result;
}