Search in sources :

Example 46 with JsArrayString

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);
    }
}
Also used : TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 47 with JsArrayString

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());
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 48 with JsArrayString

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;
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 49 with JsArrayString

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);
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 50 with JsArrayString

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());
            }
        }
    });
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)86 ArrayList (java.util.ArrayList)15 JSONString (com.google.gwt.json.client.JSONString)5 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)5 ServerError (org.rstudio.studio.client.server.ServerError)4 JsArrayInteger (com.google.gwt.core.client.JsArrayInteger)3 Command (com.google.gwt.user.client.Command)3 List (java.util.List)3 KeySequence (org.rstudio.core.client.command.KeyboardShortcut.KeySequence)3 JsObject (org.rstudio.core.client.js.JsObject)3 RmdTemplateFormatOption (org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption)3 JsArrayBoolean (com.google.gwt.core.client.JsArrayBoolean)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 Label (com.google.gwt.user.client.ui.Label)2 OperationException (org.eclipse.che.api.promises.client.OperationException)2 Handler (org.rstudio.core.client.command.Handler)2 EnsureHeightHandler (org.rstudio.core.client.events.EnsureHeightHandler)2 EnsureVisibleHandler (org.rstudio.core.client.events.EnsureVisibleHandler)2 ChangeFontSizeHandler (org.rstudio.studio.client.application.events.ChangeFontSizeHandler)2 RmdFrontMatterOutputOptions (org.rstudio.studio.client.rmarkdown.model.RmdFrontMatterOutputOptions)2