Search in sources :

Example 26 with JavaScriptObject

use of com.google.gwt.core.client.JavaScriptObject in project gerrit by GerritCodeReview.

the class DownloadBox method saveScheme.

private void saveScheme() {
    String schemeStr = scheme.getValue(scheme.getSelectedIndex());
    GeneralPreferences prefs = Gerrit.getUserPreferences();
    if (Gerrit.isSignedIn() && !schemeStr.equals(prefs.downloadScheme())) {
        prefs.downloadScheme(schemeStr);
        GeneralPreferences in = GeneralPreferences.create();
        in.downloadScheme(schemeStr);
        AccountApi.self().view("preferences").put(in, new AsyncCallback<JavaScriptObject>() {

            @Override
            public void onSuccess(JavaScriptObject result) {
            }

            @Override
            public void onFailure(Throwable caught) {
            }
        });
    }
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) GeneralPreferences(com.google.gerrit.client.info.GeneralPreferences)

Example 27 with JavaScriptObject

use of com.google.gwt.core.client.JavaScriptObject in project gerrit by GerritCodeReview.

the class GroupSuggestOracle method requestSuggestions.

@Override
public void requestSuggestions(final Request req, final Callback done) {
    if (req.getQuery().length() < chars) {
        responseEmptySuggestion(req, done);
        return;
    }
    RestApi rest = new RestApi("/groups/").addParameter("suggest", req.getQuery());
    if (req.getLimit() > 0) {
        rest.addParameter("n", req.getLimit());
    }
    rest.get(new AsyncCallback<NativeMap<JavaScriptObject>>() {

        @Override
        public void onSuccess(NativeMap<JavaScriptObject> result) {
            List<String> keys = result.sortedKeys();
            List<Suggestion> suggestions = new ArrayList<>(keys.size());
            for (String g : keys) {
                suggestions.add(new HighlightSuggestion(req.getQuery(), g));
            }
            done.onSuggestionsReady(req, new Response(suggestions));
        }

        @Override
        public void onFailure(Throwable caught) {
            responseEmptySuggestion(req, done);
        }
    });
}
Also used : RestApi(com.google.gerrit.plugin.client.rpc.RestApi) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) HighlightSuggestion(com.google.gerrit.client.ui.HighlightSuggestion) List(java.util.List) ArrayList(java.util.ArrayList) NativeMap(com.google.gerrit.client.rpc.NativeMap)

Example 28 with JavaScriptObject

use of com.google.gwt.core.client.JavaScriptObject in project gerrit by GerritCodeReview.

the class AccountApi method registerEmail.

/** Register a new email address */
public static void registerEmail(String account, String email, AsyncCallback<EmailInfo> cb) {
    JavaScriptObject in = JavaScriptObject.createObject();
    new RestApi("/accounts/").id(account).view("emails").id(email).ifNoneMatch().put(in, cb);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 29 with JavaScriptObject

use of com.google.gwt.core.client.JavaScriptObject in project rstudio by rstudio.

the class MainWindowObject method set.

public final void set(T value) {
    JavaScriptObject rstudioObject = getRStudioObject(getRStudioMainWindow());
    setImpl(key_, value, rstudioObject);
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 30 with JavaScriptObject

use of com.google.gwt.core.client.JavaScriptObject in project rstudio by rstudio.

the class MainWindowObject method get.

@SuppressWarnings("unchecked")
public final T get() {
    JavaScriptObject rstudioObject = getRStudioObject(getRStudioMainWindow());
    if (!hasImpl(key_, rstudioObject))
        return provider_.defaultValue();
    // Work around JDK 1.6 compiler issues with casting from JSO to T
    JavaScriptObject object = getImpl(key_, rstudioObject);
    T casted = (T) object;
    return casted;
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Aggregations

JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)436 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)333 PerunError (cz.metacentrum.perun.webgui.model.PerunError)212 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)181 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)110 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)110 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)104 ArrayList (java.util.ArrayList)95 JSONObject (com.google.gwt.json.client.JSONObject)79 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)73 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)58 HashMap (java.util.HashMap)34 JSONNumber (com.google.gwt.json.client.JSONNumber)32 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)31 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)31 Map (java.util.Map)25 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)24 JSONString (com.google.gwt.json.client.JSONString)22 Attribute (cz.metacentrum.perun.webgui.model.Attribute)20 Group (cz.metacentrum.perun.webgui.model.Group)19