Example usage for com.vaadin.shared.communication PushMode MANUAL

List of usage examples for com.vaadin.shared.communication PushMode MANUAL

Introduction

In this page you can find the example usage for com.vaadin.shared.communication PushMode MANUAL.

Prototype

PushMode MANUAL

To view the source code for com.vaadin.shared.communication PushMode MANUAL.

Click Source Link

Document

Push is enabled.

Usage

From source file:com.mycollab.web.DesktopApplication.java

License:Open Source License

@Override
protected void init(final VaadinRequest request) {
    broadcastReceiverService = AppContextUtil.getSpringBean(BroadcastReceiverService.class);
    if (SiteConfiguration.getPullMethod() == SiteConfiguration.PullMethod.push) {
        getPushConfiguration().setPushMode(PushMode.MANUAL);
    }//w  ww.  j ava  2 s .  co m

    VaadinSession.getCurrent().setErrorHandler(new DefaultErrorHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public void error(com.vaadin.server.ErrorEvent event) {
            Throwable e = event.getThrowable();
            handleException(request, e);
        }
    });

    setCurrentFragmentUrl(this.getPage().getUriFragment());
    currentContext = new UserUIContext();
    postSetupApp(request);

    EventBusFactory.getInstance().register(new ShellErrorHandler());

    mainWindowContainer = new MainWindowContainer();
    this.setContent(mainWindowContainer);

    getPage().setTitle("MyCollab - Online project management");

    getPage().addUriFragmentChangedListener(
            uriFragmentChangedEvent -> enter(uriFragmentChangedEvent.getUriFragment()));

    String userAgent = request.getHeader("user-agent");
    if (isInNotSupportedBrowserList(userAgent.toLowerCase())) {
        NotificationUtil.showWarningNotification(UserUIContext.getMessage(ErrorI18nEnum.BROWSER_OUT_UP_DATE));
    }
}

From source file:org.lucidj.vaadinui.SmartPush.java

License:Apache License

public SmartPush(UI ui) {
    if (!ui.getPushConfiguration().getPushMode().isEnabled()) {
        log.info("=============================================");
        log.info("Push is not ENABLED. Will NOT start SmartPush");
        log.info("=============================================");
        return;//w w  w .  j a  v a2  s.  c  o m
    }

    if (ui.getPushConfiguration().getPushMode() != PushMode.MANUAL) {
        log.info("=================================================");
        log.info("Push mode is not MANUAL. Will NOT start SmartPush");
        log.info("=================================================");
        return;
    }

    this.ui = ui;

    push_timer = new Timer();
    push_timer.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            timer_poll();
        }
    }, CHECK_INTERVAL, CHECK_INTERVAL);
}