Search in sources :

Example 56 with CustomButton

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

the class CreateFacilityTabItem method fillContentGroups.

private Widget fillContentGroups(final GetAdminGroups jsonCallback, TabMenu menu) {
    jsonCallback.clearTableSelectedSet();
    // get the table
    CellTable<Group> table = jsonCallback.getTable(new FieldUpdater<Group, String>() {

        @Override
        public void update(int i, Group grp, String s) {
            session.getTabManager().addTab(new GroupDetailTabItem(grp));
        }
    });
    menu.addWidget(0, TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addManagerGroupToFacility(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            session.getTabManager().addTabToCurrentTab(new AddFacilityManagerGroupTabItem(facility, JsonCallbackEvents.refreshTableEvents(jsonCallback)), true);
        }
    }));
    final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeManagerGroupFromFacility());
    menu.addWidget(1, removeButton);
    removeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            final ArrayList<Group> list = jsonCallback.getTableSelectedList();
            String text = "Members of following groups won't be facility managers anymore and won't be able to manage this facility in Perun.";
            UiElements.showDeleteConfirm(list, text, new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    // TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
                    for (int i = 0; i < list.size(); i++) {
                        if (i == list.size() - 1) {
                            RemoveAdmin request = new RemoveAdmin(PerunEntity.FACILITY, JsonCallbackEvents.disableButtonEvents(removeButton, JsonCallbackEvents.refreshTableEvents(jsonCallback)));
                            request.removeFacilityAdminGroup(facility, list.get(i));
                        } else {
                            RemoveAdmin request = new RemoveAdmin(PerunEntity.FACILITY, JsonCallbackEvents.disableButtonEvents(removeButton));
                            request.removeFacilityAdminGroup(facility, list.get(i));
                        }
                    }
                }
            });
        }
    });
    removeButton.setEnabled(false);
    JsonUtils.addTableManagedButton(jsonCallback, table, removeButton);
    table.addStyleName("perun-table");
    return table;
}
Also used : ArrayList(java.util.ArrayList) GroupDetailTabItem(cz.metacentrum.perun.webgui.tabs.groupstabs.GroupDetailTabItem) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) RemoveAdmin(cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin)

Example 57 with CustomButton

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

the class CreateFacilityTabItem method draw.

