本文整理匯總了Java中com.google.gwt.core.client.JsArrayString.get方法的典型用法代碼示例。如果您正苦於以下問題:Java JsArrayString.get方法的具體用法?Java JsArrayString.get怎麽用?Java JsArrayString.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.core.client.JsArrayString
的用法示例。
在下文中一共展示了JsArrayString.get方法的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: changeHtmlStyle
import com.google.gwt.core.client.JsArrayString; //導入方法依賴的package包/類
/** Method called to toggle the style in HTML-Mode **/
private void changeHtmlStyle(String startTag, String stopTag) {
JsArrayString tx = getSelection(styleText.getElement());
String txbuffer = styleText.getText();
Integer startpos = Integer.parseInt(tx.get(1));
String selectedText = tx.get(0);
styleText.setText(txbuffer.substring(0, startpos) + startTag + selectedText + stopTag + txbuffer.substring(startpos + selectedText.length()));
}
示例6: 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;
}
示例7: 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;
}
示例8: 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);
}
}
});
}
示例9: 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;
}
}
示例10: 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;
}
示例11: 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());
}
示例12: getLanguages
import com.google.gwt.core.client.JsArrayString; //導入方法依賴的package包/類
@Override
public final List<String> getLanguages() {
JsArrayString langs = getLanguages0();
if(langs == null || langs.length() == 0) {
return Collections.emptyList();
}
List<String> ls = new ArrayList<>();
for(int i = 0; i < langs.length(); i++) {
String l = langs.get(i);
ls.add(l);
}
return ls;
}
示例13: createHeadersMap
import com.google.gwt.core.client.JsArrayString; //導入方法依賴的package包/類
/**
* Inspects the headers object of the given JS object and constructs a
* {@link Map} of its keys and values.
*/
private static Map<String, HeaderValue> createHeadersMap(DynamicJso data) {
DynamicJso headers = data.get("headers");
JsArrayString keys = headers.keys();
Map<String, HeaderValue> headersMap = Maps.newHashMapWithExpectedSize(keys.length());
for (int i = 0; i < keys.length(); i++) {
String key = keys.get(i);
String value = "";
switch (headers.typeofKey(key)) {
case STRING:
value = headers.getString(key);
break;
case BOOLEAN:
value = String.valueOf(headers.getBoolean(key));
break;
case NUMBER:
value = String.valueOf(headers.getInteger(key));
break;
case INTEGER:
value = String.valueOf(headers.getDouble(key));
break;
}
headersMap.put(key.toLowerCase(), new HeaderValue(key, value));
}
return headersMap;
}
示例14: asEvent
import com.google.gwt.core.client.JsArrayString; //導入方法依賴的package包/類
public final StatisticsEvent asEvent() {
return new StatisticsEvent() {
//@Override
public String getModuleName() {
return GwtStatisticsEvent.this.getModuleName();
}
//@Override
public String getSubSystem() {
return GwtStatisticsEvent.this.getSubSystem();
}
//@Override
public String getEventGroupKey() {
return GwtStatisticsEvent.this.getEventGroupKey();
}
//@Override
public double getMillis() {
return GwtStatisticsEvent.this.getMillis();
}
//@Override
public Iterator<String> getExtraParameterNames() {
final JsArrayString names = getExtraParameterNames0();
return new Iterator<String>() {
private int idx = 0;
//@Override
public boolean hasNext() {
return idx < names.length();
}
//@Override
public String next() {
return names.get(idx++);
}
//@Override
public void remove() {
throw new RuntimeException("parameter names are read-only");
}
};
}
//@Override
public Object getExtraParameter(String name) {
return GwtStatisticsEvent.this.getExtraParameter(name);
}
};
}
示例15: convertItem
import com.google.gwt.core.client.JsArrayString; //導入方法依賴的package包/類
public static WebPlotResult convertItem(PlotResultOverlay res) {
WebPlotResult retval;
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());
}
return retval;
}