Example usage for com.vaadin.ui GridLayout setSizeFull

List of usage examples for com.vaadin.ui GridLayout setSizeFull

Introduction

In this page you can find the example usage for com.vaadin.ui GridLayout setSizeFull.

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:edu.kit.dama.ui.admin.schedule.trigger.AtTriggerConfigurationPanel.java

License:Apache License

@Override
public AbstractLayout getLayout() {
    GridLayout layout = new UIUtils7.GridLayoutBuilder(2, 5).addComponent(getGroupField(), 0, 0)
            .addComponent(getNameField(), 1, 0).addComponent(getPrioritySlider(), 0, 1, 2, 1)
            .addComponent(getAtDateField(), 0, 2, 2, 1).addComponent(getDescriptionField(), 0, 3, 2, 2)
            .getLayout();//from   w  w w .java  2  s .  c  o  m
    layout.setMargin(false);
    layout.setSpacing(true);
    layout.setSizeFull();
    return layout;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.ExpressionTriggerConfigurationPanel.java

License:Apache License

@Override
public AbstractLayout getLayout() {
    GridLayout layout = new UIUtils7.GridLayoutBuilder(2, 6).addComponent(getGroupField(), 0, 0)
            .addComponent(getNameField(), 1, 0).addComponent(getPrioritySlider(), 0, 1, 2, 1)
            .addComponent(getStartDateField(), 0, 2, 1, 1).addComponent(getEndDateField(), 1, 2, 1, 1)
            .addComponent(getExpressionLayout(), 0, 3, 2, 1).addComponent(getDescriptionField(), 0, 4, 2, 2)
            .getLayout();/*w  w w .ja  v  a 2s .  c  o m*/
    layout.setMargin(false);
    layout.setSpacing(true);
    layout.setSizeFull();
    return layout;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.IntervalTriggerConfigurationPanel.java

License:Apache License

@Override
public AbstractLayout getLayout() {
    GridLayout layout = new UIUtils7.GridLayoutBuilder(2, 6).addComponent(getGroupField(), 0, 0)
            .addComponent(getNameField(), 1, 0).addComponent(getPrioritySlider(), 0, 1, 2, 1)
            .addComponent(getStartDateField(), 0, 2, 1, 1).addComponent(getEndDateField(), 1, 2, 1, 1)
            .addComponent(getPeriodField(), 0, 3, 1, 1).addComponent(getTimesField(), 1, 3, 1, 1)
            .addComponent(getDescriptionField(), 0, 4, 2, 2).getLayout();
    layout.setMargin(false);//from   ww  w  . j  a v  a2s  .  com
    layout.setSpacing(true);
    layout.setSizeFull();
    return layout;
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.NowTriggerConfigurationPanel.java

License:Apache License

@Override
public AbstractLayout getLayout() {
    GridLayout layout = new UIUtils7.GridLayoutBuilder(2, 5).addComponent(getGroupField(), 0, 0)
            .addComponent(getNameField(), 1, 0).addComponent(getPrioritySlider(), 0, 1, 2, 1)
            .addComponent(new Label("No configuration needed."), Alignment.MIDDLE_CENTER, 0, 2, 2, 1)
            .addComponent(getDescriptionField(), 0, 3, 2, 2).getLayout();
    layout.setMargin(false);//from w  w  w.  j  ava  2  s.  c om
    layout.setSpacing(true);
    layout.setSizeFull();
    return layout;
}

From source file:io.subutai.plugin.accumulo.ui.manager.AddNodeWindow.java

public AddNodeWindow(final Accumulo accumulo, final ExecutorService executorService, final Tracker tracker,
        final AccumuloClusterConfig accumuloClusterConfig, Set<EnvironmentContainerHost> nodes,
        final NodeType nodeType) {
    super("Add New Node");
    setModal(true);/*from  w w  w  . j  a v  a  2  s .  co m*/

    setWidth(650, Unit.PIXELS);
    setHeight(450, Unit.PIXELS);

    GridLayout content = new GridLayout(1, 3);
    content.setSizeFull();
    content.setMargin(true);
    content.setSpacing(true);

    HorizontalLayout topContent = new HorizontalLayout();
    topContent.setSpacing(true);

    content.addComponent(topContent);
    topContent.addComponent(new Label("Nodes:"));

    final ComboBox hadoopNodes = new ComboBox();
    hadoopNodes.setId("HadoopNodesCb");
    hadoopNodes.setImmediate(true);
    hadoopNodes.setTextInputAllowed(false);
    hadoopNodes.setNullSelectionAllowed(false);
    hadoopNodes.setRequired(true);
    hadoopNodes.setWidth(200, Unit.PIXELS);
    for (EnvironmentContainerHost node : nodes) {
        hadoopNodes.addItem(node);
        hadoopNodes.setItemCaption(node, node.getHostname());
    }

    if (nodes.size() == 0) {
        return;
    }
    hadoopNodes.setValue(nodes.iterator().next());

    topContent.addComponent(hadoopNodes);

    final Button addNodeBtn = new Button("Add");
    addNodeBtn.setId("AddSelectedNode");
    topContent.addComponent(addNodeBtn);

    final Button ok = new Button("Ok");

    addNodeBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            addNodeBtn.setEnabled(false);
            ok.setEnabled(false);
            showProgress();
            EnvironmentContainerHost containerHost = (EnvironmentContainerHost) hadoopNodes.getValue();
            final UUID trackID = accumulo.addNode(accumuloClusterConfig.getClusterName(),
                    containerHost.getHostname(), nodeType);
            executorService.execute(new Runnable() {
                public void run() {
                    while (track) {
                        TrackerOperationView po = tracker.getTrackerOperation(AccumuloClusterConfig.PRODUCT_KEY,
                                trackID);
                        if (po != null) {
                            setOutput(po.getDescription() + "\nState: " + po.getState() + "\nLogs:\n"
                                    + po.getLog());
                            if (po.getState() != OperationState.RUNNING) {
                                hideProgress();
                                ok.setEnabled(true);
                                break;
                            }
                        } else {
                            setOutput("Product operation not found. Check logs");
                            break;
                        }
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException ex) {
                            break;
                        }
                    }
                }
            });
        }
    });

    outputTxtArea = new TextArea("Operation output");
    outputTxtArea.setId("outputTxtArea");
    outputTxtArea.setRows(13);
    outputTxtArea.setColumns(43);
    outputTxtArea.setImmediate(true);
    outputTxtArea.setWordwrap(true);

    content.addComponent(outputTxtArea);

    indicator = new Label();
    indicator.setId("indicator");
    indicator.setIcon(new ThemeResource("img/spinner.gif"));
    indicator.setContentMode(ContentMode.HTML);
    indicator.setHeight(11, Unit.PIXELS);
    indicator.setWidth(50, Unit.PIXELS);
    indicator.setVisible(false);

    ok.setId("btnOk");
    ok.setStyleName("default");
    ok.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            //close window
            track = false;
            close();
        }
    });

    HorizontalLayout bottomContent = new HorizontalLayout();
    bottomContent.addComponent(indicator);
    bottomContent.setComponentAlignment(indicator, Alignment.MIDDLE_RIGHT);
    bottomContent.addComponent(ok);

    content.addComponent(bottomContent);
    content.setComponentAlignment(bottomContent, Alignment.MIDDLE_RIGHT);

    setContent(content);
}