public Widget draw() {
    final TabItemWithUrl tab = this;
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // FOOTER
    FlexTable header = new FlexTable();
    header.setStyleName("wizardHeader");
    final CustomButton back = TabMenu.getPredefinedButton(ButtonType.BACK, ButtonTranslation.INSTANCE.backButton());
    final CustomButton next = TabMenu.getPredefinedButton(ButtonType.CONTINUE, ButtonTranslation.INSTANCE.continueButton());
    back.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // skipped services selection
            if (selectedPage == 8 && selectedServices.isEmpty()) {
                selectedPage = 5;
            } else if (selectedPage > 2) {
                selectedPage--;
            }
            draw();
        }
    });
    int column = 0;
    header.setWidget(0, 0, new Image(LargeIcons.INSTANCE.databaseServerIcon()));
    column++;
    Label title = new Label();
    title.getElement().setAttribute("style", "font-size: 1.35em;");
    header.setWidget(0, column, title);
    column++;
    // do not get back to first page
    if (selectedPage > 2) {
        header.setWidget(0, column, back);
        column++;
    }
    if (selectedPage > 1 && selectedPage != numberOfPages) {
        header.setWidget(0, column, next);
    }
    // MAIN CONTENT
    SimplePanel content = new SimplePanel();
    content.getElement().setId("centered-wrapper-outer");
    if (selectedPage == 1) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Create definition");
        // content
        FlexTable layout = new FlexTable();
        layout.setStyleName("inputFormFlexTable");
        FlexTable.FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
        // widgets
        final ExtendedTextBox name = new ExtendedTextBox();
        final ExtendedTextBox description = new ExtendedTextBox();
        final ListBoxWithObjects<Facility> copyOfFacility = new ListBoxWithObjects<Facility>();
        final ExtendedTextBox.TextBoxValidator validator = new ExtendedTextBox.TextBoxValidator() {

            @Override
            public boolean validateTextBox() {
                if (name.getTextBox().getText().trim().isEmpty()) {
                    name.setError("Facility name can't be empty.");
                    return false;
                } else if (!name.getTextBox().getText().trim().matches(Utils.FACILITY_NAME_MATCHER)) {
                    name.setError("Name can contain only letters, numbers, dash, dot and underscore.");
                    return false;
                } else {
                    name.setOk();
                    return true;
                }
            }
        };
        name.setValidator(validator);
        // default
        if (facilitiesToCopyFrom != null && !facilitiesToCopyFrom.isEmpty()) {
            copyOfFacility.addNotSelectedOption();
            copyOfFacility.addAllItems(new TableSorter<Facility>().sortByName(facilitiesToCopyFrom));
            copyOfFacility.setSelectedIndex(0);
        }
        // Add some standard form options
        layout.setHTML(0, 0, "Name:");
        layout.setWidget(0, 1, name);
        layout.setHTML(1, 0, "Description:");
        layout.setWidget(1, 1, description);
        layout.setHTML(2, 0, "As copy of:");
        layout.setWidget(2, 1, copyOfFacility);
        final CustomButton create = TabMenu.getPredefinedButton(ButtonType.CREATE, "Create new facility");
        TabMenu menu = new TabMenu();
        menu.addWidget(create);
        menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                UiElements.generateAlert("Confirmation", "Do you really want to exit create facility wizard ?", new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent clickEvent) {
                        eventsOnClose.onFinished(null);
                        session.getTabManager().closeTab(tab);
                    }
                });
            }
        }));
        VerticalPanel innerContent = new VerticalPanel();
        innerContent.add(layout);
        innerContent.add(menu);
        innerContent.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
        content.setWidget(innerContent);
        for (int i = 0; i < layout.getRowCount(); i++) {
            cellFormatter.addStyleName(i, 0, "itemName");
        }
        final GetFacilities getFacs = new GetFacilities(false, new JsonCallbackEvents() {

            public void onFinished(JavaScriptObject jso) {
                copyOfFacility.removeNotSelectedOption();
                copyOfFacility.clear();
                ArrayList<Facility> fac = JsonUtils.jsoAsList(jso);
                if (fac.isEmpty() || fac == null) {
                    copyOfFacility.addItem("No facilities available");
                    return;
                }
                fac = new TableSorter<Facility>().sortByName(fac);
                facilitiesToCopyFrom.addAll(fac);
                copyOfFacility.addNotSelectedOption();
                copyOfFacility.addAllItems(fac);
                copyOfFacility.setSelectedIndex(0);
                next.setEnabled(true);
            }

            public void onError(PerunError error) {
                next.setEnabled(true);
                copyOfFacility.removeNotSelectedOption();
                copyOfFacility.clear();
                copyOfFacility.addItem("Error while loading");
            }

            public void onLoadingStart() {
                next.setEnabled(false);
                copyOfFacility.removeNotSelectedOption();
                copyOfFacility.clear();
                copyOfFacility.addItem("Loading...");
            }
        });
        // load facilities if empty
        if (facilitiesToCopyFrom == null || facilitiesToCopyFrom.isEmpty()) {
            getFacs.retrieveData();
        }
        // next button
        create.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (!visitedBasic) {
                    if (validator.validateTextBox()) {
                        CreateFacility request = new CreateFacility(JsonCallbackEvents.disableButtonEvents(create, new JsonCallbackEvents() {

                            public void onFinished(JavaScriptObject jso) {
                                facility = jso.cast();
                                // set new facility as editable in GUI
                                session.getEditableFacilities().add(facility.getId());
                                if (copyOfFacility.getSelectedIndex() > 0) {
                                    sourceFacility = copyOfFacility.getSelectedObject();
                                }
                                visitedBasic = true;
                                selectedPage++;
                                draw();
                            }

                            public void onLoadingStart() {
                                copyOfFacility.setEnabled(false);
                            }

                            public void onError(PerunError error) {
                                copyOfFacility.setEnabled(true);
                            }
                        }));
                        request.createFacility(name.getTextBox().getText().trim(), description.getTextBox().getText().trim());
                    }
                } else {
                    // facility created - continue
                    selectedPage++;
                    draw();
                }
            }
        });
        if (visitedBasic) {
            // if tab was visited
            name.getTextBox().setValue(facility.getName());
            if (facility.getDescription() != null) {
                description.getTextBox().setValue(facility.getDescription());
            }
            name.getTextBox().setEnabled(false);
            description.getTextBox().setEnabled(false);
            copyOfFacility.setEnabled(false);
            if (sourceFacility != null) {
                copyOfFacility.setVisible(true);
                copyOfFacility.addItem(sourceFacility);
                copyOfFacility.setSelected(sourceFacility, true);
            }
        }
    } else if (selectedPage == 2) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Add managers");
        // content
        VerticalPanel innerContent = new VerticalPanel();
        innerContent.setSize("100%", "100%");
        // HORIZONTAL MENU
        final TabMenu menu = new TabMenu();
        final ListBox box = new ListBox();
        box.addItem("Users");
        box.addItem("Groups");
        box.setSelectedIndex(selectedDropDownIndex);
        final ScrollPanel sp = new ScrollPanel();
        sp.addStyleName("perun-tableScrollPanel");
        // request
        final GetRichAdminsWithAttributes admins = new GetRichAdminsWithAttributes(PerunEntity.FACILITY, facility.getId(), null);
        final GetAdminGroups adminGroups = new GetAdminGroups(PerunEntity.FACILITY, facility.getId());
        box.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                if (box.getSelectedIndex() == 0) {
                    selectedDropDownIndex = 0;
                    sp.setWidget(fillContentUsers(admins, menu));
                } else {
                    selectedDropDownIndex = 1;
                    sp.setWidget(fillContentGroups(adminGroups, menu));
                }
            }
        });
        // if first and copy from
        if (!visitedAdmins && sourceFacility != null) {
            CopyManagers copy = new CopyManagers(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    if (selectedDropDownIndex == 0) {
                        sp.setWidget(fillContentUsers(admins, menu));
                    } else {
                        sp.setWidget(fillContentGroups(adminGroups, menu));
                    }
                    menu.addWidget(2, new HTML("<strong>Select mode: </strong>"));
                    menu.addWidget(3, box);
                    menu.addWidget(4, new Image(SmallIcons.INSTANCE.helpIcon()));
                    menu.addWidget(5, new HTML("<strong>People with privilege to manage this facility in Perun.</strong>"));
                }

                @Override
                public void onError(PerunError error) {
                    if (selectedDropDownIndex == 0) {
                        sp.setWidget(fillContentUsers(admins, menu));
                    } else {
                        sp.setWidget(fillContentGroups(adminGroups, menu));
                    }
                    menu.addWidget(2, new HTML("<strong>Select mode: </strong>"));
                    menu.addWidget(3, box);
                    menu.addWidget(4, new Image(SmallIcons.INSTANCE.helpIcon()));
                    menu.addWidget(5, new HTML("<strong>People with privilege to manage this facility in Perun.</strong>"));
                }
            });
            copy.copyFacilityManagers(sourceFacility.getId(), facility.getId());
        } else {
            if (selectedDropDownIndex == 0) {
                sp.setWidget(fillContentUsers(admins, menu));
            } else {
                sp.setWidget(fillContentGroups(adminGroups, menu));
            }
            menu.addWidget(2, new HTML("<strong>Select mode: </strong>"));
            menu.addWidget(3, box);
            menu.addWidget(4, new Image(SmallIcons.INSTANCE.helpIcon()));
            menu.addWidget(5, new HTML("<strong>People with privilege to manage this facility in Perun. They aren't automatically \"roots\" on machine.</strong>"));
        }
        visitedAdmins = true;
        session.getUiElements().resizePerunTable(sp, 300, this);
        // add menu and the table to the main panel
        innerContent.add(menu);
        innerContent.setCellHeight(menu, "30px");
        innerContent.add(sp);
        content.setWidget(innerContent);
        next.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                selectedPage++;
                draw();
            }
        });
    } else if (selectedPage == 3) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Add owners");
        // CONTENT
        VerticalPanel innerContent = new VerticalPanel();
        innerContent.setSize("100%", "100%");
        // MENU
        TabMenu menu = new TabMenu();
        // CALLBACK
        final GetFacilityOwners jsonCallback = new GetFacilityOwners(facility);
        innerContent.add(menu);
        innerContent.setCellHeight(menu, "30px");
        // add button
        CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addNewOwners());
        addButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                session.getTabManager().addTabToCurrentTab(new AddFacilityOwnerTabItem(facility), true);
            }
        });
        // remove button
        final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeSelectedOwners());
        removeButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                final ArrayList<Owner> list = jsonCallback.getTableSelectedList();
                UiElements.showDeleteConfirm(list, new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent clickEvent) {
                        // TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
                        for (int i = 0; i < list.size(); i++) {
                            if (i == list.size() - 1) {
                                RemoveOwner request = new RemoveOwner(JsonCallbackEvents.disableButtonEvents(removeButton, JsonCallbackEvents.refreshTableEvents(jsonCallback)));
                                request.removeFacilityOwner(facility.getId(), list.get(i).getId());
                            } else {
                                RemoveOwner request = new RemoveOwner(JsonCallbackEvents.disableButtonEvents(removeButton));
                                request.removeFacilityOwner(facility.getId(), list.get(i).getId());
                            }
                        }
                    }
                });
            }
        });
        menu.addWidget(addButton);
        menu.addWidget(removeButton);
        // TABLE
        CellTable<Owner> table = jsonCallback.getEmptyTable();
        table.addStyleName("perun-table");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        innerContent.add(sp);
        // call for data
        if (!visitedOwners && sourceFacility != null) {
            // copy owners
            CopyOwners copy = new CopyOwners(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    jsonCallback.retrieveData();
                }

                @Override
                public void onError(PerunError error) {
                    jsonCallback.retrieveData();
                }
            });
            copy.copyFacilityOwners(sourceFacility.getId(), facility.getId());
        } else {
            jsonCallback.retrieveData();
        }
        removeButton.setEnabled(false);
        JsonUtils.addTableManagedButton(jsonCallback, table, removeButton);
        session.getUiElements().resizePerunTable(sp, 300, this);
        visitedOwners = true;
        next.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                selectedPage++;
                draw();
            }
        });
        content.add(innerContent);
    } else if (selectedPage == 4) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Add hosts");
        // SPLIT
        FlexTable hp = new FlexTable();
        hp.setSize("100%", "100%");
        // HOSTS WIDGET
        VerticalPanel hostsWidget = new VerticalPanel();
        hostsWidget.setSize("100%", "100%");
        final GetHosts hosts = new GetHosts(facility.getId(), new JsonCallbackEvents() {

            @Override
            public void onFinished(JavaScriptObject jso) {
                // store hosts for future use
                newFacilityHosts.clear();
                newFacilityHosts.addAll(JsonUtils.<Host>jsoAsList(jso));
            }
        });
        final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(hosts);
        // menu
        TabMenu menu = new TabMenu();
        final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeHosts());
        removeButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                final ArrayList<Host> hostsForRemoving = hosts.getTableSelectedList();
                String text = "Following hosts will be removed from facility.";
                UiElements.showDeleteConfirm(hostsForRemoving, text, new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent clickEvent) {
                        // TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
                        for (int i = 0; i < hostsForRemoving.size(); i++) {
                            if (i == hostsForRemoving.size() - 1) {
                                RemoveHosts request = new RemoveHosts(facility.getId(), JsonCallbackEvents.disableButtonEvents(removeButton, events));
                                request.removeHost(hostsForRemoving.get(i).getId());
                            } else {
                                RemoveHosts request = new RemoveHosts(facility.getId(), JsonCallbackEvents.disableButtonEvents(removeButton));
                                request.removeHost(hostsForRemoving.get(i).getId());
                            }
                        }
                    }
                });
            }
        });
        menu.addWidget(removeButton);
        // Hosts table
        CellTable<Host> table = hosts.getTable(new FieldUpdater<Host, String>() {

            @Override
            public void update(int index, Host object, String value) {
                session.getTabManager().addTab(new FacilityHostsSettingsTabItem(facility, object));
            }
        });
        removeButton.setEnabled(false);
        JsonUtils.addTableManagedButton(hosts, table, removeButton);
        // add a class to the table and wrap it into scroll panel
        table.addStyleName("perun-table");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        // add menu and the table to the main panel
        hostsWidget.add(menu);
        hostsWidget.setCellHeight(menu, "30px");
        hostsWidget.add(sp);
        session.getUiElements().resizePerunTable(sp, 300, 50, this);
        // ADD WIDGET
        final ExtendedTextArea newHosts = new ExtendedTextArea();
        newHosts.getTextArea().setSize("335px", "200px");
        newHosts.getTextArea().setText(newHostInput);
        final ExtendedTextArea.TextAreaValidator validator = new ExtendedTextArea.TextAreaValidator() {

            @Override
            public boolean validateTextArea() {
                if (newHosts.getTextArea().getText().trim().isEmpty()) {
                    newHosts.setError("Please enter at least one hostname to add it to facility.");
                    return false;
                } else {
                    newHosts.setOk();
                    return true;
                }
            }
        };
        newHosts.setValidator(validator);
        newHosts.getTextArea().addKeyUpHandler(new KeyUpHandler() {

            @Override
            public void onKeyUp(KeyUpEvent event) {
                newHostInput = newHosts.getTextArea().getText();
            }
        });
        final CustomButton addHostsButton = new CustomButton("Add", ButtonTranslation.INSTANCE.addHost(), SmallIcons.INSTANCE.arrowRightIcon());
        addHostsButton.setImageAlign(true);
        addHostsButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (validator.validateTextArea()) {
                    String hostnames = newHosts.getTextArea().getText().trim();
                    String[] hosts = hostnames.split("\n");
                    // trim whitespace
                    for (int i = 0; i < hosts.length; i++) {
                        hosts[i] = hosts[i].trim();
                    }
                    AddHosts request = new AddHosts(facility.getId(), JsonCallbackEvents.mergeEvents(JsonCallbackEvents.disableButtonEvents(addHostsButton, events), new JsonCallbackEvents() {

                        public void onFinished(JavaScriptObject jso) {
                            // clear input
                            newHosts.getTextArea().setText("");
                            newHostInput = "";
                        }
                    }));
                    request.addHosts(hosts);
                }
            }
        });
        // layout
        FlexTable layout = new FlexTable();
        layout.setStyleName("inputFormFlexTable");
        FlexTable.FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
        layout.setHTML(0, 0, "Hostnames:");
        layout.setWidget(1, 0, newHosts);
        cellFormatter.addStyleName(0, 0, "itemName");
        layout.setHTML(2, 0, "Enter one host per line. You can use \"[x-y]\" in hostname to generate hosts with numbers from x to y. This replacer can be specified multiple times in one hostname to generate MxN combinations.");
        cellFormatter.addStyleName(2, 0, "inputFormInlineComment");
        cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        layout.setWidget(3, 0, addHostsButton);
        addHostsButton.getElement().setAttribute("style", addHostsButton.getElement().getAttribute("style") + " float: right;");
        // FILL LAYOUT
        hp.setWidget(0, 0, layout);
        hp.setWidget(0, 1, hostsWidget);
        hp.getFlexCellFormatter().setWidth(0, 0, "350px");
        hp.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
        hp.getFlexCellFormatter().setStyleName(0, 0, "border-right");
        content.add(hp);
        next.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                selectedPage++;
                draw();
            }
        });
    } else if (selectedPage == 5) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Select services");
        // SPLIT
        FlexTable hp = new FlexTable();
        hp.setSize("100%", "100%");
        // create widget for the whole page
        VerticalPanel mainTab = new VerticalPanel();
        mainTab.setSize("100%", "100%");
        // get services
        final GetServices services = new GetServices();
        services.setEvents(new JsonCallbackEvents() {

            public void onFinished(JavaScriptObject jso) {
                if (selectedServices != null && !selectedServices.isEmpty()) {
                    for (Service s : selectedServices) {
                        services.getSelectionModel().setSelected(s, true);
                    }
                }
            }

            public void onLoadingStart() {
            }

            public void onError(PerunError error) {
            }
        });
        // get the table of services with custom field updater (lines are clickable and open service details)
        CellTable<Service> table = services.getTable();
        // add styling to table with services
        table.addStyleName("perun-table");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        mainTab.add(sp);
        final VerticalPanel helpWidget = new VerticalPanel();
        helpWidget.setSpacing(5);
        final FlowPanel fw = new FlowPanel();
        CustomButton clearButton = new CustomButton("Clear selection", "Clear services selection.", SmallIcons.INSTANCE.deleteIcon());
        clearButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                services.clearTableSelectedSet();
            }
        });
        clearButton.addStyleName("margin");
        fw.add(clearButton);
        fw.add(new AjaxLoaderImage(true));
        GetServicesPackages packs = new GetServicesPackages(new JsonCallbackEvents() {

            @Override
            public void onFinished(JavaScriptObject jso) {
                // remove loader
                fw.remove(1);
                // fill buttons based on packages
                ArrayList<ServicesPackage> packages = JsonUtils.jsoAsList(jso);
                for (final ServicesPackage pack : packages) {
                    final CustomButton button = new CustomButton(pack.getName(), pack.getDescription(), SmallIcons.INSTANCE.addIcon());
                    button.addStyleName("margin");
                    fw.add(button);
                    button.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            GetServicesFromServicesPackage serv = new GetServicesFromServicesPackage(pack.getId(), JsonCallbackEvents.disableButtonEvents(button, new JsonCallbackEvents() {

                                @Override
                                public void onFinished(JavaScriptObject jso) {
                                    for (Service s : JsonUtils.<Service>jsoAsList(jso)) {
                                        // select services from pack in table
                                        services.getSelectionModel().setSelected(s, true);
                                    }
                                }
                            }));
                            serv.retrieveData();
                        }
                    });
                }
                if (packages == null || packages.isEmpty()) {
                    fw.add(new HTML("There are no services packages defined in Perun. Use manual selection."));
                }
            }

            @Override
            public void onError(PerunError error) {
                // remove loader
                fw.remove(1);
                fw.add(new HTML("Error when loading services packages defined in Perun. Use manual selection."));
            }
        });
        packs.retrieveData();
        HTML helpText = new HTML("Please select set of services, which will be managed by Perun. You can use buttons below to help you select proper set of services.");
        helpText.setStyleName("inputFormInlineComment");
        helpWidget.add(helpText);
        helpWidget.add(fw);
        // select by source if not already set
        if (sourceFacility != null && (selectedServices == null || selectedServices.isEmpty())) {
            GetFacilityAssignedServices getCall = new GetFacilityAssignedServices(sourceFacility.getId(), new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    ArrayList<Service> serv = JsonUtils.jsoAsList(jso);
                    services.clearTableSelectedSet();
                    for (Service s : serv) {
                        services.getSelectionModel().setSelected(s, true);
                    }
                }
            });
            getCall.retrieveData();
        }
        hp.setWidget(0, 0, helpWidget);
        hp.setWidget(0, 1, mainTab);
        hp.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
        hp.getFlexCellFormatter().setWidth(0, 0, "350px");
        hp.getFlexCellFormatter().setStyleName(0, 0, "border-right");
        content.setWidget(hp);
        next.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (services.getTableSelectedList() == null || services.getTableSelectedList().isEmpty()) {
                    FlexTable layout = new FlexTable();
                    layout.setWidget(0, 0, new HTML("<p>" + new Image(LargeIcons.INSTANCE.informationIcon())));
                    layout.setHTML(0, 1, "<p>" + "You didn't select any service. Do you wish to skip services configuration ?");
                    layout.getFlexCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
                    layout.getFlexCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
                    layout.getFlexCellFormatter().setStyleName(0, 0, "alert-box-image");
                    final Confirm c = new Confirm("No service selected", layout, true);
                    c.setOkButtonText("Yes");
                    c.setCancelButtonText("No");
                    c.setOkClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            selectedServices.clear();
                            // draw
                            selectedPage = 8;
                            draw();
                        }
                    });
                    c.setCancelClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            c.hide();
                        }
                    });
                    c.setNonScrollable(true);
                    c.show();
                } else {
                    // set selected services
                    selectedServices.clear();
                    for (Service s : new TableSorter<Service>().sortByName(services.getTableSelectedList())) {
                        selectedServices.add(s);
                    }
                    // draw
                    selectedPage++;
                    draw();
                }
            }
        });
        session.getUiElements().resizePerunTable(sp, 350, this);
    } else if (selectedPage == 6) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Configure services");
        // content
        VerticalPanel settingsTab = new VerticalPanel();
        settingsTab.setSize("100%", "100%");
        // HORIZONTAL MENU
        TabMenu menu = new TabMenu();
        // Get Attributes method
        final GetRequiredAttributesV2 reqAttrs = new GetRequiredAttributesV2();
        final ListBoxWithObjects<Service> servList = new ListBoxWithObjects<Service>();
        // get empty table
        final CellTable<Attribute> table = reqAttrs.getEmptyTable();
        // ids to retrieve data from rpc
        final Map<String, Integer> ids = new HashMap<String, Integer>();
        ids.put("facility", facility.getId());
        final CustomButton saveChangesButton = TabMenu.getPredefinedButton(ButtonType.SAVE, ButtonTranslation.INSTANCE.saveChangesInAttributes());
        final JsonCallbackEvents refreshEvents = JsonCallbackEvents.refreshTableEvents(reqAttrs);
        final JsonCallbackEvents saveChangesButtonEvent = JsonCallbackEvents.disableButtonEvents(saveChangesButton, refreshEvents);
        saveChangesButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                ArrayList<Attribute> list = reqAttrs.getTableSelectedList();
                if (UiElements.cantSaveEmptyListDialogBox(list)) {
                    SetAttributes request = new SetAttributes(saveChangesButtonEvent);
                    // set to new facility
                    ids.put("facility", facility.getId());
                    request.setAttributes(ids, reqAttrs.getTableSelectedList());
                }
            }
        });
        // clear
        servList.removeAllOption();
        servList.clear();
        // fill
        if (selectedServices == null || selectedServices.isEmpty()) {
            // wizard shouldn't allow to get there
            servList.addItem("No service selected");
            servList.setEnabled(false);
        } else if (!visitedConfigure && sourceFacility != null) {
            // first visit and copy
            ids.put("facility", sourceFacility.getId());
            servList.addAllItems(selectedServices);
            servList.addAllOption();
            // default all
            servList.setSelectedIndex(0);
            reqAttrs.setEvents(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    for (Attribute a : reqAttrs.getList()) {
                        if (!a.getDefinition().equals("virt") && a.getValue() != null && !a.getValue().isEmpty()) {
                            // pre-select non-virt attributes with some value
                            reqAttrs.getSelectionModel().setSelected(a, true);
                        } else {
                            reqAttrs.getSelectionModel().setSelected(a, false);
                        }
                    }
                }
            });
            reqAttrs.setServicesToGetAttributesFor(servList.getAllObjects());
            reqAttrs.setIds(ids);
            reqAttrs.clearTable();
            reqAttrs.retrieveData();
            // inform user about it
            UiElements.generateInfo("Pre-filled values", "Services configuration was pre-filled from facility you selected to copy. <p><strong>Nothing is saved to new facility until you click on \"Save\" button.</strong>");
        } else {
            servList.addAllItems(selectedServices);
            servList.addAllOption();
            // default all
            servList.setSelectedIndex(0);
            reqAttrs.setServicesToGetAttributesFor(servList.getAllObjects());
            reqAttrs.setIds(ids);
            reqAttrs.clearTable();
            reqAttrs.retrieveData();
        }
        servList.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                if (servList.getSelectedIndex() == 0) {
                    ids.remove("service");
                    reqAttrs.setServicesToGetAttributesFor(servList.getAllObjects());
                } else {
                    ids.put("service", servList.getSelectedObject().getId());
                    reqAttrs.setServicesToGetAttributesFor(null);
                }
                reqAttrs.setIds(ids);
                reqAttrs.clearTable();
                reqAttrs.retrieveData();
            }
        });
        visitedConfigure = true;
        menu.addWidget(saveChangesButton);
        menu.addWidget(new HTML("<strong>Filter view by Service: </strong>"));
        menu.addWidget(servList);
        table.addStyleName("perun-table");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        // add menu and the table to the main panel
        settingsTab.add(menu);
        settingsTab.setCellHeight(menu, "30px");
        settingsTab.add(sp);
        session.getUiElements().resizePerunTable(sp, 350, this);
        content.add(settingsTab);
        next.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                selectedPage++;
                draw();
            }
        });
    } else if (selectedPage == 7) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Configure service destinations");
        // SPLIT
        FlexTable hp = new FlexTable();
        hp.setSize("100%", "100%");
        FlexTable layout = new FlexTable();
        layout.setStyleName("inputFormFlexTable");
        FlexTable.FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
        layout.setWidth("350px");
        final ExtendedSuggestBox destination = new ExtendedSuggestBox();
        final ListBox type = new ListBox();
        type.addItem("HOST", "host");
        type.addItem("USER@HOST", "user@host");
        type.addItem("USER@HOST:PORT", "user@host:port");
        type.addItem("URL", "url");
        type.addItem("MAIL", "email");
        type.addItem("SIGNED MAIL", "semail");
        type.addItem("SERVICE SPECIFIC", "service-specific");
        destination.getSuggestOracle().clear();
        for (Host h : newFacilityHosts) {
            destination.getSuggestOracle().add(h.getName());
        }
        final Label destinationLabel = new Label();
        destinationLabel.getElement().setInnerHTML("<strong>Host:</strong>");
        final CustomButton addButton = new CustomButton("Add", ButtonTranslation.INSTANCE.addDestination(), SmallIcons.INSTANCE.arrowRightIcon());
        addButton.setImageAlign(true);
        final ListBoxWithObjects<Service> services = new ListBoxWithObjects<Service>();
        final CheckBox useHosts = new CheckBox(WidgetTranslation.INSTANCE.useFacilityHostnames(), false);
        useHosts.setTitle(WidgetTranslation.INSTANCE.useFacilityHostnamesTitle());
        final ExtendedSuggestBox.SuggestBoxValidator validator = new ExtendedSuggestBox.SuggestBoxValidator() {

            @Override
            public boolean validateSuggestBox() {
                if (destination.getSuggestBox().getText().trim().isEmpty() && useHosts.getValue() == false) {
                    destination.setError("Destination value can't be empty.");
                    return false;
                }
                // check as email
                if (type.getSelectedIndex() > 3 && type.getSelectedIndex() < 6) {
                    if (!JsonUtils.isValidEmail(destination.getSuggestBox().getText().trim())) {
                        destination.setError("Not valid email address.");
                        return false;
                    } else {
                        destination.setOk();
                        return true;
                    }
                }
                destination.setOk();
                return true;
            }
        };
        destination.setValidator(validator);
        type.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                // if hosts - checkbox visible
                if (type.getSelectedIndex() == 0) {
                    useHosts.setVisible(true);
                } else {
                    useHosts.setVisible(false);
                    useHosts.setValue(false);
                    destination.getSuggestBox().setEnabled(true);
                }
                if (type.getSelectedIndex() < 3) {
                    destination.getSuggestOracle().clear();
                    for (Host h : newFacilityHosts) {
                        destination.getSuggestOracle().add(h.getName());
                    }
                } else {
                    destination.getSuggestOracle().clear();
                }
                // set label
                if (type.getSelectedIndex() == 0) {
                    destinationLabel.getElement().setInnerHTML("<strong>Host:</strong>");
                } else if (type.getSelectedIndex() == 1) {
                    destinationLabel.getElement().setInnerHTML("<strong>User@host:</strong>");
                } else if (type.getSelectedIndex() == 2) {
                    destinationLabel.getElement().setInnerHTML("<strong>User@host:port:</strong>");
                } else if (type.getSelectedIndex() == 3) {
                    destinationLabel.getElement().setInnerHTML("<strong>URL:</strong>");
                } else if (type.getSelectedIndex() == 4) {
                    destinationLabel.getElement().setInnerHTML("<strong>Mail:</strong>");
                } else if (type.getSelectedIndex() == 5) {
                    destinationLabel.getElement().setInnerHTML("<strong>Signed mail:</strong>");
                } else if (type.getSelectedIndex() == 6) {
                    destinationLabel.getElement().setInnerHTML("<strong>Service specific:</strong>");
                }
            }
        });
        useHosts.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (useHosts.getValue() == true) {
                    destination.getSuggestBox().setEnabled(false);
                    destination.setOk();
                } else {
                    destination.getSuggestBox().setEnabled(true);
                }
            }
        });
        services.removeAllOption();
        services.clear();
        if (selectedServices == null || selectedServices.isEmpty()) {
            // wizard shouldn't allow
            services.addItem("No service available");
        } else {
            services.addAllItems(selectedServices);
            services.addAllOption();
            services.setSelectedIndex(0);
        }
        cellFormatter.setColSpan(0, 0, 2);
        HTML text = new HTML("Please add destinations for service configuration delivery. New service configuration can be performed directly on facility (dest. type HOST) or sent to URL or by an email.");
        text.setStyleName("inputFormInlineComment");
        layout.setWidget(0, 0, text);
        layout.setHTML(1, 0, "Service:");
        layout.setWidget(1, 1, services);
        layout.setHTML(2, 0, "Type:");
        layout.setWidget(2, 1, type);
        layout.setWidget(3, 0, destinationLabel);
        layout.setWidget(3, 1, destination);
        layout.setWidget(4, 1, useHosts);
        for (int i = 1; i < layout.getRowCount(); i++) {
            cellFormatter.addStyleName(i, 0, "itemName");
        }
        //callback
        final GetAllRichDestinations callback = new GetAllRichDestinations(facility, null);
        addButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                if (services.isEmpty()) {
                    // no services available
                    addButton.setEnabled(false);
                }
                if (validator.validateSuggestBox()) {
                    if (services.getSelectedIndex() == 0) {
                        // selected all
                        if (useHosts.getValue() == true) {
                            // auto by hosts
                            AddDestinationsByHostsOnFacility request = new AddDestinationsByHostsOnFacility(facility, JsonCallbackEvents.refreshTableEvents(callback));
                            request.addDestinationByHosts(services.getAllObjects());
                        } else {
                            // default
                            // FIXME - there are no services on facility at the moment, use list of services
                            AddDestination request = new AddDestination(facility, JsonCallbackEvents.refreshTableEvents(callback));
                            request.addDestination(destination.getSuggestBox().getText().trim(), type.getValue(type.getSelectedIndex()), services.getAllObjects());
                        }
                    } else {
                        // selected one
                        if (useHosts.getValue() == true) {
                            // auto by hosts
                            AddDestinationsByHostsOnFacility request = new AddDestinationsByHostsOnFacility(facility, JsonCallbackEvents.refreshTableEvents(callback));
                            request.addDestinationByHosts(services.getSelectedObject());
                        } else {
                            // default
                            AddDestination request = new AddDestination(facility, JsonCallbackEvents.refreshTableEvents(callback));
                            request.addDestination(destination.getSuggestBox().getText().trim(), type.getValue(type.getSelectedIndex()), services.getSelectedObject());
                        }
                    }
                }
            }
        });
        cellFormatter.setColSpan(5, 0, 2);
        layout.setWidget(5, 0, addButton);
        addButton.getElement().setAttribute("style", addButton.getElement().getAttribute("style") + " float: right;");
        // DESTINATIONS WIDGET
        // main content
        final VerticalPanel destWidget = new VerticalPanel();
        destWidget.setSize("100%", "100%");
        // menu
        final TabMenu menu = new TabMenu();
        destWidget.add(menu);
        destWidget.setCellHeight(menu, "30px");
        // do not make callback yet
        final CellTable<Destination> table = callback.getTable();
        // refresh table events
        final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(callback);
        // style table
        table.addStyleName("perun-table");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        destWidget.add(sp);
        session.getUiElements().resizePerunTable(sp, 300, 50, this);
        final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeSelectedDestinations());
        menu.addWidget(removeButton);
        removeButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                final ArrayList<Destination> destForRemoving = callback.getTableSelectedList();
                String text = "Following destinations will be removed. <strong>Removing destination will stop propagation of service configuration for this destination/service.</strong>";
                UiElements.showDeleteConfirm(destForRemoving, text, new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent clickEvent) {
                        // TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
                        for (int i = 0; i < destForRemoving.size(); i++) {
                            if (i == destForRemoving.size() - 1) {
                                RemoveDestination request = new RemoveDestination(facility.getId(), destForRemoving.get(i).getService().getId(), JsonCallbackEvents.disableButtonEvents(removeButton, events));
                                request.removeDestination(destForRemoving.get(i).getDestination(), destForRemoving.get(i).getType());
                            } else {
                                RemoveDestination request = new RemoveDestination(facility.getId(), destForRemoving.get(i).getService().getId(), JsonCallbackEvents.disableButtonEvents(removeButton));
                                request.removeDestination(destForRemoving.get(i).getDestination(), destForRemoving.get(i).getType());
                            }
                        }
                    }
                });
            }
        });
        removeButton.setEnabled(false);
        JsonUtils.addTableManagedButton(callback, table, removeButton);
        // filter box
        menu.addFilterWidget(new ExtendedSuggestBox(callback.getOracle()), new PerunSearchEvent() {

            public void searchFor(String text) {
                callback.filterTable(text);
            }
        }, ButtonTranslation.INSTANCE.filterDestination());
        // FILL LAYOUT
        hp.setWidget(0, 0, layout);
        hp.setWidget(0, 1, destWidget);
        hp.getFlexCellFormatter().setWidth(0, 0, "350px");
        hp.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
        hp.getFlexCellFormatter().setStyleName(0, 0, "border-right");
        content.add(hp);
        next.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                selectedPage++;
                draw();
            }
        });
    } else if (selectedPage == 8) {
        // header
        title.setText("Create facility " + selectedPage + " of " + numberOfPages + ": Finish");
        SimplePanel sp = new SimplePanel();
        sp.getElement().setId("centered-wrapper-inner");
        session.getUiElements().resizePerunTable(sp, 350, this);
        FlexTable ft = new FlexTable();
        ft.setSize("100%", "100%");
        ft.setCellPadding(5);
        ft.getElement().setId("centered-content");
        HTML text = new HTML("Your facility was created and configured.<p>You can exit or continue by creating resource(s) for VOs.");
        text.setStyleName("now-managing");
        ft.setWidget(0, 0, text);
        if (sourceFacility != null) {
            CustomButton copyResources = new CustomButton("Copy resources from source facility", SmallIcons.INSTANCE.copyIcon());
            copyResources.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                //session.getTabManager().closeTab(tab);
                }
            });
            CustomButton createResource = new CustomButton("Create new resource…", SmallIcons.INSTANCE.addIcon());
            createResource.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    session.getTabManager().addTabToCurrentTab(new CreateFacilityResourceTabItem(facility), false);
                //session.getTabManager().closeTab(tab);
                }
            });
            // TODO - when there will be new copy resources wizard
            //ft.setWidget(1, 0, copyResources);
            ft.setWidget(2, 0, createResource);
        } else {
            CustomButton createResource = new CustomButton("Create new resource…", SmallIcons.INSTANCE.addIcon());
            createResource.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    session.getTabManager().addTabToCurrentTab(new CreateFacilityResourceTabItem(facility), false);
                //session.getTabManager().closeTab(tab);
                }
            });
            ft.setWidget(1, 0, createResource);
        }
        CustomButton finish = new CustomButton("Exit", "Exit wizard", SmallIcons.INSTANCE.doorOutIcon());
        finish.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent clickEvent) {
                eventsOnClose.onFinished(null);
                session.getTabManager().closeTab(tab);
            }
        });
        ft.setWidget(3, 0, finish);
        sp.add(ft);
        content.add(sp);
    }
    vp.add(header);
    vp.add(new HTML("<hr size=\"1\" color=\"#ccc\">"));
    vp.add(content);
    vp.setCellHeight(content, "100%");
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ArrayList(java.util.ArrayList) SetAttributes(cz.metacentrum.perun.webgui.json.attributesManager.SetAttributes) CellTable(com.google.gwt.user.cellview.client.CellTable) GetRequiredAttributesV2(cz.metacentrum.perun.webgui.json.attributesManager.GetRequiredAttributesV2) GetRichAdminsWithAttributes(cz.metacentrum.perun.webgui.json.authzResolver.GetRichAdminsWithAttributes) HashMap(java.util.HashMap) Map(java.util.Map) TabItemWithUrl(cz.metacentrum.perun.webgui.tabs.TabItemWithUrl) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) FieldUpdater(com.google.gwt.cell.client.FieldUpdater) GetAdminGroups(cz.metacentrum.perun.webgui.json.authzResolver.GetAdminGroups) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CreateFacilityResourceTabItem(cz.metacentrum.perun.webgui.tabs.resourcestabs.CreateFacilityResourceTabItem)

