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:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest request) {
    HawkbitCommonUtil.initLocalization(this, uiProperties.getLocalization(), i18n);
    SpringContextHelper.setContext(context);

    params = UriComponentsBuilder.fromUri(Page.getCurrent().getLocation()).build().getQueryParams();

    setContent(buildContent());/*from   ww  w.  j  av a  2 s . c  o m*/

    fillOutUsernameTenantFields();
    readCookie();
}

From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java

License:Open Source License

private void loginAuthenticationFailedNotification() {
    final Notification notification = new Notification(i18n.getMessage("notification.login.failed.title"));
    notification.setDescription(i18n.getMessage("notification.login.failed.description"));
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("error closable");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.setDelayMsec(1_000);/*from www .j av  a  2 s.c  o  m*/
    notification.show(Page.getCurrent());
}

From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java

License:Open Source License

private void loginCredentialsExpiredNotification() {
    final Notification notification = new Notification(
            i18n.getMessage("notification.login.failed.credentialsexpired.title"));
    notification.setDescription(i18n.getMessage("notification.login.failed.credentialsexpired.description"));
    notification.setDelayMsec(10_000);/*from w ww .j a v  a  2  s .  c  om*/
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("error closeable");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.show(Page.getCurrent());
}

From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java

License:Open Source License

private static boolean isUnsupportedBrowser() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    return webBrowser.isIE() && webBrowser.getBrowserMajorVersion() < 11;
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

void loginAuthenticationFailedNotification() {
    final Notification notification = new Notification(i18n.getMessage("notification.login.failed.title"));
    notification.setDescription(i18n.getMessage("notification.login.failed.description"));
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("error closable");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.setDelayMsec(1000);//from   w w  w. ja  v a 2s  .  c o m
    notification.show(Page.getCurrent());
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

void loginCredentialsExpiredNotification() {
    final Notification notification = new Notification(
            i18n.getMessage("notification.login.failed.credentialsexpired.title"));
    notification.setDescription(i18n.getMessage("notification.login.failed.credentialsexpired.description"));
    notification.setDelayMsec(10000);/*from   ww w  . ja v  a  2 s  .co  m*/
    notification.setHtmlContentAllowed(true);
    notification.setStyleName("error closeable");
    notification.setPosition(Position.BOTTOM_CENTER);
    notification.show(Page.getCurrent());
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

/**
 * Renders the {@link View}.//  w w  w  .  j  ava 2  s  .  c  o  m
 */
@PostConstruct
public void render() {
    final URI spURI = Page.getCurrent().getLocation();
    final String uriPath = spURI.toString();
    if (uriPath.contains("?demo")) {
        login(uiProperties.getDemo().getTenant(), uiProperties.getDemo().getUser(),
                uiProperties.getDemo().getPassword(), false);
    }
    final Component loginForm = buildLoginForm();
    addComponent(loginForm);
    setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER);

    readCredentialsFromUriPath(uriPath);
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

private boolean isUnsupportedBrowser() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isIE() && webBrowser.getBrowserMajorVersion() < 11) {
        return true;
    }//from ww w.jav  a 2 s  . c o  m
    return false;
}

From source file:org.eclipse.hawkbit.ui.management.DeploymentView.java

License:Open Source License

@PostConstruct
void init() {//from w w  w. j  av a 2s. co m
    buildLayout();
    restoreState();
    checkNoDataAvaialble();
    Page.getCurrent().addBrowserWindowResizeListener(this);
    showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
    getEventBus().publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE);
}

From source file:org.eclipse.hawkbit.ui.management.targettable.BulkUploadHandler.java

License:Open Source License

@Override
public void uploadStarted(final StartedEvent event) {
    if (!event.getFilename().endsWith(".csv")) {

        new HawkbitErrorNotificationMessage(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null,
                i18n.getMessage("bulk.targets.upload"), true).show(Page.getCurrent());
        LOG.error("Wrong file format for file {}", event.getFilename());
        upload.interruptUpload();//ww  w .  j a  v  a 2  s.  c o  m
    } else {
        eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED));
    }
}