From source file:io.subutai.plugin.accumulo.ui.wizard.VerificationStep.java

public VerificationStep(final Accumulo accumulo, final Hadoop hadoop, final ExecutorService executorService,
        final Tracker tracker, EnvironmentManager environmentManager, final Wizard wizard) {

    setSizeFull();//from  w ww .  j a va 2s  . c  om

    GridLayout grid = new GridLayout(1, 5);
    grid.setSpacing(true);
    grid.setMargin(true);
    grid.setSizeFull();

    Label confirmationLbl = new Label("<strong>Please verify the installation settings "
            + "(you may change them by clicking on Back button)</strong><br/>");
    confirmationLbl.setContentMode(ContentMode.HTML);

    ConfigView cfgView = new ConfigView("Installation configuration");
    cfgView.addStringCfg("Cluster Name", wizard.getConfig().getClusterName());
    cfgView.addStringCfg("Instance name", wizard.getConfig().getInstanceName());
    cfgView.addStringCfg("Password", wizard.getConfig().getPassword());
    cfgView.addStringCfg("Hadoop cluster", wizard.getConfig().getHadoopClusterName());
    cfgView.addStringCfg("Zookeeper cluster", wizard.getConfig().getZookeeperClusterName());

    if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) {
        try {
            Environment hadoopEnvironment = environmentManager.loadEnvironment(
                    hadoop.getCluster(wizard.getConfig().getHadoopClusterName()).getEnvironmentId());
            EnvironmentContainerHost master = hadoopEnvironment
                    .getContainerHostById(wizard.getConfig().getMasterNode());
            EnvironmentContainerHost gc = hadoopEnvironment
                    .getContainerHostById(wizard.getConfig().getGcNode());
            EnvironmentContainerHost monitor = hadoopEnvironment
                    .getContainerHostById(wizard.getConfig().getMonitor());
            Set<EnvironmentContainerHost> tracers = hadoopEnvironment
                    .getContainerHostsByIds(wizard.getConfig().getTracers());
            Set<EnvironmentContainerHost> slaves = hadoopEnvironment
                    .getContainerHostsByIds(wizard.getConfig().getSlaves());

            cfgView.addStringCfg("Master node", master.getHostname());
            cfgView.addStringCfg("GC node", gc.getHostname());
            cfgView.addStringCfg("Monitor node", monitor.getHostname());
            for (EnvironmentContainerHost containerHost : tracers) {
                cfgView.addStringCfg("Tracers", containerHost.getHostname());
            }
            for (EnvironmentContainerHost containerHost : slaves) {
                cfgView.addStringCfg("Slaves", containerHost.getHostname());
            }
        } catch (EnvironmentNotFoundException | ContainerHostNotFoundException e) {
            LOGGER.error("Error applying operations on environment/container", e);
        }
    } else {
        cfgView.addStringCfg("Number of Hadoop slaves",
                wizard.getHadoopClusterConfig().getCountOfSlaveNodes() + "");
        cfgView.addStringCfg("Hadoop replication factor",
                wizard.getHadoopClusterConfig().getReplicationFactor() + "");
        cfgView.addStringCfg("Hadoop domain name", wizard.getHadoopClusterConfig().getDomainName() + "");
        cfgView.addStringCfg("Number of tracers", wizard.getConfig().getNumberOfTracers() + "");
        cfgView.addStringCfg("Number of slaves", wizard.getConfig().getNumberOfSlaves() + "");
    }

    Button install = new Button("Install");
    install.setId("installBtn");
    install.addStyleName("default");
    install.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UUID trackID;
            if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) {
                trackID = accumulo.installCluster(wizard.getConfig());
            } else {
                trackID = accumulo.installCluster(wizard.getConfig());
            }
            ProgressWindow window = new ProgressWindow(executorService, tracker, trackID,
                    AccumuloClusterConfig.PRODUCT_KEY);
            window.getWindow().addCloseListener(new Window.CloseListener() {
                @Override
                public void windowClose(Window.CloseEvent closeEvent) {
                    wizard.init();
                }
            });
            getUI().addWindow(window.getWindow());
        }
    });

    Button back = new Button("Back");
    back.setId("verBack");
    back.addStyleName("default");
    back.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            wizard.back();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addComponent(back);
    buttons.addComponent(install);

    grid.addComponent(confirmationLbl, 0, 0);

    grid.addComponent(cfgView.getCfgTable(), 0, 1, 0, 3);

    grid.addComponent(buttons, 0, 4);

    setContent(grid);
}

