Warning: session_start(): open(/var/lib/php/sessions/sess_jpoln8ect7dbn9kkfitq0jc7f0, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule NestedDesktopPane {
transient JDesktopPane desktopPane;
L windows = syncL();
sclass Win {
Rect rect;
S title;
transient JInternalFrame frame;
}
visualize {
ret withCenteredButtons(desktopPane = jDesktopPane(),
"Add frame", rThreadEnter { addAFrame(randomEnglishWord()) });
}
// Restoring frames in visualize() leads to the module menu not accessible after
// reload when there is at least one subwindow. So we do it here instead.
void enhanceFrame(JInternalFrame f) {
restoreFrames();
}
void unvisualize {
super.unvisualize();
for (Win win : windows) win.frame = null;
}
JInternalFrame addAFrame(S title) {
JInternalFrame f = showInternalFrame(desktopPane, "Hello world");
new Win win;
win.rect = boundsAsRect(f);
win.title = internalFrameTitle(f);
setWinFrame(win, f);
windows.add(win);
change();
ret f;
}
void setWinFrame(Win win, JInternalFrame f) {
win.frame = f;
onBoundsChange(f, r { grabRect(win) });
onInternalFrameClosing(f, r { win.frame = null; removeWin(win) });
onTitleChanged(f, r {
if (set_trueIfChanged(win, title := internalFrameTitle(f))) change()
});
}
void restoreFrames {
if (desktopPane == null) ret;
for (Win win : windows)
setWinFrame(win, setBounds(win.rect, showInternalFrame(desktopPane, win.title)));
}
void grabRect(Win win) {
if (win != null && win.frame != null && set_trueIfChanged(win, rect := boundsAsRect(win.frame)))
change();
}
void removeWin(Win win) {
if (windows.remove(win)) {
disposeInternalFrame(win.frame);
change();
}
}
}