Example usage for com.vaadin.ui Window Window

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

Introduction

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

Prototype

public Window(String caption, Component content) 

Source Link

Document

Creates a new, empty window with the given content and title.

Usage

From source file:annis.gui.controlpanel.CorpusListPanel.java

License:Apache License

public void initCorpusBrowser(String topLevelCorpusName, final Button l) {

    AnnisCorpus c = ui.getQueryState().getAvailableCorpora().getItem(topLevelCorpusName).getBean();
    MetaDataPanel meta = new MetaDataPanel(c.getName());

    CorpusBrowserPanel browse = new CorpusBrowserPanel(c, ui.getQueryController());
    GridLayout infoLayout = new GridLayout(2, 2);
    infoLayout.setSizeFull();//from ww w .j  a  v a 2 s .c  o m

    String corpusURL = Helper.generateCorpusLink(Sets.newHashSet(topLevelCorpusName));
    Label lblLink = new Label("Link to corpus: <a href=\"" + corpusURL + "\">" + corpusURL + "</a>",
            ContentMode.HTML);
    lblLink.setHeight("-1px");
    lblLink.setWidth("-1px");

    infoLayout.addComponent(meta, 0, 0);
    infoLayout.addComponent(browse, 1, 0);
    infoLayout.addComponent(lblLink, 0, 1, 1, 1);

    infoLayout.setRowExpandRatio(0, 1.0f);
    infoLayout.setColumnExpandRatio(0, 0.5f);
    infoLayout.setColumnExpandRatio(1, 0.5f);
    infoLayout.setComponentAlignment(lblLink, Alignment.MIDDLE_CENTER);

    Window window = new Window("Corpus information for " + c.getName() + " (ID: " + c.getId() + ")",
            infoLayout);
    window.setWidth(70, UNITS_EM);
    window.setHeight(45, UNITS_EM);
    window.setResizable(true);
    window.setModal(false);
    window.setResizeLazy(true);

    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            l.setEnabled(true);
        }
    });

    UI.getCurrent().addWindow(window);
    window.center();
}

From source file:com.abien.vaadin.helloapp.HelloApp.java

License:Apache License

@Override
public void init() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);// w  w w  . ja v  a 2  s  .co m
    Label header = new Label("Vaadin on Java EE");
    header.setStyleName("h1");
    layout.addComponent(header);

    final TextField nameField = new TextField("Input something:");
    final Label greetingLbl = new Label();
    layout.addComponent(nameField);

    layout.addComponent(
            new Button("Say slow Hello, clicking this shouldn't stall other users", new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        Thread.sleep(20 * 1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(HelloApp.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    getMainWindow().showNotification("Hello!");
                }
            }));

    layout.addComponent(new Button("Say Hello", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            greetingLbl.setCaption(greetingService.sayHello(nameField.getValue().toString()));
            buttonEvents.fire(event);
        }
    }));
    layout.addComponent(greetingLbl);

    Window mainWindow = new Window("Vaadin 6.8 - Java EE Integration", layout);
    setMainWindow(mainWindow);
}

From source file:com.bellkenz.modules.PersonalInformation.java

