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:com.akjava.gwt.volumegraph.client.VolumeGraph.java

License:Apache License

private void addVolumesChangedListener() {
    colors.add(alphaColor(200, 255, 0, 0.7));
    colors.add(alphaColor(0, 200, 255, 0.7));
    colors.add(alphaColor(200, 0, 255, 0.7));

    colors.add(alphaColor(255, 200, 200, 0.7));
    colors.add(alphaColor(255, 200, 200, 0.7));
    colors.add(alphaColor(200, 255, 200, 0.7));

    colors.add(alphaColor(0, 0, 255, 0.7));

    colors.add(alphaColor(0, 255, 0, 0.7));
    colors.add(alphaColor(255, 0, 0, 0.7));
    colors.add(alphaColor(255, 255, 0, 0.7));
    colors.add(alphaColor(255, 0, 255, 0.7));
    colors.add(alphaColor(0, 255, 255, 0.7));

    colors.add(alphaColor(255, 200, 0, 0.7));
    colors.add(alphaColor(255, 0, 200, 0.7));
    colors.add(alphaColor(0, 255, 200, 0.7));

    final ColorPainter painter = new ColorPainter(canvas, 80);
    volumeChangeListener = new VolumesChangedListener() {

        @Override/*w w  w  . j av  a2  s.  c  om*/
        public void volumeChanged(NumberMap volumeMap) {

            painter.clear();

            //dummys
            for (int i = 0; i < dummyParticipant; i++) {
                volumeMap.put("dummy" + i, (int) (Math.random() * 5));
            }
            JsArrayString keys = volumeMap.keys();

            for (int i = 0; i < keys.length(); i++) {
                String key = keys.get(i);
                int num = (int) volumeMap.get(keys.get(i));
                painter.update(num, getColor(key));

            }
            painter.increment();

        }

    };
    Av.addVolumesChangedListener(volumeChangeListener);
}

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 a2  s .c  o m*/
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 www . j  a va 2s. c o m
 * 
 * @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
 *//* w w  w .j a  v  a2  s . c  o  m*/
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.bcdlog.client.edition.RichTextToolbar.java

License:Apache License

/**
 * Get first occurence of selected text//from w w  w .  java2s  . c  o m
 * @return
 */
private String getSelectedText() {
    JsArrayString tx = GWTUtils.getSelection(richTextArea.getElement());
    return tx.get(0);
}

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 ww.  j a  v  a 2  s . com
 * 
 * @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./*ww  w  .java2  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);
    }//w  w w .j  a  v  a2 s.  com

    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 .  ja  va2 s  .co 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 w w w.  j ava  2 s .  c  om*/
    JsArrayString a = keysImpl();
    String[] ret = new String[a.length()];
    for (int i = 0; i < a.length(); i++) {
        ret[i] = a.get(i);
    }
    return ret;
}