use of com.google.gwt.core.client.JsArrayString in project gerrit by GerritCodeReview.
the class ReplyBox method renderLabels.
private void renderLabels(List<String> names, NativeMap<LabelInfo> all, NativeMap<JsArrayString> permitted) {
TreeSet<Short> values = new TreeSet<>();
List<LabelAndValues> labels = new ArrayList<>(permitted.size());
for (String id : names) {
JsArrayString p = permitted.get(id);
if (p != null) {
if (!all.containsKey(id)) {
continue;
}
Set<Short> a = new TreeSet<>();
for (int i = 0; i < p.length(); i++) {
a.add(LabelInfo.parseValue(p.get(i)));
}
labels.add(new LabelAndValues(all.get(id), a));
values.addAll(a);
}
}
List<Short> columns = new ArrayList<>(values);
labelsTable.resize(1 + labels.size(), 2 + values.size());
for (int c = 0; c < columns.size(); c++) {
labelsTable.setText(0, 1 + c, LabelValue.formatValue(columns.get(c)));
labelsTable.getCellFormatter().setStyleName(0, 1 + c, style.label_value());
}
List<LabelAndValues> checkboxes = new ArrayList<>(labels.size());
int row = 1;
for (LabelAndValues lv : labels) {
if (isCheckBox(lv.info.valueSet())) {
checkboxes.add(lv);
} else {
renderRadio(row++, columns, lv);
}
}
for (LabelAndValues lv : checkboxes) {
renderCheckBox(row++, lv);
}
}
use of com.google.gwt.core.client.JsArrayString in project GwtMobile by dennisjzh.
the class EntityInternal method index.
public void index(String[] columns, boolean unique) {
JsArrayString jsArray = (JsArrayString) JavaScriptObject.createArray();
for (int i = 0; i < columns.length; i++) {
String col = columns[i];
jsArray.set(i, col);
}
index(jsArray, false, getNativeObject());
}
use of com.google.gwt.core.client.JsArrayString in project GwtMobile by dennisjzh.
the class File method getRootPaths.
// fileMgr methods are not in phonegap doc yet.
public static String[] getRootPaths() {
JsArrayString jsArray = getRootPathsNative();
String[] array = new String[jsArray.length()];
for (int i = 0; i < jsArray.length(); i++) {
array[i] = jsArray.get(i);
}
return array;
}
use of com.google.gwt.core.client.JsArrayString in project che by eclipse.
the class WorkerGlobalScope method importScripts.
public final void importScripts(String[] urls) {
JsArrayString jsUrls = JsArrayString.createArray().cast();
for (int i = 0, l = urls.length; i < l; ++i) {
jsUrls.set(i, urls[i]);
}
importScripts(jsUrls);
}
use of com.google.gwt.core.client.JsArrayString in project che by eclipse.
the class RequireJsLoader method configureGlobalErrorCallback.
protected static void configureGlobalErrorCallback() {
Requirejs.get().setOnError(new RequirejsErrorHandler() {
@Override
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());
}
}
});
}
Aggregations