0
자바 스윙에서 장기 실행 작업에 대한 모달 대화 상자를 표시하는 데 사용됩니다. 백그라운드 스레드는 수시로 대화 상자의 상태 레이블과 진행률 막대를 업데이트합니다.바디 인 모달 윈도우의 구성 요소를 업데이트 할 수 있습니까?
vaadin 모달 창이있는 경우 배경 스레드에서 아무 것도 변경할 수 없으며 창을 닫을 수도 없습니다.
예상되는 동작입니까, 아니면 잘못입니까?
편집 : 실제로 비모 달적이라도 창을 업데이트 할 수 없습니다.
Window window = new Window();
// window.setModal(true);
VerticalLayout layout = new VerticalLayout();
Label label = new Label("0");
layout.addComponent(label);
window.setContent(layout);
window.center();
new Thread(() -> {
try
{
Thread.sleep(1000);
System.out.println("update 1");
UI.getCurrent().access(() -> label.setValue("1"));
Thread.sleep(1000);
System.out.println("update 2");
UI.getCurrent().access(() -> label.setValue("2"));
Thread.sleep(1000);
System.out.println("update 3");
UI.getCurrent().access(() -> label.setValue("3"));
Thread.sleep(1000);
System.out.println("close");
UI.getCurrent().access(() -> window.close());
}
catch(InterruptedException e)
{
System.out.println(e);
}
}).start();
UI.getCurrent().addWindow(window);
편집 2 : 난 그냥 여기에 놓친 거지 무슨 아마 인은 angel이라는 push concept를 우연히 발견했다.