I have a dialog box implemented using a Window. Inside the Dialog (Window) is a VerticalLayout with a single TextArea component.
The dialog is displayed in response to clicking on a table row.
Before construction a server side call retrieves some relevant data (about 17 items). This data (a list of String) is simply added to the TextArea.
The problem is that the Dialog (Window) is unclosable. The network activity icon (upper right-hand corner - yellow spinner followed by red spinner) is visible. There is no response to clicking the ‘X’ (close) on the Dialog (Window).
However, if I programmatically place hard-coded text into the TextArea, there is no problem (i.e. you can close the Dialog (Window))
[font=courier new]
// This ItemClickListener is attached to a Table during Table construction:
addItemClickListener(new ItemClickListener() {
@Override
public void itemClick(ItemClickEvent event) {
System.out.println("CLICK TIME from table");
if(event.getItem()!=null) {
List<String> logLines = (List<String>) event.getItem().getItemProperty("logLines").getValue();
showLogLines(logLines,"Some Title");
}
}
private void showLogLines(List<String> logLines, String msg) {
final Window myWindow = new Window(String.format("Logs %d log lines - %s",beans.size(),msg));
myWindow.setWidth("900");
myWindow.setHeight(500,Unit.PIXELS);
myWindow.setModal(true);
myWindow.setClosable(true);
myWindow.setCloseShortcut(KeyCode.ESCAPE);
VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
TextArea ta = new TextArea();
ta.setBuffered(false);
StringBuilder sb = new StringBuilder();
for (String line : logLines) {
// The following with server-obtained data prohibits closing the dialog.
sb.append(line).append("\n");
// The following with hard-coded "HELLO" allows closing the dialog.
//sb.append("HELLO").append("\n");
}
ta.setValue(sb.toString());
ta.setSizeFull();
layout.addComponent(ta);
myWindow.setContent(layout);
myWindow.addCloseListener(new Window.CloseListener(){
@Override
public void windowClose(CloseEvent e) {
System.out.println("CLOSING THE WINDOW TIME");
myWindow.close();
}
});
UI.getCurrent().addWindow(myWindow);
}
});
[/font]