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;
}
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;
}
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();
}
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;
}
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;
}
Aggregations