]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #1235. setting subwindow subwindow readonly now disables client side closing
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 30 Sep 2008 07:27:57 +0000 (07:27 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 30 Sep 2008 07:27:57 +0000 (07:27 +0000)
svn changeset:5552/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
src/com/itmill/toolkit/ui/Window.java

index 193b63f660ddb97be30ece69622f9f9f93f9b95c..40d4d0222aeb288b016269e94fb55868b466d966 100644 (file)
@@ -103,6 +103,8 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
     private Element headerText;
 
+    private boolean readonly;
+
     public IWindow() {
         super();
         final int order = windowOrder.size();
@@ -212,6 +214,10 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
             setResizable(!resizable);
         }
 
+        if (isReadOnly() != uidl.getBooleanAttribute("readonly")) {
+            setReadOnly(!isReadOnly());
+        }
+
         // Initialize the position form UIDL
         try {
             final int positionx = uidl.getIntVariable("positionx");
@@ -381,6 +387,19 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
 
     }
 
+    private void setReadOnly(boolean readonly) {
+        this.readonly = readonly;
+        if (readonly) {
+            DOM.setStyleAttribute(closeBox, "display", "none");
+        } else {
+            DOM.setStyleAttribute(closeBox, "display", "");
+        }
+    }
+
+    private boolean isReadOnly() {
+        return readonly;
+    }
+
     @Override
     public void show() {
         if (modal) {
index 2d9ce6e9cff10405a77236d8403fd5a310850d7e..c3d4e234d29cf2d18426a1747374802126f2d1dc 100644 (file)
@@ -833,10 +833,12 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
             setPositionY(y < 0 ? -1 : y);
         }
 
-        // Closing
-        final Boolean close = (Boolean) variables.get("close");
-        if (close != null && close.booleanValue()) {
-            close();
+        if (!isReadOnly()) {
+            // Closing
+            final Boolean close = (Boolean) variables.get("close");
+            if (close != null && close.booleanValue()) {
+                close();
+            }
         }
     }