當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。