]> source.dussan.org Git - vaadin-framework.git/commitdiff
#5286 implement Serializable where necessary
authorHenri Sara <henri.sara@itmill.com>
Thu, 1 Jul 2010 08:14:45 +0000 (08:14 +0000)
committerHenri Sara <henri.sara@itmill.com>
Thu, 1 Jul 2010 08:14:45 +0000 (08:14 +0000)
svn changeset:13989/svn branch:6.4

src/com/vaadin/terminal/StreamResource.java
src/com/vaadin/ui/DragAndDropWrapper.java
src/com/vaadin/ui/PopupView.java
src/com/vaadin/ui/SplitPanel.java
src/com/vaadin/ui/Table.java

index 7b4c040229e87fa8d53dc4987ee2e8471f09c1e7..7fefd0119cd885b9d522659d7658f5df6b64ba5f 100644 (file)
@@ -5,6 +5,7 @@
 package com.vaadin.terminal;
 
 import java.io.InputStream;
+import java.io.Serializable;
 
 import com.vaadin.Application;
 import com.vaadin.service.FileTypeResolver;
@@ -166,7 +167,7 @@ public class StreamResource implements ApplicationResource {
      * @VERSION@
      * @since 3.0
      */
-    public interface StreamSource {
+    public interface StreamSource extends Serializable {
 
         /**
          * Returns new input stream that is used for reading the resource.
index e431592e8e07ea27e795b84624f7125b2562a857..2421e434013d51497b31ede5731a14d6527ba69e 100644 (file)
@@ -6,6 +6,7 @@ package com.vaadin.ui;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -100,7 +101,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
          * computer if appropriate HTML 5 features are supported on client side.
          * This class wraps information about dragged file on server side.
          */
-        public class Html5File {
+        public class Html5File implements Serializable {
 
             public String name;
             private int size;
index 6a14238f8b7f9e2e0a4e68e6f0a7044004e67dbf..93208d84d270d01417d4ccfedcea95458a43d28d 100644 (file)
@@ -42,6 +42,40 @@ public class PopupView extends AbstractComponentContainer {
         }
     }
 
+    /**
+     * Iterator for the visible components (zero or one components), used by
+     * {@link PopupView#getComponentIterator()}.
+     */
+    private static class SingleComponentIterator implements
+            Iterator<Component>,
+            Serializable {
+
+        private final Component component;
+        private boolean first;
+
+        public SingleComponentIterator(Component component) {
+            this.component = component;
+            first = (component == null);
+        }
+
+        public boolean hasNext() {
+            return !first;
+        }
+
+        public Component next() {
+            if (!first) {
+                first = true;
+                return component;
+            } else {
+                return null;
+            }
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
     /* Constructors */
 
     /**
@@ -190,28 +224,7 @@ public class PopupView extends AbstractComponentContainer {
      * @see com.vaadin.ui.ComponentContainer#getComponentIterator()
      */
     public Iterator<Component> getComponentIterator() {
-        return new Iterator<Component>() {
-
-            private boolean first = visibleComponent == null;
-
-            public boolean hasNext() {
-                return !first;
-            }
-
-            public Component next() {
-                if (!first) {
-                    first = true;
-                    return visibleComponent;
-                } else {
-                    return null;
-                }
-            }
-
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        };
-
+        return new SingleComponentIterator(visibleComponent);
     }
 
     /**
index cd41a8276069a8270918cd6c8cd71d5c64edf615..d38dc06f9e1299141aa92d06047dc213859c3876 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.vaadin.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Iterator;
 import java.util.Map;
@@ -63,6 +64,51 @@ public class SplitPanel extends AbstractLayout {
 
     private static final String SPLITTER_CLICK_EVENT = VSplitPanel.SPLITTER_CLICK_EVENT_IDENTIFIER;
 
+    /**
+     * Modifiable and Serializable Iterator for the components, used by
+     * {@link SplitPanel#getComponentIterator()}.
+     */
+    private class ComponentIterator implements Iterator<Component>,
+            Serializable {
+
+        int i = 0;
+
+        public boolean hasNext() {
+            if (i < (firstComponent == null ? 0 : 1)
+                    + (secondComponent == null ? 0 : 1)) {
+                return true;
+            }
+            return false;
+        }
+
+        public Component next() {
+            if (!hasNext()) {
+                return null;
+            }
+            i++;
+            if (i == 1) {
+                return firstComponent == null ? secondComponent
+                        : firstComponent;
+            } else if (i == 2) {
+                return secondComponent;
+            }
+            return null;
+        }
+
+        public void remove() {
+            if (i == 1) {
+                if (firstComponent != null) {
+                    setFirstComponent(null);
+                    i = 0;
+                } else {
+                    setSecondComponent(null);
+                }
+            } else if (i == 2) {
+                setSecondComponent(null);
+            }
+        }
+    }
+
     /**
      * Creates a new split panel. The orientation of the panels is
      * <code>ORIENTATION_VERTICAL</code>.
@@ -165,50 +211,13 @@ public class SplitPanel extends AbstractLayout {
     }
 
     /**
-     * Gets the component container iterator for going trough all the components
-     * in the container.
+     * Gets the component container iterator for going through all the
+     * components in the container.
      * 
      * @return the Iterator of the components inside the container.
      */
     public Iterator<Component> getComponentIterator() {
-        return new Iterator<Component>() {
-            int i = 0;
-
-            public boolean hasNext() {
-                if (i < (firstComponent == null ? 0 : 1)
-                        + (secondComponent == null ? 0 : 1)) {
-                    return true;
-                }
-                return false;
-            }
-
-            public Component next() {
-                if (!hasNext()) {
-                    return null;
-                }
-                i++;
-                if (i == 1) {
-                    return firstComponent == null ? secondComponent
-                            : firstComponent;
-                } else if (i == 2) {
-                    return secondComponent;
-                }
-                return null;
-            }
-
-            public void remove() {
-                if (i == 1) {
-                    if (firstComponent != null) {
-                        setFirstComponent(null);
-                        i = 0;
-                    } else {
-                        setSecondComponent(null);
-                    }
-                } else if (i == 2) {
-                    setSecondComponent(null);
-                }
-            }
-        };
+        return new ComponentIterator();
     }
 
     /**
index 20aaedd1fc1d25020742b004a2c6aef3a02653d9..8162d72545a28425bdd5d78343c1c04a9bd067ea 100644 (file)
@@ -4099,7 +4099,7 @@ public class Table extends AbstractSelect implements Action.Container,
     /**
      * Interface for listening to column resize events.
      */
-    public interface ColumnResizeListener {
+    public interface ColumnResizeListener extends Serializable {
 
         /**
          * This method is triggered when the column has been resized