Example usage for com.vaadin.server Page getCurrent

List of usage examples for com.vaadin.server Page getCurrent

Introduction

In this page you can find the example usage for com.vaadin.server Page getCurrent.

Prototype

public static Page getCurrent() 

Source Link

Document

Gets the Page to which the current uI belongs.

Usage

From source file:probe.com.view.body.welcomelayout.StudiesInformationWindow.java

public StudiesInformationWindow(Set<QuantDatasetObject> dsObjects, Map<String, String> diseaseHashedColorMap) {

    int height = Page.getCurrent().getBrowserWindowHeight() - 100;
    int width = Page.getCurrent().getBrowserWindowWidth() - 100;
    VerticalLayout popupBody = new VerticalLayout();
    popupBody.setWidth((width - 20) + "px");
    popupBody.setHeightUndefined();/*from  w w w . j a v a2s  . com*/
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);
    popupBody.setMargin(true);
    popupBody.setSpacing(true);

    popupWindow = new Window() {

        @Override
        public void close() {
            popupWindow.setVisible(false);

        }

    };

    popupWindow.setContent(popupBody);
    popupWindow.setWindowMode(WindowMode.NORMAL);
    popupWindow.setWidth((width) + "px");
    popupWindow.setHeight((height) + "px");
    popupWindow.setVisible(false);
    popupWindow.setResizable(false);
    popupWindow.setClosable(false);
    popupWindow.setStyleName(Reindeer.WINDOW_LIGHT);
    popupWindow.setModal(true);
    popupWindow.setDraggable(false);
    popupWindow.center();

    popupWindow.setCaption(
            "<font color='gray' style='font-weight: bold;!important'>&nbsp;&nbsp;Datasets Information</font>");

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

    popupWindow.setCaptionAsHtml(true);
    popupWindow.setClosable(true);
    this.addLayoutClickListener(StudiesInformationWindow.this);

    Map<Integer, DatasetInformationOverviewLayout> datasetInfoLayoutDSIndexMap = new HashMap<Integer, DatasetInformationOverviewLayout>();
    for (QuantDatasetObject quantDs : dsObjects) {
        DatasetInformationOverviewLayout datasetInfoLayout = new DatasetInformationOverviewLayout(width - 40,
                diseaseHashedColorMap);
        datasetInfoLayout.updateDatasetForm(quantDs);
        //                datasetInfoLayout.setWidth(width-40+"px");
        datasetInfoLayoutDSIndexMap.put(quantDs.getDsKey(), datasetInfoLayout);

    }

    StudyPopupLayout studiesPopupLayout = new StudyPopupLayout(datasetInfoLayoutDSIndexMap);

    popupBody.addComponent(studiesPopupLayout);
    popupBody.setComponentAlignment(studiesPopupLayout, Alignment.TOP_CENTER);
    studiesPopupLayout.setInformationData(dsObjects);

}

From source file:probe.com.view.core.NotificationTip.java

public void showNotification() {
    if (visible) {
        hideNotficiation();/*from  ww w.j a  va 2  s.com*/

    } else {
        this.setDelayMsec(15000);
        visible = true;
        this.setStyleName(defaultStyleName);
        notification.show(Page.getCurrent());

    }
}

From source file:probe.com.view.core.StudyPopupLayout.java

public StudyPopupLayout(Map<Integer, DatasetInformationOverviewLayout> datasetInfoLayoutDSIndexMap) {
    this.datasetInfoLayoutDSIndexMap = datasetInfoLayoutDSIndexMap;
    this.setWidth("100%");
    this.setStyleName(Reindeer.LAYOUT_BLACK);
    this.setHeightUndefined();
    this.setStyleName(Reindeer.LAYOUT_WHITE);
    this.setMargin(false);
    this.setSpacing(true);
    int width = Page.getCurrent().getBrowserWindowWidth() * 90 / 100;
    int colNum = Math.max(1, width / 200);
    topLayout = new GridLayout();
    topLayout.setWidth("100%");
    topLayout.setColumns(colNum);//  w  w  w  .  ja  v  a 2s . c  o  m
    topLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    topLayout.setHeightUndefined();
    topLayout.setSpacing(true);
    this.addComponent(topLayout);
    //        datasetsInformationContainer = this.initInformationContainer(width);

    //        bottomLayout = new VerticalLayout();
    //        bottomLayout.setSpacing(true);

    //        bottomLayout.setMargin(new MarginInfo(true, false, false, false));
    //        this.addComponent(bottomLayout);
    //        this.setComponentAlignment(bottomLayout, Alignment.BOTTOM_CENTER);
    //        bottomLayout.setWidth("100%");
    //        bottomLayout.setHeight("500px");

    //        bottomLayout.setStyleName(Reindeer.LAYOUT_WHITE);

    //        bottomLayout.addComponent(datasetsInformationContainer);

}

