List of usage examples for com.google.gwt.core.client JsArrayString length
public final native int length() ;
From source file:com.googlecode.gflot.client.options.TimeSeriesAxisOptions.java
License:Open Source License
/** * Set the label used for days.//w ww.jav a 2s . c o m */ public final TimeSeriesAxisOptions setDayNames(JsArrayString dayNames) { assert null != dayNames : "dayNames can't be null"; assert dayNames.length() == 7 : "dayNames must have all 7 days names"; put(DAY_NAMES_KEY, dayNames); return this; }
From source file:com.gwtmobile.phonegap.client.File.java
License:Apache License
public static String[] getRootPaths() { JsArrayString jsArray = getRootPathsNative(); String[] array = new String[jsArray.length()]; for (int i = 0; i < jsArray.length(); i++) { array[i] = jsArray.get(i);//from w w w.j a va 2s . c o m } return array; }
From source file:com.gwtmobile.phonegap.client.File.java
License:Apache License
public static String[] getFileBasePaths() { JsArrayString jsArray = getFileBasePathsNative(); String[] array = new String[jsArray.length()]; for (int i = 0; i < jsArray.length(); i++) { array[i] = jsArray.get(i);//w w w. jav a 2s . c o m } return array; }
From source file:com.invient.vaadin.charts.widgetset.client.ui.VInvientCharts.java
License:Apache License
private boolean areStringArraysEqual(JsArrayString arrOne, JsArrayString arrTwo) { if (arrOne == arrTwo) { return true; }/*from w w w . j av a 2 s .c o m*/ if ((arrOne != null && arrTwo == null) || (arrOne == null && arrTwo != null)) { return false; } if (arrOne.length() != arrTwo.length()) { return false; } // Compare each array element for (int arrInd = 0; arrInd < arrOne.length(); arrInd++) { String arrOneVal = arrOne.get(arrInd); String arrTwoVal = arrTwo.get(arrInd); if (arrOneVal == null) { if (arrTwoVal != null) { return false; } } else if (!arrOneVal.equals(arrTwoVal)) { return false; } } return true; }
From source file:com.invient.vaadin.charts.widgetset.client.ui.VInvientCharts.java
License:Apache License
private void updateChartData(UIDL uidlChartDataUpdates, UIDL uidlChartData) { VConsole.log("Enter [updateChartData]"); JsArrayString seriesToAdd = JavaScriptObject.createArray().cast(); JsArrayString seriesToUpdate = JavaScriptObject.createArray().cast(); List<UIDL> seriesToUpdateList = new ArrayList<UIDL>(); for (int ind = 0; ind < uidlChartDataUpdates.getChildCount(); ind++) { UIDL seriesUpdateUIDL = uidlChartDataUpdates.getChildUIDL(ind); String seriesName = seriesUpdateUIDL.getStringAttribute("seriesName"); String operation = seriesUpdateUIDL.getStringAttribute("operation"); VConsole.log("Series name : " + seriesName + ", operation : " + operation); if (seriesName != null && seriesName.length() > 0 && operation != null && operation.length() > 0) { if (SeriesCURType.REMOVE.getName().equals(operation)) { GwtSeries series = chart.getSeries(seriesName); if (series != null) { VConsole.log("Removing series : " + seriesName); setRedrawChart();/*from w w w. j a v a2 s . c o m*/ series.remove(false); } } else if (SeriesCURType.ADD.getName().equals(operation)) { seriesToAdd.push(seriesName); } else if (SeriesCURType.UPDATE.getName().equals(operation)) { VConsole.log("Will update series : " + seriesName); seriesToUpdateList.add(seriesUpdateUIDL); seriesToUpdate.push(seriesName); } } } if (seriesToAdd.length() > 0) { setRedrawChart(); JsArray<GwtSeriesDataOptions> uidlChartDataArr = getChartData(uidlChartData, seriesToAdd); for (int ind = 0; ind < uidlChartDataArr.length(); ind++) { VConsole.log("Adding series " + uidlChartDataArr.get(ind).getName()); chart.addSeries(uidlChartDataArr.get(ind), false); } } if (seriesToUpdateList.size() > 0) { setRedrawChart(); JsArray<GwtSeriesDataOptions> uidlChartDataArr = getChartData(uidlChartData, seriesToUpdate); for (int ind = 0; ind < seriesToUpdateList.size(); ind++) { UIDL uidlSeriesToUpdate = seriesToUpdateList.get(ind); GwtSeriesDataOptions uidlSeriesDataOptions = uidlChartDataArr.get(ind); GwtSeries chartSeries = chart.getSeries(uidlSeriesDataOptions.getName()); GwtSeriesGeneralOptions chartSeriesOptions = chartSeries.getSeriesGeneralOptions(); GwtSeriesGeneralOptions uidlSeriesOptions = uidlSeriesDataOptions.getSeriesOptions(); // Update visibility boolean isVisible = (uidlSeriesOptions != null ? uidlSeriesOptions.isVisible() : true); chartSeriesOptions.setVisible(isVisible); if (chartSeriesOptions.isVisible() == true && chartSeries.isVisible() == false) { chartSeries.show(); } if (chartSeriesOptions.isVisible() == false && chartSeries.isVisible() == true) { chartSeries.hide(); } // Update points if (uidlSeriesToUpdate.getBooleanAttribute("isReloadPoints")) { // update all points VConsole.log("Reloading points for series : " + uidlSeriesToUpdate.getStringAttribute("name")); chartSeries.setDataAsPointOptions(uidlSeriesDataOptions.getDataAsPointOptions(), false); } else { UIDL uidlPointsAdded = uidlSeriesToUpdate.getChildUIDL(0); UIDL uidlPointsRemoved = uidlSeriesToUpdate.getChildUIDL(1); updateSeriesData(chartSeries, uidlPointsAdded, uidlPointsRemoved); } } } VConsole.log("Exit [updateChartData]"); }
From source file:com.invient.vaadin.charts.widgetset.client.ui.VInvientCharts.java
License:Apache License
private boolean doesArrayContainSeriesName(JsArrayString namesOfSeriesToAdd, String seriesName) { for (int ind = 0; ind < namesOfSeriesToAdd.length(); ind++) { if (seriesName.equals(namesOfSeriesToAdd.get(ind))) { return true; }//from w w w .j ava 2s. c o m } return false; }
From source file:com.jythonui.client.js.JSOToVariables.java
License:Apache License
static DialogVariables toV(JavaScriptObject o) { DialogVariables v = new DialogVariables(); JSOModel mo = (JSOModel) o;/* w w w . j ava2s. co m*/ JsArrayString a = mo.keys(); for (int i = 0; i < a.length(); i++) { String key = a.get(i); String val = mo.get(key); String type = mo.get(key + IUIConsts.JSADDTYPE); FieldDataType ff = null; if (IConsts.JSUNDEFINED.equals(type)) ff = FieldDataType.constructString(); else if (ICommonConsts.INTTYPE.equals(type)) ff = FieldDataType.constructInt(); else if (ICommonConsts.LONGTYPE.equals(type)) ff = FieldDataType.constructLong(); else if (ICommonConsts.BOOLTYPE.equals(type)) ff = FieldDataType.constructBoolean(); else if (ICommonConsts.DATETIMETYPE.equals(type)) ff = FieldDataType.constructDate(); else if (ICommonConsts.DATETYPE.equals(type)) ff = FieldDataType.constructDate(); else if (ICommonConsts.DECIMALTYPE.equals(type)) ff = FieldDataType.constructBigDecimal(); if (ff == null) { String mess = M.M().JavaScriptInvalideType(type, key + IUIConsts.JSADDTYPE); Utils.errAlert(mess); } IVField vv = VField.construct(key, ff.getType()); Object oVal = FUtils.getValue(vv, val); FieldValue fVal = new FieldValue(); fVal.setValue(ff.getType(), oVal, ff.getAfterdot()); v.setValue(key, fVal); } return v; }
From source file:com.kk_electronic.kkportal.core.util.JsMap.java
License:Open Source License
public final Set<String> keySet() { JsArrayString jsKeys = getKeys(); HashSet<String> javaKeys = new HashSet<String>(); for (int i = 0; i < jsKeys.length(); i++) { javaKeys.add(jsKeys.get(i));//from w w w . jav a 2 s. co m } return javaKeys; }
From source file:com.parabay.client.gears.Utils.java
License:Apache License
/** * Converts a JavaScript array of strings to a Java array of strings. *///from w w w .j a v a2 s . c om public static String[] toJavaArray(JsArrayString jsArray) { String[] urls = new String[jsArray.length()]; for (int i = 0; i < jsArray.length(); i++) { urls[i] = jsArray.get(i); } return urls; }
From source file:com.risevision.ui.client.common.widgets.iframe.IFrameController.java
License:Open Source License
private static void onMessageStatic(String source, String command, JsArrayString rawValues) { IFramePanelWidget widget = widgets.get(source); if (widget != null) { List<String> values = new ArrayList<>(); if (rawValues != null) { for (int i = 0; i < rawValues.length(); i++) { values.add(rawValues.get(i)); }//from w w w .j a v a 2 s . com } widget.onMessage(command, values); } }