Search in sources :

Example 11 with Confirm

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

the class SetAttributes method testSetting.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testSetting() {
    boolean result = true;
    String errorMsg = "";
    if (this.ids.isEmpty()) {
        errorMsg += "Wrong attribute type value.\n";
        result = false;
    }
    // silent skip - used by save changes buttons on attributes pages
    if (attributes == null || attributes.isEmpty()) {
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while setting attributes", new Label(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Label(com.google.gwt.user.client.ui.Label) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm)

Example 12 with Confirm

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

the class UpdateAttribute method testUpdating.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testUpdating() {
    boolean result = true;
    String errorMsg = "";
    if (attributeDefinition == null) {
        errorMsg += "Attribute to update can't be null.</ br>";
        result = false;
    }
    if (attributeDefinition.getId() == 0) {
        errorMsg += "Wrong ID of attribute definition.</ br>";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating attribute", 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 13 with Confirm

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

the class WebGui method showCurrentGDPRApproval.

private void showCurrentGDPRApproval(Map<String, Integer> ids, Attribute a, Map<String, String> approvedAdminGDPR, String currentVersion, JsonCallbackEvents finishEvents) {
    String gdprApprovalText = session.getConfiguration().getGDPRproperty("text");
    String agreeButtonText = session.getConfiguration().getGDPRproperty("agree");
    String disagreeButtonText = session.getConfiguration().getGDPRproperty("disagree");
    String disagreeResult = session.getConfiguration().getGDPRproperty("disagree_result");
    String title = session.getConfiguration().getGDPRproperty("title");
    String backToGdprConfirm = session.getConfiguration().getGDPRproperty("disagree_back");
    HTML html = new HTML("<div height=\"500\" width=\"420\">" + gdprApprovalText + "</div>");
    Confirm gdprConfirm = new Confirm(title, html, new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            SetAttribute setAttribute = new SetAttribute(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    // approved finish loading UI
                    finishEvents.onFinished(null);
                }

                @Override
                public void onError(PerunError error) {
                    error.setErrorInfo("Failed to store your GDPR approval for version: " + currentVersion);
                    finishEvents.onError(error);
                }
            });
            approvedAdminGDPR.put(currentVersion, JsonUtils.getCurrentDateAsString());
            a.setValueAsMap(approvedAdminGDPR);
            setAttribute.setAttribute(ids, a);
        }
    }, new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Confirm disagreeConfirm = new Confirm(title, new HTML(disagreeResult), false);
            disagreeConfirm.setNonScrollable(true);
            disagreeConfirm.setAutoHide(false);
            disagreeConfirm.setOkButtonText(backToGdprConfirm);
            disagreeConfirm.setOkClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    finishEvents.onError(null);
                    Window.Location.reload();
                }
            });
            disagreeConfirm.show();
        }
    }, agreeButtonText, disagreeButtonText, true);
    gdprConfirm.setNonScrollable(true);
    gdprConfirm.setAutoHide(false);
    gdprConfirm.show();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) PerunError(cz.metacentrum.perun.webgui.model.PerunError) SetAttribute(cz.metacentrum.perun.webgui.json.attributesManager.SetAttribute)

Example 14 with Confirm

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

the class ConvertAttributeToNonUnique method testDeleting.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testDeleting() {
    boolean result = true;
    String errorMsg = "";
    if (attrDefId == 0) {
        errorMsg += "Wrong Attribute definition ID parameter.\n";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while modifying attribute", new Label(errorMsg), true);
        c.show();
    }
    return result;
}
Also used : Label(com.google.gwt.user.client.ui.Label) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm)

Example 15 with Confirm

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

the class CreateAttribute method testCreating.

/**
 * Tests the values, if the process can continue
 *
 * @return true/false for continue/stop
 */
private boolean testCreating() {
    boolean result = true;
    String errorMsg = "";
    if (friendlyName.length() == 0) {
        errorMsg += "You must enter attribute <strong>Friendly name</strong>.</ br>";
        result = false;
    }
    if (friendlyName.length() == 0) {
        errorMsg += "You must enter attribute <strong>Display name</strong>.</ br>";
        result = false;
    }
    if (namespace.length() == 0) {
        errorMsg += "Wrong parameter <strong>EntityType+DefinitionType</strong>.</ br>";
        result = false;
    }
    if (type.length() == 0) {
        errorMsg += "Wrong parameter <strong>Values type</strong>.</ br>";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating attribute", 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)

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