Example usage for com.vaadin.ui Window setClosable

List of usage examples for com.vaadin.ui Window setClosable

Introduction

In this page you can find the example usage for com.vaadin.ui Window setClosable.

Prototype

public void setClosable(boolean closable) 

Source Link

Document

Sets the closable status for the window.

Usage

From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("More Info");
    win.setResizable(false);//w  w  w  . ja  va2s  .  co  m
    win.center();

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    String taskName = step.getCaption();
    UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory");
    UserStory userStory = userStoryDAO.getCurrentWorkingUserStory(project);

    TaskDAO taskDAO = (TaskDAO) DashboardUI.context.getBean("Task");
    Task task1 = taskDAO.getTaskFromUserStroyNameAndTaskName(userStory.getName(), taskName);

    TextField userStoryNameField = new TextField("Task Name");
    userStoryNameField.setValue(task1.getName());

    TextField userStoryPriority = new TextField("Priority");
    userStoryPriority.setValue(String.valueOf(task1.getPriority()));

    TextField userStoryState = new TextField("State");
    userStoryState.setValue(task1.getState());

    TextField projectName = new TextField("Project Name");
    projectName.setValue(project.getName());

    TextField userStoryName = new TextField("UserStoryName Name");
    userStoryName.setValue(userStory.getName());

    content.addComponent(userStoryNameField);
    content.addComponent(userStoryPriority);
    content.addComponent(userStoryState);
    content.addComponent(projectName);
    content.addComponent(userStoryName);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            win.close();
        }

    });

    content.addComponent(ok);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("More Info");
    win.setResizable(false);/*from   w ww.j  a  va2s . co  m*/
    win.center();

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    String userStoryName = step.getCaption();
    UserStoryDAO userStoryDAO = (UserStoryDAO) DashboardUI.context.getBean("UserStory");
    UserStory userStory = userStoryDAO.getUserStoryFormProjectNameAndUserStoryName(project.getName(),
            userStoryName);

    TextField userStoryNameField = new TextField("User Story Name");
    userStoryNameField.setValue(userStory.getName());

    TextField userStoryPriority = new TextField("Priority");
    userStoryPriority.setValue(String.valueOf(userStory.getPriority()));

    TextField userStoryState = new TextField("State");
    userStoryState.setValue(userStory.getState());

    TextField projectName = new TextField("Project Name");
    projectName.setValue(project.getName());

    content.addComponent(userStoryNameField);
    content.addComponent(userStoryPriority);
    content.addComponent(userStoryState);
    content.addComponent(projectName);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            win.close();
        }

    });

    content.addComponent(ok);
    win.setClosable(true);

    DashboardUI.getCurrent().getUI().addWindow(win);
}

From source file:com.purebred.core.MainApplication.java

License:Open Source License

/**
 * Open separate error Window, useful for showing stacktraces.
 *
 * @param message/*from  w w  w .ja v  a  2  s  .c  o  m*/
 */
public void openErrorWindow(String message) {
    Window errorWindow = new Window("Error");
    errorWindow.addStyleName("opaque");
    VerticalLayout layout = (VerticalLayout) errorWindow.getContent();
    layout.setSpacing(true);
    layout.setWidth("100%");
    errorWindow.setWidth("100%");
    errorWindow.setModal(true);
    Label label = new Label(message);
    label.setContentMode(Label.CONTENT_PREFORMATTED);
    layout.addComponent(label);
    errorWindow.setClosable(true);
    errorWindow.setScrollable(true);
    MainApplication.getInstance().getMainWindow().addWindow(errorWindow);
}

From source file:com.snowy.UsersList.java

