Search in sources :

Example 1 with Confirm

use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.

the class CreatePassword method validateAndSetUserExtSources.

/**
	 * Validates password and sets user ext sources
	 *
	 * @param userId user to set password for
	 * @param login used for validation only
	 * @param namespace defined login in namespace
	 */
public void validateAndSetUserExtSources(int userId, String login, String namespace) {
    this.userId = userId;
    this.namespace = namespace;
    this.login = login;
    // test arguments
    String errorMsg = "";
    if (userId == 0) {
        errorMsg += "<p>User ID can't be 0.";
    }
    if (namespace.isEmpty()) {
        errorMsg += "<p>Namespace can't be empty.";
    }
    if (login.isEmpty()) {
        errorMsg += "<p>Login to create password for can't be empty.";
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating password.", new HTML(errorMsg), true);
        c.show();
        return;
    }
    JsonPostClient jspc = new JsonPostClient(events);
    jspc.sendData(JSON_URL_VALIDATE_AND_SET_USER_EXT_SOURCE, validateCallJSON());
}
Also used : JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML) JSONString(com.google.gwt.json.client.JSONString)

Example 2 with Confirm

use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.

the class RemoveUserExtSource method testRemoving.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testRemoving() {
    boolean result = true;
    String errorMsg = "";
    if (userId == 0) {
        errorMsg += "Wrong parameter <strong>User ID</strong>. ";
        result = false;
    }
    if (uesId == 0) {
        errorMsg += "Wrong parameter <strong>User Ext Source ID</strong>. ";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while adding user external source", new HTML(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML)

Example 3 with Confirm

use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.

the class CreateVo method testCreating.

/**
 * Tests the values, if the process can continue
 *
 * @return
 */
private boolean testCreating() {
    boolean result = true;
    String errorMsg = "";
    if (name.length() == 0) {
        errorMsg += "You must fill in the parameter <strong>Name</strong>.<br />";
        result = false;
    }
    if (shortName.length() == 0) {
        errorMsg += "You must fill in the parameter <strong>Short name</strong>.<br />";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating VO", new HTML(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML) JSONString(com.google.gwt.json.client.JSONString)

Example 4 with Confirm

use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.

the class AddUserExtSource method testAdding.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testAdding() {
    boolean result = true;
    String errorMsg = "";
    if (userId == 0) {
        errorMsg += "Wrong parameter <strong>User ID</strong>.\n";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while adding user external source", new HTML(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML) JSONString(com.google.gwt.json.client.JSONString)

Example 5 with Confirm

use of cz.metacentrum.perun.webgui.widgets.Confirm in project perun by CESNET.

the class CreatePassword method createRandomPassword.

/**
 * Create empty password for the user - random password is generated on KDC side
 *
 * @param userId user to set password for
 * @param login used for validation only
 * @param namespace defined login in namespace
 */
public void createRandomPassword(int userId, String login, String namespace) {
    this.userId = userId;
    this.namespace = namespace;
    this.login = login;
    // test arguments
    String errorMsg = "";
    if (userId == 0) {
        errorMsg += "<p>User ID can't be 0.";
    }
    if (namespace.isEmpty()) {
        errorMsg += "<p>Namespace can't be empty.";
    }
    if (login.isEmpty()) {
        errorMsg += "<p>Login to create password for can't be empty.";
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating password.", new HTML(errorMsg), true);
        c.show();
        return;
    }
    // final events
    final JsonCallbackEvents newEvents = new JsonCallbackEvents() {

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

        @Override
        public void onFinished(JavaScriptObject jso) {
            session.getUiElements().setLogSuccessText("Password created successfully.");
            events.onFinished(jso);
        }
    };
    // validate event
    JsonCallbackEvents validateEvent = new JsonCallbackEvents() {

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

        @Override
        public void onFinished(JavaScriptObject jso) {
            JsonPostClient jspc = new JsonPostClient(newEvents);
            jspc.sendData(JSON_URL_VALIDATE, validateCallJSON());
        }

        @Override
        public void onLoadingStart() {
            events.onLoadingStart();
        }
    };
    // sending data
    JsonPostClient jspc = new JsonPostClient(validateEvent);
    jspc.sendData(JSON_URL_RESERVE_RANDOM, prepareJSONObject());
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) JsonPostClient(cz.metacentrum.perun.webgui.json.JsonPostClient) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) HTML(com.google.gwt.user.client.ui.HTML) JSONString(com.google.gwt.json.client.JSONString) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Aggregations

Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)49 HTML (com.google.gwt.user.client.ui.HTML)26 JSONString (com.google.gwt.json.client.JSONString)19 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)16 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)16 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)15 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)12 Label (com.google.gwt.user.client.ui.Label)8 PerunError (cz.metacentrum.perun.webgui.model.PerunError)8 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)8 Column (com.google.gwt.user.cellview.client.Column)5 ListHandler (com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler)5 ArrayList (java.util.ArrayList)5 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)4 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)4 FlexTable (com.google.gwt.user.client.ui.FlexTable)3 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)3 RegistrarFormItemGenerator (cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator)3 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)3 Context (com.google.gwt.cell.client.Cell.Context)2