当前位置: 首页>>代码示例>>Java>>正文


Java JsArrayString类代码示例

本文整理汇总了Java中com.google.gwt.core.client.JsArrayString的典型用法代码示例。如果您正苦于以下问题:Java JsArrayString类的具体用法?Java JsArrayString怎么用?Java JsArrayString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsArrayString类属于com.google.gwt.core.client包,在下文中一共展示了JsArrayString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JsEnumValueArrayList

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
/**
 * Internal constructor used to load a JSArray already in another object.
 * @param values all values of an enumeration
 * @param array JS array instance
 */
JsEnumValueArrayList(E[] values, JsArrayStringImpl array) {
	// sets all enumeration values
	this.definedValues = values;
	// if null, creates a new JS array
	if (array == null){
		this.array = (JsArrayStringImpl)JsArrayString.createArray().cast();
	} else {
		// uses an existing array
		this.array = array;
	}
}
 
开发者ID:pepstock-org,项目名称:Charba,代码行数:17,代码来源:JsEnumValueArrayList.java

示例2: getStrings

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
/**
 * Returns a multi line label at a specific index. An array of strings is returned. 
 * @param index index of label
 * @return an array of strings
 */
public final String[] getStrings(int index){
	// checks range
	if (checkRange(index)){
		// gets multi line array
		JsArrayString multiValues = getObject(index);
		// if consistent
		if (multiValues != null){
			// creates an string array
			String[] result = new String[multiValues.length()];
			// scans all values
			for (int i=0; i<multiValues.length(); i++){
				// adds to java array
				result[i] = multiValues.get(i);
			}
			// returns array
			return result;
		} else {
			// returns an empty array
			return new String[0];
		}
	}
	// returns an empty array
	return new String[0];
}
 
开发者ID:pepstock-org,项目名称:Charba,代码行数:30,代码来源:Labels.java

示例3: getSelection

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
/** Native JavaScript that returns the selected text and position of the start **/
public static native JsArrayString getSelection(Element elem) /*-{
       var txt = "";
       var pos = 0;
       var range;
       var parentElement;
       var container;

       if (elem.contentWindow.getSelection) {
           txt = elem.contentWindow.getSelection();
           pos = elem.contentWindow.getSelection().getRangeAt(0).startOffset;
       } else if (elem.contentWindow.document.getSelection) {
           txt = elem.contentWindow.document.getSelection();
           pos = elem.contentWindow.document.getSelection().getRangeAt(0).startOffset;
       } else if (elem.contentWindow.document.selection) {
           range = elem.contentWindow.document.selection.createRange();
           txt = range.text;
           parentElement = range.parentElement();
           container = range.duplicate();
           container.moveToElementText(parentElement);
           container.setEndPoint('EndToEnd', range);
           pos = container.text.length - range.text.length;
       }
       return ["" + txt, "" + pos];
   }-*/;
 
开发者ID:openkm,项目名称:document-management-system,代码行数:26,代码来源:RichTextToolbar.java

