List of usage examples for com.google.gwt.core.client JsArrayString length
public final native int length() ;
From source file:org.ducktools.tutorial.gwt.architecture.photoalbum.client.commons.dispatcher.AlbumListDispatchAsync.java
License:Open Source License
public AlbumListDispatchAsync() { JsArrayString initialAlbums = initFromPage(); currentAlbumList = new ArrayList<Album>(initialAlbums.length()); for (int i = 0; i < initialAlbums.length(); i++) { Album album = new Album(); album.setName(initialAlbums.get(i)); currentAlbumList.add(album);// w w w . j a v a2 s.c o m } }
From source file:org.ebayopensource.turmeric.monitoring.client.model.MetricsMetaDataResponse.java
License:Open Source License
/** * Gets the ordered resource entity response names. * * @return the ordered resource entity response names *///from w w w . j a v a 2 s . c om public final Set<String> getOrderedResourceEntityResponseNames() { JsArrayString array = getResourceEntityResponseNames(); Set<String> set = new TreeSet<String>(); if (array != null) { for (int i = 0; i < array.length(); i++) { set.add(array.get(i)); } } return set; }
From source file:org.ebayopensource.turmeric.policy.adminui.client.model.policy.CreateSubjectGroupsResponseJS.java
License:Open Source License
/** * Gets the subject group ids./*from www. j av a 2 s. c o m*/ * * @return the subject group ids * @see org.ebayopensource.turmeric.policy.adminui.client.model.policy.PolicyQueryService.CreateSubjectGroupsResponse#getSubjectGroupIds() */ public final List<Long> getSubjectGroupIds() { JsArrayString idsAsStrings = getSubjectGroupIdsAsStrings(); List<Long> results = new ArrayList<Long>(); if (idsAsStrings != null) { for (int i = 0; i < idsAsStrings.length(); i++) { String s = idsAsStrings.get(i); results.add(Long.valueOf(s)); } } return results; }
From source file:org.ebayopensource.turmeric.policy.adminui.client.model.policy.CreateSubjectsResponseJS.java
License:Open Source License
/** * Gets the subject ids./*from ww w . ja v a2 s. c om*/ * * @return the subject ids * @see org.ebayopensource.turmeric.policy.adminui.client.model.policy.PolicyQueryService.CreateSubjectsResponse#getSubjectIds() */ public final List<Long> getSubjectIds() { JsArrayString idsAsStrings = getSubjectIdsAsStrings(); List<Long> results = new ArrayList<Long>(); if (idsAsStrings != null) { for (int i = 0; i < idsAsStrings.length(); i++) { String s = idsAsStrings.get(i); results.add(Long.valueOf(s)); } } return results; }
From source file:org.eclipse.che.ide.editor.codemirror.client.CodeMirrorEditorWidget.java
License:Open Source License
private boolean modePresent(final String modeName) { if (modeName == null) { return false; }/*from w w w . j av a 2s. com*/ final JsArrayString modeNames = this.codeMirror.modeNames(); for (int i = 0; i < modeNames.length(); i++) { if (modeName.equals(modeNames.get(i))) { return true; } } return false; }
From source file:org.eclipse.che.ide.editor.codemirror.client.CodemirrorGutter.java
License:Open Source License
@Override public void addGutterItem(final int line, final String gutterId, final Element element, final LineNumberingChangeCallback lineCallback) { // condition reversed from the other methods here if (GUTTER_MAP.isProtectedLogical(gutterId)) { return;// w w w . j a v a 2 s .c o m } this.editorOverlay.setGutterMarker(line, GUTTER_MAP.logicalToCm(gutterId), element); this.codeMirror.on(editorOverlay, EventTypes.CHANGE, new EventHandlerMixedParameters() { @Override public void onEvent(final JsArrayMixed params) { // 0->editor, 1->event object final CMChangeEventOverlay event = params.getObject(1); final JsArrayString newText = event.getText(); final CMPositionOverlay from = event.getFrom(); final CMPositionOverlay to = event.getTo(); // if the first character of the line is not included, the (potential) line // numbering change only starts at the following line. int changeStart = from.getLine() + 1; int removedCount = 0; if (from.getLine() != to.getLine()) { // no lines were removed // don't count first line yet removedCount = Math.abs(from.getLine() - to.getLine()) - 1; if (from.getCharacter() == 0) { // start of first line is included, 'to' is on another line, so the line is deleted removedCount = removedCount + 1; changeStart = changeStart - 1; } // if 'to' is at the end of the line, the line is _not_ removed, just emptied } // else no lines were removed final int addedCount = newText.length() - 1; // only call back if there is a change in the lines if (removedCount > 0 || addedCount > 0) { LOG.fine("Line change from l." + changeStart + " removed " + removedCount + " added " + addedCount); lineCallback.onLineNumberingChange(changeStart, removedCount, addedCount); } } }); }
From source file:org.eclipse.che.ide.editor.codemirrorjso.client.CMKeymapOverlay.java
License:Open Source License
public final List<String> getKeys() { final JsArrayString jsObject = keys(this); final List<String> result = new ArrayList<>(); for (int i = 0; i < jsObject.length(); i++) { result.add(jsObject.get(i));//w w w .j a v a2s . com } return result; }
From source file:org.eclipse.che.ide.editor.orion.client.OrionContentTypeRegistrant.java
License:Open Source License
public void registerFileType(final OrionContentTypeOverlay contentType, final OrionHighlightingConfigurationOverlay config) { // register content type and configure orion JsArrayString extensions = contentType.getExtensions(); for (int i = 0; i < extensions.length(); i++) { String extension = extensions.get(i); fileTypeIdentifier.registerNewExtension(extension, newArrayList(contentType.getId())); }//from w w w . j ava 2s .c o m editorModule.waitReady(new EditorModuleReadyCallback() { @Override public void onEditorModuleReady() { OrionServiceRegistryOverlay serviceRegistry = codeEditWidgetProvider.get().getServiceRegistry(); serviceRegistry.doRegisterService("orion.core.contenttype", JavaScriptObject.createObject(), contentType.toServiceObject()); serviceRegistry.doRegisterService("orion.edit.highlighter", JavaScriptObject.createObject(), config); } @Override public void onEditorModuleError() { } }); }
From source file:org.eclipse.che.ide.jseditor.client.requirejs.RequireJsLoader.java
License:Open Source License
protected static void configureGlobalErrorCallback() { Requirejs.get().setOnError(new RequirejsErrorHandler() { @Override/* w ww . j a v a 2 s.c om*/ public void onError(final RequireError err) { final String type = err.getRequireType(); if ("scripterror".equals(type)) { // leave the module as-is final JsArrayString modules = err.getRequireModules(); if (modules != null && modules.length() > 0) { final String failed = modules.get(0); String formattedMsg = ""; if (err.getMessage() != null) { formattedMsg = formattedMsg.replace("\n", "\n\t\t"); } consoleWarn( "Required module '%s' load failed with script error " + "(nonexistant script or error in the loaded script)\n" + "\t- error message = '%s'\n" + "\t- original error = %o", failed, formattedMsg, err); } else { consoleWarn( "Unexpected requirejs of type 'scripterror' without requireModules property: %o", err); throw new RuntimeException(err.toString()); } } else if ("timeout".equals(type)) { // we'll retry next time final JsArrayString modules = err.getRequireModules(); if (modules != null && modules.length() > 0) { final String failed = modules.get(0); consoleWarn("Required module '%s' load failed on timeout.", failed); Requirejs.get().undef(failed); } else { consoleWarn("Unexpected requirejs of type 'timeout' without requireModules property: %o", err); throw new RuntimeException(err.toString()); } } else { throw new RuntimeException(err.toString()); } } }); }
From source file:org.eclipse.che.requirejs.RequireJsLoader.java
License:Open Source License
protected static void configureGlobalErrorCallback() { Requirejs.get().setOnError(new RequirejsErrorHandler() { @Override/*from ww w.j a v a 2 s . com*/ public void onError(final RequireError err) { final String type = err.getRequireType(); if ("scripterror".equals(type)) { // leave the module as-is final JsArrayString modules = err.getRequireModules(); if (modules != null && modules.length() > 0) { final String failed = modules.get(0); String formattedMsg = ""; if (err.getMessage() != null) { formattedMsg = formattedMsg.replace("\n", "\n\t\t"); } consoleWarn( "Required module '%s' load failed with script error " + "(nonexistant script or error in the loaded script)\n" + "\t- error message = '%s'\n" + "\t- original error = %o", failed, formattedMsg, err); } else { consoleWarn( "Unexpected requirejs of type 'scripterror' without requireModules property: %o", err); throw new RuntimeException(err.toString()); } } else if ("timeout".equals(type)) { // we'll retry next time final JsArrayString modules = err.getRequireModules(); if (modules != null && modules.length() > 0) { final String failed = modules.get(0); consoleWarn("Required module '%s' load failed on timeout.", failed); Requirejs.get().undef(failed); } else { consoleWarn("Unexpected requirejs of type 'timeout' without requireModules property: %o", err); throw new RuntimeException(err.toString()); } } else { throw new RuntimeException(err.toString()); } } }); }