public UsersList(data d) {
    this.d = d;/*from   ww w . jav  a  2 s  .  c  o m*/
    c.addContainerProperty("id", Integer.class, "");
    retrieveActiveUsers();
    //this.addItem("Chase");
    //this.addItem("Cole");

    //ll.addComponent(ll);
    //PopupView pop = new PopupView(null,ll);
    //pop.s
    //pop.addPopupVisibilityListener(e->{
    //   ll.addComponent(hl);
    //});

    //TODO add the select listener
    ls.addValueChangeListener(e -> {
        if (e.getProperty().getValue() != null) {
            Window w = new Window("Confirm Challenge");
            int id = Integer.parseInt(c.getItem(e.getProperty().getValue().toString()).getItemProperty("id")
                    .getValue().toString());
            String Username = e.getProperty().getValue().toString();
            //Logger.getLogger(UsersList.class.getName()).info(Username);
            //Logger.getLogger(UsersList.class.getName()).info(id+"");
            VerticalLayout ll = new VerticalLayout();
            VerticalLayout bb = new VerticalLayout();
            HorizontalLayout hl = new HorizontalLayout();
            Label la = new Label("Send challenge to " + Username + "?");
            bb.addComponent(la);
            ll.addComponent(bb);

            ll.setSizeUndefined();
            bb.setComponentAlignment(la, Alignment.MIDDLE_CENTER);

            ll.addComponent(hl);
            ll.setSpacing(true);
            ll.setMargin(new MarginInfo(true, true, false, true));
            hl.setMargin(new MarginInfo(false, true, true, true));
            hl.setSpacing(true);
            Button cancle = new Button("Cancel", b -> {
                w.close();
            });
            Button send = new Button("Send", c -> {
                if (d.sendChallenge(id)) {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Sent Succesfully!"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Success");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                } else {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Dend Failed"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Failure");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                }
            });
            hl.addComponents(cancle, send);
            //      this.addComponent(pop);
            //    ll.addComponent(la);
            //   pop.setPopupVisible(true);
            //w.setPosition(null, null);
            w.center();
            w.setModal(true);
            w.setClosable(false);
            w.setResizable(false);
            w.setContent(ll);
            this.getUI().addWindow(w);

        }
    });

    this.setSizeFull();
    this.addStyleName("mine");
    this.addComponent(ls);
    ls.setContainerDataSource(c);
    //ls.setContainerDataSource((Container) hm.keySet());
    ls.setSizeFull();
    ls.setImmediate(true);

}

From source file:edu.nps.moves.mmowgli.components.MmowgliDialogContent.java

License:Open Source License

public static void throwUpDialog2() {
    Window w = new Window();
    w.setClosable(false);
    w.setResizable(true);//www .j a  va 2s  . c o m
    w.setStyleName("m-mmowglidialog2");
    w.addStyleName("m-transparent"); // don't know why I need this, .mmowglidialog sets it too
    w.setWidth("600px");
    w.setHeight("400px");
    MmowgliDialogContent con = new MmowgliDialogContent();
    w.setContent(con);
    con.setSizeFull();
    con.initGui();
    con.setTitleString("Yippee ki awol!");

    UI.getCurrent().addWindow(w);
    w.center();

}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.PasswordResetPopup.java

License:Open Source License