From source file:io.subutai.plugin.accumulo.ui.wizard.WelcomeStep.java

public WelcomeStep(final Wizard wizard) {

    setSizeFull();//from  ww w.  j  a  v  a  2s  . c o  m

    GridLayout grid = new GridLayout(10, 6);
    grid.setSpacing(true);
    grid.setMargin(true);
    grid.setSizeFull();

    Label welcomeMsg = new Label("<center><h2>Welcome to Accumulo Installation Wizard!</h2>");
    welcomeMsg.setContentMode(ContentMode.HTML);
    grid.addComponent(welcomeMsg, 3, 1, 6, 2);

    Label logoImg = new Label();
    // Image as a file resource
    logoImg.setIcon(new FileResource(FileUtil.getFile(AccumuloPortalModule.MODULE_IMAGE, this)));
    logoImg.setContentMode(ContentMode.HTML);
    logoImg.setHeight(56, Unit.PIXELS);
    logoImg.setWidth(220, Unit.PIXELS);
    grid.addComponent(logoImg, 1, 3, 2, 5);

    Button startOverHadoopNZK = new Button("Start over Hadoop & ZK installation");
    startOverHadoopNZK.setId("startOverHadoopNZK");
    startOverHadoopNZK.addStyleName("default");
    grid.addComponent(startOverHadoopNZK, 4, 4, 4, 4);
    grid.setComponentAlignment(startOverHadoopNZK, Alignment.BOTTOM_RIGHT);

    startOverHadoopNZK.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            wizard.init();
            wizard.getConfig().setSetupType(SetupType.OVER_HADOOP_N_ZK);
            wizard.next();
        }
    });

    setContent(grid);
}

