本文整理汇总了Java中com.google.gwt.core.client.JsArrayString.length方法的典型用法代码示例。如果您正苦于以下问题:Java JsArrayString.length方法的具体用法?Java JsArrayString.length怎么用?Java JsArrayString.length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.client.JsArrayString
的用法示例。
在下文中一共展示了JsArrayString.length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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];
}
示例2: fromJSON
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
@Override
public Object fromJSON(JsonSerializationHelper helper, JavaScriptObject obj) throws JaxmppException {
String type = JsonSerializationHelper.getStringFromObject(obj, "type");
if (!getJsonType().equals(type)) {
return null;
}
JavaScriptObject presences = JsonSerializationHelper.getObjectFromObject(obj, "items");
JsArrayString jids = JsonSerializationHelper.getKeysFromObject(presences);
for (int i=0; i<jids.length(); i++) {
String key = jids.get(i);
JID jid = JID.jidInstance(key);
JavaScriptObject jsPresence = JsonSerializationHelper.getObjectFromObject(presences, key);
Element el = (Element) helper.fromJSON(jsPresence);
Presence presence = (Presence) Stanza.create(el);
update(presence);
}
return this;
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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;
}
示例6: getMatches
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
@Override
public List<String> getMatches(String test) {
JsArrayString matches = matches(regExp, test);
if (matches != null && matches.length() > 0) {
List<String> result = new ArrayList<String>(matches.length());
for (int i = 0; i < matches.length(); ++i) {
result.add(matches.get(i));
}
return result;
}
return new ArrayList<String>();
}
示例7: getScopes
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
private final String[] getScopes() {
JsArrayString jsa = getScopesNative();
String[] arr = new String[jsa.length()];
for (int i = 0; i < jsa.length(); i++) {
arr[i] = jsa.get(i);
}
return arr;
}
示例8: indexes
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
public final int[] indexes() {
checkNull();
JsArrayString a = keysImpl();
int[] ret = new int[a.length()];
for (int i = 0; i < a.length(); i++) {
try {
ret[i] = Integer.valueOf(a.get(i));
} catch (Exception e) {
ret[i] = i;
}
}
return ret;
}
示例9: keys
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
public final String[] keys() {
checkNull();
JsArrayString a = keysImpl();
String[] ret = new String[a.length()];
for (int i = 0; i < a.length(); i++) {
ret[i] = a.get(i);
}
return ret;
}
示例10: toList
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
public static List<String> toList(JsArrayString array) {
List<String> list = new ArrayList<>();
if(array != null) {
for (int i = 0; i < array.length(); i++) {
list.add(array.get(i));
}
}
return list;
}
示例11: registerFileType
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
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()));
}
editorModule
.getInitializerPromise()
.then(
new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
OrionServiceRegistryOverlay serviceRegistry =
codeEditWidgetProvider.get().getServiceRegistry();
serviceRegistry.doRegisterService(
"orion.core.contenttype",
JavaScriptObject.createObject(),
contentType.toServiceObject());
if (config.getPatterns() != null && config.getPatterns().length() != 0) {
serviceRegistry.doRegisterService(
"orion.edit.highlighter", JavaScriptObject.createObject(), config);
}
}
});
}
示例12: split
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
@Override
public List<String> split(String string, String separator) {
JsArrayString jsArrayString = nativeSplit(string, separator);
List<String> result = new ArrayList<>();
for (int i = 0; i < jsArrayString.length(); i++) {
result.add(jsArrayString.get(i));
}
return result;
}
示例13: toArray
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
/**
* From JSArrays implementation https://code.google.com/p/gwt-in-the-air/source/browse/trunk/src/net/ltgt/gwt/jscollections/client/JsArrays.java
*
* @param values
* @return
*/
static String[] toArray(JsArrayString values) {
if (GWT.isScript()) {
return reinterpretCast(values);
} else {
int length = values.length();
String[] ret = new String[length];
for (int i = 0, l = length; i < l; i++) {
ret[i] = values.get(i);
}
return ret;
}
}
示例14: fromJSON
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
@Override
public Object fromJSON(JsonSerializationHelper helper, JavaScriptObject obj) throws JaxmppException {
String type = JsonSerializationHelper.getStringFromObject(obj, "type");
if (!getJsonType().equals(type)) {
return null;
}
JavaScriptObject items = JsonSerializationHelper.getObjectFromObject(obj, "items");
JsArrayString jids = JsonSerializationHelper.getKeysFromObject(items);
for (int i=0; i<jids.length(); i++) {
String key = jids.get(i);
BareJID jid = BareJID.bareJIDInstance(key);
JavaScriptObject item = JsonSerializationHelper.getObjectFromObject(items, key);
RosterItem ri = new RosterItem(jid, helper.getSessionObject());
JsArrayString propNames = JsonSerializationHelper.getKeysFromObject(item);
for (int j=0; j<propNames.length(); j++) {
String prop = propNames.get(j);
if ("name".equals(prop)) {
ri.setName(JsonSerializationHelper.getStringFromObject(item, prop));
} else if ("sub".equals(prop)) {
ri.setSubscription(Subscription.valueOf(JsonSerializationHelper.getStringFromObject(item, prop)));
} else if ("ask".equals(prop)) {
ri.setAsk(true);
} else if ("groups".equals(prop)) {
JsArrayString groups = (JsArrayString) JsonSerializationHelper.getObjectFromObject(item, prop);
for (int k=0; k<groups.length(); k++) {
String group = groups.get(k);
ri.getGroups().add(group);
}
}
this.addItem(ri);
}
}
return this;
}
示例15: set
import com.google.gwt.core.client.JsArrayString; //导入方法依赖的package包/类
void set(
DiffPreferences prefs,
JsArray<RevisionInfo> list,
int parents,
DiffInfo info,
boolean editExists,
boolean current,
boolean open,
boolean binary) {
this.changeType = info.changeType();
patchSetSelectBoxA.setUpPatchSetNav(
list, parents, info.metaA(), editExists, current, open, binary);
patchSetSelectBoxB.setUpPatchSetNav(
list, parents, info.metaB(), editExists, current, open, binary);
JsArrayString hdr = info.diffHeader();
if (hdr != null) {
StringBuilder b = new StringBuilder();
for (int i = 1; i < hdr.length(); i++) {
String s = hdr.get(i);
if (!info.binary()
&& (s.startsWith("diff --git ")
|| s.startsWith("index ")
|| s.startsWith("+++ ")
|| s.startsWith("--- "))) {
continue;
}
b.append(s).append('\n');
}
String hdrTxt = b.toString().trim();
header = !hdrTxt.isEmpty();
diffHeaderText.setInnerText(hdrTxt);
UIObject.setVisible(diffHeaderRow, header);
} else {
header = false;
UIObject.setVisible(diffHeaderRow, false);
}
setHideEmptyPane(prefs.hideEmptyPane());
}