List of usage examples for com.google.gwt.core.client JsArrayString get
public final native String get(int index) ;
From source file:edu.caltech.ipac.firefly.visualize.WebPlotResultParser.java
public static WebPlotResult convertItem(PlotResultOverlay res) { WebPlotResult retval;/*from ww w . ja v a2s .co m*/ if (res.isSuccess()) { retval = new WebPlotResult(); String stateStr = res.getResult(WebPlotResult.PLOT_STATE); if (stateStr != null) { PlotState state = PlotState.parse(stateStr); retval.putResult(WebPlotResult.PLOT_STATE, state); } String imagesStr = res.getResult(WebPlotResult.PLOT_IMAGES); if (imagesStr != null) { PlotImages images = PlotImages.parse(imagesStr); retval.putResult(WebPlotResult.PLOT_IMAGES, images); } String wpInitStr = res.getResult(WebPlotResult.INSERT_BAND_INIT); if (wpInitStr != null) { InsertBandInitializer ibInit = InsertBandInitializer.parse(wpInitStr); retval.putResult(WebPlotResult.INSERT_BAND_INIT, ibInit); } JsArrayString creatorAry = res.getStringArrayResult(WebPlotResult.PLOT_CREATE); // String wpCreateStr= res.getResult(WebPlotResult.PLOT_CREATE); if (creatorAry != null) { String ary[] = new String[creatorAry.length()]; for (int i = 0; (i < ary.length); i++) ary[i] = creatorAry.get(i); List<WebPlotInitializer> wpInitList = new ArrayList<WebPlotInitializer>(ary.length); for (String s : ary) { WebPlotInitializer wpInit = WebPlotInitializer.parse(s); if (wpInit != null) wpInitList.add(wpInit); } CreatorResults cr = new CreatorResults( wpInitList.toArray(new WebPlotInitializer[wpInitList.size()])); retval.putResult(WebPlotResult.PLOT_CREATE, cr); } checkForStringResult(WebPlotResult.STRING, retval, res); checkForStringResult(WebPlotResult.DATA_HIST_IMAGE_URL, retval, res); checkForStringResult(WebPlotResult.CBAR_IMAGE_URL, retval, res); checkForStringResult(WebPlotResult.IMAGE_FILE_NAME, retval, res); checkForStringResult(WebPlotResult.REGION_FILE_NAME, retval, res); checkForStringResult(WebPlotResult.REGION_DATA, retval, res); checkForStringResult(WebPlotResult.REGION_ERRORS, retval, res); checkForStringResult(WebPlotResult.TITLE, retval, res); checkForIntAryResult(WebPlotResult.DATA_HISTOGRAM, retval, res); checkForDoubleAryResult(WebPlotResult.DATA_BIN_MEAN_ARRAY, retval, res); String biStr = res.getResult(WebPlotResult.BAND_INFO); if (biStr != null) { BandInfo bi = BandInfo.parse(biStr); retval.putResult(WebPlotResult.BAND_INFO, bi); } } else { retval = WebPlotResult.makeFail(res.getBriefFailReason(), res.getUserFailReason(), res.getDetailFailReason(), res.getProgressKey(), null); } return retval; }
From source file:edu.ycp.cs.netcoder.client.logchange.ChangeFromAceOnChangeEvent.java
License:Open Source License
protected static Change convertFromLines(String aceChangeType, int sr, int sc, int er, int ec, JsArrayString lines, int userId, int problemId) { ChangeType type = fromAceChangeType(aceChangeType); String[] lineArr = new String[lines.length()]; for (int i = 0; i < lineArr.length; i++) { lineArr[i] = lines.get(i); }//from w ww . ja v a 2 s . c om return new Change(type, sr, sc, er, ec, System.currentTimeMillis(), userId, problemId, lineArr); }
From source file:gov.wa.wsdot.search.client.SearchWidget.java
License:Open Source License
private static void updateResults(Search searchData, String query, String page) { StringBuilder sb = new StringBuilder(); JsArray<Results> searchResults = searchData.getResults(); JsArrayString searchRelated = searchData.getRelated(); JsArray<BoostedResults> boostedResults = searchData.getBoostedResults(); NumberFormat fmt = NumberFormat.getDecimalFormat(); // See if there are any related topics results. if (searchRelated != null) { for (int j = 0; j < searchRelated.length(); j++) { ListItem item = new ListItem(); Anchor a = new Anchor(); item.add(addSearchRelated(a, searchRelated.get(j))); list.add(item);/* www .ja v a 2 s. c o m*/ } relatedTopicsHTMLPanel.add(list); leftNavBoxHTMLPanel.setVisible(true); } // See if there are any boosted results. if (boostedResults != null) { boostedResultsHTMLPanel.setVisible(true); for (int i = 0; i < boostedResults.length(); i++) { boostedResultsHTMLPanel.add( new HTML("<p><span style=\"font-size:1.2em;\"><a href=\"" + boostedResults.get(i).getUrl() + "\" style=\"color:#036;\">" + boostedResults.get(i).getTitle() + "</a></span><br />" + boostedResults.get(i).getDescription() + "<br />" + "<a href=\"" + boostedResults.get(i).getUrl() + "\" style=\"color:#488048\">" + boostedResults.get(i).getUrl() + "</a></p>")); } } // See if there are any returned results. if (searchResults.length() > 0) { bingLogoHTMLPanel.setVisible(true); searchResultsForHTML.setHTML("<h4 style=\"line-height:2em;\">Results " + searchData.getStartRecord() + "-" + searchData.getEndRecord() + " of about " + fmt.format(searchData.getTotal()) + " for \"" + query + "\"</h4>"); for (int i = 0; i < searchResults.length(); i++) { sb.append(buildResult(searchResults.get(i))); } searchResultsHTML.setHTML(sb.toString()); int totalPages = (searchData.getTotal() + 10 - 1) / 10; // (results + resultsPerPage - 1) / resultsPerPage PageLinks pageLinks = new PageLinks(totalPages, Integer.parseInt(page), query); paginationHTMLPanel.add(pageLinks); } else { searchResultsForHTML.setHTML("<h4>Sorry. No results found for \"" + query + "\".</h4>"); } loadingImage.setVisible(false); }
From source file:gwt.g3d.client.gl2.GL2Impl.java
License:Apache License
@Override public String[] getSupportedExtensions() { JsArrayString supportedExts = getSupportedExtensionsImpl(); String[] outSupportedExts = new String[supportedExts.length()]; for (int i = 0; i < outSupportedExts.length; i++) { outSupportedExts[i] = supportedExts.get(i); }/* w w w.ja v a 2s .c o m*/ return outSupportedExts; }
From source file:jschismes.client.JsProperties.java
License:Apache License
public final String[] keys() { JsArrayString a = keysImpl(p); String[] ret = new String[a.length()]; for (int i = 0; i < a.length(); i++) { ret[i] = "" + a.get(i); }//from ww w . ja v a2 s .c o m return ret; }
From source file:net.codemirror.lib.ModeInjector.java
License:Apache License
private void ensureDependenciesAreLoaded(String mode) { JsArrayString deps = getDependencies(mode); for (int i = 0; i < deps.length(); i++) { String d = deps.get(i); if (loading.contains(d) || isModeLoaded(d)) { continue; }// www. j a v a 2 s .c o m SafeUri uri = modeUris.get(d); if (uri == null) { Logger.getLogger("net.codemirror").log(Level.SEVERE, "CodeMirror mode " + mode + " needs " + d); continue; } loading.add(d); beginLoading(d); } }
From source file:net.codemirror.mode.ModeInjector.java
License:Apache License
private void ensureDependenciesAreLoaded(String mode) { JsArrayString deps = getDependencies(mode); for (int i = 0; i < deps.length(); i++) { String d = deps.get(i); if (loading.contains(d) || isModeLoaded(d)) { continue; }//from w w w . j av a 2 s. c om if (!canLoad(d)) { Logger.getLogger("net.codemirror").log(Level.SEVERE, "CodeMirror mode " + d + " needs " + d); continue; } loading.add(d); beginLoading(d); } }
From source file:net.randomhacks.wave.gadgets.client.StateImpl.java
License:Apache License
public ArrayList<String> getKeys() { JsArrayString keys = getJsState().getKeys(); ArrayList<String> result = new ArrayList<String>(); for (int i = 0; i < keys.length(); ++i) result.add(keys.get(i)); return result; }
From source file:net.sf.mmm.util.gwt.api.JavaScriptUtil.java
License:Apache License
/** * @return the {@link List} of fonts available in the browser. *//*from w w w . j av a 2 s . com*/ public List<String> getAvailableFonts() { if (this.fonts == null) { JsArrayString jsArray = getFonts(); this.fonts = new String[jsArray.length()]; for (int i = 0; i < this.fonts.length; i++) { this.fonts[i] = jsArray.get(i); } } return Arrays.asList(this.fonts); }
From source file:net.zschech.gwt.comet.client.impl.IEHTMLFileCometTransport.java
License:Apache License
private void onMessages(JsArrayString arguments) { collect();// w ww . j a va 2 s . c o m int length = arguments.length(); List<Serializable> messages = new ArrayList<Serializable>(length); for (int i = 0; i < length; i++) { String message = arguments.get(i); switch (message.charAt(0)) { case ']': messages.add(message.substring(1)); break; case '[': case 'R': case 'r': case 'f': CometSerializer serializer = client.getSerializer(); if (serializer == null) { listener.onError(new SerializationException( "Can not deserialize message with no serializer: " + message), true); } else { try { messages.add(serializer.parse(message)); } catch (SerializationException e) { listener.onError(e, true); } } break; default: listener.onError(new CometException("Invalid message received: " + message), true); } } listener.onMessage(messages); }