Search in sources :

Example 1 with JavaScriptObject

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

the class OrionEditorWidget method initBreakpointRuler.

private Gutter initBreakpointRuler(ModuleHolder moduleHolder) {
    JavaScriptObject orionEventTargetModule = moduleHolder.getModule("OrionEventTarget");
    orionLineNumberRuler = editorOverlay.getTextView().getRulers()[1];
    orionLineNumberRuler.overrideOnClickEvent();
    OrionEventTargetOverlay.addMixin(orionEventTargetModule, orionLineNumberRuler);
    return new OrionBreakpointRuler(orionLineNumberRuler, editorOverlay);
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 2 with JavaScriptObject

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

the class OrionEditorWidget method addKeyBinding.

@Override
public void addKeyBinding(final KeyBinding keyBinding, String actionDescription) {
    OrionKeyStrokeOverlay strokeOverlay;
    JavaScriptObject keyBindingModule = moduleHolder.getModule("OrionKeyBinding").cast();
    String type = keyBinding.getType();
    boolean modifier1 = UserAgent.isMac() ? keyBinding.isCmd() : keyBinding.isControl();
    boolean modifier2 = keyBinding.isShift();
    boolean modifier3 = keyBinding.isAlt();
    boolean modifier4 = UserAgent.isMac() ? keyBinding.isControl() : false;
    if (keyBinding.isCharacterBinding()) {
        strokeOverlay = OrionKeyStrokeOverlay.create(keyBinding.getCharacter(), modifier1, modifier2, modifier3, modifier4, type, keyBindingModule);
    } else {
        strokeOverlay = OrionKeyStrokeOverlay.create(keyBinding.getKeyCodeNumber(), modifier1, modifier2, modifier3, modifier4, type, keyBindingModule);
    }
    String actionId = "che-action-" + keyBinding.getAction().toString();
    editorOverlay.getTextView().setKeyBinding(strokeOverlay, actionId);
    editorOverlay.getTextView().setAction(actionId, new Action() {

        @Override
        public boolean onAction() {
            return keyBinding.getAction().action();
        }
    }, actionDescription);
}
Also used : OrionKeyStrokeOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionKeyStrokeOverlay) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 3 with JavaScriptObject

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

the class BrowserLogger method log.

private static void log(Class<?> clazz, LogConfig.LogLevel logLevel, Object... args) {
    String prefix = new StringBuilder(logLevel.toString()).append(" (").append(clazz.getName()).append("): ").toString();
    for (Object o : args) {
        if (o instanceof String) {
            logToBrowser(logLevel, prefix + (String) o);
        } else if (o instanceof Throwable) {
            Throwable t = (Throwable) o;
            logToBrowser(logLevel, prefix + ExceptionUtils.getStackTraceAsString(t));
        } else if (o instanceof JavaScriptObject) {
            logToBrowser(logLevel, prefix + "(JSO below)");
            logToBrowser(logLevel, o);
        } else {
            logToBrowser(logLevel, prefix + (o != null ? o.toString() : "(null)"));
        }
    }
}
Also used : JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject)

Example 4 with JavaScriptObject

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

the class ApplicationFormPage method tryToFindUserByName.

/**
	 * Try to find user by name
	 *
	 * If user found, message box shown
	 *
	 * @param jso returned data
	 */
private void tryToFindUserByName(JavaScriptObject jso) {
    // try to find
    JsonPostClient jspc = new JsonPostClient(new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            ArrayList<Identity> users = JsonUtils.<Identity>jsoAsList(jso);
            if (users != null && !users.isEmpty())
                similarUsersFound(users);
        }
    });
    JSONObject query = new JSONObject();
    if (jso == null) {
        // before app submission
        jspc.sendData("registrarManager/checkForSimilarUsers", query);
    } else {
        // after app submission
        query.put("voId", new JSONNumber(vo.getId()));
        if (group != null) {
            query.put("groupId", new JSONNumber(group.getId()));
        } else {
            query.put("groupId", new JSONNumber(0));
        }
        query.put("type", new JSONString(type));
        jspc.sendData("registrarManager/checkForSimilarUsers", query);
    }
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JSONObject(com.google.gwt.json.client.JSONObject) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) ArrayList(java.util.ArrayList) JSONNumber(com.google.gwt.json.client.JSONNumber) JSONString(com.google.gwt.json.client.JSONString)

Example 5 with JavaScriptObject

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

the class ApplicationFormPage method sendForm.

/**
	 * Send form
	 */
protected void sendForm(final CustomButton button) {
    PerunPrincipal pp = session.getPerunPrincipal();
    // fed info
    String fedInfo = "";
    fedInfo += "{";
    fedInfo += " displayName=\"" + pp.getAdditionInformations("displayName") + "\"";
    fedInfo += " commonName=\"" + pp.getAdditionInformations("cn") + "\"";
    fedInfo += " givenName=\"" + pp.getAdditionInformations("givenName") + "\"";
    fedInfo += " sureName=\"" + pp.getAdditionInformations("sn") + "\"";
    fedInfo += " loa=\"" + pp.getAdditionInformations("loa") + "\"";
    fedInfo += " mail=\"" + pp.getAdditionInformations("mail") + "\"";
    fedInfo += " organization=\"" + pp.getAdditionInformations("o") + "\"";
    fedInfo += " }";
    Application app = Application.construct(vo, group, type, fedInfo, pp.getActor(), pp.getExtSource(), pp.getExtSourceType(), pp.getExtSourceLoa());
    if (session.getUser() != null) {
        // set user association if known from perun
        app.setUser(session.getUser());
    }
    // loading
    final PopupPanel loadingBox = session.getUiElements().perunLoadingBox(ApplicationMessages.INSTANCE.processing());
    // Create application request
    CreateApplication ca = new CreateApplication(JsonCallbackEvents.disableButtonEvents(button, new JsonCallbackEvents() {

        @Override
        public void onLoadingStart() {
            // show loading box
            loadingBox.show();
        }

        @Override
        public void onFinished(JavaScriptObject jso) {
            loadingBox.hide();
            formOk(jso);
        }

        @Override
        public void onError(PerunError err) {
            loadingBox.hide();
            formError(err);
        }
    }));
    // Send the request
    ca.createApplication(app, data);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) CreateApplication(cz.metacentrum.perun.webgui.json.registrarManager.CreateApplication) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JSONString(com.google.gwt.json.client.JSONString) CreateApplication(cz.metacentrum.perun.webgui.json.registrarManager.CreateApplication)

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