com.google.gwt.core.client.JsArrayNumber Java Examples
The following examples show how to use
com.google.gwt.core.client.JsArrayNumber.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SliderBase.java From gwtbootstrap3-extras with Apache License 2.0 | 6 votes |
private List<Double> getNumberArrayAttribute(SliderOption option, List<Double> defaultValue) { // Get array attribute JsArrayNumber array = null; if (isAttached()) { array = getNumberArrayAttribute(getElement(), option.getName()); } else { String value = attributeMixin.getAttribute(option.getDataAttribute()); if (value != null && !value.isEmpty()) { array = JsonUtils.safeEval(value); } } // Attribute not set if (array == null) { return defaultValue; } // Put array to list List<Double> list = new ArrayList<Double>(array.length()); for (int i = 0; i < array.length(); i++) { list.add(array.get(i)); } return list; }
Example #2
Source File: FastArrayNumber.java From gwt-jackson with Apache License 2.0 | 5 votes |
public FastArrayNumber() { if(GWT.isScript()) { stackNative = JsArrayNumber.createArray().cast(); } else { stackJava = new JsList<Double>(); } }
Example #3
Source File: SliderBase.java From gwtbootstrap3-extras with Apache License 2.0 | 5 votes |
private void updateSliderForNumberArray(SliderOption option, List<Double> value) { JsArrayNumber array = JavaScriptObject.createArray().cast(); for (Double val : value) { array.push(val); } if (isAttached()) { setAttribute(getElement(), option.getName(), array); refresh(); } else { String arrayStr = JsonUtils.stringify(array); attributeMixin.setAttribute(option.getDataAttribute(), arrayStr); } }
Example #4
Source File: Range.java From gwtbootstrap3-extras with Apache License 2.0 | 5 votes |
/** * Converts the range to a JavaScript number array. * * @return a JavaScript number array */ public JsArrayNumber toJsArray() { JsArrayNumber array = JavaScriptObject.createArray().cast(); array.push(minValue); array.push(maxValue); return array; }
Example #5
Source File: Gamepad.java From gdx-controllerutils with Apache License 2.0 | 4 votes |
public native JsArrayNumber getAxes() /*-{ return this.axes; }-*/;
Example #6
Source File: NumberPriorityQueue.java From swellrt with Apache License 2.0 | 4 votes |
public NumberPriorityQueue(Comparator comparator) { heap = (JsArrayNumber)JsArrayNumber.createArray(); this.comparator = comparator; }
Example #7
Source File: NumberPriorityQueue.java From swellrt with Apache License 2.0 | 4 votes |
private static native double pop(JsArrayNumber arr) /*-{ return arr.pop(); }-*/;
Example #8
Source File: AreaSeries.java From dashbuilder with Apache License 2.0 | 4 votes |
public final void setData(double[] data){ JsArrayNumber array = JsArrayNumber.createArray().cast(); for(double str : data) array.push(str); setData(array); }
Example #9
Source File: AreaSeries.java From dashbuilder with Apache License 2.0 | 4 votes |
private final native void setData(JsArrayNumber data) /*-{ this.data = data; }-*/;
Example #10
Source File: NumberPriorityQueue.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
public NumberPriorityQueue(Comparator comparator) { heap = (JsArrayNumber)JsArrayNumber.createArray(); this.comparator = comparator; }
Example #11
Source File: NumberPriorityQueue.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
private static native double pop(JsArrayNumber arr) /*-{ return arr.pop(); }-*/;
Example #12
Source File: FastArrayNumber.java From gwt-jackson with Apache License 2.0 | 4 votes |
private static native double[] reinterpretCast( JsArrayNumber value ) /*-{ return value; }-*/;
Example #13
Source File: SliderBase.java From gwtbootstrap3-extras with Apache License 2.0 | 4 votes |
private native void setAttribute(Element e, String attr, JsArrayNumber value) /*-{ if ([email protected]::isSliderNamespaceAvailable()()) $wnd.jQuery(e).slider(@org.gwtbootstrap3.extras.slider.client.ui.base.SliderCommand::SET_ATTRIBUTE, attr, value); else $wnd.jQuery(e).bootstrapSlider(@org.gwtbootstrap3.extras.slider.client.ui.base.SliderCommand::SET_ATTRIBUTE, attr, value); }-*/;
Example #14
Source File: SliderBase.java From gwtbootstrap3-extras with Apache License 2.0 | 4 votes |
private native JsArrayNumber getNumberArrayAttribute(Element e, String attr) /*-{ if ([email protected]::isSliderNamespaceAvailable()()) return $wnd.jQuery(e).slider(@org.gwtbootstrap3.extras.slider.client.ui.base.SliderCommand::GET_ATTRIBUTE, attr); return $wnd.jQuery(e).bootstrapSlider(@org.gwtbootstrap3.extras.slider.client.ui.base.SliderCommand::GET_ATTRIBUTE, attr); }-*/;
Example #15
Source File: SelectBase.java From gwtbootstrap3-extras with Apache License 2.0 | 3 votes |
/** * Sets the window padding to top, right, bottom, and right sides. This * is useful in cases where the window has areas that the drop-down menu * should not cover - for instance a fixed header. * * @param top * @param right * @param bottom * @param left */ public void setWindowPaddingTopRightBottomLeft(final int top, final int right, final int bottom, final int left) { JsArrayNumber array = JavaScriptObject.createArray(4).cast(); array.push(top); array.push(right); array.push(bottom); array.push(left); attrMixin.setAttribute(WINDOW_PADDING, JsonUtils.stringify(array)); }
Example #16
Source File: Range.java From gwtbootstrap3-extras with Apache License 2.0 | 3 votes |
/** * Converts the given string to a range instance.<br> * <br> * Useful when using UiBinder. * * @param value * @return */ public static Range fromString(String value) { if (value == null || value.isEmpty()) return null; JsArrayNumber array = JsonUtils.safeEval(value); return new Range(array); }
Example #17
Source File: Range.java From gwtbootstrap3-extras with Apache License 2.0 | 2 votes |
/** * Creates a slider range with a JavaScritp number array. <br> * <br> * This constructor is useful in JSNI calls. * * @param array */ public Range(final JsArrayNumber array) { this(array.get(0), array.get(1)); }
Example #18
Source File: JsArraySort.java From incubator-retired-wave with Apache License 2.0 | 2 votes |
/** * Sorts a JsArray of doubles. * * @param sortMe Array to be sorted. * @param comparator Comparator to be used, per native JS sort() method. */ public static native void sort(JsArrayNumber sortMe, JavaScriptObject comparator) /*-{ sortMe.sort(comparator); }-*/;
Example #19
Source File: JsArraySort.java From swellrt with Apache License 2.0 | 2 votes |
/** * Sorts a JsArray of doubles. * * @param sortMe Array to be sorted. * @param comparator Comparator to be used, per native JS sort() method. */ public static native void sort(JsArrayNumber sortMe, JavaScriptObject comparator) /*-{ sortMe.sort(comparator); }-*/;