Example 58 with CustomButton

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

the class CreateAttributeDefinitionTabItem method draw.

public Widget draw() {
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // creates HTML elements
    final ExtendedTextBox attributeDisplayName = new ExtendedTextBox();
    final ExtendedTextBox attributeName = new ExtendedTextBox();
    final ExtendedTextBox attributeDescription = new ExtendedTextBox();
    final ExtendedTextBox.TextBoxValidator nameValidator = new ExtendedTextBox.TextBoxValidator() {

        @Override
        public boolean validateTextBox() {
            if (attributeName.getTextBox().getText().trim().isEmpty()) {
                attributeName.setError("Name of attribute can't be empty.");
            } else if (!attributeName.getTextBox().getText().trim().matches(Utils.ATTRIBUTE_FRIENDLY_NAME_MATCHER)) {
                attributeName.setError("Name of attribute can contain only letters, numbers, dash and colon.");
            } else {
                attributeName.setOk();
                return true;
            }
            return false;
        }
    };
    final ExtendedTextBox.TextBoxValidator descriptionValidator = new ExtendedTextBox.TextBoxValidator() {

        @Override
        public boolean validateTextBox() {
            if (!attributeDescription.getTextBox().getText().trim().isEmpty()) {
                attributeDescription.setOk();
                return true;
            } else {
                attributeDescription.setError("Description of attribute can't be empty.");
                return false;
            }
        }
    };
    final ExtendedTextBox.TextBoxValidator displayNameValidator = new ExtendedTextBox.TextBoxValidator() {

        @Override
        public boolean validateTextBox() {
            if (!attributeDisplayName.getTextBox().getText().trim().isEmpty()) {
                attributeDisplayName.setOk();
                return true;
            } else {
                attributeDisplayName.setError("Display name of attribute can't be empty.");
                return false;
            }
        }
    };
    attributeName.setValidator(nameValidator);
    attributeDisplayName.setValidator(displayNameValidator);
    attributeDescription.setValidator(descriptionValidator);
    final ListBox entityListBox = new ListBox();
    final ListBox definitionListBox = new ListBox();
    final ListBox typeListBox = new ListBox();
    // fill listboxs with pre-defined values
    entityListBox.addItem("facility", "urn:perun:facility:");
    entityListBox.addItem("resource", "urn:perun:resource:");
    entityListBox.addItem("group", "urn:perun:group:");
    entityListBox.addItem("group_resource", "urn:perun:group_resource:");
    entityListBox.addItem("host", "urn:perun:host:");
    entityListBox.addItem("member", "urn:perun:member:");
    entityListBox.addItem("member_group", "urn:perun:member_group:");
    entityListBox.addItem("member_resource", "urn:perun:member_resource:");
    entityListBox.addItem("user", "urn:perun:user:");
    entityListBox.addItem("user_ext_source", "urn:perun:ues:");
    entityListBox.addItem("user_facility", "urn:perun:user_facility:");
    entityListBox.addItem("vo", "urn:perun:vo:");
    entityListBox.addItem("entityless", "urn:perun:entityless:");
    definitionListBox.addItem("def", "attribute-def:def");
    definitionListBox.addItem("opt", "attribute-def:opt");
    definitionListBox.addItem("virt", "attribute-def:virt");
    definitionListBox.addItem("core", "attribute-def:core");
    typeListBox.addItem("String", "java.lang.String");
    typeListBox.addItem("Integer", "java.lang.Integer");
    typeListBox.addItem("Boolean", "java.lang.Boolean");
    typeListBox.addItem("Array", "java.util.ArrayList");
    typeListBox.addItem("LinkedHashMap", "java.util.LinkedHashMap");
    typeListBox.addItem("LargeString", Utils.largeStringClassName);
    typeListBox.addItem("LargeArrayList", Utils.largeArrayListClassName);
    // prepare layout for this tab
    FlexTable layout = new FlexTable();
    layout.setStyleName("inputFormFlexTable");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
    TabMenu menu = new TabMenu();
    // BUTTONS
    final CustomButton createButton = TabMenu.getPredefinedButton(ButtonType.CREATE, buttonTranslation.createAttributeDefinition());
    menu.addWidget(createButton);
    // close tab events & enable, disable buttons
    final JsonCallbackEvents closeTabEvents = JsonCallbackEvents.closeTabDisableButtonEvents(createButton, this);
    createButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (nameValidator.validateTextBox() && descriptionValidator.validateTextBox() && displayNameValidator.validateTextBox()) {
                String displayName = attributeDisplayName.getTextBox().getText().trim();
                String friendlyName = attributeName.getTextBox().getText().trim();
                String description = attributeDescription.getTextBox().getText().trim();
                String namespace = entityListBox.getValue(entityListBox.getSelectedIndex()) + definitionListBox.getValue(definitionListBox.getSelectedIndex());
                String type = typeListBox.getValue(typeListBox.getSelectedIndex());
                CreateAttribute request = new CreateAttribute(JsonCallbackEvents.disableButtonEvents(createButton, new JsonCallbackEvents() {

                    @Override
                    public void onFinished(JavaScriptObject jso) {
                        AttributeDefinition a = jso.cast();
                        ArrayList<AttributeRights> list = new ArrayList<AttributeRights>();
                        AttributeRights right = AttributeRights.create(a.getId(), "SELF");
                        list.add(getRightsFromWidgets(selfRead, selfWrite, right));
                        AttributeRights right2 = AttributeRights.create(a.getId(), "VOADMIN");
                        list.add(getRightsFromWidgets(voRead, voWrite, right2));
                        AttributeRights right3 = AttributeRights.create(a.getId(), "GROUPADMIN");
                        list.add(getRightsFromWidgets(groupRead, groupWrite, right3));
                        AttributeRights right4 = AttributeRights.create(a.getId(), "FACILITYADMIN");
                        list.add(getRightsFromWidgets(facilityRead, facilityWrite, right4));
                        // after update - update rights
                        SetAttributeRights request = new SetAttributeRights(JsonCallbackEvents.disableButtonEvents(createButton, new JsonCallbackEvents() {

                            @Override
                            public void onFinished(JavaScriptObject jso) {
                                enableDisableWidgets(true);
                                closeTabEvents.onFinished(jso);
                            }

                            @Override
                            public void onLoadingStart() {
                                enableDisableWidgets(false);
                            }

                            @Override
                            public void onError(PerunError error) {
                                enableDisableWidgets(true);
                            }
                        }));
                        request.setAttributeRights(list);
                    }
                }));
                request.createAttributeDefinition(displayName, friendlyName, description, namespace, type);
            }
        }
    });
    // insert layout
    layout.setHTML(0, 0, "Friendly name:");
    layout.setWidget(0, 1, attributeName);
    layout.setHTML(1, 0, "Display name:");
    layout.setWidget(1, 1, attributeDisplayName);
    layout.setHTML(2, 0, "Description:");
    layout.setWidget(2, 1, attributeDescription);
    layout.setHTML(3, 0, "Entity:");
    layout.setWidget(3, 1, entityListBox);
    layout.setHTML(4, 0, "Definition type:");
    layout.setWidget(4, 1, definitionListBox);
    layout.setHTML(5, 0, "Value type:");
    layout.setWidget(5, 1, typeListBox);
    for (int i = 0; i < layout.getRowCount(); i++) {
        cellFormatter.addStyleName(i, 0, "itemName");
    }
    final TabItem tab = this;
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().closeTab(tab, false);
        }
    }));
    final FlexTable rightsTable = new FlexTable();
    rightsTable.setStyleName("inputFormFlexTable");
    rightsTable.setHTML(0, 1, "<strong>SELF</strong>");
    rightsTable.setHTML(0, 2, "<strong>VO</strong>");
    rightsTable.setHTML(0, 3, "<strong>GROUP</strong>");
    rightsTable.setHTML(0, 4, "<strong>FACILITY</strong>");
    rightsTable.setHTML(1, 0, "<strong>READ</strong>");
    rightsTable.setHTML(2, 0, "<strong>WRITE</strong>");
    rightsTable.setWidget(1, 1, selfRead);
    rightsTable.setWidget(2, 1, selfWrite);
    rightsTable.setWidget(1, 2, voRead);
    rightsTable.setWidget(2, 2, voWrite);
    rightsTable.setWidget(1, 3, groupRead);
    rightsTable.setWidget(2, 3, groupWrite);
    rightsTable.setWidget(1, 4, facilityRead);
    rightsTable.setWidget(2, 4, facilityWrite);
    rightsTable.addStyleName("centeredTable");
    vp.add(layout);
    vp.add(rightsTable);
    vp.add(menu);
    vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) CreateAttribute(cz.metacentrum.perun.webgui.json.attributesManager.CreateAttribute) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) AttributeDefinition(cz.metacentrum.perun.webgui.model.AttributeDefinition) ExtendedTextBox(cz.metacentrum.perun.webgui.widgets.ExtendedTextBox) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) AttributeRights(cz.metacentrum.perun.webgui.model.AttributeRights) SetAttributeRights(cz.metacentrum.perun.webgui.json.attributesManager.SetAttributeRights) PerunError(cz.metacentrum.perun.webgui.model.PerunError) SetAttributeRights(cz.metacentrum.perun.webgui.json.attributesManager.SetAttributeRights)