From source file:ru.inovus.ui.SignInUI.java

License:Apache License

private void notification() {
    Notification notification = new Notification("!");
    notification.setDescription(/*from   ww  w  . j  av  a  2 s . c  om*/
            "<span> ??  ?  <b>User</b>  <b>password</b>.</span>");
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("tray dark small closable login-help");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.setDelayMsec(20000);
    notification.show(Page.getCurrent());
}

From source file:sk.stefan.mvps.view.components.administrace.V7_AdministrationView.java

public V7_AdministrationView() {
    Design.read(this);
    Localizator.localizeDesign(this);

    butUsers.addClickListener(//  www  . j a  v a 2 s .co m
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(UsersTab.class), null));
    butNewUser.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(NewUserForm.class), null));
    butKraj.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(KrajeTab.class), null));
    butOkres.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(DistrictTab.class), null));
    butMiesto.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(LocationTab.class), null));
    butTema.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(TemataTab.class), null));
    butPredmet.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(SubjectsTab.class), null));
    butObdobi.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(TenuresTab.class), null));
}

From source file:sk.stefan.mvps.view.components.hlasovani.V6s_VotesView.java

public V6s_VotesView() {
    Design.read(this);
    Localizator.localizeDesign(this);

    container = new BeanItemContainer<>(Vote.class);

    grid.setContainerDataSource(container);
    grid.setHeightMode(HeightMode.ROW);/*from  www . j  a  v a 2s . com*/
    grid.addSelectionListener(event -> Page.getCurrent()
            .open(linkService.getUriFragmentForEntity((TabEntity) grid.getSelectedRow()), null));

    addVoteBt.addClickListener(event -> Page.getCurrent()
            .open(tabEntity != null
                    ? linkService.getUriFragmentForTabWithParentEntity(NewVoteForm.class,
                            tabEntity.getEntityName(), tabEntity.getId())
                    : linkService.getUriFragmentForTab(NewVoteForm.class), null));

}

From source file:sk.stefan.mvps.view.components.verejnaOsoba.V4s_PublicPersonsView.java

public V4s_PublicPersonsView() {
    Design.read(this);
    Localizator.localizeDesign(this);

    container = new BeanItemContainer<>(PublicPerson.class);
    grid.setContainerDataSource(container);
    grid.setHeightMode(HeightMode.ROW);//from  w  w w  .  j  av a 2 s  .co m
    grid.addSelectionListener(event -> Page.getCurrent()
            .open(linkService.getUriFragmentForEntity((TabEntity) grid.getSelectedRow()), null));

    searchFd.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY);

    addNewPublicPersonBt.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(NewPublicPersonForm.class), null));
}

From source file:sk.stefan.mvps.view.components.verejnyOrgan.V3s_PublicBodiesView.java

public V3s_PublicBodiesView() {
    Design.read(this);
    Localizator.localizeDesign(this);

    container = new BeanItemContainer<>(PublicBody.class);
    grid.setContainerDataSource(container);
    grid.setHeightMode(HeightMode.ROW);/*from   w  w w.j av a2s. c o  m*/
    grid.addSelectionListener(event -> Page.getCurrent()
            .open(linkService.getUriFragmentForEntity((TabEntity) grid.getSelectedRow()), null));

    searchFd.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY);

    addNewPublicBodyBt.addClickListener(
            event -> Page.getCurrent().open(linkService.getUriFragmentForTab(NewPublicBodyForm.class), null));
}

From source file:songstock.web.SongStockUI.java

License:Open Source License

/**
 * Shows a warning notification with the given title and message.
 * @param title of the notification/*from  w w  w.j a v  a 2  s.c  o  m*/
 * @param message for the notification
 */
public void showWarningNotification(String title, String message) {
    new Notification(title, message, Type.WARNING_MESSAGE, true).show(Page.getCurrent());
}