public Window transferEmployee(final String employeeId, final ComboBox div, final ComboBox dept,
        final TextField post) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);/*www .  j a  v a2s.  c  o m*/
    vlayout.setSpacing(true);

    final Window subWindow = new Window("Transfer Employee", vlayout);
    subWindow.setWidth("200px");

    final ComboBox division = new ComboBox("Division: ");
    division.setWidth("100%");
    dropDownBoxList.populateBranchComboBox(division);
    subWindow.addComponent(division);

    final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox());
    department.setWidth("100%");
    division.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (division.getValue() == null) {
            } else {
                divisionId = branchDAO.getBranchId(division.getValue().toString());
            }
        }

    });
    subWindow.addComponent(department);

    final TextField position = createTextField("Position: ");
    position.setWidth("100%");
    subWindow.addComponent(position);

    final PopupDateField entryDate = (PopupDateField) createDateField("Date of Entry: ");
    subWindow.addComponent(entryDate);

    Button updateButton = new Button("UPDATE");
    updateButton.setWidth("100%");
    updateButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (division.getValue() == null) {
                getWindow().showNotification("Select Division!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (department.getValue() == null) {
                getWindow().showNotification("Select Department!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (position.getValue() == null || position.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Enter Position!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (entryDate.getValue() == null) {
                getWindow().showNotification("Select Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            List<EmployeePositionHistory> ephList = new ArrayList<EmployeePositionHistory>();
            EmployeePositionHistory eph = new EmployeePositionHistory();
            eph.setBranch(division.getValue().toString());
            eph.setDepartment(department.getValue().toString());
            eph.setPosition(position.getValue().toString().trim().toLowerCase());
            eph.setEntryDate(conUtil.convertDateFormat(entryDate.getValue().toString()));
            ephList.add(eph);
            Integer deptId = departmentDAO.getDepartmentId(divisionId, department.getValue().toString());
            Boolean result = employeeInformationDAO.transferEmployee(ephList, deptId);
            if (result) {
                Object divObjectId = div.addItem();
                div.setItemCaption(divObjectId, division.getValue().toString());
                div.setValue(divObjectId);

                Object deptObjectId = dept.addItem();
                dept.setItemCaption(deptObjectId, department.getValue().toString());
                dept.setValue(deptObjectId);

                post.setValue(position.getValue().toString().trim().toLowerCase());

                (subWindow.getParent()).removeWindow(subWindow);
            } else {
                getWindow().showNotification("Cannot Transfer employee",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    subWindow.addComponent(updateButton);

    return subWindow;
}

From source file:com.esspl.datagen.DataGenApplication.java

License:Open Source License

private void buildMainLayout() {
    log.debug("DataGenApplication - buildMainLayout() start");
    VerticalLayout rootLayout = new VerticalLayout();
    final Window root = new Window("DATA Gen", rootLayout);
    root.setStyleName("tData");

    setMainWindow(root);//from www.  ja v  a 2s.c o  m

    rootLayout.setSizeFull();
    rootLayout.setMargin(false, true, false, true);

    // Top area, containing logo and header
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    root.addComponent(top);

    // Create the placeholders for all the components in the top area
    HorizontalLayout header = new HorizontalLayout();

    // Add the components and align them properly
    top.addComponent(header);
    top.setComponentAlignment(header, Alignment.TOP_LEFT);

    top.setStyleName("top");
    top.setHeight("75px"); // Same as the background image height

    // header controls
    Embedded logo = new Embedded();
    logo.setSource(DataGenConstant.LOGO);
    logo.setWidth("100%");
    logo.setStyleName("logo");
    header.addComponent(logo);
    header.setSpacing(false);

    //Show which connection profile is connected
    connectedString = new Label("Connected to - Oracle");
    connectedString.setStyleName("connectedString");
    connectedString.setWidth("500px");
    connectedString.setVisible(false);
    top.addComponent(connectedString);

    //Toolbar
    toolbar = new ToolBar(this);
    top.addComponent(toolbar);
    top.setComponentAlignment(toolbar, Alignment.TOP_RIGHT);

    listing = new Table();
    listing.setHeight("240px");
    listing.setWidth("100%");
    listing.setStyleName("dataTable");
    listing.setImmediate(true);

    // turn on column reordering and collapsing
    listing.setColumnReorderingAllowed(true);
    listing.setColumnCollapsingAllowed(true);
    listing.setSortDisabled(true);

    // Add the table headers
    listing.addContainerProperty("Sl No.", Integer.class, null);
    listing.addContainerProperty("Column Name", TextField.class, null);
    listing.addContainerProperty("Data Type", Select.class, null);
    listing.addContainerProperty("Format", Select.class, null);
    listing.addContainerProperty("Examples", Label.class, null);
    listing.addContainerProperty("Additional Data", HorizontalLayout.class, null);
    listing.setColumnAlignments(new String[] { Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER,
            Table.ALIGN_CENTER, Table.ALIGN_CENTER, Table.ALIGN_CENTER });

    //From the starting create 5 rows
    addRow(5);

    //Add different style for IE browser
    WebApplicationContext context = ((WebApplicationContext) getMainWindow().getApplication().getContext());
    WebBrowser browser = context.getBrowser();

    //Create a TabSheet
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    if (!browser.isIE()) {
        tabSheet.setStyleName("tabSheet");
    }

    //Generator Tab content start
    generator = new VerticalLayout();
    generator.setMargin(true, true, false, true);

    generateTypeHl = new HorizontalLayout();
    generateTypeHl.setMargin(false, false, false, true);
    generateTypeHl.setSpacing(true);
    List<String> generateTypeList = Arrays.asList(new String[] { "Sql", "Excel", "XML", "CSV" });
    generateType = new OptionGroup("Generation Type", generateTypeList);
    generateType.setNullSelectionAllowed(false); // user can not 'unselect'
    generateType.select("Sql"); // select this by default
    generateType.setImmediate(true); // send the change to the server at once
    generateType.addListener(this); // react when the user selects something
    generateTypeHl.addComponent(generateType);

    //SQL Options
    sqlPanel = new Panel("SQL Options");
    sqlPanel.setHeight("180px");
    if (browser.isIE()) {
        sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        sqlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }
    VerticalLayout vl1 = new VerticalLayout();
    vl1.setMargin(false);
    Label lb1 = new Label("DataBase");
    database = new Select();
    database.addItem("Oracle");
    database.addItem("Sql Server");
    database.addItem("My Sql");
    database.addItem("Postgress Sql");
    database.addItem("H2");
    database.select("Oracle");
    database.setWidth("160px");
    database.setNullSelectionAllowed(false);
    HorizontalLayout dbBar = new HorizontalLayout();
    dbBar.setMargin(false, false, false, false);
    dbBar.setSpacing(true);
    dbBar.addComponent(lb1);
    dbBar.addComponent(database);
    vl1.addComponent(dbBar);

    Label tblLabel = new Label("Table Name");
    tblName = new TextField();
    tblName.setWidth("145px");
    tblName.setStyleName("mandatory");
    HorizontalLayout tableBar = new HorizontalLayout();
    tableBar.setMargin(true, false, false, false);
    tableBar.setSpacing(true);
    tableBar.addComponent(tblLabel);
    tableBar.addComponent(tblName);
    vl1.addComponent(tableBar);

    createQuery = new CheckBox("Include CREATE TABLE query");
    createQuery.setValue(true);
    HorizontalLayout createBar = new HorizontalLayout();
    createBar.setMargin(true, false, false, false);
    createBar.addComponent(createQuery);
    vl1.addComponent(createBar);
    sqlPanel.addComponent(vl1);

    generateTypeHl.addComponent(sqlPanel);
    generator.addComponent(generateTypeHl);

    //CSV Option
    csvPanel = new Panel("CSV Options");
    csvPanel.setHeight("130px");
    if (browser.isIE()) {
        csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        csvPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }
    Label delimiter = new Label("Delimiter Character(s)");
    VerticalLayout vl2 = new VerticalLayout();
    vl2.setMargin(false);
    csvDelimiter = new TextField();
    HorizontalLayout csvBar = new HorizontalLayout();
    csvBar.setMargin(true, false, false, false);
    csvBar.setSpacing(true);
    csvBar.addComponent(delimiter);
    csvBar.addComponent(csvDelimiter);
    vl2.addComponent(csvBar);
    csvPanel.addComponent(vl2);

    //XML Options
    xmlPanel = new Panel("XML Options");
    xmlPanel.setHeight("160px");
    if (browser.isIE()) {
        xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanelIE");
    } else {
        xmlPanel.setStyleName(Runo.PANEL_LIGHT + " sqlPanel");
    }

    VerticalLayout vl3 = new VerticalLayout();
    vl3.setMargin(false);
    Label lb4 = new Label("Root node name");
    rootNode = new TextField();
    rootNode.setWidth("125px");
    rootNode.setStyleName("mandatory");
    HorizontalLayout nodeBar = new HorizontalLayout();
    nodeBar.setMargin(true, false, false, false);
    nodeBar.setSpacing(true);
    nodeBar.addComponent(lb4);
    nodeBar.addComponent(rootNode);
    vl3.addComponent(nodeBar);

    Label lb5 = new Label("Record node name");
    recordNode = new TextField();
    recordNode.setWidth("112px");
    recordNode.setStyleName("mandatory");
    HorizontalLayout recordBar = new HorizontalLayout();
    recordBar.setMargin(true, false, false, false);
    recordBar.setSpacing(true);
    recordBar.addComponent(lb5);
    recordBar.addComponent(recordNode);
    vl3.addComponent(recordBar);
    xmlPanel.addComponent(vl3);

    HorizontalLayout noOfRowHl = new HorizontalLayout();
    noOfRowHl.setSpacing(true);
    noOfRowHl.setMargin(true, false, false, true);
    noOfRowHl.addComponent(new Label("Number of Results"));
    resultNum = new TextField();
    resultNum.setImmediate(true);
    resultNum.setNullSettingAllowed(false);
    resultNum.setStyleName("mandatory");
    resultNum.addValidator(new IntegerValidator("Number of Results must be an Integer"));
    resultNum.setWidth("5em");
    resultNum.setMaxLength(5);
    resultNum.setValue(50);
    noOfRowHl.addComponent(resultNum);
    generator.addComponent(noOfRowHl);

    HorizontalLayout addRowHl = new HorizontalLayout();
    addRowHl.setMargin(true, false, true, true);
    addRowHl.setSpacing(true);
    addRowHl.addComponent(new Label("Add"));
    rowNum = new TextField();
    rowNum.setImmediate(true);
    rowNum.setNullSettingAllowed(true);
    rowNum.addValidator(new IntegerValidator("Row number must be an Integer"));
    rowNum.setWidth("4em");
    rowNum.setMaxLength(2);
    rowNum.setValue(1);
    addRowHl.addComponent(rowNum);
    rowsBttn = new Button("Row(s)");
    rowsBttn.setIcon(DataGenConstant.ADD);
    rowsBttn.addListener(ClickEvent.class, this, "addRowButtonClick"); // react to clicks
    addRowHl.addComponent(rowsBttn);
    generator.addComponent(addRowHl);

    //Add the Grid
    generator.addComponent(listing);

    //Generate Button
    Button bttn = new Button("Generate");
    bttn.setDescription("Generate Gata");
    bttn.addListener(ClickEvent.class, this, "generateButtonClick"); // react to clicks
    bttn.setIcon(DataGenConstant.VIEW);
    bttn.setStyleName("generate");
    generator.addComponent(bttn);
    //Generator Tab content end

    //Executer Tab content start - new class created to separate execution logic
    executor = new ExecutorView(this);
    //Executer Tab content end

    //Explorer Tab content start - new class created to separate execution logic
    explorer = new ExplorerView(this, databaseSessionManager);
    //explorer.setMargin(true);
    //Explorer Tab content end

    //About Tab content start
    VerticalLayout about = new VerticalLayout();
    about.setMargin(true);
    Label aboutRichText = new Label(DataGenConstant.ABOUT_CONTENT);
    aboutRichText.setContentMode(Label.CONTENT_XHTML);
    about.addComponent(aboutRichText);
    //About Tab content end

    //Help Tab content start
    VerticalLayout help = new VerticalLayout();
    help.setMargin(true);
    Label helpText = new Label(DataGenConstant.HELP_CONTENT);
    helpText.setContentMode(Label.CONTENT_XHTML);
    help.addComponent(helpText);

    Embedded helpScreen = new Embedded();
    helpScreen.setSource(DataGenConstant.HELP_SCREEN);
    help.addComponent(helpScreen);

    Label helpStepsText = new Label(DataGenConstant.HELP_CONTENT_STEPS);
    helpStepsText.setContentMode(Label.CONTENT_XHTML);
    help.addComponent(helpStepsText);
    //Help Tab content end

    //Add the respective contents to the tab sheet
    tabSheet.addTab(generator, "Generator", DataGenConstant.HOME_ICON);
    executorTab = tabSheet.addTab(executor, "Executor", DataGenConstant.EXECUTOR_ICON);
    explorerTab = tabSheet.addTab(explorer, "Explorer", DataGenConstant.EXPLORER_ICON);
    tabSheet.addTab(about, "About", DataGenConstant.ABOUT_ICON);
    tabSheet.addTab(help, "Help", DataGenConstant.HELP_ICON);

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

    rootLayout.addComponent(content);
    rootLayout.setExpandRatio(content, 1);
    log.debug("DataGenApplication - buildMainLayout() end");
}

From source file:com.github.peholmst.springsecuritydemo.ui.SpringSecurityDemoApp.java

License:Apache License

@SuppressWarnings("serial")
@Override/*from  w w  w .  j  a va2s .c  o m*/
public void init() {
    if (logger.isDebugEnabled()) {
        logger.debug("Initializing application [" + this + "]");
    }
    // Register listener
    getContext().addTransactionListener(this);

    // Create the views
    loginView = new LoginView(this, authenticationManager);
    loginView.setSizeFull();

    setTheme("SpringSecurityDemo"); // We use a custom theme

    final Window loginWindow = new Window(getMessage("app.title", getVersion()), loginView);
    setMainWindow(loginWindow);

    loginView.addListener(new com.vaadin.ui.Component.Listener() {
        @Override
        public void componentEvent(Event event) {
            if (event instanceof LoginView.LoginEvent) {
                if (logger.isDebugEnabled()) {
                    logger.debug("User logged on [" + ((LoginView.LoginEvent) event).getAuthentication() + "]");
                }
                /*
                 * A user has logged on, which means we can ditch the login
                 * view and open the main view instead. We also have to
                 * update the security context holder.
                 */
                setUser(((LoginView.LoginEvent) event).getAuthentication());
                SecurityContextHolder.getContext()
                        .setAuthentication(((LoginView.LoginEvent) event).getAuthentication());
                removeWindow(loginWindow);
                loginView = null;
                mainView = new MainView(SpringSecurityDemoApp.this, categoryService);
                mainView.setSizeFull();
                setMainWindow(new Window(getMessage("app.title", getVersion()), mainView));
            }
        }
    });
}

From source file:com.github.wolfie.sessionguard.SessionguardApplication.java

License:Apache License

@Override
public void init() {
    final VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);//from  ww  w.  ja  v a2 s . com
    final Window mainWindow = new Window("Sessionguard Application", mainLayout);

    final int sessionTimeout = ((WebApplicationContext) getContext()).getHttpSession().getMaxInactiveInterval()
            / 60;

    final Label label = new Label(
            "This application has a " + sessionTimeout + "-minute session, with a timeout warning of "
                    + WARNING_PERIOD_MINS + " minutes session time left.");
    mainWindow.addComponent(label);
    setMainWindow(mainWindow);
    final SessionGuard sessionGuard = new SessionGuard();
    sessionGuard.setTimeoutWarningPeriod(WARNING_PERIOD_MINS);
    mainWindow.addComponent(sessionGuard);

    mainWindow.addComponent(new Button("Switch to keepalive", new Button.ClickListener() {
        private static final long serialVersionUID = -4423285632350279761L;
        private boolean keepalive = false;

        public void buttonClick(final ClickEvent event) {
            keepalive = !keepalive;
            sessionGuard.setKeepalive(keepalive);
            event.getButton().setCaption(keepalive ? "Switch to timeout message" : "Switch to keepalive");
        }
    }));

    final TextField warningXhtmlField = new TextField("Change warning XHTML");
    warningXhtmlField.setWidth("100%");
    warningXhtmlField.setValue(sessionGuard.getTimeoutWarningXHTML());
    warningXhtmlField.setImmediate(true);
    warningXhtmlField.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = -5236596836421389890L;

        public void valueChange(final ValueChangeEvent event) {
            sessionGuard.setTimeoutWarningXHTML((String) warningXhtmlField.getValue());
            getMainWindow().showNotification("Warning string changed");
        }
    });
    mainWindow.addComponent(warningXhtmlField);

}

From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java

private void showComponent(final Component c, final String name) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setSizeUndefined();//  w  w w  .j a v  a  2s .  co  m
    layout.setMargin(true);
    final Window w = new Window(name, layout);
    w.addStyleName("dropdisplaywindow");
    w.setSizeUndefined();
    w.setResizable(false);
    c.setSizeUndefined();
    layout.addComponent(c);
    UI.getCurrent().addWindow(w);

}

From source file:com.hris.connection.ErrorLoggedNotification.java

public static void showErrorLoggedOnWindow(String error, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();// w  ww  .j  av  a 2  s .  c o m
    v.setMargin(true);

    Window sub = new Window("ERROR MESSAGE!", v);
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(new Label(error + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();

    sub.setContent(panel);
    sub.getContent().setHeightUndefined();
}

From source file:com.klwork.explorer.project.MyCalendarView.java

License:Apache License

private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from w w  w.j a v  a2  s  .  c  om*/
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                commitCalendarEvent();
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button cancel = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addCloseListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

From source file:com.klwork.explorer.ui.business.project.MyCalendarView.java

License:Apache License

private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//from   w w  w.  j  a  v  a 2  s .c  o m
    layout.setSpacing(true);
    layout.addStyleName("social");

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                commitCalendarEvent();
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button cancel = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addCloseListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}