Example 59 with CustomButton

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

the class SetNewAttributeTabItem method draw.

public Widget draw() {
    VerticalPanel mainTab = new VerticalPanel();
    mainTab.setSize("100%", "100%");
    // correct IDS for getting attrDefs
    if (ids.containsKey("resourceToGetServicesFrom")) {
        if (!ids.containsKey("resource")) {
            ids.put("resource", ids.get("resourceToGetServicesFrom"));
            ids.remove("resourceToGetServicesFrom");
        }
    }
    if (ids.containsKey("workWithUserAttributes")) {
        ids.remove("workWithUserAttributes");
    }
    if (ids.containsKey("workWithGroupAttributes")) {
        ids.remove("workWithGroupAttributes");
    }
    // set tab name
    String label = titleWidget.getText() + " (";
    for (Map.Entry<String, Integer> entry : ids.entrySet()) {
        label += entry.getKey() + ":" + String.valueOf(entry.getValue()) + " ";
    }
    label = label.substring(0, label.length() - 1) + ")";
    titleWidget.setText(label);
    // helper text
    String entityIds = "";
    for (Map.Entry<String, Integer> item : ids.entrySet()) {
        entityIds = entityIds.concat(" " + item.getKey() + ": " + item.getValue());
    }
    HTML helper = new HTML();
    String helperInside = "<p>Enter new values and press Enter key. Save changes by clicking on \"Save changes\" button. Values will be set for<strong>" + entityIds + ".</strong></p>";
    helper.setHTML(helperInside);
    // callback
    final GetAttributesDefinitionWithRights attrDef = new GetAttributesDefinitionWithRights(ids);
    // remove already used attributes from offering
    JsonCallbackEvents localEvents = new JsonCallbackEvents() {

        public void onFinished(JavaScriptObject jso) {
            if (!inUse.isEmpty()) {
                for (Attribute a : inUse) {
                    attrDef.removeFromTable(a);
                }
            }
        }
    };
    attrDef.setEvents(localEvents);
    // filter core attributes
    attrDef.switchCore();
    // which entities to show
    Set<String> namespaces = getNamespacesForEntities(ids.keySet());
    // show only these attributes
    attrDef.setEntities(namespaces);
    // get table
    CellTable<Attribute> table = attrDef.getTable();
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    table.addStyleName("perun-table");
    table.setWidth("100%");
    // add save button
    TabMenu menu = new TabMenu();
    final TabItem tab = this;
    final CustomButton saveButton = TabMenu.getPredefinedButton(ButtonType.SAVE, buttonTranslation.saveNewAttributes());
    final JsonCallbackEvents events = JsonCallbackEvents.closeTabDisableButtonEvents(saveButton, tab);
    saveButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            // Save the attributes
            ArrayList<Attribute> list = attrDef.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {
                // separated list by entity
                ArrayList<Attribute> facilityList = new ArrayList<Attribute>();
                ArrayList<Attribute> userFacilityList = new ArrayList<Attribute>();
                ArrayList<Attribute> userList = new ArrayList<Attribute>();
                ArrayList<Attribute> memberList = new ArrayList<Attribute>();
                ArrayList<Attribute> memberGroupList = new ArrayList<Attribute>();
                ArrayList<Attribute> memberResourceList = new ArrayList<Attribute>();
                ArrayList<Attribute> resourceList = new ArrayList<Attribute>();
                ArrayList<Attribute> groupList = new ArrayList<Attribute>();
                ArrayList<Attribute> groupResourceList = new ArrayList<Attribute>();
                ArrayList<Attribute> hostList = new ArrayList<Attribute>();
                ArrayList<Attribute> voList = new ArrayList<Attribute>();
                ArrayList<Attribute> uesList = new ArrayList<Attribute>();
                for (Attribute a : list) {
                    if (a.getEntity().equalsIgnoreCase("facility")) {
                        facilityList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("user_facility")) {
                        userFacilityList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("resource")) {
                        resourceList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("user")) {
                        userList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("member_resource")) {
                        memberResourceList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("member")) {
                        memberList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("group")) {
                        groupList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("group_resource")) {
                        groupResourceList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("host")) {
                        hostList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("vo")) {
                        voList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("member_group")) {
                        memberGroupList.add(a);
                    } else if (a.getEntity().equalsIgnoreCase("ues")) {
                        uesList.add(a);
                    }
                }
                // GROUPING BY IDS
                // GROUPING BY IDS
                SetAttributes request = new SetAttributes(events);
                if (ids.size() == 4 && ids.containsKey("facility") && ids.containsKey("user") && ids.containsKey("member") && ids.containsKey("resource")) {
                    ArrayList sendList = new ArrayList();
                    sendList.addAll(memberList);
                    sendList.addAll(userList);
                    sendList.addAll(memberResourceList);
                    sendList.addAll(userFacilityList);
                    request.setAttributes(ids, sendList);
                } else if (ids.size() == 2 && ids.containsKey("facility") && ids.containsKey("user")) {
                    ArrayList sendList = new ArrayList();
                    sendList.addAll(userList);
                    sendList.addAll(userFacilityList);
                    request.setAttributes(ids, sendList);
                } else if (ids.size() == 2 && ids.containsKey("member") && ids.containsKey("resource")) {
                    ArrayList sendList = new ArrayList();
                    sendList.addAll(memberList);
                    sendList.addAll(memberResourceList);
                    request.setAttributes(ids, sendList);
                } else if (ids.size() == 2 && ids.containsKey("group") && ids.containsKey("resource")) {
                    ArrayList sendList = new ArrayList();
                    sendList.addAll(groupList);
                    sendList.addAll(groupResourceList);
                    // call proper method in RPC
                    ids.put("workWithGroupAttributes", 1);
                    request.setAttributes(ids, sendList);
                    ids.remove("workWithGroupAttributes");
                } else if (ids.size() == 2 && ids.containsKey("member") && ids.containsKey("user")) {
                    ArrayList sendList = new ArrayList();
                    sendList.addAll(memberList);
                    sendList.addAll(userList);
                    // call proper method in RPC
                    ids.put("workWithUserAttributes", 1);
                    request.setAttributes(ids, sendList);
                    ids.remove("workWithUserAttributes");
                } else if (ids.size() == 2 && ids.containsKey("group") && ids.containsKey("member")) {
                    ArrayList sendList = new ArrayList();
                    sendList.addAll(memberGroupList);
                    // call proper method in RPC
                    request.setAttributes(ids, sendList);
                } else if (ids.size() == 1 && ids.containsKey("group")) {
                    request.setAttributes(ids, groupList);
                } else if (ids.size() == 1 && ids.containsKey("resource")) {
                    request.setAttributes(ids, resourceList);
                } else if (ids.size() == 1 && ids.containsKey("facility")) {
                    request.setAttributes(ids, facilityList);
                } else if (ids.size() == 1 && ids.containsKey("vo")) {
                    request.setAttributes(ids, voList);
                } else if (ids.size() == 1 && ids.containsKey("host")) {
                    request.setAttributes(ids, hostList);
                } else if (ids.size() == 1 && ids.containsKey("member")) {
                    request.setAttributes(ids, memberList);
                } else if (ids.size() == 1 && ids.containsKey("user")) {
                    request.setAttributes(ids, userList);
                } else if (ids.size() == 1 && ids.containsKey("userExtSource")) {
                    request.setAttributes(ids, uesList);
                } else {
                    String combination = "";
                    for (String key : ids.keySet()) {
                        combination += key + ": " + ids.get(key) + " | ";
                    }
                    UiElements.generateAlert("Wrong entities combination", "Unsupported combination of attributes to set: " + combination);
                }
            }
        }
    });
    menu.addWidget(saveButton);
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().closeTab(tab, false);
        }
    }));
    menu.addWidget(helper);
    mainTab.add(menu);
    mainTab.setCellHeight(menu, "30px");
    // table wrapper
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    // do not resize like perun table to prevent wrong width in inner tab
    session.getUiElements().resizeSmallTabPanel(sp, 350, this);
    // add table to the page
    mainTab.add(sp);
    //saveButton.setEnabled(false);
    //JsonUtils.addTableManagedButton(attrDef, table, saveButton);
    this.contentWidget.setWidget(mainTab);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Attribute(cz.metacentrum.perun.webgui.model.Attribute) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SetAttributes(cz.metacentrum.perun.webgui.json.attributesManager.SetAttributes) GetAttributesDefinitionWithRights(cz.metacentrum.perun.webgui.json.attributesManager.GetAttributesDefinitionWithRights) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton)

