/** * Restores a maximized window back to its original size and position prior to being maximized and * also replaces the 'restore' tool button with the 'maximize' tool button. */ public void restore() { if (maximized) { el().removeStyleName("x-window-maximized"); if (maximizable) { restoreBtn.setVisible(false); maxBtn.setVisible(true); } if (restoreShadow != null && restoreShadow.booleanValue() && layer != null) { layer.enableShadow(); restoreShadow = null; } if (draggable) { dragger.setEnabled(true); } if (resizable) { resizer.setEnabled(true); } head.addStyleName("x-window-draggable"); if (restorePos != null) { setPosition(restorePos.x, restorePos.y); boolean cacheSizesRestore = cacheSizes; cacheSizes = false; setSize(restoreSize.width, restoreSize.height); cacheSizes = cacheSizesRestore; } if (container == null && restoreWindowScrolling != null) { com.google.gwt.dom.client.Document.get() .enableScrolling(restoreWindowScrolling.booleanValue()); restoreWindowScrolling = null; } maximized = false; fireEvent(Events.Restore, new WindowEvent(this)); } }
/** * Fits the window within its current container and automatically replaces the 'maximize' tool * button with the 'restore' tool button. */ public void maximize() { if (!maximized) { restoreSize = getSize(); restorePos = getPosition(true); restoreShadow = getShadow(); if (container == null) { String bodyOverflow = com.google.gwt.dom.client.Document.get().isCSS1Compat() ? com.google.gwt.dom.client.Document.get() .getDocumentElement() .getStyle() .getProperty("overflow") : com.google.gwt.dom.client.Document.get() .getBody() .getStyle() .getProperty("overflow"); if (!"hidden".equals(bodyOverflow)) { restoreWindowScrolling = true; } com.google.gwt.dom.client.Document.get().enableScrolling(false); } maximized = true; addStyleName("x-window-maximized"); head.removeStyleName("x-window-draggable"); if (layer != null) { layer.disableShadow(); } boolean cacheSizesRestore = cacheSizes; cacheSizes = false; fitContainer(); cacheSizes = cacheSizesRestore; if (maximizable) { maxBtn.setVisible(false); restoreBtn.setVisible(true); } if (draggable) { dragger.setEnabled(false); } if (resizable) { resizer.setEnabled(false); } fireEvent(Events.Maximize, new WindowEvent(this)); } else { fitContainer(); } }