private void makeResetAnnounceDialogTL_5(String email, ArrayList<User> aLis) {
    UI myUI = getUI();//from   www.j av  a  2 s. c om
    myUI.removeWindow(PasswordResetPopup.this);

    final Window resetAnnounceDialog = new Window("Password Reset Announcement");
    resetAnnounceDialog.setModal(true);
    resetAnnounceDialog.setClosable(false);
    VerticalLayout vLay = new VerticalLayout();
    resetAnnounceDialog.setContent(vLay);
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.setSizeUndefined();
    vLay.setWidth("400px");

    Label message = new HtmlLabel("An email has been sent to <b>" + email + "</b>.");
    vLay.addComponent(message);

    message = new Label(
            "Follow the link in the message to confirm your password reset request to enable login to your mmowgli player account.");
    vLay.addComponent(message);

    message = new Label(
            "Please be advised that you will only have three hours to complete this process, after which time "
                    + "you will have to re-initiate a new password reset process from the game login page.");
    vLay.addComponent(message);

    message = new HtmlLabel(
            "Now, press <b>Homepage -- Return to login</b> after receiving a reset request confirmation email.");
    vLay.addComponent(message);

    @SuppressWarnings("serial")
    Button laterButt = new Button("Homepage -- Return to login", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            HSess.init();
            Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameHomeUrl());
            HSess.close();
        }
    });
    vLay.addComponent(laterButt);

    @SuppressWarnings("serial")
    Button troubleButt = new Button("Send trouble report", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            HSess.init();
            Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink());
            HSess.close();
        }
    });
    vLay.addComponent(troubleButt);

    myUI.addWindow(resetAnnounceDialog);
    resetAnnounceDialog.center();

    // This process generates unique uId for th3 reset process that will
    // need to be confirmed once the user receives a confirmation email and
    // click on the link containing the uId
    Iterator<User> itr = aLis.iterator();
    // sends email to all user accounts (which are at the same email address)
    // if a game name was entered, only that account receives the email
    while (itr.hasNext()) {
        User usr = itr.next();
        PasswordReset pr = new PasswordReset(usr);
        PasswordReset.saveTL(pr);

        String confirmUrl = buildConfirmUrl(pr);
        AppMaster.instance().getMailManager().sendPasswordResetEmailTL(email, usr.getUserName(), confirmUrl);
    }
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java

License:Open Source License

@SuppressWarnings("serial")
private void wereInTL(User _usr) {
    Game g = Game.getTL();//from   w  w w.  j  a va  2s. c o  m
    if (!g.isEmailConfirmation()/* && !g.isSMSConfirmation()*/) {
        _usr.setEmailConfirmed(true); // confirmation didn't happen, but they want to login
        wereInReallyTL(_usr); // will do update
    }
    /*  else if(g.isSMSConfirmation()) {  // if both are selected, only sms is done
                
      } */
    else {
        List<String> sLis = VHibPii.getUserPiiEmails(_usr.getId());
        String email = sLis.get(0);
        final Window emailDialog = new Window("Email Confirmation");
        emailDialog.setModal(true);
        emailDialog.setClosable(false);
        VerticalLayout vLay = new VerticalLayout();
        emailDialog.setContent(vLay);
        vLay.setMargin(true);
        vLay.setSpacing(true);
        vLay.setSizeUndefined();
        vLay.setWidth("400px");

        Label message = new HtmlLabel("A confirmation email has been sent to <b>" + email + "</b>.");
        vLay.addComponent(message);

        message = new Label("Follow the link in the message "
                + "to confirm your registration and unlock your mmowgli user account.");
        vLay.addComponent(message);

        message = new HtmlLabel("Press the <b>Am I confirmed yet?</b> button " + "to play if ready.");
        vLay.addComponent(message);

        message = new HtmlLabel(
                "Alternatively, press <b>Quit -- I'll come back later</b> to login at a future time.");
        vLay.addComponent(message);

        GridLayout grid = new GridLayout();
        vLay.addComponent(grid);

        MSysOut.println(NEWUSER_CREATION_LOGS,
                "email confirmation dialog displayed, user " + _usr.getUserName());

        final Button contButt = new Button("Am I confirmed yet?", new ClickListener() {
            boolean confirmed = false;

            @Override
            @HibernateUpdate
            @HibernateUserUpdate
            public void buttonClick(ClickEvent event) {
                MSysOut.println(DEBUG_LOGS, "\"Am I confirmed?\" button handler entered");

                HSess.init();
                User u = User.getTL(userId);
                MSysOut.println(NEWUSER_CREATION_LOGS, "\"Am I confirmed?\" clicked, user " + u.getUserName());

                if (confirmed) {
                    closePopup(emailDialog);
                    wereInReallyTL(u); //  @HibernateUserUpdate //@HibernateUserRead
                    MSysOut.println(NEWUSER_CREATION_LOGS,
                            "\"Am I confirmed?\", positive confirmation, user " + u.getUserName());
                } else {
                    MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.wereInTL()");
                    //User locUsr = User.getTL(userId);  why necessary?
                    //if(locUsr.isEmailConfirmed()) {
                    if (u.isEmailConfirmed()) {
                        confirmed = true;
                        event.getButton().setCaption("I'm ready to play mmowgli!");
                    } else {
                        MSysOut.println(NEWUSER_CREATION_LOGS,
                                "\"Am I confirmed?\", negative confirmation, user " + u.getUserName());
                        Notification.show("Your email is not yet confirmed");
                    }
                }
                HSess.close();
            }
        });
        grid.addComponent(contButt);
        contButt.setImmediate(true);

        Button laterButt = new Button("Quit -- I'll come back later", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                MSysOut.println(DEBUG_LOGS, "\"Quit -- I'll come back later\" button handler entered");

                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getThanksForInterestLink());
                HSess.close();
            }
        });
        grid.addComponent(laterButt);

        Button troubleButt = new Button("Send trouble report", new ClickListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void buttonClick(ClickEvent event) // no need for HSess
            {
                MSysOut.println(DEBUG_LOGS, "\"Send trouble report\" button handler entered");

                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink());
                HSess.close();
            }
        });
        grid.addComponent(troubleButt);

        openPopupWindowInMainWindow(emailDialog, 500);

        EmailConfirmation ec = new EmailConfirmation(_usr);
        EmailConfirmation.saveTL(ec);

        String confirmUrl = buildConfirmUrl(ec);
        AppMaster.instance().getMailManager().sendEmailConfirmationTL(email, _usr.getUserName(), confirmUrl);
    } // else weren't confirmed
}

