本文整理了Java中com.vaadin.ui.UI.isAttached()
方法的一些代码示例,展示了UI.isAttached()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UI.isAttached()
方法的具体详情如下:
包路径:com.vaadin.ui.UI
类名称:UI
方法名:isAttached
暂无
代码示例来源:origin: OpenNMS/opennms
public static <T extends UI> T getCurrent(Class<T> clazz) {
final T ui = (T) UI.getCurrent();
if (ui == null || !ui.isAttached()) {
throw new IllegalStateException("UI is either null or not attached. Ensure it is invoked from within a VaadinRequest");
}
return ui;
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Override
public void messageCleared(final Message message) {
if (ui.isAttached()) {
ui.access(() -> eventBus.fireEvent(new MessageEvent(message, true)));
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Override
public void messageSent(final Message message) {
if (ui.isAttached()) {
ui.access(() -> eventBus.fireEvent(new MessageEvent(message, false)));
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Override
public void messageRemoved(final String id) {
if (ui.isAttached()) {
ui.access(() -> eventBus.fireEvent(new MessageEvent(id, true)));
}
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Before
public void setUp() {
Context ctx = mock(Context.class);
User usr = mock(User.class);
when(ctx.getUser()).thenReturn(usr);
when(usr.getName()).thenReturn("peter");
MgnlContext.setInstance(ctx);
this.ui = mock(UI.class);
doReturn(true).when(ui).isAttached();
doAnswer(invocation -> {
final Runnable task = invocation.getArgumentAt(0, Runnable.class);
task.run();
return null;
}).when(ui).access(any(Runnable.class));
}
代码示例来源:origin: com.haulmont.addon.search/search-web
.filter(UI::isConnectorEnabled)
.forEach(ui -> {
if (ui.isAttached()) {
ui.access(callback);
} else {
代码示例来源:origin: OpenNMS/opennms
public static ZoneId extractUserTimeZoneIdOrNull(final UI ui) {
// Verify if a ui is provided, still attached and has a session
if (ui != null && ui.isAttached() && ui.getSession() != null && ui.getSession().getSession() != null) {
// Only the wrapped session has the attribute set, the VaadinSession does not!
return (ZoneId) ui.getSession().getSession().getAttribute(CentralizedDateTimeFormat.SESSION_PROPERTY_TIMEZONE_ID);
}
return null;
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Before
public void setUp() {
this.context = mock(Context.class);
User usr = mock(User.class);
when(context.getUser()).thenReturn(usr);
MgnlContext.setInstance(context);
this.componentProvider = mock(ComponentProvider.class);
when(componentProvider.getComponent(eq(SystemContext.class))).thenReturn(new MockContext());
this.eventBus = new SimpleEventBus();
this.events = new ArrayList<>();
final UI ui = mock(UI.class);
doReturn(true).when(ui).isAttached();
doAnswer(invocation -> {
final Runnable task = invocation.getArgumentAt(0, Runnable.class);
task.run();
return null;
}).when(ui).access(any(Runnable.class));
this.dispatcher = new LocalTaskDispatcher(eventBus, ui, context, componentProvider);
eventBus.addHandler(TaskEvent.class, new CollectingTaskEventHandler(events));
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework
@Override
public void onTaskEvent(final TaskEvent taskEvent) {
if (!ui.isAttached()) {
return;
内容来源于网络,如有侵权,请联系作者删除!