- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试在 google 上查找一些提示并查看 Vaadin 的网站,但没有找到与此问题之王相关的任何内容:
当我启动应用程序时,在控制台中,我多次看到此警告:
Ignoring RPC call for disabled connector com.vaadin.ui.Window, caption=Window's caption
我正在使用 Refresher 插件,它以 2000 毫秒的间隔轮询我的服务器。以及实现推送到 Vaadin UI 的 ICEPush 插件。
我认为这与 Refresher 插件有关,因为如果我与为测试创建的组件(在代码下方)交互,警告会添加到控制台。
这是代码:
package com.example.events;
import java.util.ArrayList;
import java.util.List;
import com.github.wolfie.refresher.Refresher;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Notification;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Noticeboard extends VerticalLayout {
/**
*
*/
private static final long serialVersionUID = -6023888496081433464L;
private static List<Note> notes = new ArrayList<Note>();
private List<Window> windows = new ArrayList<Window>();
private static int userCount;
private int userId;
private static int noteId;
private Refresher refresher = new Refresher();
private static final int UPDATE_INTERVAL = 2000;
private Note currentlyFocusedNote;
public class NoticeboardUpdater extends Thread {
@Override
public void run() {
while (true) {
try {
Thread.sleep(UPDATE_INTERVAL);
} catch (Exception e) {
e.printStackTrace();
}
getUI().getSession().getLockInstance().lock();
try {
updateNoticeboard();
} finally {
getUI().getSession().getLockInstance().unlock();
}
}
}
}
public Noticeboard() {
refresher.setRefreshInterval(UPDATE_INTERVAL);
userId = ++userCount;
setSpacing(true);
setMargin(true);
addComponent(new Label("Logged in as User " + userId));
Button addNoteButton = new Button("Add note");
addNoteButton.addClickListener(new ClickListener() {
/**
*
*/
private static final long serialVersionUID = -4927018162887570343L;
@Override
public void buttonClick(ClickEvent event) {
Note note = new Note(++noteId);
note.setCaption("Note " + note.getId());
notes.add(note);
Window window = createWindow(note);
windows.add(window);
UI.getCurrent().addWindow(window);
}
});
addComponent(addNoteButton);
addExtension(refresher);
new NoticeboardUpdater().start();
}
private Window createWindow(final Note note) {
final Window window = new Window(note.getCaption());
VerticalLayout layout = new VerticalLayout();
layout.addComponent(createContentNote(note, window));
window.setContent(layout);
window.setWidth(300, Unit.PIXELS);
window.setResizable(false);
window.setPositionX(note.getPositionX());
window.setPositionY(note.getPositionY());
window.setData(note);
window.addBlurListener(createBlurListener(window));
window.addFocusListener(createFocusListener(window));
LayoutClickNotifier mainLayout = (LayoutClickNotifier) getUI().getContent();
mainLayout.addLayoutClickListener(e -> {
if (note.isNoteFocusedWindow() || note.isNoteFocusedTextArea()) {
if (note.getLockedByUser() > -1 && note.getLockedByUser() == userId) {
unlockNote(getWindow(currentlyFocusedNote));
note.setNoteFocusedWindow(false);
note.setNoteBlurredWindow(false);
note.setNoteFocusedTextArea(false);
note.setNoteBlurredTextArea(false);
currentlyFocusedNote = null;
}
}
});
return window;
}
private TextArea createContentNote(final Note note, final Window window) {
TextArea contentNote = new TextArea();
contentNote.setSizeFull();
contentNote.setValue(note.getText());
contentNote.setImmediate(true);
contentNote.setTextChangeEventMode(TextChangeEventMode.EAGER);
contentNote.addBlurListener(createBlurListener(window));
contentNote.addFocusListener(createFocusListener(window));
contentNote.addTextChangeListener(new TextChangeListener() {
/**
*
*/
private static final long serialVersionUID = 8552875156973567499L;
@Override
public void textChange(TextChangeEvent event) {
note.setText(event.getText());
}
});
return contentNote;
}
private BlurListener createBlurListener(Window window) {
return e -> {
Component blurredComponent = e.getComponent();
if (blurredComponent == window) {
currentlyFocusedNote.setNoteBlurredWindow(true);
}
else if (blurredComponent == (((Layout) window.getContent())).iterator().next()) {
currentlyFocusedNote.setNoteBlurredTextArea(true);
}
};
}
private FocusListener createFocusListener(Window window) {
return e -> {
Component focusedComponent = e.getComponent();
Note note = (Note) window.getData();
if (currentlyFocusedNote != null && currentlyFocusedNote != note) {
unlockNote(getWindow(currentlyFocusedNote));
currentlyFocusedNote.setNoteFocusedWindow(false);
currentlyFocusedNote.setNoteBlurredWindow(false);
currentlyFocusedNote.setNoteFocusedTextArea(false);
currentlyFocusedNote.setNoteBlurredTextArea(false);
}
currentlyFocusedNote = note;
if (focusedComponent == window) {
Notification.show("Focused Note Window");
currentlyFocusedNote.setNoteFocusedWindow(true);
}
else if (focusedComponent == (((Layout) window.getContent())).iterator().next()) {
Notification.show("Focused Note TextArea");
currentlyFocusedNote.setNoteFocusedTextArea(true);
}
if (currentlyFocusedNote.isNoteFocusedWindow() && currentlyFocusedNote.isNoteBlurredTextArea() ||
currentlyFocusedNote.isNoteFocusedTextArea() && currentlyFocusedNote.isNoteBlurredWindow()) {
// Lock is already set here, skipping
return;
}
lockNote(window);
};
}
private void lockNote(Window window) {
Note note = (Note) window.getData();
note.setLockedByUser(userId);
String caption = "Locked by User " + userId;
note.setCaption(caption);
window.setCaption(caption);
}
private void unlockNote(Window window) {
Note note = (Note) window.getData();
note.setLockedByUser(-1);
note.setPositionX(window.getPositionX());
note.setPositionY(window.getPositionY());
note.setCaption("Note " + note.getId());
window.setCaption("Note " + note.getId());
}
private void updateNoticeboard() {
for (Note note : notes) {
Window window = getWindow(note);
if (window == null) {
window = createWindow(note);
windows.add(window);
UI.getCurrent().addWindow(window);
}
if (note.getLockedByUser() > -1) {
if (note.getLockedByUser() != userId) {
// If the note is locked by another user, then we disable this window.
window.setEnabled(false);
updateTextArea(window, note);
updateWindowPosition(window, note);
}
else {
// Otherwise the window is enabled.
window.setEnabled(true);
Note focusedNote = (Note) window.getData();
updateFocusedNotePosition(focusedNote, window);
}
}
else {
window.setEnabled(true);
updateTextArea(window, note);
updateWindowPosition(window, note);
}
}
}
private void updateTextArea(Window window, Note note) {
Layout layout = (Layout) window.getContent();
TextArea area = (TextArea) layout.iterator().next();
area.setValue(note.getText());
}
private Window getWindow(Note note) {
for (Window window : windows) {
if (window.getData().equals(note))
return window;
}
return null;
}
private void updateWindowPosition(Window window, Note note) {
window.setPositionX(note.getPositionX());
window.setPositionY(note.getPositionY());
window.setCaption(note.getCaption());
}
private void updateFocusedNotePosition(Note focusedNote, Window window) {
focusedNote.setPositionX(window.getPositionX());
focusedNote.setPositionY(window.getPositionY());
focusedNote.setCaption(window.getCaption());
}
}
在 UI 的 init 方法中,我只需使用此Noticeboard 类:
@Override
protected void init(VaadinRequest request) {
setContent(new Noticeboard());
}
当我移动使用“添加注释”按钮创建的窗口或将焦点从一个窗口更改到另一个窗口时,我会遇到警告。
出现此类问题的原因可能是什么?
我知道,代码并不是更好的代码,只是为了看看这个 Vaadin 插件的行为如何。
最佳答案
当您禁用组件时,禁用状态会在客户端和服务器端处理,这意味着组件不仅在视觉上被禁用,而且服务器也会拒绝处理对禁用组件的任何请求。
您看到的警告意味着存在针对已禁用组件的 RPC 请求(来自客户端的 HTTP 请求)。由于该组件被禁用,RPC 请求将被忽略。
当您有一个禁用组件的后台线程,然后还从客户端进行轮询时,通常会发生这种情况。
关于java - 这个警告在 Vaadin : "Ignoring RPC call for disabled connector com.vaadin.ui.Window"? 中意味着什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28571566/
我有一个示例应用程序,包含以下三个步骤 输入用户详细信息 -> 个人详细信息 -> 完成 当我点击一个链接时,它会调用我的 vaadin 应用程序。问题是一旦我的三步过程完成,当我再次尝试点击我的 v
我希望框架捕获每个未捕获的异常并显示适当的通知消息。 因此我在我的 UI 中设置了一个自定义的 ErrorHandler(灵感来自“Book of Vaadin”:https://vaadin.com
我在 Vaadin 有一张 table 。一列是 String 类型,因此其大小是可变的。因此,我想让列的宽度固定(具有扩展比率),但每行的高度应该是可变的(根据其内容 - 字符串)。 即,这是预期的
有谁知道用于 vaadin 框架的数据可视化(图表、饼图等)的任何 UI 组件库? 最佳答案 我建议 dChart: https://vaadin.com/directory#!addon/dchar
我在 Grid 中使用 BeanItemContainer 来显示我的数据。我需要根据单元格中的数据分别为每个单元格着色。 最佳答案 section about the Grid在 Vaadin 的书
在我的一个应用程序中,我创建了一个页脚: public Footer(){ hl.setHeight("120px"); hl.setWidth("100%");
是否有任何特定方法可以在 Vaadin 表中实现分页/延迟加载。 我试图找到一些文档,但我找不到。 最佳答案 使用Viritin add-on及其 MTable 组件。 I 是最有效的(服务器资源副)
我正在尝试使用 Vaadin Charts 创建饼图。 这段代码为图表添加了漂亮的标签,但小数点 t 后两位数字就足够了。 dataLabels.setFormatter("''+ this.poi
我是 vaadin 框架的新手,一切正常,直到......表头没有正确显示,......我正在开发一个在 exoplatform 上运行的 portlet,我正在使用 vaadin 6,我的表只显示第
我有一个带有基于复杂查询填充数据的表的页面(即使我使用分页也需要很多时间)。我使用 BeanItemcontainer 将数据加载到表中。现在遇到问题,我希望以异步方式将数据加载到表中(在用户屏幕上加
我有一个现有的应用程序(在 WebGuiToolkit.org 中编写),我正在尝试在其中嵌入一个 Vaadin 14 页面。 我看过几个 Vaadin 8 指南,比如 https://vaadin.
更改pom.xml文件的vaadin版本号和vaadin插件版本号后构建失败 7.4.5 7.4.5 然后我尝试清理并重建项目,但显示构建失败: Copying 3 resources --- va
我想通过更改文件列表中元素的外观来设置 Vaadin Upload 组件 (vaadin-upload) 的样式,例如隐藏命令按钮(开始、删除、重试)。文件列表包含 vaadin-upload-fil
如何向文本字段、选项卡、链接、标签等添加悬停文本(即当我将鼠标悬停在组件上时出现的包含一些解释或详细信息的文本框) 我用谷歌搜索并浏览了“Book of Vaadin”和“Building Moder
this.grid.asSingleSelect().addValueChangeListener(event -> { if (!Objects.isNull(event.getVa
在 Vaadin 中,一旦您有了 TabSheet,并且已经打开了一些选项卡,您就不会希望多次打开包含相同内容的同一个 Tab。 如何检查选项卡是否已打开并将其设置为选定的选项卡? 最佳答案 默认情况
我已经使用 vaadin 创建了表格。现在我想为该表格中的特定列内容设置字体大小。是否可以为该表格中的特定列设置字体大小?。 如果是这样,请给我设置字体大小的想法。如果你能提供我一些代码片段。 最佳答
是否可以在 vaadin 中以百分比设置表格的列宽。如果可以,请告诉我如何使用示例代码片段来做到这一点。提前谢谢。 最佳答案 是的。为此使用 Table.setColumnExpandRatio(co
我正在开发 Vaadin 8 UI。目前,每次修改 UI 时,我都必须重新启动我的应用程序。 有没有更好的办法?我曾尝试附加 Java 调试器并使用 IntelliJ 的 Reload Changed
序言:我是Vaadin的高级开发人员(我用过6、7,现在我的所有项目都已迁移到Vaadin 8)。 我开始学习Vaadin 10/Flow,但发现自己在一些热水中。 我实际上在挣扎的是“项目”本身。
我是一名优秀的程序员,十分优秀!