From source file:life.qbic.components.qOfferManager.java

License:Open Source License

private void init() {

    DBManager.setCredentials();/*  w w w .  ja  v a  2s  .c  om*/
    DBManager.getDatabaseInstance();
    db = Database.Instance;
    managerTabs = new TabSheet();

    /*    System.out.println(ft.format(dNow) + "  INFO  Offer Manager accessed! - User: "
            + LiferayAndVaadinUtils.getUser().getScreenName());*/

    managerTabs.addStyleName(ValoTheme.TABSHEET_FRAMED);
    managerTabs.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);

    final GridLayout gridLayout = new GridLayout(6, 6);
    gridLayout.setMargin(true);
    gridLayout.setSpacing(true);

    try {

        managerTabs.addTab(createOfferGeneratorTab(), "Offer Generator");
        managerTabs.addTab(createOfferManagerTab(), "Offer Manager");
        managerTabs.addTab(createPackageManagerTab(), "Package Manager");

        managerTabs.setSelectedTab(1); // show the offer manager first, since this will probably be mostly in use

        // TODO: make this more elegant
        // if one changes the tab e.g. from the offer manager to the package manager, creates a new package and goes
        // back to the offer manager tab, the package won't be updated -> workaround:
        // since the selected offer in the offer manager grid won't requery the database for the information needed, we
        // deselect the current offer (if any has been selected), so the user has to select the offer again -> information
        // for the database is queried again and e.g. the newly created packages are shown properly)
        managerTabs.addSelectedTabChangeListener((TabSheet.SelectedTabChangeListener) event -> {
            OfferManagerTab.getOfferManagerGrid().deselectAll();
            OfferManagerTab.getDetailsLayout().removeAllComponents();
        });

    } catch (SQLException e1) {
        e1.printStackTrace();
    }

    try {
        gridLayout.addComponent(managerTabs, 0, 1, 5, 1);
    } catch (OverlapsException | OutOfBoundsException e) {
        e.printStackTrace();
    }

    gridLayout.setSizeFull();
    setCompositionRoot(gridLayout);
}

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