Example 60 with CustomButton

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

the class AddAuthorTabItem method draw.

public Widget draw() {
    titleWidget.setText("Add author");
    this.users = new FindCompleteRichUsers("", null);
    // MAIN TAB PANEL
    VerticalPanel firstTabPanel = new VerticalPanel();
    firstTabPanel.setSize("100%", "100%");
    // PUB-INFO
    TabMenu info = new TabMenu();
    info.addWidget(new HTML("<strong>FULL&nbsp;CITE: </strong>" + publication.getMain()));
    firstTabPanel.add(info);
    // HORIZONTAL MENU
    TabMenu tabMenu = new TabMenu();
    // get the table
    final CellTable<User> table;
    if (session.isPerunAdmin()) {
        table = users.getTable(new FieldUpdater<User, String>() {

            public void update(int index, User object, String value) {
                session.getTabManager().addTab(new UserDetailTabItem(object));
            }
        });
    } else {
        table = users.getTable();
    }
    final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, "Add selected user(s) as author(s) of publication: " + publication.getTitle());
    tabMenu.addWidget(addButton);
    addButton.setEnabled(false);
    JsonUtils.addTableManagedButton(users, table, addButton);
    final TabItem tab = this;
    addButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            ArrayList<User> list = users.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {
                // proceed
                for (int i = 0; i < list.size(); i++) {
                    final String name = list.get(i).getFullNameWithTitles();
                    // add name events
                    JsonCallbackEvents authorshipEvents = new JsonCallbackEvents() {

                        public void onFinished(JavaScriptObject jso) {
                            updateAlreadyAdded(name);
                        }
                    };
                    // merge with refresh?
                    if (i == list.size() - 1 && events != null) {
                        authorshipEvents = JsonCallbackEvents.mergeEvents(authorshipEvents, events);
                    }
                    // call
                    CreateAuthorship request = new CreateAuthorship(JsonCallbackEvents.disableButtonEvents(addButton, authorshipEvents));
                    request.createAuthorship(publicationId, list.get(i).getId());
                    if (i == list.size() - 1) {
                        users.clearTableSelectedSet();
                    }
                }
            }
        }
    });
    tabMenu.addWidget(TabMenu.getPredefinedButton(ButtonType.CLOSE, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // trigger refresh of sub-tab via event
            events.onFinished(null);
            session.getTabManager().closeTab(tab, false);
        }
    }));
    tabMenu.addSearchWidget(new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            users.searchFor(text);
            searchString = text;
        }
    }, ButtonTranslation.INSTANCE.searchUsers());
    // add a class to the table and wrap it into scroll panel
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    // add menu to the main panel
    firstTabPanel.add(tabMenu);
    firstTabPanel.setCellHeight(tabMenu, "30px");
    // add already added
    firstTabPanel.add(alreadyAddedAuthors);
    firstTabPanel.setCellHeight(alreadyAddedAuthors, "30px");
    // add table to the main panel
    firstTabPanel.add(sp);
    // do not resize like perun table to prevent wrong width in inner tab
    session.getUiElements().resizeSmallTabPanel(sp, 350, this);
    this.contentWidget.setWidget(firstTabPanel);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) FieldUpdater(com.google.gwt.cell.client.FieldUpdater) User(cz.metacentrum.perun.webgui.model.User) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) CreateAuthorship(cz.metacentrum.perun.webgui.json.cabinetManager.CreateAuthorship) FindCompleteRichUsers(cz.metacentrum.perun.webgui.json.usersManager.FindCompleteRichUsers) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) ArrayList(java.util.ArrayList) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton)

Aggregations

CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)174 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)161 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)161 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)132 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)115 ArrayList (java.util.ArrayList)113 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)98 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)71 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)38 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)32 PerunError (cz.metacentrum.perun.webgui.model.PerunError)30 HashMap (java.util.HashMap)29 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)21 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)20 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)20 Map (java.util.Map)20 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)19 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)19 Group (cz.metacentrum.perun.webgui.model.Group)17 User (cz.metacentrum.perun.webgui.model.User)17