示例4: addHashtag

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
private void addHashtag(String hashtags) {
  ChangeApi.hashtags(project.get(), changeId.get())
      .post(
          PostInput.create(hashtags, null),
          new GerritCallback<JsArrayString>() {
            @Override
            public void onSuccess(JsArrayString result) {
              Gerrit.display(
                  PageLinks.toChange(project, psId.getParentKey(), String.valueOf(psId.get())));
            }

            @Override
            public void onFailure(Throwable err) {
              UIObject.setVisible(error, true);
              error.setInnerText(
                  err instanceof StatusCodeException
                      ? ((StatusCodeException) err).getEncodedResponse()
                      : err.getMessage());
              hashtagTextBox.setEnabled(true);
            }
          });
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:Hashtags.java

示例5: onRequestSuggestions

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
@Override
protected void onRequestSuggestions(Request req, Callback cb) {
  RestApi api = ChangeApi.revision(project.get(), changeId.get(), revision.name()).view("files");
  if (req.getQuery() != null) {
    api.addParameter("q", req.getQuery() == null ? "" : req.getQuery());
  }
  api.background()
      .get(
          new AsyncCallback<JsArrayString>() {
            @Override
            public void onSuccess(JsArrayString result) {
              List<Suggestion> r = new ArrayList<>();
              for (String path : Natives.asList(result)) {
                r.add(new PathSuggestion(path));
              }
              cb.onSuggestionsReady(req, new Response(r));
            }

            @Override
            public void onFailure(Throwable caught) {
              List<Suggestion> none = Collections.emptyList();
              cb.onSuggestionsReady(req, new Response(none));
            }
          });
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:PathSuggestOracle.java

示例6: onLoad

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
@Override
protected void onLoad() {
  if (!loaded) {
    ChangeApi.includedIn(
        project.get(),
        changeId.get(),
        new AsyncCallback<IncludedInInfo>() {
          @Override
          public void onSuccess(IncludedInInfo r) {
            branches.setInnerSafeHtml(formatList(r.branches()));
            tags.setInnerSafeHtml(formatList(r.tags()));
            for (String n : r.externalNames()) {
              JsArrayString external = r.external(n);
              if (external.length() > 0) {
                appendRow(n, external);
              }
            }
            loaded = true;
          }

          @Override
          public void onFailure(Throwable caught) {}
        });
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:IncludedInBox.java

示例7: require

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
public final native void require(
  JsArrayString deps, RequirejsCallback callback, RequirejsErrorHandler errorHandler) /*-{
    var realCallback = function() {
        var param = [];
        var args = Array.prototype.slice.call(arguments);
        args.forEach(function(module) {
            param.push(module);
        });
        [email protected]::onReady(Lcom/google/gwt/core/client/JsArray;)(param);
    };
    var realErrHandler = function(err) {
        if (errorHandler) {
            [email protected]::onError(Lorg/eclipse/che/requirejs/RequirejsErrorHandler$RequireError;)(err);
        } else {
            $wnd.require.onError(err);
        }
    };
    this.require(deps, realCallback, realErrHandler);
}-*/;
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:Requirejs.java

示例8: ReplyAction

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
ReplyAction(
    ChangeInfo info,
    String revision,
    boolean hasDraftComments,
    ChangeScreen.Style style,
    CommentLinkProcessor clp,
    Widget replyButton,
    Widget quickApproveButton) {
  this.psId = new PatchSet.Id(info.legacyId(), info.revisions().get(revision)._number());
  this.project = info.projectNameKey();
  this.revision = revision;
  this.hasDraftComments = hasDraftComments;
  this.style = style;
  this.clp = clp;
  this.replyButton = replyButton;
  this.quickApproveButton = quickApproveButton;

  boolean current = revision.equals(info.currentRevision());
  allLabels = info.allLabels();
  permittedLabels =
      current && info.hasPermittedLabels()
          ? info.permittedLabels()
          : NativeMap.<JsArrayString>create();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:25,代码来源:ReplyAction.java

示例9: ensureDependenciesAreLoaded

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
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;
    }

    if (!canLoad(d)) {
      Logger.getLogger("net.codemirror")
          .log(Level.SEVERE, "CodeMirror mode " + d + " needs " + d);
      continue;
    }

    loading.add(d);
    beginLoading(d);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:19,代码来源:ModeInjector.java

示例10: getUrl

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
private static String getUrl(JavaScriptException e) {
  String baseUrl = baseUrl();
  JsArrayString stack = getStack(e);
  for (int i = stack.length() - 1; i >= 0; i--) {
    String frame = stack.get(i);
    int at = frame.indexOf(baseUrl);
    if (at >= 0) {
      int end = frame.indexOf(':', at + baseUrl.length());
      if (end < 0) {
        end = frame.length();
      }
      return frame.substring(at, end);
    }
  }
  return UNKNOWN;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:PluginName.java

示例11: markEdit

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
private void markEdit(DisplaySide side, int startLine, JsArrayString lines, JsArray<Span> edits) {
  if (lines == null || edits == null) {
    return;
  }

  EditIterator iter = new EditIterator(lines, startLine);
  Configuration bg =
      Configuration.create().set("className", getIntralineBgFromSide(side)).set("readOnly", true);

  Configuration diff =
      Configuration.create().set("className", getDiffColorFromSide(side)).set("readOnly", true);

  Pos last = Pos.create(0, 0);
  for (Span span : Natives.asList(edits)) {
    Pos from = iter.advance(span.skip());
    Pos to = iter.advance(span.mark());
    if (from.line() == last.line()) {
      getMarkers().add(cm.markText(last, from, bg));
    } else {
      getMarkers().add(cm.markText(Pos.create(from.line(), 0), from, bg));
    }
    getMarkers().add(cm.markText(from, to, diff));
    last = to;
    colorLines(cm, LineClassWhere.BACKGROUND, getDiffColorFromSide(side), from.line(), to.line());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:UnifiedChunkManager.java

示例12: JsStringArrayList

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
/**
 * Internal constructor used to load a JSArray already in another object.
 * @param array JS array instance
 */
JsStringArrayList(JsArrayStringImpl array) {
	// if null, creates a new JS array
	if (array == null){
		this.array = (JsArrayStringImpl)JsArrayString.createArray().cast();
	} else {
		// uses an existing array
		this.array = array;
	}
}
 
开发者ID:pepstock-org,项目名称:Charba,代码行数:14,代码来源:JsStringArrayList.java

示例13: add

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
/**
 * Adds a multi line label
 * @param values array ofstring which represents a multi line label
 */
public final void add(String... values){
	// checks if is a valid array
	if (values != null && values.length > 0){
		// creates new JS array
		JsArrayString multiValues = JsArrayString.createArray().cast();
		// scans values
		for(String value: values){
			// adds to JS array string
			multiValues.push(value);
		}
		// pushes array to JS array
		push(multiValues);
	}
}
 
开发者ID:pepstock-org,项目名称:Charba,代码行数:19,代码来源:Labels.java

示例14: getProj4jsProjections

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
private static List<String> getProj4jsProjections() {
	List<String> projections = new ArrayList<String>(); 
				
	JsArrayString projDefs = getProjDefs();

	for (int i = 0; i < projDefs.length(); i++) {
		projections.add(projDefs.get(i).trim());
	}

	return projections;
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:12,代码来源:Projections.java

示例15: getExtensionsToLoad

import com.google.gwt.core.client.JsArrayString; //导入依赖的package包/类
public static JsArrayString getExtensionsToLoad() {
  JsArrayString result = JsArrayString.createArray().cast();
  if (INSTANCE != null) {
    for (String s : INSTANCE.extensions) {
      result.push(s);
    }
  }
  return result;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:10,代码来源:AssetManager.java


注:本文中的com.google.gwt.core.client.JsArrayString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。