License:Open Source License

public AdminAuthView() {

    setSizeFull();// www.  j av  a2  s.co  m

    VerticalLayout header = new VerticalLayout();
    header.setSizeFull();

    HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();

    addComponents(header, content);
    setExpandRatio(header, 1);
    setExpandRatio(content, 6);

    welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>");
    welcomeText.setContentMode(ContentMode.HTML);
    welcomeText.setSizeUndefined();
    header.addComponent(welcomeText);
    header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER);

    Panel controlPanel = new Panel("Administrator control panel");
    controlPanel.setSizeUndefined();

    Panel addCoordPanel = new Panel("Create a new coordinator");
    addCoordPanel.setSizeUndefined();

    Panel messagesPanel = new Panel("Administrator messages");
    messagesPanel.setWidth("580px");

    Table adminMessagesTable = new Table();

    adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource());

    adminMessagesTable.setColumnWidth("inputEvent", 180);
    adminMessagesTable.setSizeFull();

    VerticalLayout controlLayout = new VerticalLayout(controlPanel);
    controlLayout.setSizeFull();
    controlLayout.setMargin(false);
    controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER);

    VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel);
    coordOperationsLayout.setSizeFull();
    coordOperationsLayout.setMargin(false);
    coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER);

    /******************************************/
    coordOperationsLayout.setVisible(true); // main layout in the middle
    addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator"
    /******************************************/

    HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel);
    VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable);

    messagesExternalLayout.setSizeFull();
    messagesExternalLayout.setMargin(false);
    messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER);

    messagesInternalLayout.setMargin(false);
    messagesInternalLayout.setSizeFull();
    messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER);

    messagesPanel.setContent(messagesInternalLayout);

    TextField idCoordAdd = new TextField();
    TextField loginCoord = new TextField();
    PasswordField pwdCoord = new PasswordField();

    Label idCaptionAdd = new Label("ID");
    Label loginCaption = new Label("Login");
    Label pwdCaption = new Label("Password");

    idCaptionAdd.setSizeUndefined();
    idCoordAdd.setSizeUndefined();

    loginCaption.setSizeUndefined();
    loginCoord.setSizeUndefined();

    pwdCaption.setSizeUndefined();
    pwdCoord.setSizeUndefined();

    Button validateNewCoord = new Button("Validate");
    validateNewCoord.setClickShortcut(KeyCode.ENTER);
    validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY);

    GridLayout addCoordinatorLayout = new GridLayout(2, 4);
    addCoordinatorLayout.setSpacing(true);
    addCoordinatorLayout.setMargin(true);
    addCoordinatorLayout.setSizeFull();

    addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption,
            pwdCoord);

    addCoordinatorLayout.addComponent(validateNewCoord, 1, 3);

    addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT);

    addCoordPanel.setContent(addCoordinatorLayout);

    content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);

    content.setExpandRatio(controlLayout, 20);
    content.setExpandRatio(coordOperationsLayout, 10);
    content.setExpandRatio(messagesExternalLayout, 28);

    Button addCoordinator = new Button("Add coordinator");
    Button deleteCoordinator = new Button("Delete coordinator");

    addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE);

    VerticalLayout buttons = new VerticalLayout();

    buttons.setMargin(true);
    buttons.setSpacing(true);
    buttons.setSizeFull();

    buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    controlPanel.setContent(buttons);

    buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn);

    /******* DELETE COORDINATOR PANEL BEGIN *********/
    Label idCaptionDel = new Label("ID");
    TextField idCoordDel = new TextField();

    Panel delCoordPanel = new Panel("Delete a coordinator");

    coordOperationsLayout.addComponent(delCoordPanel);
    delCoordPanel.setVisible(false);

    coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER);
    delCoordPanel.setSizeUndefined();

    GridLayout delCoordinatorLayout = new GridLayout(2, 2);
    delCoordinatorLayout.setSpacing(true);
    delCoordinatorLayout.setMargin(true);
    delCoordinatorLayout.setSizeFull();

    Button deleteCoordBtn = new Button("Delete");
    deleteCoordBtn.setClickShortcut(KeyCode.ENTER);
    deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY);

    delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel);

    delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1);

    delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT);
    delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT);

    delCoordPanel.setContent(delCoordinatorLayout);
    /******* DELETE COORDINATOR PANEL END *********/

    /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/

    addCoordinator.addClickListener(event -> {
        if (!addCoordPanel.isVisible()) {
            delCoordPanel.setVisible(false);
            addCoordPanel.setVisible(true);
            idCoordAdd.focus();
        } else
            addCoordPanel.setVisible(false);
    });

    deleteCoordinator.addClickListener(event -> {
        if (!delCoordPanel.isVisible()) {
            addCoordPanel.setVisible(false);
            delCoordPanel.setVisible(true);
            idCoordDel.focus();
        } else
            delCoordPanel.setVisible(false);
    });

    /************************************************* MAIN BUTTONS LOGIC END *************************************************/

    /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/
    validateNewCoord.addClickListener(event -> {

        String currentURL = Page.getCurrent().getLocation().toString();
        int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName);
        String iCrashURL = currentURL.substring(0, strIndexCreator);
        String googleShebang = "#!";
        String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang;

        try {
            sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())),
                    new DtLogin(new PtString(loginCoord.getValue())),
                    new DtPassword(new PtString(pwdCoord.getValue())));

            // open new browser tab with the newly created coordinator console...
            // "_blank" instructs the browser to open a new tab instead of a new window...
            // unhappily not all browsers interpret it correctly,
            // some versions of some browsers might still open a new window instead (notably Firefox)!
            Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank");

        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordAdd.setValue("");
        loginCoord.setValue("");
        pwdCoord.setValue("");

        idCoordAdd.focus();
    });
    /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/
    /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/
    deleteCoordBtn.addClickListener(event -> {
        IcrashSystem sys = IcrashSystem.getInstance();

        try {
            sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue())));
        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordDel.setValue("");
        idCoordDel.focus();
    });
    /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java

