com.vaadin.shared.communication.PushMode Java Examples

The following examples show how to use com.vaadin.shared.communication.PushMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UIServlet.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters) {
  return new DefaultDeploymentConfiguration(getClass(), initParameters) {
    @Override
    public String getResourcesPath() {
      return myURLPrefix;
    }

    @Override
    public String getWidgetset(String defaultValue) {
      return "consulo.web.gwt.UI";
    }

    @Override
    public PushMode getPushMode() {
      return PushMode.AUTOMATIC;
    }
  };
}
 
Example #2
Source File: CubaUIProvider.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public PushMode getPushMode(UICreateEvent event) {
    WebConfig webConfig = configuration.getConfig(WebConfig.class);

    if (!webConfig.getPushEnabled()) {
        return PushMode.DISABLED;
    }

    return super.getPushMode(event);
}
 
Example #3
Source File: DesktopApplication.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
    broadcastReceiverService = AppContextUtil.getSpringBean(BroadcastReceiverService.class);

    ServerConfiguration serverConfiguration = AppContextUtil.getSpringBean(ServerConfiguration.class);
    if (serverConfiguration.isPush()) {
        getPushConfiguration().setPushMode(PushMode.MANUAL);
    }

    UI.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());
    setCurrentContext(new UserUIContext());
    postSetupApp(request);

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

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

    getPage().addPopStateListener((Page.PopStateListener) event -> enter(event.getPage().getUriFragment()));

    String userAgent = request.getHeader("user-agent");
    if (isInNotSupportedBrowserList(userAgent.toLowerCase())) {
        NotificationUtil.showWarningNotification(UserUIContext.getMessage(ErrorI18nEnum.BROWSER_OUT_UP_DATE));
    }
}
 
Example #4
Source File: MultiFileUpload.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void ensurePushOrPollingIsEnabled() {
    UI current = UI.getCurrent();
    PushConfiguration pushConfiguration = current.getPushConfiguration();
    PushMode pushMode = pushConfiguration.getPushMode();
    if (pushMode != PushMode.AUTOMATIC) {
        int currentPollInterval = current.getPollInterval();
        if (currentPollInterval == -1 || currentPollInterval > 1000) {
            savedPollInterval = currentPollInterval;
            current.setPollInterval(getPollInterval());
        }
    }
}