本文整理汇总了Java中com.vaadin.shared.communication.PushMode类的典型用法代码示例。如果您正苦于以下问题:Java PushMode类的具体用法?Java PushMode怎么用?Java PushMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PushMode类属于com.vaadin.shared.communication包,在下文中一共展示了PushMode类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: receiveBroadcast
import com.vaadin.shared.communication.PushMode; //导入依赖的package包/类
@Override
public void receiveBroadcast(final String event) {
if (ui != null && ui.getSession() != null) { // prevent from detached ui
// deserialize received message
final Message message = Message.fromJson(event);
if (message != null) {
Long receiverId = message.getReceiverId();
if (null == userId || null == receiverId || receiverId.equals(userId)) {
// ok - receive this message
ui.access(() -> {
fireEvent(new MessageEvent(message));
if (PushMode.MANUAL == ui.getPushConfiguration().getPushMode()) {
try {
ui.push();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
}
}
示例2: createDeploymentConfiguration
import com.vaadin.shared.communication.PushMode; //导入依赖的package包/类
@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;
}
};
}
示例3: getPushMode
import com.vaadin.shared.communication.PushMode; //导入依赖的package包/类
@Override
public PushMode getPushMode(UICreateEvent event) {
WebConfig webConfig = configuration.getConfig(WebConfig.class);
if (!webConfig.getPushEnabled()) {
return PushMode.DISABLED;
}
return super.getPushMode(event);
}
示例4: init
import com.vaadin.shared.communication.PushMode; //导入依赖的package包/类
@Override
protected void init(final VaadinRequest request) {
broadcastReceiverService = AppContextUtil.getSpringBean(BroadcastReceiverService.class);
ServerConfiguration serverConfiguration = AppContextUtil.getSpringBean(ServerConfiguration.class);
if (serverConfiguration.isPush()) {
getPushConfiguration().setPushMode(PushMode.MANUAL);
}
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());
setCurrentContext(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));
}
}
示例5: pushMode
import com.vaadin.shared.communication.PushMode; //导入依赖的package包/类
default Optional<PushMode> pushMode() {
return Optional.empty();
}
示例6: getPushMode
import com.vaadin.shared.communication.PushMode; //导入依赖的package包/类
@Override
public PushMode getPushMode() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}