License:Apache License

private Component getMenu() {
    GridLayout gl = new GridLayout(3, 3);
    gl.addComponent(new Image("", LOGO), 0, 0);
    Label version = new Label(TRANSLATOR.translate("general.version") + ": " + getVersion());
    gl.addComponent(version, 2, 2);//from ww  w.j  a  va 2 s  .c om
    if (getUser() != null) {
        getUser().update();
        //Logout button
        Button logout = new Button(TRANSLATOR.translate("general.logout"));
        logout.addClickListener((Button.ClickEvent event) -> {
            try {
                user.update();
                user.write2DB();
                user = null;
                main = null;
                setLocale(Locale.ENGLISH);
                updateScreen();
                // Close the session
                closeSession();
            } catch (VMException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        });
        gl.addComponent(logout, 1, 0);
        //Notification Button
        if (getUser().getNotificationList().isEmpty() && DataBaseManager.isDemo()) {
            //For demo add a notification for users
            try {
                Lookup.getDefault().lookup(INotificationManager.class).addNotification(
                        "Welcome to ValidationManager!", NotificationTypes.GENERAL, getUser().getEntity(),
                        new VMUserServer(1).getEntity());
            } catch (Exception ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }
        Button notification = new Button();
        if (getUser().getPendingNotifications().size() > 0) {
            notification.setCaption("" + getUser().getPendingNotifications().size()); //any number, count, etc
        }
        notification.setHtmlContentAllowed(true);
        notification.setIcon(VaadinIcons.BELL);
        notification.addClickListener((Button.ClickEvent event) -> {
            //TODO: Show notifications screen
        });
        gl.addComponent(notification, 2, 0);
    }
    gl.setSizeFull();
    return gl;
}