Child windows shortcut close problem

How to forbid to close an affiliated window from its heading?
11680.jpg

Has found in Vaadin book, that it is necessary to expose
setReadOnly(true)
.

Also, Window.setClosable(true)

I welcome you, Jouni Koivuviita !

Such problem - I design a window in some class -


...
GenericWin genericWin = new GenericWin<NewTable>(new NewTable(userWorkSpace, tab);
...

part of code GenericWin class -


...
Class [] classParm = {HashMap.class, Tab.class};
Object [] objectParm = {userWorkSpace, tab};
			
java.lang.reflect.Constructor co = ob.getClass().getConstructor(classParm);
w = (Window)co.newInstance(objectParm);

w.setReadOnly(true); 
charts.add(w);			
window.addWindow(w);			
userWorkSpace.put(tab, charts);
...

“Message Boards is temporarily unavailable”. :unsure:


...
if(closeButton == event.getButton()) {			
   ArrayList windows = (ArrayList)userWorkSpace.get(tab);
   if(null != windows) {				
      getWindow().removeWindow((Window)this);
      windows.remove(this);			
      userWorkSpace.put(tab, windows);
   }
}				 
...

Why getWindow().removeWindow((Window)this) don’t work?

When i restore windows from list - everything is all right:


...
ArrayList windows = (ArrayList)userWorkSpace.get(tab);
if(null != windows) {
   for(Object w : windows) { 
      addWindow((Window)w);
   }
...

For example -
11681.jpg

The decision is found -


(this.getParent()).removeWindow(this)

The code resulted more low isn’t correct -


getWindow().removeWindow(this)
or
removeWindow(this)

In this case, certainly. :smiley: