Search in sources :

Example 36 with Confirm

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

the class GetFormItems method prepareSettings.

/**
 * Prepares the widgets from the items as A FORM FOR SETTINGS
 *
 * @param items
 */
public void prepareSettings(final ArrayList<ApplicationFormItem> items) {
    // refresh table events
    final JsonCallbackEvents refreshEvents = new JsonCallbackEvents() {

        public void onFinished(JavaScriptObject jso) {
            prepareSettings(items);
        }
    };
    FlexTable ft = new FlexTable();
    ft.setWidth("100%");
    ft.setCellPadding(8);
    FlexCellFormatter fcf = ft.getFlexCellFormatter();
    ft.addStyleName("borderTable");
    ft.setHTML(0, 0, "<strong>Short name</strong>");
    ft.setHTML(0, 1, "<strong>Type</strong>");
    ft.setHTML(0, 2, "<strong>Disabled</strong>");
    ft.setHTML(0, 3, "<strong>Hidden</strong>");
    ft.setHTML(0, 4, "<strong>Preview</strong>");
    ft.setHTML(0, 5, "<strong>Edit</strong>");
    fcf.setStyleName(0, 0, "header");
    fcf.setStyleName(0, 1, "header");
    fcf.setStyleName(0, 2, "header");
    fcf.setStyleName(0, 3, "header");
    fcf.setStyleName(0, 4, "header");
    fcf.setStyleName(0, 5, "header");
    String locale = "en";
    if (!Utils.getNativeLanguage().isEmpty() && !LocaleInfo.getCurrentLocale().getLocaleName().equals("default") && !LocaleInfo.getCurrentLocale().getLocaleName().equals("en")) {
        locale = Utils.getNativeLanguage().get(0);
    }
    int i = 1;
    for (final ApplicationFormItem item : items) {
        final int index = i - 1;
        // not yet set locale on config page
        RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, locale);
        // 0 = label
        String label = "";
        label = item.getShortname();
        if (item.isRequired() == true) {
            label += "*";
        }
        ft.setHTML(i, 0, SafeHtmlUtils.fromString(label).asString());
        // 1 = type
        Label type_label = new Label(CreateFormItemTabItem.inputTypes.get(item.getType()));
        type_label.setTitle(item.getType());
        ft.setWidget(i, 1, type_label);
        // 2 = disabled
        if (item.getDisabled() != "NEVER") {
            Image lockIcon = new Image(SmallIcons.INSTANCE.lockIcon());
            String dependency = item.getDisabledDependencyItemId() == 0 ? "(self)" : items.stream().filter(it -> it.getId() == item.getDisabledDependencyItemId()).collect(Collectors.toList()).get(0).getShortname();
            VerticalPanel lockPanel = createVPForIcon(lockIcon, item.getDisabled(), "disabled", dependency);
            ft.setWidget(i, 2, lockPanel);
        }
        // 3 = hidden
        if (item.getHidden() != "NEVER") {
            Image eyeIcon = new Image(SmallIcons.INSTANCE.hiddenIcon());
            String dependency = item.getHiddenDependencyItemId() == 0 ? "(self)" : items.stream().filter(it -> it.getId() == item.getHiddenDependencyItemId()).collect(Collectors.toList()).get(0).getShortname();
            VerticalPanel eyePanel = createVPForIcon(eyeIcon, item.getHidden(), "hidden", dependency);
            ft.setWidget(i, 3, eyePanel);
        }
        // 4 = preview
        Widget w = gen.getWidget();
        ft.setWidget(i, 4, w);
        // 5 = EDIT
        FlexTable editTable = new FlexTable();
        editTable.setStyleName("noBorder");
        ft.setWidget(i, 5, editTable);
        JsArrayString appTypes = item.getApplicationTypes();
        if (appTypes == null || appTypes.length() == 0) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-unused");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-unused");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-unused");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-unused");
            ft.getFlexCellFormatter().setStyleName(i, 4, "log-unused");
            ft.getFlexCellFormatter().setStyleName(i, 5, "log-unused");
        }
        // color for items with unsaved changes
        if (item.wasEdited() == true) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 4, "log-changed");
            ft.getFlexCellFormatter().setStyleName(i, 5, "log-changed");
        }
        // mark row for deletion
        if (item.isForDelete()) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 4, "log-error");
            ft.getFlexCellFormatter().setStyleName(i, 5, "log-error");
            // undelete button
            CustomButton undelete = new CustomButton(ButtonTranslation.INSTANCE.undeleteFormItemButton(), ButtonTranslation.INSTANCE.undeleteFormItem(), SmallIcons.INSTANCE.arrowLeftIcon(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    items.get(index).setForDelete(false);
                    // refresh
                    prepareSettings(items);
                }
            });
            FlexTable undelTable = new FlexTable();
            undelTable.setStyleName("noBorder");
            undelTable.setHTML(0, 0, "<strong><span style=\"color:red;\">MARKED FOR DELETION</span></strong>");
            undelTable.setWidget(0, 1, undelete);
            ft.setWidget(i, 3, undelTable);
        }
        // color for new items to be saved
        if (item.getId() < 0) {
            ft.getFlexCellFormatter().setStyleName(i, 0, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 1, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 2, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 3, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 4, "log-success");
            ft.getFlexCellFormatter().setStyleName(i, 5, "log-success");
        }
        // up
        PushButton upButton = new PushButton(new Image(SmallIcons.INSTANCE.arrowUpIcon()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (index - 1 < 0) {
                    // move to the bottom
                    items.remove(index);
                    items.add(item);
                    for (int i = 0; i < items.size(); i++) {
                        items.get(i).setOrdnum(i);
                    }
                } else {
                    // move it up
                    items.remove(index);
                    items.add(index - 1, item);
                    item.setOrdnum(item.getOrdnum() - 1);
                }
                item.setEdited(true);
                // refresh
                prepareSettings(items);
            }
        });
        editTable.setWidget(0, 0, upButton);
        upButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemUp());
        // down
        PushButton downButton = new PushButton(new Image(SmallIcons.INSTANCE.arrowDownIcon()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (index + 1 >= items.size()) {
                    // move to the top
                    items.remove(index);
                    items.add(0, item);
                    for (int i = 0; i < items.size(); i++) {
                        items.get(i).setOrdnum(i);
                    }
                } else {
                    // move it down
                    items.remove(index);
                    items.add(index + 1, item);
                    item.setOrdnum(item.getOrdnum() + 1);
                }
                item.setEdited(true);
                // refresh
                prepareSettings(items);
            }
        });
        editTable.setWidget(0, 1, downButton);
        downButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemDown());
        // edit
        CustomButton editButton = new CustomButton(ButtonTranslation.INSTANCE.editFormItemButton(), ButtonTranslation.INSTANCE.editFormItem(), SmallIcons.INSTANCE.applicationFormEditIcon());
        editButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (group == null) {
                    session.getTabManager().addTabToCurrentTab(new EditFormItemTabItem(id, 0, item, applFormItems, refreshEvents));
                } else {
                    session.getTabManager().addTabToCurrentTab(new EditFormItemTabItem(group.getVoId(), group.getId(), item, applFormItems, refreshEvents));
                }
            }
        });
        editTable.setWidget(0, 2, editButton);
        // remove
        CustomButton removeButton = new CustomButton(ButtonTranslation.INSTANCE.deleteButton(), ButtonTranslation.INSTANCE.deleteFormItem(), SmallIcons.INSTANCE.deleteIcon());
        removeButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                boolean forDelete = false;
                for (ApplicationFormItem it : items) {
                    if (it.isForDelete())
                        forDelete = true;
                }
                if (forDelete || items.get(index).getId() < 0) {
                    // mark for deletion when save changes
                    items.get(index).setForDelete(true);
                    // remove if newly created
                    if (items.get(index).getId() < 0) {
                        items.remove(index);
                    }
                    // refresh
                    prepareSettings(items);
                } else {
                    HTML text = new HTML("<p>Deleting of form items is <strong>NOT RECOMMENDED!</strong><p>You will loose access to data users submitted in older applications within this form item!<p>Do you want to continue?");
                    Confirm c = new Confirm("Delete confirm", text, new ClickHandler() {

                        public void onClick(ClickEvent event) {
                            // mark for deletion when save changes
                            items.get(index).setForDelete(true);
                            // refresh
                            prepareSettings(items);
                        }
                    }, true);
                    c.setNonScrollable(true);
                    c.show();
                }
            }
        });
        editTable.setWidget(0, 3, removeButton);
        if ((PerunEntity.GROUP.equals(entity) && !session.isGroupAdmin(id) && !session.isVoAdmin(group.getVoId())) || (PerunEntity.VIRTUAL_ORGANIZATION.equals(entity) && !session.isVoAdmin(id))) {
            editButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
            removeButton.setEnabled(false);
        }
        // format
        fcf.setHeight(i, 0, "28px");
        fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
        fcf.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_MIDDLE);
        fcf.setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);
        i++;
    }
    // set empty table widget
    if (items == null || items.isEmpty()) {
        ft.setWidget(1, 0, loaderImage);
        ft.getFlexCellFormatter().addStyleName(1, 0, "noBorder");
        ft.getFlexCellFormatter().setColSpan(1, 0, 6);
    }
    contents.setWidget(ft);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) AjaxLoaderImage(cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage) EditFormItemTabItem(cz.metacentrum.perun.webgui.tabs.registrartabs.EditFormItemTabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) RegistrarFormItemGenerator(cz.metacentrum.perun.webgui.client.applicationresources.RegistrarFormItemGenerator) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton)

Example 37 with Confirm

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

the class AddUserToBlacklist 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 (securityTeamId == 0) {
        errorMsg += "Wrong parameter <strong>SECURITY TEAM ID</strong>.\n";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while adding user to blacklist", 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 38 with Confirm

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

the class WebGui method loadPerunPrincipal.

/**
 * Performs a login into the RPC, loads user and his roles into session and enables GUI.
 */
private void loadPerunPrincipal() {
    // WEB PAGE SPLITTER
    final DockLayoutPanel bodySplitter = new DockLayoutPanel(Unit.PX);
    body.add(bodySplitter);
    // MAIN CONTENT WRAPPER - make content resize-able
    final ResizeLayoutPanel contentWrapper = new ResizeLayoutPanel();
    contentWrapper.setSize("100%", "100%");
    // MAIN CONTENT
    AbsolutePanel contentPanel = new AbsolutePanel();
    contentPanel.setSize("100%", "100%");
    // put content into wrapper
    contentWrapper.setWidget(contentPanel);
    // SETUP SESSION
    // store handler for main contetn's elements (tabs etc.) into session
    session.setUiElements(new UiElements(contentPanel));
    // Store TabManager into session for handling tabs (add/remove/close...)
    session.setTabManager(new TabManager());
    // Store this class into session
    session.setWebGui(webgui);
    // Set this class as browser's History handler
    History.addValueChangeHandler(webgui);
    // show loading box
    final PopupPanel loadingBox = session.getUiElements().perunLoadingBox();
    loadingBox.show();
    // events after getting PerunPrincipal from RPC
    final JsonCallbackEvents events = new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            // store perun principal into session for future use
            final PerunPrincipal pp = (PerunPrincipal) jso;
            session.setPerunPrincipal(pp);
            GetGuiConfiguration getConfig = new GetGuiConfiguration(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    session.setConfiguration((BasicOverlayType) jso.cast());
                    String newGuiAlertContent = session.getConfiguration().getCustomProperty("newAdminGuiAlert");
                    if (newGuiAlertContent != null && !newGuiAlertContent.isEmpty()) {
                        DOM.getElementById("perun-new-gui-alert").setInnerHTML(newGuiAlertContent);
                        DOM.getElementById("perun-new-gui-alert").setClassName("newGuiAlertActive");
                    }
                    // check if user exists
                    if (session.getUser() == null && !pp.getRoles().hasAnyRole()) {
                        // if not and no role, redraw page body
                        RootLayoutPanel body = RootLayoutPanel.get();
                        loadingBox.hide();
                        body.clear();
                        body.add(new NotUserOfPerunWidget());
                        return;
                    }
                    // check if user exists
                    if (session.getUser().isServiceUser()) {
                        // if not and no role, redraw page body
                        RootLayoutPanel body = RootLayoutPanel.get();
                        loadingBox.hide();
                        body.clear();
                        body.add(new CantLogAsServiceUserWidget());
                        return;
                    }
                    // Sets URL mapper for loading proper tabs
                    urlMapper = new UrlMapper();
                    // MENU WRAPPER
                    VerticalPanel menuWrapper = new VerticalPanel();
                    menuWrapper.setHeight("100%");
                    // add menu
                    menuWrapper.add(session.getUiElements().getMenu().getWidget());
                    menuWrapper.setCellVerticalAlignment(session.getUiElements().getMenu().getWidget(), HasVerticalAlignment.ALIGN_TOP);
                    // Put all panels into web page splitter
                    // bodySplitter.addNorth(session.getUiElements().getHeader(), 78);
                    bodySplitter.addNorth(session.getUiElements().getHeader(), 64);
                    bodySplitter.addSouth(session.getUiElements().getFooter(), 30);
                    bodySplitter.addWest(menuWrapper, 202);
                    // content must be added as last !!
                    bodySplitter.add(contentWrapper);
                    // Append more GUI elements from UiElements class which are not part of splitted design
                    if ("true".equalsIgnoreCase(Location.getParameter("log"))) {
                        // log
                        bodySplitter.getElement().appendChild(session.getUiElements().getLog().getElement());
                    }
                    // status
                    bodySplitter.getElement().appendChild(session.getUiElements().getStatus().getElement());
                    // keep alive
                    VerticalPanel vp = new VerticalPanel();
                    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                    vp.add(new HTML("<h2>Connection to Perun has been lost.</h2><strong>Please check your internet connection.</strong>"));
                    final FlexTable layout = new FlexTable();
                    layout.setVisible(false);
                    layout.setHTML(0, 0, "<p>You can also try to <strong>refresh the browser window</strong>. However, all <strong>unsaved changes will be lost</strong>.");
                    layout.getFlexCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_TOP);
                    vp.add(layout);
                    vp.setSpacing(10);
                    final Confirm c = new Confirm("", vp, true);
                    c.setAutoHide(false);
                    c.setHideOnButtonClick(false);
                    c.setOkIcon(SmallIcons.INSTANCE.arrowRefreshIcon());
                    c.setOkButtonText("Re-connect");
                    c.setNonScrollable(true);
                    c.setOkClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            KeepAlive call = new KeepAlive(JsonCallbackEvents.disableButtonEvents(c.getOkButton(), new JsonCallbackEvents() {

                                @Override
                                public void onLoadingStart() {
                                    checkPending = true;
                                }

                                @Override
                                public void onFinished(JavaScriptObject jso) {
                                    BasicOverlayType type = jso.cast();
                                    checkPending = false;
                                    connected = true;
                                    keepAliveCounter = 0;
                                    if (type.getString().equals("OK")) {
                                        if (c.isShowing()) {
                                            c.hide();
                                        }
                                    }
                                    // If ok, append new keepalive checker
                                    appendKeepAliveChecker(c);
                                }

                                @Override
                                public void onError(PerunError error) {
                                    checkPending = false;
                                    // connection lost only IF TIMEOUT
                                    if (error != null && error.getErrorId().equals("0")) {
                                        keepAliveCounter++;
                                        if (keepAliveCounter >= keepAliveTreshold) {
                                            connected = false;
                                            if (!c.isShowing()) {
                                                c.show();
                                            }
                                            layout.setVisible(true);
                                            c.getOkButton().setText("Reload");
                                            c.getOkButton().addClickHandler(new ClickHandler() {

                                                @Override
                                                public void onClick(ClickEvent event) {
                                                    Window.Location.reload();
                                                }
                                            });
                                        } else {
                                            // not connected but under treshold
                                            appendKeepAliveChecker(c);
                                        }
                                    }
                                }
                            }));
                            call.retrieveData();
                        }
                    });
                    appendKeepAliveChecker(c);
                    // store users roles and editable entities into session
                    session.setRoles(pp.getRoles());
                    // display logged user
                    session.getUiElements().setLoggedUserInfo(pp);
                    session.getUiElements().setLogText("Welcome " + pp.getUser().getFullNameWithTitles());
                    // show extended info ?
                    boolean showExtendedInfo = false;
                    // is perun admin ?
                    if (session.isPerunAdmin()) {
                        showExtendedInfo = true;
                    }
                    // replace by local storage if possible
                    Storage localStorage = Storage.getLocalStorageIfSupported();
                    if (localStorage != null) {
                        String value = localStorage.getItem("urn:perun:gui:preferences:extendedInfo");
                        if (value != null) {
                            showExtendedInfo = Boolean.parseBoolean(value);
                        }
                    }
                    // finally set it
                    JsonUtils.setExtendedInfoVisible(showExtendedInfo);
                    // set extended info button
                    session.getUiElements().getExtendedInfoButtonWidget().setDown(showExtendedInfo);
                    // Specific GDPR approval is required only from admins
                    if (session.isFacilityAdmin() || session.isVoAdmin() || session.isVoObserver() || session.isGroupAdmin() || session.isPerunAdmin() || session.isSecurityAdmin()) {
                        checkGdprApproval(new JsonCallbackEvents() {

                            @Override
                            public void onFinished(JavaScriptObject jso) {
                                // FINISH LOADING UI ONCE ITS CHECKED
                                // perun loaded = true
                                perunLoaded = true;
                                // loads the page based on URL or default
                                loadPage();
                                // hides the loading box
                                loadingBox.hide();
                                // load proper parts of menu (based on roles)
                                session.getUiElements().getMenu().prepare();
                            }

                            @Override
                            public void onError(PerunError error) {
                                // hides the loading box
                                loadingBox.hide();
                                // shows error box
                                PopupPanel loadingFailedBox;
                                if (error != null) {
                                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                                } else {
                                    String checkFailed = session.getConfiguration().getGDPRproperty("check_failed");
                                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(checkFailed);
                                }
                                loadingFailedBox.show();
                            }
                        });
                    } else {
                        // NO GDPR CHECK NEEDED
                        // perun loaded = true
                        perunLoaded = true;
                        // loads the page based on URL or default
                        loadPage();
                        // hides the loading box
                        loadingBox.hide();
                        // load proper parts of menu (based on roles)
                        session.getUiElements().getMenu().prepare();
                    }
                }

                @Override
                public void onError(PerunError error) {
                    // hides the loading box
                    loadingBox.hide();
                    // shows error box
                    PopupPanel loadingFailedBox;
                    if (error != null) {
                        loadingFailedBox = session.getUiElements().perunLoadingFailedBox("Request timeout exceeded.");
                    } else {
                        if (error.getName().contains("UserNotExistsException")) {
                            loadingFailedBox = session.getUiElements().perunLoadingFailedBox("You are not registered to any Virtual Organization.</br></br>" + error.getErrorInfo());
                        } else {
                            loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                        }
                    }
                    if (!error.getErrorId().equals("0")) {
                        loadingFailedBox.show();
                    }
                }
            });
            getConfig.retrieveData();
        }

        @Override
        public void onError(PerunError error) {
            // hides the loading box
            loadingBox.hide();
            // shows error box
            PopupPanel loadingFailedBox;
            if (error == null) {
                loadingFailedBox = session.getUiElements().perunLoadingFailedBox("Request timeout exceeded.");
            } else {
                if (error.getName().contains("UserNotExistsException")) {
                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox("You are not registered to any Virtual Organization.</br></br>" + error.getErrorInfo());
                } else {
                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                }
            }
            loadingFailedBox.show();
        }
    };
    GetPerunPrincipal loggedUserRequst = new GetPerunPrincipal(events);
    loggedUserRequst.retrieveData();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) TabManager(cz.metacentrum.perun.webgui.tabs.TabManager) BasicOverlayType(cz.metacentrum.perun.webgui.model.BasicOverlayType) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) CantLogAsServiceUserWidget(cz.metacentrum.perun.webgui.widgets.CantLogAsServiceUserWidget) GetPerunPrincipal(cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal) PerunPrincipal(cz.metacentrum.perun.webgui.model.PerunPrincipal) GetPerunPrincipal(cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal) GetGuiConfiguration(cz.metacentrum.perun.webgui.json.GetGuiConfiguration) UrlMapper(cz.metacentrum.perun.webgui.tabs.UrlMapper) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Storage(com.google.gwt.storage.client.Storage) NotUserOfPerunWidget(cz.metacentrum.perun.webgui.widgets.NotUserOfPerunWidget) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) KeepAlive(cz.metacentrum.perun.webgui.json.authzResolver.KeepAlive) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 39 with Confirm

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

the class GenerateAccount 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 (namespace.isEmpty()) {
        errorMsg += "<p>Namespace can't be empty.";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while creating password.", 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 40 with Confirm

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

the class ChangePassword 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 (user == null) {
        errorMsg += "User null.\n";
        result = false;
    }
    if (errorMsg.length() > 0) {
        Confirm c = new Confirm("Error while changing password.", 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