From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.KmlDocumentViewer.java

License:Apache License

public KmlDocumentViewer(String focusedFeature, Coordinate coordinate) {
    super();/*from  www  . ja  v  a 2 s . co  m*/
    setImmediate(true);
    loadDocument();
    setWidth(100, UNITS_PERCENTAGE);
    addComponent(ufu);
    addLayer(osm);
    addLayer(vectorLayer);

    extractStyles(doc);

    displayFeatures(focusedFeature);

    vectorLayer.setSelectionMode(SIMPLE);
    vectorLayer.setImmediate(true);
    vectorLayer.addListener(new VectorSelectedListener() {
        public void vectorSelected(VectorSelectedEvent event) {
            final Area component = (Area) event.getVector();
            final String data = (String) component.getData();

            final Window window = new Window("Details");
            window.getContent().setSizeFull();
            window.setHeight("50%");
            window.setWidth("50%");

            Button button = new Button("Focus this feature");
            button.addListener(new ClickListener() {
                private static final long serialVersionUID = 3286851301965195290L;

                @Override
                public void buttonClick(ClickEvent event) {
                    ufu.setFragment(data);
                    displayFeatures(data);
                    window.getParent().removeWindow(window);
                }
            });
            window.addComponent(button);
            window.setClosable(true);
            window.center();
            getWindow().addWindow(window);
            vectorLayer.setSelectedVector(null);
        }
    });

    if (coordinate != null) {
        // Definig a Marker Layer
        MarkerLayer markerLayer = new MarkerLayer();

        // Defining a new Marker

        final Marker marker = new Marker(coordinate.getLongitude(), coordinate.getLatitude());
        // URL of marker Icon
        marker.setIcon(new ThemeResource("img/marker.png"), 60, 60);
        markerLayer.addComponent(marker);
        addLayer(markerLayer);
        setCenter(coordinate.getLongitude(), coordinate.getLatitude());
    }

}

From source file:kn.uni.gis.ui.GameApplication.java

License:Apache License

