Example usage for com.google.gwt.json.client JSONBoolean getInstance

List of usage examples for com.google.gwt.json.client JSONBoolean getInstance

Introduction

In this page you can find the example usage for com.google.gwt.json.client JSONBoolean getInstance.

Prototype

public static JSONBoolean getInstance(boolean b) 

Source Link

Document

Gets a reference to the singleton instance representing either true or false.

Usage

From source file:amdb.client.slider.RangeSlider.java

License:Apache License

/**
 * A convenient way to create an options JSONObject for the RangeSlider.
 * @param min - default minimum of the slider
 * @param max - default maximum of the slider
 * @param defaultMin - the default value of the lowest anchor
 * @param defaultMax - the default value of the highest anchor
 * @return a JSONObject of RangeSlider options
 *///from   ww w.  j a va 2  s.  c o  m
public static JSONObject getOptions(int min, int max, int defaultMin, int defaultMax) {
    JSONObject options = Slider.getOptions(min, max, new int[] { defaultMin, defaultMax });
    options.put(SliderOption.RANGE.toString(), JSONBoolean.getInstance(true));
    options.put(SliderOption.STEP.toString(), new JSONNumber(1));
    return options;
}

From source file:annis.gui.widgets.gwt.client.ui.JITConf.java

License:Apache License

public void setProperty(String key, Boolean value) {
    this.put(key, JSONBoolean.getInstance(value));
}

From source file:ca.nanometrics.gflot.client.util.JSONArrayWrapper.java

License:Open Source License

protected void set(int index, boolean value) {
    set(index, JSONBoolean.getInstance(value));
}

From source file:ca.nanometrics.gflot.client.util.JSONArrayWrapper.java

License:Open Source License

protected void push(boolean value) {
    set(++currentIndex, JSONBoolean.getInstance(value));
}

From source file:ca.nanometrics.gflot.client.util.JSONObjectWrapper.java

License:Open Source License

protected void put(String key, boolean value) {
    jsonObj.put(key, JSONBoolean.getInstance(value));
}

From source file:ca.upei.ic.timetable.client.CourseViewController.java

License:Apache License

public void search() {
    JSONObject department = new JSONObject();
    for (String d : departmentCriteria_.keySet()) {
        if (departmentCriteria_.get(d)) {
            department.put(d, JSONBoolean.getInstance(true));
        }//from  w  ww . j  a  v  a  2 s .  c om
    }
    JSONObject level = new JSONObject();
    for (String l : levelCriteria_.keySet()) {
        if (levelCriteria_.get(l)) {
            level.put(l, JSONBoolean.getInstance(true));
        }
    }
    JSONObject semester = new JSONObject();
    for (String s : semesterCriteria_.keySet()) {
        if (semesterCriteria_.get(s))
            semester.put(s, JSONBoolean.getInstance(true));
    }

    JSONObject value = new JSONObject();
    value.put("department", department);
    value.put("level", level);
    value.put("semester", semester);
    value.put("day", new JSONString(courseDay_));
    value.put("startTime", new JSONString(courseStartTime_));

    Service.defaultInstance().askCourses(value.toString(), new RequestCallback() {

        public void onError(Request request, Throwable exception) {
            app_.error(ApplicationController.OOPS, exception);
        }

        public void onResponseReceived(Request request, Response response) {

            try {
                JSONArray parsedArray = (JSONArray) JSONParser.parse(response.getText());
                // remove the selected courses
                // filtered array
                JSONArray filteredArray = new JSONArray();
                int filtered_index = 0;
                for (int i = 0; i < parsedArray.size(); i++) {
                    JSONObject o = (JSONObject) parsedArray.get(i);
                    int id = (int) ((JSONNumber) o.get("id")).doubleValue();
                    if (!isSelected(id)) {
                        filteredArray.set(filtered_index++, o);
                    }
                }
                // clear out the view so we can add courses
                view_.clear();
                // add the selected values first
                for (int index : selectionIndexes_) {
                    view_.addCourse(index, selectionValues_.get(index), true);
                }
                // add the remaining courses
                view_.loadJSON(filteredArray);
            } catch (Throwable e) {
                app_.error("Error: " + response.getText(), e);
            }
        }

    });
}

From source file:ccc.client.gwt.core.GWTJson.java

License:Open Source License

/** {@inheritDoc} */
@Override//from   w w w. j av  a  2s . c o  m
public void set(final String key, final Boolean bool) {
    _delegate.put(key, (null == bool) ? JSONNull.getInstance() : JSONBoolean.getInstance(bool.booleanValue()));
}

From source file:ch.uzh.softwareengineering.climatechangeviewer.client.widget.slider.RangeSlider.java

License:Apache License

/**
 * A convenient way to create an options JSONObject for the RangeSlider.
 * @param min - default minimum of the slider
 * @param max - default maximum of the slider
 * @param defaultMin - the default value of the lowest anchor
 * @param defaultMax - the default value of the highest anchor
 * @return a JSONObject of RangeSlider options
 *//*from  www. ja  v  a  2s  . co m*/
public static JSONObject getOptions(int min, int max, int defaultMin, int defaultMax) {
    JSONObject options = Slider.getOptions(min, max, new int[] { defaultMin, defaultMax });
    options.put(SliderOption.RANGE.toString(), JSONBoolean.getInstance(true));
    return options;
}

From source file:colt.json.gwt.client.UJsonClient.java

License:Apache License

static public void add(JSONObject _o, String _key, boolean _boolean) {
    _o.put(_key, JSONBoolean.getInstance(_boolean));
}

From source file:com.ait.lienzo.client.core.shape.Movie.java

License:Open Source License

@Override
public JSONObject toJSONObject() {
    JSONObject object = super.toJSONObject();

    ImageDataFilterChain chain = m_filters;

    if ((null != chain) && (chain.size() > 0)) {
        JSONArray filters = new JSONArray();

        JSONObject filter = new JSONObject();

        filter.put("active", JSONBoolean.getInstance(chain.isActive()));

        for (ImageDataFilter<?> ifilter : chain.getFilters()) {
            if (null != ifilter) {
                JSONObject make = ifilter.toJSONObject();

                if (null != make) {
                    filters.set(filters.size(), make);
                }// w  w  w .ja  va  2 s  .c om
            }
        }
        filter.put("filters", filters);

        object.put("filter", filter);
    }
    return object;
}