Search in sources :

Example 56 with JavaScriptObject

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

the class ChangeNonAuthzPassword method changeNonAuthzPassword.

/**
	 * Changes password for the user
	 *
	 * @param i        encrypted value 1
	 * @param m        encrypted value 2
	 * @param password new password to set
	 */
public void changeNonAuthzPassword(String i, String m, String password) {
    this.i = i;
    this.m = m;
    this.password = password;
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Changing password failed.");
            // custom events
            events.onError(error);
        }

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Password changed successfully.");
            events.onFinished(jso);
        }

        public void onLoadingStart() {
            events.onLoadingStart();
        }
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.sendData(JSON_URL, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 57 with JavaScriptObject

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

the class ChangePassword method changePassword.

/**
	 * Changes password for the user
	 *
	 * @param user User to change password for
	 * @param loginNamespace Login namespace
	 * @param oldPassword Old password for comparing
	 * @param newPassword New password
	 */
public void changePassword(User user, String loginNamespace, String oldPassword, String newPassword) {
    this.user = user;
    this.loginNamespace = loginNamespace;
    this.oldPassword = oldPassword;
    this.newPassword = newPassword;
    // test arguments
    if (!this.testAdding()) {
        return;
    }
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Changing password failed.");
            // custom events
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Password changed successfully.");
            events.onFinished(jso);
        }

        ;

        public void onLoadingStart() {
            events.onLoadingStart();
        }

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.sendData(JSON_URL, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 58 with JavaScriptObject

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

the class CreateCompleteService method createCompleteService.

/**
	 * Attempts to create a new Service including both ExecServices with dependency,
	 * it first tests the values and then submits them.
	 *
	 * @param name service Name
	 * @param scriptPath Path to the service script, default "./service_name"
	 * @param defaultDelay Delay in minutes when service is rescheduled (10 min is default)
	 * @param enabled TRUE if service should be enabled
	 */
public void createCompleteService(final String name, final String scriptPath, final int defaultDelay, final boolean enabled) {
    this.serviceName = name;
    this.scriptPath = scriptPath;
    this.defaultDelay = defaultDelay;
    this.enabled = enabled;
    // test arguments
    if (!this.testCreating()) {
        return;
    }
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Creating service " + serviceName + " failed.");
            // custom events
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Service " + serviceName + " created.");
            events.onFinished(jso);
        }

        ;

        public void onLoadingStart() {
            events.onLoadingStart();
        }

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.sendData(JSON_URL, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 59 with JavaScriptObject

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

the class CreateServicePackage method createServicePackage.

/**
	 * Attempts to create a new ServicesPackage, it first tests the values and then submits them.
	 *
	 * @param name service package name
	 * @param description service package description
	 */
public void createServicePackage(final String name, final String description) {
    this.packageName = name;
    this.packageDescription = description;
    // test arguments
    if (!this.testCreating()) {
        return;
    }
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Creating service package " + packageName + " failed.");
            // custom events
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Service package " + packageName + " created.");
            events.onFinished(jso);
        }

        ;

        public void onLoadingStart() {
            events.onLoadingStart();
        }

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.sendData(JSON_URL, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 60 with JavaScriptObject

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

the class DeleteService method deleteService.

/**
	 * Attempts to delete a service, tests values first
	 *
	 * @param serviceId id of service to be deleted
	 */
public void deleteService(final int serviceId) {
    this.serviceId = serviceId;
    // test arguments
    if (!this.testDeleting()) {
        return;
    }
    // new events
    JsonCallbackEvents newEvents = new JsonCallbackEvents() {

        public void onError(PerunError error) {
            session.getUiElements().setLogErrorText("Deleting service: " + serviceId + " failed.");
            events.onError(error);
        }

        ;

        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Service : " + serviceId + " deleted !");
            events.onFinished(jso);
        }

        ;

        public void onLoadingStart() {
            events.onLoadingStart();
        }

        ;
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(newEvents);
    jspc.sendData(JSON_URL, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Aggregations

JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)357 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)286 PerunError (cz.metacentrum.perun.webgui.model.PerunError)173 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)149 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)105 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)105 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)98 ArrayList (java.util.ArrayList)86 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)67 JSONObject (com.google.gwt.json.client.JSONObject)54 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)54 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)28 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)28 HashMap (java.util.HashMap)27 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)22 JSONNumber (com.google.gwt.json.client.JSONNumber)19 User (cz.metacentrum.perun.webgui.model.User)18 AjaxLoaderImage (cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage)18 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)18 Map (java.util.Map)18