private Window createGameWindow() {

    tabsheet = new TabSheet();
    tabsheet.setImmediate(true);//from   w ww .  j a  v  a 2 s. co m
    tabsheet.setCloseHandler(new CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {

            Game game = ((GameComposite) tabContent).getGame();

            GameComposite remove = gameMap.remove(game);

            // closes the game and the running thread!
            remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent());

            eventBus.unregister(remove);
            eventBus.unregister(remove.getLayer());

            map.removeLayer(remove.getLayer());

            tabsheet.removeComponent(tabContent);

            if (gameMap.isEmpty()) {
                pi.setVisible(false);
            }
        }
    });

    final Window mywindow = new Window("Games");
    mywindow.setPositionX(0);
    mywindow.setPositionY(0);
    mywindow.setHeight("50%");
    mywindow.setWidth("25%");
    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout lay = new HorizontalLayout();

    final Button button_1 = new Button();
    button_1.setCaption("Open Game");
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");

    button_1.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final String id = textField_1.getValue().toString();

            if (id.length() < 5) {
                window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE);
            } else {
                String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s"
                        + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER);

                final Game game = new Game(id);
                final PreparedStatement statement = geoUtil.getConn()
                        .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER
                                + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT "
                                + MAX_STATES_IN_MEM);

                try {
                    geoUtil.getConn().executeSafeQuery(sql, new DoWithin() {

                        @Override
                        public void doIt(ResultSet executeQuery) throws SQLException {

                            while (executeQuery.next()) {
                                if (statement == null) {

                                }
                                String playerId = executeQuery.getString(1);
                                Timestamp min = executeQuery.getTimestamp(3);
                                Timestamp max = executeQuery.getTimestamp(4);
                                game.addPlayer(playerId, executeQuery.getString(2), min, max,
                                        new TimingIterator(geoUtil, id, playerId, min.getTime(), statement));
                            }
                        }
                    }, id + "%");
                } catch (SQLException e) {
                    LOGGER.info("error on sql!", e);

                }

                game.finish(statement);

                if (!!!gameMap.containsKey(game)) {
                    if (game.getStates().size() == 0) {
                        window.showNotification("game not found!");
                    } else {
                        LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size());

                        GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus,
                                game, createColorMap(game));

                        final GameComposite gameComposite = new GameComposite(GameApplication.this, game,
                                gameVectorLayer, eventBus);

                        eventBus.register(gameComposite);
                        eventBus.register(gameVectorLayer);

                        map.addLayer(gameVectorLayer);
                        gameMap.put(game, gameComposite);

                        // Add the component to the tab sheet as a new tab.
                        Tab addTab = tabsheet.addTab(gameComposite);
                        addTab.setCaption(game.getId().substring(0, 5));
                        addTab.setClosable(true);

                        pi.setVisible(true);
                        // pl.get
                        PlayerState playerState = game.getStates().get(game.getFox()).peek();
                        map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint())));
                    }
                }
            }
        }

        private Map<Player, Integer> createColorMap(Game game) {
            Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size());

            ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder();

            int i = 0;

            for (Player play : game.getStates().keySet()) {
                builder.put(play, getColor(scale.apply((double) i++)));
            }

            return builder.build();
        }

        private Integer getColor(double dob) {

            int toReturn = 0;
            toReturn = toReturn | 255 - (int) Math.round(255 * dob);
            toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16);
            return toReturn;
            // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob +
            // 5 * dob);
        }

    });

    Button button_2 = new Button();
    button_2.setCaption("All seeing Hunter");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (adminWindow == null) {
                adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() {
                    @Override
                    public void itemClick(ItemClickEvent event) {

                        textField_1.setValue(event.getItemId().toString());
                        mywindow.bringToFront();
                        button_1.focus();
                    }
                });
                window.addWindow(adminWindow);
                adminWindow.setWidth("30%");
                adminWindow.setHeight("40%");
                adminWindow.addListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        adminWindow = null;
                    }
                });
            }
        }
    });

    lay.addComponent(button_1);
    textField_1 = new TextField();
    textField_1.setImmediate(false);
    textField_1.setWidth("-1px");
    textField_1.setHeight("-1px");
    lay.addComponent(textField_1);
    lay.addComponent(button_2);
    lay.addComponent(pi);

    lay.setComponentAlignment(pi, Alignment.TOP_RIGHT);

    layout.addComponent(lay);
    layout.addComponent(tabsheet);

    mywindow.addComponent(layout);
    mywindow.setClosable(false);

    /* Add the window inside the main window. */
    return mywindow;
}

From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileAuthView.java

License:Open Source License

public CoordMobileAuthView(String CoordID) {

    CtCoordinator ctCoordinator = (CtCoordinator) sys
            .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID)));
    ActCoordinator actCoordinator = sys.getActCoordinator(ctCoordinator);

    actCoordinator.setActorUI(UI.getCurrent());
    env.setActCoordinator(actCoordinator.getName(), actCoordinator);

    IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator);
    IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator);

    thisCoordID = CoordID;//from w  ww . j  ava2s .  c  o m

    setResponsive(true);
    setWidth("100%");

    NavigationBar alertsBar = new NavigationBar();
    VerticalComponentGroup alertsContent = new VerticalComponentGroup();
    alertsContent.setWidth("100%");
    alertsContent.setResponsive(true);

    HorizontalLayout alertButtons1 = new HorizontalLayout();
    HorizontalLayout alertButtons2 = new HorizontalLayout();
    //alertButtons.setMargin(true);
    //alertButtons.setSpacing(true);

    alertsBar.setCaption("Coordinator " + ctCoordinator.login.toString());
    // NavigationButton logoutBtn1 = new NavigationButton("Logout");
    Button logoutBtn1 = new Button("Logout");
    alertsBar.setRightComponent(logoutBtn1);

    alertsTable = new Grid();
    alertsTable.setContainerDataSource(actCoordinator.getAlertsContainer());
    alertsTable.setColumnOrder("ID", "date", "time", "longitude", "latitude", "comment", "status");
    alertsTable.setSelectionMode(SelectionMode.SINGLE);

    alertsTable.setWidth("100%");
    alertsTable.setResponsive(true);
    //alertsTable.setSizeUndefined();

    alertsTable.setImmediate(true);

    Grid inputEventsTable1 = new Grid();
    inputEventsTable1.setContainerDataSource(actCoordinator.getMessagesDataSource());
    inputEventsTable1.setWidth("100%");
    inputEventsTable1.setResponsive(true);

    alertsContent.addComponents(alertsBar, alertButtons1, alertButtons2, alertsTable, inputEventsTable1);

    Tab alertsTab = this.addTab(alertsContent);
    alertsTab.setCaption("Alerts");

    alertStatus = new NativeSelect();
    alertStatus.setNullSelectionAllowed(false);
    alertStatus.addItems("Pending", "Valid", "Invalid");
    alertStatus.setImmediate(true);

    alertStatus.select("Pending");

    Button validateAlertBtn = new Button("Validate");
    Button invalidateAlertBtn = new Button("Invalidate");
    Button getAlertsSetBtn = new Button("Get alerts set");

    validateAlertBtn.setImmediate(true);
    invalidateAlertBtn.setImmediate(true);

    validateAlertBtn.addClickListener(event -> {
        AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow();

        Integer thisAlertID = new Integer(selectedAlertBean.getID());
        PtBoolean res;
        res = sys.oeValidateAlert(new DtAlertID(new PtString(thisAlertID.toString())));
    });

    invalidateAlertBtn.addClickListener(event -> {
        AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow();
        Integer thisAlertID = new Integer(selectedAlertBean.getID());
        PtBoolean res;
        res = sys.oeInvalidateAlert(new DtAlertID(new PtString(thisAlertID.toString())));
    });

    getAlertsSetBtn.addClickListener(event -> {
        if (alertStatus.getValue().toString().equals("Pending"))
            actCoordinator.oeGetAlertsSet(EtAlertStatus.pending);
        else if (alertStatus.getValue().toString().equals("Valid"))
            actCoordinator.oeGetAlertsSet(EtAlertStatus.valid);
        else if (alertStatus.getValue().toString().equals("Invalid"))
            actCoordinator.oeGetAlertsSet(EtAlertStatus.invalid);
    });

    alertButtons1.addComponents(validateAlertBtn, invalidateAlertBtn);
    alertButtons2.addComponents(getAlertsSetBtn, alertStatus);

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////

    NavigationBar crisesBar = new NavigationBar();
    VerticalComponentGroup crisesContent = new VerticalComponentGroup();
    crisesContent.setWidth("100%");
    crisesContent.setResponsive(true);

    HorizontalLayout crisesButtons1 = new HorizontalLayout();
    HorizontalLayout crisesButtons2 = new HorizontalLayout();
    crisesBar.setCaption("Coordinator " + ctCoordinator.login.toString());
    //NavigationButton logoutBtn2 = new NavigationButton("Logout");
    Button logoutBtn2 = new Button("Logout");
    crisesBar.setRightComponent(logoutBtn2);

    crisesTable = new Grid();
    crisesTable.setContainerDataSource(actCoordinator.getCrisesContainer());
    crisesTable.setColumnOrder("ID", "date", "time", "type", "longitude", "latitude", "comment", "status");
    crisesTable.setSelectionMode(SelectionMode.SINGLE);

    crisesTable.setWidth("100%");
    //crisesTable.setSizeUndefined();

    crisesTable.setImmediate(true);
    crisesTable.setResponsive(true);

    Grid inputEventsTable2 = new Grid();
    inputEventsTable2.setContainerDataSource(actCoordinator.getMessagesDataSource());
    inputEventsTable2.setWidth("100%");
    inputEventsTable2.setResponsive(true);

    crisesContent.addComponents(crisesBar, crisesButtons1, crisesButtons2, crisesTable, inputEventsTable2);

    Tab crisesTab = this.addTab(crisesContent);
    crisesTab.setCaption("Crises");

    Button handleCrisesBtn = new Button("Handle");
    Button reportOnCrisisBtn = new Button("Report");
    Button changeCrisisStatusBtn = new Button("Status");
    Button closeCrisisBtn = new Button("Close");
    Button getCrisesSetBtn = new Button("Get crises set");
    crisesStatus = new NativeSelect();

    handleCrisesBtn.setImmediate(true);
    reportOnCrisisBtn.setImmediate(true);
    changeCrisisStatusBtn.setImmediate(true);
    closeCrisisBtn.setImmediate(true);
    getCrisesSetBtn.setImmediate(true);
    crisesStatus.setImmediate(true);

    crisesStatus.addItems("Pending", "Handled", "Solved", "Closed");
    crisesStatus.setNullSelectionAllowed(false);
    crisesStatus.select("Pending");

    crisesButtons1.addComponents(handleCrisesBtn, reportOnCrisisBtn, changeCrisisStatusBtn);
    crisesButtons2.addComponents(closeCrisisBtn, getCrisesSetBtn, crisesStatus);

    ////////////////////////////////////////

    Window reportCrisisSubWindow = new Window();
    reportCrisisSubWindow.setClosable(false);
    reportCrisisSubWindow.setResizable(false);
    reportCrisisSubWindow.setResponsive(true);
    VerticalLayout reportLayout = new VerticalLayout();
    reportLayout.setMargin(true);
    reportLayout.setSpacing(true);
    reportCrisisSubWindow.setContent(reportLayout);
    TextField crisisID = new TextField();
    TextField reportText = new TextField();
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    Button reportCrisisBtn = new Button("Report");
    reportCrisisBtn.setClickShortcut(KeyCode.ENTER);
    reportCrisisBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    Button cancelBtn = new Button("Cancel");
    buttonsLayout.addComponents(reportCrisisBtn, cancelBtn);
    buttonsLayout.setSpacing(true);
    reportLayout.addComponents(crisisID, reportText, buttonsLayout);

    cancelBtn.addClickListener(event -> {
        reportCrisisSubWindow.close();
        reportText.clear();
    });

    reportCrisisBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        actCoordinator.oeReportOnCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())),
                new DtComment(new PtString(reportText.getValue())));

        reportCrisisSubWindow.close();
        reportText.clear();
    });

    ////////////////////////////////////////

    Window changeCrisisStatusSubWindow = new Window();
    changeCrisisStatusSubWindow.setClosable(false);
    changeCrisisStatusSubWindow.setResizable(false);
    changeCrisisStatusSubWindow.setResponsive(true);
    VerticalLayout statusLayout = new VerticalLayout();
    statusLayout.setMargin(true);
    statusLayout.setSpacing(true);
    changeCrisisStatusSubWindow.setContent(statusLayout);
    TextField crisisID1 = new TextField();

    NativeSelect crisisStatus = new NativeSelect("crisis status");
    crisisStatus.addItems("Pending", "Handled", "Solved", "Closed");
    crisisStatus.setNullSelectionAllowed(false);
    crisisStatus.select("Pending");

    HorizontalLayout buttonsLayout1 = new HorizontalLayout();
    Button changeCrisisStatusBtn1 = new Button("Change status");
    changeCrisisStatusBtn1.setClickShortcut(KeyCode.ENTER);
    changeCrisisStatusBtn1.addStyleName(ValoTheme.BUTTON_PRIMARY);
    Button cancelBtn1 = new Button("Cancel");
    buttonsLayout1.addComponents(changeCrisisStatusBtn1, cancelBtn1);
    buttonsLayout1.setSpacing(true);
    statusLayout.addComponents(crisisID1, crisisStatus, buttonsLayout1);

    cancelBtn1.addClickListener(event -> changeCrisisStatusSubWindow.close());

    changeCrisisStatusBtn1.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());

        EtCrisisStatus statusToPut = null;

        if (crisisStatus.getValue().toString().equals("Pending"))
            statusToPut = EtCrisisStatus.pending;
        if (crisisStatus.getValue().toString().equals("Handled"))
            statusToPut = EtCrisisStatus.handled;
        if (crisisStatus.getValue().toString().equals("Solved"))
            statusToPut = EtCrisisStatus.solved;
        if (crisisStatus.getValue().toString().equals("Closed"))
            statusToPut = EtCrisisStatus.closed;

        PtBoolean res = actCoordinator.oeSetCrisisStatus(new DtCrisisID(new PtString(thisCrisisID.toString())),
                statusToPut);

        changeCrisisStatusSubWindow.close();
    });

    ////////////////////////////////////////

    handleCrisesBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        PtBoolean res = actCoordinator
                .oeSetCrisisHandler(new DtCrisisID(new PtString(thisCrisisID.toString())));
    });

    reportOnCrisisBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        reportCrisisSubWindow.center();
        crisisID.setValue(thisCrisisID.toString());
        crisisID.setEnabled(false);
        reportText.focus();
        UI.getCurrent().addWindow(reportCrisisSubWindow);
    });

    changeCrisisStatusBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        changeCrisisStatusSubWindow.center();
        crisisID1.setValue(thisCrisisID.toString());
        crisisID1.setEnabled(false);
        crisisStatus.focus();
        UI.getCurrent().addWindow(changeCrisisStatusSubWindow);
    });

    closeCrisisBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        PtBoolean res = actCoordinator.oeCloseCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())));
    });

    getCrisesSetBtn.addClickListener(event -> {
        if (crisesStatus.getValue().toString().equals("Closed"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.closed);
        if (crisesStatus.getValue().toString().equals("Handled"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.handled);
        if (crisesStatus.getValue().toString().equals("Solved"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.solved);
        if (crisesStatus.getValue().toString().equals("Pending"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.pending);
    });

    ClickListener logoutAction = event -> {
        PtBoolean res;
        try {
            res = actCoordinator.oeLogout();
            if (res.getValue()) {
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        Page.getCurrent().reload();
    };

    logoutBtn1.addClickListener(logoutAction);
    logoutBtn2.addClickListener(logoutAction);
}