]> source.dussan.org Git - vaadin-framework.git/commitdiff
Implementation serialization support for Toolkit. Fixes #695
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>
Sun, 12 Apr 2009 00:07:09 +0000 (00:07 +0000)
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>
Sun, 12 Apr 2009 00:07:09 +0000 (00:07 +0000)
svn changeset:7387/svn branch:6.0

150 files changed:
src/com/itmill/toolkit/Application.java
src/com/itmill/toolkit/automatedtests/ComponentsInTable.java
src/com/itmill/toolkit/automatedtests/SimplestApplication.java
src/com/itmill/toolkit/automatedtests/featurebrowser/AccordionExample.java
src/com/itmill/toolkit/automatedtests/featurebrowser/ButtonExample.java
src/com/itmill/toolkit/automatedtests/featurebrowser/ClientCachingExample.java
src/com/itmill/toolkit/automatedtests/featurebrowser/ComboBoxExample.java
src/com/itmill/toolkit/automatedtests/featurebrowser/EmbeddedBrowserExample.java
src/com/itmill/toolkit/automatedtests/featurebrowser/FeatureBrowser.java
src/com/itmill/toolkit/automatedtests/featurebrowser/FormExample.java
src/com/itmill/toolkit/automatedtests/featurebrowser/GeneratedColumnExample.java
src/com/itmill/toolkit/automatedtests/util/DebugId.java
src/com/itmill/toolkit/automatedtests/util/Log.java
src/com/itmill/toolkit/automatedtests/util/RandomComponents.java
src/com/itmill/toolkit/data/Buffered.java
src/com/itmill/toolkit/data/BufferedValidatable.java
src/com/itmill/toolkit/data/Container.java
src/com/itmill/toolkit/data/Item.java
src/com/itmill/toolkit/data/Property.java
src/com/itmill/toolkit/data/Validatable.java
src/com/itmill/toolkit/data/Validator.java
src/com/itmill/toolkit/data/util/BeanItem.java
src/com/itmill/toolkit/data/util/BeanItemContainer.java
src/com/itmill/toolkit/data/util/ContainerHierarchicalWrapper.java
src/com/itmill/toolkit/data/util/ContainerOrderedWrapper.java
src/com/itmill/toolkit/data/util/FilesystemContainer.java
src/com/itmill/toolkit/data/util/Filter.java
src/com/itmill/toolkit/data/util/HierarchicalContainer.java
src/com/itmill/toolkit/data/util/IndexedContainer.java
src/com/itmill/toolkit/data/util/MethodProperty.java
src/com/itmill/toolkit/data/util/ObjectProperty.java
src/com/itmill/toolkit/data/util/PropertyFormatter.java
src/com/itmill/toolkit/data/util/PropertysetItem.java
src/com/itmill/toolkit/data/util/QueryContainer.java
src/com/itmill/toolkit/data/validator/AbstractStringValidator.java
src/com/itmill/toolkit/data/validator/AbstractValidator.java
src/com/itmill/toolkit/data/validator/CompositeValidator.java
src/com/itmill/toolkit/data/validator/DoubleValidator.java
src/com/itmill/toolkit/data/validator/EmailValidator.java
src/com/itmill/toolkit/data/validator/IntegerValidator.java
src/com/itmill/toolkit/data/validator/NullValidator.java
src/com/itmill/toolkit/data/validator/RegexpValidator.java
src/com/itmill/toolkit/data/validator/StringLengthValidator.java
src/com/itmill/toolkit/demo/HelloWorld.java
src/com/itmill/toolkit/demo/ToolkitTunesLayout.java
src/com/itmill/toolkit/demo/sampler/ActiveLink.java
src/com/itmill/toolkit/demo/sampler/Feature.java
src/com/itmill/toolkit/demo/sampler/SamplerApplication.java
src/com/itmill/toolkit/demo/tutorial/addressbook/data/Person.java
src/com/itmill/toolkit/demo/tutorial/addressbook/data/PersonContainer.java
src/com/itmill/toolkit/demo/tutorial/addressbook/data/SearchFilter.java
src/com/itmill/toolkit/event/Action.java
src/com/itmill/toolkit/event/EventRouter.java
src/com/itmill/toolkit/event/ItemClickEvent.java
src/com/itmill/toolkit/event/ListenerMethod.java
src/com/itmill/toolkit/event/MethodEventSource.java
src/com/itmill/toolkit/event/ShortcutAction.java
src/com/itmill/toolkit/service/ApplicationContext.java
src/com/itmill/toolkit/service/FileTypeResolver.java
src/com/itmill/toolkit/terminal/ApplicationResource.java
src/com/itmill/toolkit/terminal/ClassResource.java
src/com/itmill/toolkit/terminal/CompositeErrorMessage.java
src/com/itmill/toolkit/terminal/DownloadStream.java
src/com/itmill/toolkit/terminal/ErrorMessage.java
src/com/itmill/toolkit/terminal/ExternalResource.java
src/com/itmill/toolkit/terminal/FileResource.java
src/com/itmill/toolkit/terminal/KeyMapper.java
src/com/itmill/toolkit/terminal/PaintException.java
src/com/itmill/toolkit/terminal/PaintTarget.java
src/com/itmill/toolkit/terminal/Paintable.java
src/com/itmill/toolkit/terminal/ParameterHandler.java
src/com/itmill/toolkit/terminal/Resource.java
src/com/itmill/toolkit/terminal/Scrollable.java
src/com/itmill/toolkit/terminal/Sizeable.java
src/com/itmill/toolkit/terminal/StreamResource.java
src/com/itmill/toolkit/terminal/SystemError.java
src/com/itmill/toolkit/terminal/Terminal.java
src/com/itmill/toolkit/terminal/ThemeResource.java
src/com/itmill/toolkit/terminal/URIHandler.java
src/com/itmill/toolkit/terminal/UploadStream.java
src/com/itmill/toolkit/terminal/UserError.java
src/com/itmill/toolkit/terminal/VariableOwner.java
src/com/itmill/toolkit/terminal/gwt/client/ui/IMarginInfo.java
src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java
src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
src/com/itmill/toolkit/terminal/gwt/server/ComponentSizeValidator.java
src/com/itmill/toolkit/terminal/gwt/server/HttpUploadStream.java
src/com/itmill/toolkit/terminal/gwt/server/JsonPaintTarget.java
src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java
src/com/itmill/toolkit/terminal/gwt/server/SessionExpired.java
src/com/itmill/toolkit/terminal/gwt/server/SystemMessageException.java
src/com/itmill/toolkit/terminal/gwt/server/WebApplicationContext.java
src/com/itmill/toolkit/terminal/gwt/server/WebBrowser.java
src/com/itmill/toolkit/tests/tickets/Ticket695.java [new file with mode: 0644]
src/com/itmill/toolkit/ui/AbsoluteLayout.java
src/com/itmill/toolkit/ui/AbstractComponent.java
src/com/itmill/toolkit/ui/AbstractComponentContainer.java
src/com/itmill/toolkit/ui/AbstractField.java
src/com/itmill/toolkit/ui/AbstractLayout.java
src/com/itmill/toolkit/ui/AbstractOrderedLayout.java
src/com/itmill/toolkit/ui/AbstractSelect.java
src/com/itmill/toolkit/ui/Accordion.java
src/com/itmill/toolkit/ui/Alignment.java
src/com/itmill/toolkit/ui/AlignmentUtils.java
src/com/itmill/toolkit/ui/BaseFieldFactory.java
src/com/itmill/toolkit/ui/Button.java
src/com/itmill/toolkit/ui/CheckBox.java
src/com/itmill/toolkit/ui/ComboBox.java
src/com/itmill/toolkit/ui/Component.java
src/com/itmill/toolkit/ui/ComponentContainer.java
src/com/itmill/toolkit/ui/CustomComponent.java
src/com/itmill/toolkit/ui/CustomLayout.java
src/com/itmill/toolkit/ui/DateField.java
src/com/itmill/toolkit/ui/Embedded.java
src/com/itmill/toolkit/ui/ExpandLayout.java
src/com/itmill/toolkit/ui/Field.java
src/com/itmill/toolkit/ui/FieldFactory.java
src/com/itmill/toolkit/ui/Form.java
src/com/itmill/toolkit/ui/FormLayout.java
src/com/itmill/toolkit/ui/GridLayout.java
src/com/itmill/toolkit/ui/HorizontalLayout.java
src/com/itmill/toolkit/ui/InlineDateField.java
src/com/itmill/toolkit/ui/Label.java
src/com/itmill/toolkit/ui/Layout.java
src/com/itmill/toolkit/ui/Link.java
src/com/itmill/toolkit/ui/ListSelect.java
src/com/itmill/toolkit/ui/LoginForm.java
src/com/itmill/toolkit/ui/MenuBar.java
src/com/itmill/toolkit/ui/NativeSelect.java
src/com/itmill/toolkit/ui/OptionGroup.java
src/com/itmill/toolkit/ui/OrderedLayout.java
src/com/itmill/toolkit/ui/Panel.java
src/com/itmill/toolkit/ui/PopupDateField.java
src/com/itmill/toolkit/ui/PopupView.java
src/com/itmill/toolkit/ui/ProgressIndicator.java
src/com/itmill/toolkit/ui/RichTextArea.java
src/com/itmill/toolkit/ui/Select.java
src/com/itmill/toolkit/ui/Slider.java
src/com/itmill/toolkit/ui/SplitPanel.java
src/com/itmill/toolkit/ui/TabSheet.java
src/com/itmill/toolkit/ui/Table.java
src/com/itmill/toolkit/ui/TextField.java
src/com/itmill/toolkit/ui/Tree.java
src/com/itmill/toolkit/ui/TwinColSelect.java
src/com/itmill/toolkit/ui/Upload.java
src/com/itmill/toolkit/ui/UriFragmentUtility.java
src/com/itmill/toolkit/ui/VerticalLayout.java
src/com/itmill/toolkit/ui/Window.java

index 60045ac702fb05cf21838d7cf7581195f50a14a4..049969f9ec440f729c9f659fd16d1c1fddb7529c 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit;
 
+import java.io.Serializable;
 import java.net.SocketException;
 import java.net.URL;
 import java.util.Collection;
@@ -84,7 +85,9 @@ import com.itmill.toolkit.ui.Window;
  * @VERSION@
  * @since 3.0
  */
-public abstract class Application implements URIHandler, Terminal.ErrorListener {
+@SuppressWarnings("serial")
+public abstract class Application implements URIHandler,
+        Terminal.ErrorListener, Serializable {
 
     /**
      * Random window name generator.
@@ -757,11 +760,6 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      */
     public class UserChangeEvent extends java.util.EventObject {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3544951069307188281L;
-
         /**
          * New user of the application.
          */
@@ -826,7 +824,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      * @VERSION@
      * @since 3.0
      */
-    public interface UserChangeListener extends EventListener {
+    public interface UserChangeListener extends EventListener, Serializable {
 
         /**
          * The <code>applicationUserChanged</code> method Invoked when the
@@ -872,11 +870,6 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      */
     public class WindowDetachEvent extends EventObject {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3544669568644691769L;
-
         private final Window window;
 
         /**
@@ -914,11 +907,6 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      */
     public class WindowAttachEvent extends EventObject {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3977578104367822392L;
-
         private final Window window;
 
         /**
@@ -954,7 +942,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     /**
      * Window attach listener interface.
      */
-    public interface WindowAttachListener {
+    public interface WindowAttachListener extends Serializable {
 
         /**
          * Window attached
@@ -968,7 +956,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     /**
      * Window detach listener interface.
      */
-    public interface WindowDetachListener {
+    public interface WindowDetachListener extends Serializable {
 
         /**
          * Window detached.
@@ -1186,7 +1174,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      * </p>
      * 
      */
-    public static class SystemMessages {
+    public static class SystemMessages implements Serializable {
         protected String sessionExpiredURL = null;
         protected boolean sessionExpiredNotificationEnabled = true;
         protected String sessionExpiredCaption = "Session Expired";
@@ -1369,7 +1357,8 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
      * </p>
      */
 
-    public static class CustomizedSystemMessages extends SystemMessages {
+    public static class CustomizedSystemMessages extends SystemMessages
+            implements Serializable {
 
         /**
          * Sets the URL to go to when the session has expired.
@@ -1557,7 +1546,6 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
     }
 
     public class ApplicationError implements Terminal.ErrorEvent {
-
         private final Throwable throwable;
 
         public ApplicationError(Throwable throwable) {
@@ -1569,5 +1557,4 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
         }
 
     }
-
 }
\ No newline at end of file
index 1aabdfea71797889d0939a2bb110d45079c8dac4..48a71213e7a96827853c6c9764f5d92efa42473e 100644 (file)
@@ -16,6 +16,8 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
 \r
 public class ComponentsInTable extends CustomComponent {\r
 \r
+    private static final long serialVersionUID = 7179313717613510935L;\r
+\r
     public ComponentsInTable(int cols, int rows) {\r
         final OrderedLayout main = new OrderedLayout();\r
         setCompositionRoot(main);\r
index 01f3990bd202c63228bafc274a03bf7512788a13..b21c1cd7b8633c55de08061453b026f4c1794ae5 100644 (file)
@@ -8,6 +8,7 @@ import com.itmill.toolkit.ui.Label;
 import com.itmill.toolkit.ui.Window;
 
 public class SimplestApplication extends com.itmill.toolkit.Application {
+    private static final long serialVersionUID = 1401107566407830534L;
 
     @Override
     public void init() {
index f5e81ba9d5a30b7a88db60d304139a1c6db9207b..e7609d97138d0d91ddbe187af13609717dca14c5 100644 (file)
@@ -11,6 +11,8 @@ import com.itmill.toolkit.ui.VerticalLayout;
  * the tab contents between the vertical tabs.
  */
 public class AccordionExample extends CustomComponent {
+    private static final long serialVersionUID = 7172404542359409349L;
+
     public AccordionExample() {
         // Create a new accordion
         final Accordion accordion = new Accordion();
index bf61a443c6efa1069e2541f14d7d6e42c809e092..ba7296fd134b5d2edd8b7937fd6e7a53619bdc39 100644 (file)
@@ -24,6 +24,8 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
 public class ButtonExample extends CustomComponent implements\r
         Button.ClickListener {\r
 \r
+    private static final long serialVersionUID = -3934416497726624080L;\r
+\r
     public ButtonExample() {\r
 \r
         final VerticalLayout main = new VerticalLayout();\r
index 6cddcd29dc3d9b32ec8dbfd278588282026c9c33..b43770d45f1d7306cc1d9a451208023306708660 100644 (file)
@@ -23,6 +23,7 @@ import com.itmill.toolkit.ui.VerticalLayout;
  */\r
 public class ClientCachingExample extends CustomComponent {\r
 \r
+    private static final long serialVersionUID = -1033520074262036031L;\r
     private static final String msg = "This example is a (simple) demonstration of client-side caching."\r
             + " The content in one tab is intentionally made very slow to"\r
             + " 'produce' server-side. When you changes to this tab for the"\r
@@ -52,6 +53,8 @@ public class ClientCachingExample extends CustomComponent {
         layout = new VerticalLayout();\r
         layout.setMargin(true);\r
         l = new Label("Slow label - until cached client side.") {\r
+            private static final long serialVersionUID = -2741194381200799815L;\r
+\r
             @Override\r
             public void paintContent(PaintTarget target) throws PaintException {\r
                 try {\r
index 03271a98e38a1a24ec7fa7120299ec09de009953..312c7b27d2476df5f18f87439e6527b56243fb0a 100644 (file)
@@ -16,6 +16,8 @@ import com.itmill.toolkit.ui.AbstractSelect.Filtering;
  */
 public class ComboBoxExample extends CustomComponent {
 
+    private static final long serialVersionUID = 1580175413996261572L;
+
     private static final String[] firstnames = new String[] { "John", "Mary",
             "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Robert", "Paula",
             "Lenny", "Kenny", "Nathan", "Nicole", "Laura", "Jos", "Josie",
index 22f7d103f4e790c7e2fc3c819cdbe5fcfa398d95..cd60dbd2bd64bc10899ad6f7f882948e1b58b5ce 100644 (file)
@@ -24,6 +24,8 @@ import com.itmill.toolkit.ui.Window.Notification;
 public class EmbeddedBrowserExample extends VerticalLayout implements
         Select.ValueChangeListener {
 
+    private static final long serialVersionUID = -6209869808788169597L;
+
     // Default URL to open.
     private static final String DEFAULT_URL = "http://www.itmill.com/index_itmill_toolkit.htm";
 
index 5edbca6ea23f5bb50a0d796a8a14a1b19fb120ad..2c22926e2f1c94a5202fefe5487d62fd1e24a1df 100644 (file)
@@ -39,7 +39,9 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
 public class FeatureBrowser extends com.itmill.toolkit.Application implements
         Select.ValueChangeListener {
 
+    private static final long serialVersionUID = -4653905515159295197L;
     // Property IDs
+
     private static final Object PROPERTY_ID_CATEGORY = "Category";
     private static final Object PROPERTY_ID_NAME = "Name";
     private static final Object PROPERTY_ID_DESC = "Description";
@@ -167,7 +169,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         tree.addListener(this);
         tree.setImmediate(true);
         tree.expandItemsRecursively(rootId);
-        for (Iterator i = container.getItemIds().iterator(); i.hasNext();) {
+        for (Iterator<?> i = container.getItemIds().iterator(); i.hasNext();) {
             Object id = i.next();
             if (container.getChildren(id) == null) {
                 tree.setChildrenAllowed(id, false);
@@ -207,6 +209,8 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
 
         final HorizontalLayout wbLayout = new HorizontalLayout();
         Button b = new Button("Open in sub-window", new Button.ClickListener() {
+            private static final long serialVersionUID = -9168589977880405848L;
+
             public void buttonClick(ClickEvent event) {
                 Component component = (Component) ts.getComponentIterator()
                         .next();
@@ -231,6 +235,9 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
         b.setStyleName(Button.STYLE_LINK);
         wbLayout.addComponent(b);
         b = new Button("Open in native window", new Button.ClickListener() {
+
+            private static final long serialVersionUID = 3847765713639897223L;
+
             public void buttonClick(ClickEvent event) {
                 Component component = (Component) ts.getComponentIterator()
                         .next();
@@ -348,8 +355,8 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
                 tree.setValue(table.getValue());
                 table.addListener(this);
                 final Item item = table.getItem(table.getValue());
-                final Class c = (Class) item.getItemProperty(PROPERTY_ID_CLASS)
-                        .getValue();
+                final Class<?> c = (Class<?>) item.getItemProperty(
+                        PROPERTY_ID_CLASS).getValue();
                 final Component component = getComponent(c);
                 if (component != null) {
                     final String caption = (String) item.getItemProperty(
@@ -369,7 +376,7 @@ public class FeatureBrowser extends com.itmill.toolkit.Application implements
 
     }
 
-    private Component getComponent(Class componentClass) {
+    private Component getComponent(Class<?> componentClass) {
         if (!exampleInstances.containsKey(componentClass)) {
             try {
                 final Component c = (Component) componentClass.newInstance();
index 90ce0237c75cf9d4864f95a20a8e45fcde391ac0..290a2ca1bf873b06f6cf16e5b7d79014775d2e0b 100644 (file)
@@ -1,5 +1,7 @@
 package com.itmill.toolkit.automatedtests.featurebrowser;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.data.Item;
 import com.itmill.toolkit.data.Validator;
 import com.itmill.toolkit.data.util.BeanItem;
@@ -25,6 +27,7 @@ import com.itmill.toolkit.ui.Button.ClickEvent;
  */
 public class FormExample extends CustomComponent {
 
+    private static final long serialVersionUID = -5382205369084031674L;
     static final String cities[] = { "Amsterdam", "Berlin", "Helsinki",
             "Hong Kong", "London", "Luxemburg", "New York", "Oslo", "Paris",
             "Rome", "Stockholm", "Tokyo", "Turku" };
@@ -36,6 +39,7 @@ public class FormExample extends CustomComponent {
         final Address dataModel = new Address();
         Button peekDataModelState = new Button("Show the data model state",
                 new Button.ClickListener() {
+                    private static final long serialVersionUID = -9128707564903086213L;
 
                     public void buttonClick(ClickEvent event) {
                         getWindow().showNotification(
@@ -61,6 +65,9 @@ public class FormExample extends CustomComponent {
     }
 
     public static class AddressForm extends Form {
+
+        private static final long serialVersionUID = -1356475197391501301L;
+
         public AddressForm(String caption) {
 
             setCaption(caption);
@@ -114,7 +121,10 @@ public class FormExample extends CustomComponent {
      * This is example on how to customize field creation. Any kind of field
      * components could be created on the fly.
      */
-    static class MyFieldFactory extends BaseFieldFactory {
+    static class MyFieldFactory extends BaseFieldFactory implements
+            Serializable {
+
+        private static final long serialVersionUID = 4993348078809959988L;
 
         @Override
         public Field createField(Item item, Object propertyId,
@@ -138,6 +148,8 @@ public class FormExample extends CustomComponent {
      */
     static class PostalCodeValidator implements Validator {
 
+        private static final long serialVersionUID = -7635596091609806427L;
+
         public boolean isValid(Object value) {
             if (value == null || !(value instanceof String)) {
                 return false;
@@ -159,7 +171,9 @@ public class FormExample extends CustomComponent {
      * it would be a good idea to implement Item -interface for the datamodel to
      * make it directly bindable to form (without BeanItem wrapper)
      */
-    public static class Address {
+    public static class Address implements Serializable {
+
+        private static final long serialVersionUID = 6238878890199428556L;
         String name = "";
         String streetAddress = "";
         String postalCode = "";
index 6052d96642d262d770fcc3e0b71023ed60d77dcb..4872a670fb372ea244f79ee26c07354594461a23 100644 (file)
@@ -37,6 +37,7 @@ import com.itmill.toolkit.ui.Button.ClickListener;
  * @author magi
  */
 public class GeneratedColumnExample extends CustomComponent {
+
     /**
      * The business model: fill-up at a gas station.
      */
@@ -116,12 +117,13 @@ public class GeneratedColumnExample extends CustomComponent {
      * implementations, as they are not needed in this example.
      */
     public class MySimpleIndexedContainer implements Container, Indexed {
-        Vector items;
+
+        Vector<BeanItem> items;
         Object itemtemplate;
 
         public MySimpleIndexedContainer(Object itemtemplate) {
             this.itemtemplate = itemtemplate;
-            items = new Vector(); // Yeah this is just a test
+            items = new Vector<BeanItem>(); // Yeah this is just a test
         }
 
         public boolean addContainerProperty(Object propertyId, Class type,
@@ -164,7 +166,7 @@ public class GeneratedColumnExample extends CustomComponent {
             if (itemId instanceof Integer) {
                 int pos = ((Integer) itemId).intValue();
                 if (pos >= 0 && pos < items.size()) {
-                    Item item = (Item) items.get(pos);
+                    Item item = items.get(pos);
 
                     // The BeanItem provides the property objects for the items.
                     return item.getItemProperty(propertyId);
@@ -185,7 +187,7 @@ public class GeneratedColumnExample extends CustomComponent {
             if (itemId instanceof Integer) {
                 int pos = ((Integer) itemId).intValue();
                 if (pos >= 0 && pos < items.size()) {
-                    return (Item) items.get(pos);
+                    return items.get(pos);
                 }
             }
             return null;
@@ -365,6 +367,9 @@ public class GeneratedColumnExample extends CustomComponent {
 
     /** Table column generator for calculating consumption column. */
     class ConsumptionColumnGenerator implements Table.ColumnGenerator {
+
+        private static final long serialVersionUID = -1077081052659001251L;
+
         /**
          * Generates a cell containing value calculated from the item.
          */
@@ -408,6 +413,7 @@ public class GeneratedColumnExample extends CustomComponent {
 
     /** Table column generator for calculating daily cost column. */
     class DailyCostColumnGenerator extends ConsumptionColumnGenerator {
+
         @Override
         public Component generateCell(FillUp fillup, FillUp prev) {
             double dailycost = fillup.dailyCost(prev);
index 03dc6cedecffc42bab4ec89502bcf2e825bdee4c..bcf9453109ccc79340dcd0d4ee125de53da24d98 100644 (file)
@@ -4,11 +4,12 @@
 
 package com.itmill.toolkit.automatedtests.util;
 
+import java.io.Serializable;
 import java.util.HashMap;
 
 import com.itmill.toolkit.ui.Component;
 
-public class DebugId {
+public class DebugId implements Serializable {
 
     private static HashMap debugIds = new HashMap();
 
index 8d113e0fe5989c76a8ae440f0569497461d2ea7d..d7f98540d180cf20ff0c713f843e0713f97c3125 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.automatedtests.util;
 
+import java.io.Serializable;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -17,7 +18,7 @@ import java.util.Iterator;
  * figure out what went wrong.
  * 
  */
-public class Log {
+public class Log implements Serializable {
 
     // 3 (errors only)
     // 2 (+ warnings)
index af2c44a40b0532bebacf1e4b1b4b22b8c2103feb..03b045e4a4e07b9803731b1d2a8f9d4134740bdf 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.automatedtests.util;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Random;
@@ -41,7 +42,7 @@ import com.itmill.toolkit.ui.Select;
 import com.itmill.toolkit.ui.TabSheet;
 import com.itmill.toolkit.ui.TextField;
 
-public class RandomComponents {
+public class RandomComponents implements Serializable {
 
     private Random rand = null;
 
index 4aba27376dad76639526ee1cd121bbb2a560ddd2..0550c49146c9f5297a8503c7ea1b9b293ae26d91 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.data.Validator.InvalidValueException;
 import com.itmill.toolkit.terminal.ErrorMessage;
 import com.itmill.toolkit.terminal.PaintException;
@@ -42,7 +44,7 @@ import com.itmill.toolkit.terminal.SystemError;
  * @VERSION@
  * @since 3.0
  */
-public interface Buffered {
+public interface Buffered extends Serializable {
 
     /**
      * Updates all changes since the previous commit to the data source. The
@@ -147,13 +149,9 @@ public interface Buffered {
      * @VERSION@
      * @since 3.0
      */
+    @SuppressWarnings("serial")
     public class SourceException extends RuntimeException implements
-            ErrorMessage {
-
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3256720671781630518L;
+            ErrorMessage, Serializable {
 
         /** Source class implementing the buffered interface */
         private final Buffered source;
index 756936710ad23620b5b4db9c62b517c6eea0ab01..24fd68912250c9ed9e2ecb09e1a06e170d805f15 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * This interface defines the combination of <code>Validatable</code> and
@@ -16,7 +18,8 @@ package com.itmill.toolkit.data;
  * @VERSION@
  * @since 3.0
  */
-public interface BufferedValidatable extends Buffered, Validatable {
+public interface BufferedValidatable extends Buffered, Validatable,
+        Serializable {
 
     /**
      * Tests if the invalid data is committed to datasource. The default is
index 5df1b34f91a6f668265baad130ca44d2bcd0d1c4..7b9bb319716d525bff4c5b8cfc4a5e11ce6059c3 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
 import java.util.Collection;
 
 /**
@@ -51,7 +52,7 @@ import java.util.Collection;
  * @VERSION@
  * @since 3.0
  */
-public interface Container {
+public interface Container extends Serializable {
 
     /**
      * Gets the Item with the given Item ID from the Container. If the Container
@@ -70,7 +71,7 @@ public interface Container {
      * 
      * @return unmodifiable collection of Property IDs
      */
-    public Collection getContainerPropertyIds();
+    public Collection<?> getContainerPropertyIds();
 
     /**
      * Gets the ID's of all Items stored in the Container. The ID's are returned
@@ -78,7 +79,7 @@ public interface Container {
      * 
      * @return unmodifiable collection of Item IDs
      */
-    public Collection getItemIds();
+    public Collection<?> getItemIds();
 
     /**
      * Gets the Property identified by the given itemId and propertyId from the
@@ -100,7 +101,7 @@ public interface Container {
      *            ID identifying the Properties
      * @return data type of the Properties
      */
-    public Class getType(Object propertyId);
+    public Class<?> getType(Object propertyId);
 
     /**
      * Gets the number of Items in the Container.
@@ -181,7 +182,7 @@ public interface Container {
      * @return <code>true</code> if the operation succeeded, <code>false</code>
      *         if not
      */
-    public boolean addContainerProperty(Object propertyId, Class type,
+    public boolean addContainerProperty(Object propertyId, Class<?> type,
             Object defaultValue) throws UnsupportedOperationException;
 
     /**
@@ -334,7 +335,7 @@ public interface Container {
          * 
          * @return The sortable field ids.
          */
-        Collection getSortableContainerPropertyIds();
+        Collection<?> getSortableContainerPropertyIds();
 
     }
 
@@ -418,7 +419,7 @@ public interface Container {
          *         containing the IDs of all other Items that are children in
          *         the container hierarchy
          */
-        public Collection getChildren(Object itemId);
+        public Collection<?> getChildren(Object itemId);
 
         /**
          * Gets the ID of the parent Item of the specified Item.
@@ -438,7 +439,7 @@ public interface Container {
          * @return An unmodifiable {@link java.util.Collection collection}
          *         containing IDs of all root elements of the container
          */
-        public Collection rootItemIds();
+        public Collection<?> rootItemIds();
 
         /**
          * <p>
@@ -568,7 +569,7 @@ public interface Container {
      * 
      * @since 5.0
      */
-    public interface Filterable extends Container {
+    public interface Filterable extends Container, Serializable {
 
         /**
          * Add a filter for given property.
@@ -600,7 +601,7 @@ public interface Container {
      * Interface implemented by viewer classes capable of using a Container as a
      * data source.
      */
-    public interface Viewer {
+    public interface Viewer extends Serializable {
 
         /**
          * Sets the Container that serves as the data source of the viewer.
@@ -631,7 +632,7 @@ public interface Container {
      * internally.
      * </p>
      */
-    public interface Editor extends Container.Viewer {
+    public interface Editor extends Container.Viewer, Serializable {
 
     }
 
@@ -641,7 +642,7 @@ public interface Container {
      * An <code>Event</code> object specifying the Container whose Item set has
      * changed.
      */
-    public interface ItemSetChangeEvent {
+    public interface ItemSetChangeEvent extends Serializable {
 
         /**
          * Gets the Property where the event occurred.
@@ -652,7 +653,7 @@ public interface Container {
     }
 
     /** Container Item set change listener interface. */
-    public interface ItemSetChangeListener {
+    public interface ItemSetChangeListener extends Serializable {
 
         /**
          * Lets the listener know a Containers Item set has changed.
@@ -677,7 +678,7 @@ public interface Container {
      * be able to implement an interface.
      * </p>
      */
-    public interface ItemSetChangeNotifier {
+    public interface ItemSetChangeNotifier extends Serializable {
 
         /**
          * Adds an Item set change listener for the object.
@@ -702,7 +703,7 @@ public interface Container {
      * An <code>Event</code> object specifying the Container whose Property set
      * has changed.
      */
-    public interface PropertySetChangeEvent {
+    public interface PropertySetChangeEvent extends Serializable {
 
         /**
          * Retrieves the Container whose contents have been modified.
@@ -716,7 +717,7 @@ public interface Container {
      * The listener interface for receiving <code>PropertySetChangeEvent</code>
      * objects.
      */
-    public interface PropertySetChangeListener {
+    public interface PropertySetChangeListener extends Serializable {
 
         /**
          * Notifies this listener that the Containers contents has changed.
@@ -744,7 +745,7 @@ public interface Container {
      * be able to implement an interface.
      * </p>
      */
-    public interface PropertySetChangeNotifier {
+    public interface PropertySetChangeNotifier extends Serializable {
 
         /**
          * Registers a new Property set change listener for this Container.
index a8ffc3d7c2b1f8acb9996a688acc3207f9b7d693..1259d9cbda71e8d990562fa12a170f15e538a7a8 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
 import java.util.Collection;
 
 /**
@@ -18,7 +19,7 @@ import java.util.Collection;
  * @VERSION@
  * @since 3.0
  */
-public interface Item {
+public interface Item extends Serializable {
 
     /**
      * Gets the Property corresponding to the given Property ID stored in the
@@ -37,7 +38,7 @@ public interface Item {
      * @return unmodifiable collection containing IDs of the Properties stored
      *         the Item
      */
-    public Collection getItemPropertyIds();
+    public Collection<?> getItemPropertyIds();
 
     /**
      * Tries to add a new Property into the Item.
@@ -78,7 +79,7 @@ public interface Item {
      * Interface implemented by viewer classes capable of using an Item as a
      * data source.
      */
-    public interface Viewer {
+    public interface Viewer extends Serializable {
 
         /**
          * Sets the Item that serves as the data source of the viewer.
@@ -105,7 +106,7 @@ public interface Item {
      * restrict the class from editing the contents of an internally.
      * </p>
      */
-    public interface Editor extends Item.Viewer {
+    public interface Editor extends Item.Viewer, Serializable {
 
     }
 
@@ -119,7 +120,7 @@ public interface Item {
      * this event.
      * </p>
      */
-    public interface PropertySetChangeEvent {
+    public interface PropertySetChangeEvent extends Serializable {
 
         /**
          * Retrieves the Item whose contents has been modified.
@@ -133,7 +134,7 @@ public interface Item {
      * The listener interface for receiving <code>PropertySetChangeEvent</code>
      * objects.
      */
-    public interface PropertySetChangeListener {
+    public interface PropertySetChangeListener extends Serializable {
 
         /**
          * Notifies this listener that the Item's property set has changed.
@@ -158,7 +159,7 @@ public interface Item {
      * be able to implement an interface.
      * </p>
      */
-    public interface PropertySetChangeNotifier {
+    public interface PropertySetChangeNotifier extends Serializable {
 
         /**
          * Registers a new property set change listener for this Item.
index 42e438025c8487001a23a98764d0fccda473f963..b3277fdde200478e175764ae6092c38dd6aabeb3 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * The <code>Property</code> is a simple data object that contains one typed
@@ -33,7 +35,7 @@ package com.itmill.toolkit.data;
  * @VERSION@
  * @since 3.0
  */
-public interface Property {
+public interface Property extends Serializable {
 
     /**
      * Gets the value stored in the Property. The returned object is compatible
@@ -91,7 +93,7 @@ public interface Property {
      * 
      * @return type of the Property
      */
-    public Class getType();
+    public Class<?> getType();
 
     /**
      * Tests if the Property is in read-only mode. In read-only mode calls to
@@ -124,13 +126,9 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
+    @SuppressWarnings("serial")
     public class ReadOnlyException extends RuntimeException {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257571702287119410L;
-
         /**
          * Constructs a new <code>ReadOnlyException</code> without a detail
          * message.
@@ -160,13 +158,9 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
+    @SuppressWarnings("serial")
     public class ConversionException extends RuntimeException {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257571706666366008L;
-
         /**
          * Constructs a new <code>ConversionException</code> without a detail
          * message.
@@ -206,7 +200,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface Viewer {
+    public interface Viewer extends Serializable {
 
         /**
          * Sets the Property that serves as the data source of the viewer.
@@ -240,7 +234,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface Editor extends Property.Viewer {
+    public interface Editor extends Property.Viewer, Serializable {
 
     }
 
@@ -255,7 +249,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface ValueChangeEvent {
+    public interface ValueChangeEvent extends Serializable {
 
         /**
          * Retrieves the Property that has been modified.
@@ -274,7 +268,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface ValueChangeListener {
+    public interface ValueChangeListener extends Serializable {
 
         /**
          * Notifies this listener that the Property's value has changed.
@@ -304,7 +298,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface ValueChangeNotifier {
+    public interface ValueChangeNotifier extends Serializable {
 
         /**
          * Registers a new value change listener for this Property.
@@ -334,7 +328,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface ReadOnlyStatusChangeEvent {
+    public interface ReadOnlyStatusChangeEvent extends Serializable {
 
         /**
          * Property whose read-only state has changed.
@@ -353,7 +347,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface ReadOnlyStatusChangeListener {
+    public interface ReadOnlyStatusChangeListener extends Serializable {
 
         /**
          * Notifies this listener that a Property's read-only status has
@@ -385,7 +379,7 @@ public interface Property {
      * @VERSION@
      * @since 3.0
      */
-    public interface ReadOnlyStatusChangeNotifier {
+    public interface ReadOnlyStatusChangeNotifier extends Serializable {
 
         /**
          * Registers a new read-only status change listener for this Property.
index c8f5afb9186f2f9866288ef5977740898f09861b..e5c074726bb1bb03cbf7022b9fe49ea8304129f8 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
 import java.util.Collection;
 
 /**
@@ -19,7 +20,7 @@ import java.util.Collection;
  * @since 3.0
  * @see com.itmill.toolkit.data.Validator
  */
-public interface Validatable {
+public interface Validatable extends Serializable {
 
     /**
      * <p>
@@ -54,7 +55,7 @@ public interface Validatable {
      * 
      * @return collection of validators or <code>null</code>
      */
-    public Collection getValidators();
+    public Collection<?> getValidators();
 
     /**
      * <p>
index d0094914eda6060e6745dde19c2224bac6a0bba6..15fea5de344a294bb138103b7cb30a3165ca6f34 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.data;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.terminal.ErrorMessage;
 import com.itmill.toolkit.terminal.PaintException;
 import com.itmill.toolkit.terminal.PaintTarget;
@@ -25,7 +27,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
-public interface Validator {
+public interface Validator extends Serializable {
 
     /**
      * Checks the given value against this validator. If the value is valid this
index 65bc57a1b3e00c0724fe2f642c88e82f055017c3..0df0ea39e8e11c0ad265678dd3ea0769f759778b 100644 (file)
@@ -22,6 +22,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class BeanItem extends PropertysetItem {
 
     /**
@@ -97,7 +98,7 @@ public class BeanItem extends PropertysetItem {
      * @param propertyIds
      *            id of the property.
      */
-    public BeanItem(Object bean, Collection propertyIds) {
+    public BeanItem(Object bean, Collection<?> propertyIds) {
 
         this.bean = bean;
 
index 5ba44568ada9121fadb523d677156cb91766937b..b2eb55d2cc81b087e10eb320ec0e5ce1de93bae5 100644 (file)
@@ -1,6 +1,7 @@
 package com.itmill.toolkit.data.util;
 
 import java.beans.PropertyDescriptor;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -36,6 +37,7 @@ import com.itmill.toolkit.data.Property.ValueChangeNotifier;
  * 
  * @since 5.4
  */
+@SuppressWarnings("serial")
 public class BeanItemContainer<BT> implements Indexed, Sortable, Filterable,
         ItemSetChangeNotifier, ValueChangeListener {
     // filtered and unfiltered item IDs
@@ -45,12 +47,19 @@ public class BeanItemContainer<BT> implements Indexed, Sortable, Filterable,
 
     // internal data model to obtain property IDs etc.
     private final Class<BT> type;
-    private final LinkedHashMap<String, PropertyDescriptor> model;
+    private transient LinkedHashMap<String, PropertyDescriptor> model;
 
     private List<ItemSetChangeListener> itemSetChangeListeners;
 
     private Set<Filter> filters = new HashSet<Filter>();
 
+    /* Special serialization to handle method references */
+    private void readObject(java.io.ObjectInputStream in) throws IOException,
+            ClassNotFoundException {
+        in.defaultReadObject();
+        model = BeanItem.getPropertyDescriptors(type);
+    }
+
     public BeanItemContainer(Class<BT> type) throws InstantiationException,
             IllegalAccessException {
         this.type = type;
@@ -65,7 +74,6 @@ public class BeanItemContainer<BT> implements Indexed, Sortable, Filterable,
      * @throws IllegalAccessException
      * @throws InstantiationException
      */
-    @SuppressWarnings("unchecked")
     public BeanItemContainer(Collection<BT> list)
             throws InstantiationException, IllegalAccessException {
         type = (Class<BT>) list.iterator().next().getClass();
@@ -106,7 +114,6 @@ public class BeanItemContainer<BT> implements Indexed, Sortable, Filterable,
      *            Id of the new item to be added.
      * @return Returns new item or null if the operation fails.
      */
-    @SuppressWarnings("unchecked")
     private Item addItemAtInternalIndex(int index, Object newItemId) {
         // Make sure that the Item has not been created yet
         if (allItems.contains(newItemId)) {
@@ -364,7 +371,6 @@ public class BeanItemContainer<BT> implements Indexed, Sortable, Filterable,
         }
     }
 
-    @SuppressWarnings("unchecked")
     public void addContainerFilter(Object propertyId, String filterString,
             boolean ignoreCase, boolean onlyMatchPrefix) {
         if (filters.isEmpty()) {
@@ -386,7 +392,6 @@ public class BeanItemContainer<BT> implements Indexed, Sortable, Filterable,
      * items, and send a notification if the set of visible items changed in any
      * way.
      */
-    @SuppressWarnings("unchecked")
     protected void filterAll() {
         // avoid notification if the filtering had no effect
         List<BT> originalItems = list;
index 91dd00fc463d9283bd07707b0e86a31b86d134bf..2c88c2ab61c1d2a7e6bbe18b55a08e3c41223353 100644 (file)
@@ -34,6 +34,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class ContainerHierarchicalWrapper implements Container.Hierarchical,
         Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier {
 
index c9e5736b9a2fff0a32cf788e0a59b80ec948cfbb..a57fbb17190494be7b4e161d68ad33e6a086aeeb 100644 (file)
@@ -31,6 +31,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class ContainerOrderedWrapper implements Container.Ordered,
         Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier {
 
index f1d5273003f63766b9f5ddeed070641d7731239e..03451ad411af4fe4fae1f78b0e9ad56ab678337d 100644 (file)
@@ -7,6 +7,7 @@ package com.itmill.toolkit.data.util;
 import java.io.File;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -35,6 +36,7 @@ import com.itmill.toolkit.terminal.Resource;
  * @author mattitahvonen
  * 
  */
+@SuppressWarnings("serial")
 public class FilesystemContainer implements Container.Hierarchical {
 
     /**
@@ -62,13 +64,13 @@ public class FilesystemContainer implements Container.Hierarchical {
      */
     public static Collection FILE_PROPERTIES;
 
-    private static Method FILEITEM_LASTMODIFIED;
+    private final static Method FILEITEM_LASTMODIFIED;
 
-    private static Method FILEITEM_NAME;
+    private final static Method FILEITEM_NAME;
 
-    private static Method FILEITEM_ICON;
+    private final static Method FILEITEM_ICON;
 
-    private static Method FILEITEM_SIZE;
+    private final static Method FILEITEM_SIZE;
 
     static {
 
@@ -741,7 +743,7 @@ public class FilesystemContainer implements Container.Hierarchical {
      * @VERSION@
      * @since 3.0
      */
-    public class FileExtensionFilter implements FilenameFilter {
+    public class FileExtensionFilter implements FilenameFilter, Serializable {
 
         private final String filter;
 
index cbb1efae0da8789b8d1d6af8326fab97e73e41f5..cd31a57b9df801425dc5559a9052691f4efe549e 100644 (file)
@@ -1,5 +1,7 @@
 package com.itmill.toolkit.data.util;\r
 \r
+import java.io.Serializable;\r
+\r
 import com.itmill.toolkit.data.Item;\r
 import com.itmill.toolkit.data.Property;\r
 \r
@@ -9,7 +11,8 @@ import com.itmill.toolkit.data.Property;
  * \r
  * @since 5.4\r
  */\r
-public class Filter {\r
+@SuppressWarnings("serial")\r
+public class Filter implements Serializable {\r
     final Object propertyId;\r
     final String filterString;\r
     final boolean ignoreCase;\r
index ce46da362a5fd14810e1237385b557aa761ffbfe..75ade41e26f411db211c88e3866173466e4b5edf 100644 (file)
@@ -22,6 +22,7 @@ import com.itmill.toolkit.data.Item;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class HierarchicalContainer extends IndexedContainer implements
         Container.Hierarchical {
 
index 0dbe44fc46d93f1572e7a0cf299af9cd63378f6a..e649cace8edd4c9f1c0628b67ce2eda86c80323a 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.data.util;
 
+import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -45,6 +46,7 @@ import com.itmill.toolkit.data.Property;
  * @since 3.0
  */
 
+@SuppressWarnings("serial")
 public class IndexedContainer implements Container.Indexed,
         Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier,
         Property.ValueChangeNotifier, Container.Sortable, Comparator,
@@ -726,12 +728,7 @@ public class IndexedContainer implements Container.Indexed,
      * @since 3.0
      */
     private class PropertySetChangeEvent extends EventObject implements
-            Container.PropertySetChangeEvent {
-
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257002172528079926L;
+            Container.PropertySetChangeEvent, Serializable {
 
         private PropertySetChangeEvent(IndexedContainer source) {
             super(source);
@@ -759,12 +756,8 @@ public class IndexedContainer implements Container.Indexed,
      * @since 3.0
      */
     public class ItemSetChangeEvent extends EventObject implements
-            Container.ItemSetChangeEvent {
+            Container.ItemSetChangeEvent, Serializable {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3832616279386372147L;
         private final int addedItemIndex;
 
         private ItemSetChangeEvent(IndexedContainer source, int addedItemIndex) {
@@ -804,12 +797,7 @@ public class IndexedContainer implements Container.Indexed,
      * @since 3.0
      */
     private class PropertyValueChangeEvent extends EventObject implements
-            Property.ValueChangeEvent {
-
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3833749884498359857L;
+            Property.ValueChangeEvent, Serializable {
 
         private PropertyValueChangeEvent(Property source) {
             super(source);
index 165d54c90230a7925465722564f03585765c724c..9d74175b2cfdd9c0da26881e19d74f05f0ee5733 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.data.util;
 
+import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -43,18 +44,19 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class MethodProperty implements Property, Property.ValueChangeNotifier,
         Property.ReadOnlyStatusChangeNotifier {
 
     /**
      * The object that includes the property the MethodProperty is bound to.
      */
-    private final Object instance;
+    private transient Object instance;
 
     /**
      * Argument arrays for the getter and setter methods.
      */
-    private Object[] setArgs, getArgs;
+    private transient Object[] setArgs, getArgs;
 
     /**
      * Is the MethodProperty read-only?
@@ -64,7 +66,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
     /**
      * The getter and setter methods.
      */
-    private Method setMethod, getMethod;
+    private transient Method setMethod, getMethod;
 
     /**
      * Index of the new value in the argument list for the setter method. If the
@@ -90,6 +92,41 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      */
     private LinkedList valueChangeListeners = null;
 
+    /* Special serialization to handle method references */
+    private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+        out.defaultWriteObject();
+        out.writeObject(instance);
+        out.writeObject(setArgs);
+        out.writeObject(getArgs);
+        out.writeObject(setMethod.getName());
+        out.writeObject(setMethod.getParameterTypes());
+        out.writeObject(getMethod.getName());
+        out.writeObject(getMethod.getParameterTypes());
+    };
+
+    /* Special serialization to handle method references */
+    private void readObject(java.io.ObjectInputStream in) throws IOException,
+            ClassNotFoundException {
+        in.defaultReadObject();
+        try {
+            instance = in.readObject();
+            setArgs = (Object[]) in.readObject();
+            getArgs = (Object[]) in.readObject();
+            String name = (String) in.readObject();
+            Class<?>[] paramTypes = (Class<?>[]) in.readObject();
+            setMethod = instance.getClass().getMethod(name, paramTypes);
+            name = (String) in.readObject();
+            paramTypes = (Class<?>[]) in.readObject();
+            getMethod = instance.getClass().getMethod(name, paramTypes);
+        } catch (SecurityException e) {
+            System.err.println("Internal deserialization error");
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            System.err.println("Internal deserialization error");
+            e.printStackTrace();
+        }
+    };
+
     /**
      * <p>
      * Creates a new instance of <code>MethodProperty</code> from a named bean
@@ -701,11 +738,6 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      */
     public class MethodException extends RuntimeException {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3690473623827855153L;
-
         /**
          * Cause of the method exception
          */
@@ -762,11 +794,6 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
     private class ReadOnlyStatusChangeEvent extends java.util.EventObject
             implements Property.ReadOnlyStatusChangeEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3258129163305955896L;
-
         /**
          * Constructs a new read-only status change event for this object.
          * 
index 1821a815ed405d45d9b7349e80bb757378250067..dd31c89606e6336ae3a86ae907928810e2a9dc27 100644 (file)
@@ -19,6 +19,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class ObjectProperty implements Property, Property.ValueChangeNotifier,
         Property.ReadOnlyStatusChangeNotifier {
 
@@ -215,11 +216,6 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
     private class ValueChangeEvent extends java.util.EventObject implements
             Property.ValueChangeEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3256718468479725873L;
-
         /**
          * Constructs a new value change event for this object.
          * 
@@ -252,11 +248,6 @@ public class ObjectProperty implements Property, Property.ValueChangeNotifier,
     private class ReadOnlyStatusChangeEvent extends java.util.EventObject
             implements Property.ReadOnlyStatusChangeEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3907208273529616696L;
-
         /**
          * Constructs a new read-only status change event for this object.
          * 
index c6454a7f470d80ff2c266b76a9b37d394388deeb..0b407bdd5200eeda5e98ed005a12b74f67d46b47 100644 (file)
@@ -31,6 +31,7 @@ import com.itmill.toolkit.data.Property;
  * @author IT Mill Ltd.
  * @since 5.3.0
  */
+@SuppressWarnings("serial")
 public abstract class PropertyFormatter implements Property,
         Property.ValueChangeNotifier, Property.ValueChangeListener,
         Property.ReadOnlyStatusChangeListener,
@@ -228,11 +229,6 @@ public abstract class PropertyFormatter implements Property,
     private class ValueChangeEvent extends java.util.EventObject implements
             Property.ValueChangeEvent {
 
-        /**
- * 
- */
-        private static final long serialVersionUID = -489631310964258710L;
-
         /**
          * Constructs a new value change event for this object.
          * 
@@ -263,11 +259,6 @@ public abstract class PropertyFormatter implements Property,
     private class ReadOnlyStatusChangeEvent extends java.util.EventObject
             implements Property.ReadOnlyStatusChangeEvent {
 
-        /**
- * 
- */
-        private static final long serialVersionUID = 8329395774911454548L;
-
         /**
          * Constructs a new read-only status change event for this object.
          * 
index c6c01743e29b248f86e88f352011369851b818ac..d2d2946d4e02539f227eca700aec3ef4f655c219 100644 (file)
@@ -25,6 +25,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
         Cloneable {
 
@@ -165,11 +166,6 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
     private class PropertySetChangeEvent extends EventObject implements
             Item.PropertySetChangeEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257562910590055991L;
-
         private PropertySetChangeEvent(Item source) {
             super(source);
         }
index 2c76e587025f59c7c06a31e3a694889bc4a058a7..2139318e0c8bf1aec283a33c7d19e89469fb6960 100644 (file)
@@ -46,6 +46,7 @@ import com.itmill.toolkit.data.Property;
  * @since 4.0
  */
 
+@SuppressWarnings("serial")
 public class QueryContainer implements Container, Container.Ordered,
         Container.Indexed {
 
index 7f26a878616ce598fe9b0d317f0cce80e2094f78..cecc63a637ade123fb1480d193051b170bece495 100644 (file)
@@ -15,6 +15,7 @@ package com.itmill.toolkit.data.validator;
  * @VERSION@\r
  * @since 5.4\r
  */\r
+@SuppressWarnings("serial")\r
 public abstract class AbstractStringValidator extends AbstractValidator {\r
 \r
     /**\r
index 93d6ae41faae41126aedf6e9ca9025c8483c9939..c12ea0d84864efc608464355e0eba82504188911 100644 (file)
@@ -15,6 +15,7 @@ import com.itmill.toolkit.data.Validator;
  * @VERSION@\r
  * @since 5.4\r
  */\r
+@SuppressWarnings("serial")\r
 public abstract class AbstractValidator implements Validator {\r
 \r
     /**\r
index 6aa9d07b992f0e423122d1b497eaac9466a609b2..13266d4ca8e2d23d1a079928572023281a5a7735 100644 (file)
@@ -23,6 +23,7 @@ import com.itmill.toolkit.data.Validator;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class CompositeValidator extends AbstractValidator {
 
     /**
index 56f537f5e426846ad3e43402ac1a0e20c8e49897..9ee4fec65ec7295cb024d6b406fc6bac70406a44 100644 (file)
@@ -10,6 +10,7 @@ package com.itmill.toolkit.data.validator;
  * @VERSION@\r
  * @since 5.4\r
  */\r
+@SuppressWarnings("serial")\r
 public class DoubleValidator extends AbstractStringValidator {\r
 \r
     /**\r
index b5abb4d71246fe0fcadf7d3e9e34cb4bc60ad589..f833d5ca7705dec7a21df022a4dc15b979645d62 100644 (file)
@@ -13,6 +13,7 @@ package com.itmill.toolkit.data.validator;
  * @VERSION@\r
  * @since 5.4\r
  */\r
+@SuppressWarnings("serial")\r
 public class EmailValidator extends RegexpValidator {\r
 \r
     /**\r
index f48e85943eaf0fcb2f01476de0bc460d4ab78cfb..48afacf8c8f8e34c3e79198bdd86278a7e014dcb 100644 (file)
@@ -10,6 +10,7 @@ package com.itmill.toolkit.data.validator;
  * @VERSION@\r
  * @since 5.4\r
  */\r
+@SuppressWarnings("serial")\r
 public class IntegerValidator extends AbstractStringValidator {\r
 \r
     /**\r
index e2038d9017fd4ba7737233fdab6935a49b50e190..be2b041bb2bfb7fdd9cffa61796fb7bf0dcba39a 100644 (file)
@@ -15,6 +15,7 @@ import com.itmill.toolkit.data.Validator;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class NullValidator implements Validator {
 
     private boolean onlyNullAllowed;
index 56316bea848263ef4c4156f985400e91b7431cd7..eb42a2668ab6c335bb73a768123e2a7286f1c4b0 100644 (file)
@@ -21,6 +21,7 @@ import java.util.regex.Pattern;
  * @VERSION@\r
  * @since 5.4\r
  */\r
+@SuppressWarnings("serial")\r
 public class RegexpValidator extends AbstractStringValidator {\r
 \r
     private Pattern pattern;\r
index e4c28041a73576a02fa80ef14911dcd4bf57aba6..6105b0e7465ff1cdeebd0f607660f8b07d62ac27 100644 (file)
@@ -13,6 +13,7 @@ package com.itmill.toolkit.data.validator;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class StringLengthValidator extends AbstractValidator {
 
     private int minLength = -1;
index d77ce235f2e0ff084d7f8030dfc5ba0c000c205d..817d7ce647bd36cc4f447d0d91ec09b5a2619609 100644 (file)
@@ -6,17 +6,17 @@ import com.itmill.toolkit.ui.Window;
 public class HelloWorld extends com.itmill.toolkit.Application {
 
     /**
-        * Init is invoked on application load (when a user accesses the application
-        * for the first time).
+     * Init is invoked on application load (when a user accesses the application
+     * for the first time).
      */
     @Override
     public void init() {
 
-               // Main window is the primary browser window
+        // Main window is the primary browser window
         final Window main = new Window("Hello window");
         setMainWindow(main);
 
-               // "Hello world" text is added to window as a Label component
+        // "Hello world" text is added to window as a Label component
         main.addComponent(new Label("Hello World!"));
     }
 }
index fc0036d448aa8ea9f66106de10a2b0d9b1606257..6d81263b3947b79eb323f05fbd046e819fbc8546 100644 (file)
@@ -23,6 +23,7 @@ import com.itmill.toolkit.ui.Window.Notification;
  * @author IT Mill Ltd.
  * 
  */
+@SuppressWarnings("serial")
 public class ToolkitTunesLayout extends Application {
 
     @Override
index 5432e96fc1725d4cd66922b244b4252d4e76b2f0..51cb8afe6c0899d36a061ab2bfbecd8920e40b3d 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.demo.sampler;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.HashSet;
 import java.util.Map;
@@ -149,7 +150,7 @@ public class ActiveLink extends Link {
     /**
      * ActiveLink click listener
      */
-    public interface LinkActivatedListener {
+    public interface LinkActivatedListener extends Serializable {
 
         /**
          * ActiveLink has been activated.
index a63902aad44f1007d5c0c0025a6573245b22fb4c..10cc7e747d80d79a0d5da206c058deed13c3b30c 100644 (file)
@@ -3,6 +3,7 @@ package com.itmill.toolkit.demo.sampler;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.Serializable;
 
 import com.itmill.toolkit.ui.Component;
 
@@ -13,7 +14,7 @@ import com.itmill.toolkit.ui.Component;
  * </p>
  * 
  */
-abstract public class Feature {
+abstract public class Feature implements Serializable {
 
     public static final Object PROPERTY_ICON = "Icon";
     public static final Object PROPERTY_NAME = "Name";
@@ -54,8 +55,8 @@ abstract public class Feature {
      * May return null, if the example has no related resources.
      * </p>
      * <p>
-     * The name of the NamedExternalResource will be shown in the UI. <br/> Note
-     * that Javadoc should be referenced via {@link #getRelatedAPI()}.
+     * The name of the NamedExternalResource will be shown in the UI. <br/>
+     * Note that Javadoc should be referenced via {@link #getRelatedAPI()}.
      * </p>
      * 
      * @see #getThemeBase()
index 6b24a8bf4fc843314ad7f2e0c1b3a24e79dd4f69..926cfc531070c1672f3e4f28067952fb4c280adf 100644 (file)
@@ -21,7 +21,6 @@ import com.itmill.toolkit.terminal.ExternalResource;
 import com.itmill.toolkit.terminal.Resource;
 import com.itmill.toolkit.terminal.ThemeResource;
 import com.itmill.toolkit.terminal.URIHandler;
-import com.itmill.toolkit.terminal.gwt.server.WebApplicationContext;
 import com.itmill.toolkit.ui.Alignment;
 import com.itmill.toolkit.ui.Button;
 import com.itmill.toolkit.ui.ComboBox;
@@ -45,6 +44,7 @@ import com.itmill.toolkit.ui.PopupView.PopupVisibilityEvent;
 import com.itmill.toolkit.ui.UriFragmentUtility.FragmentChangedEvent;
 import com.itmill.toolkit.ui.UriFragmentUtility.FragmentChangedListener;
 
+@SuppressWarnings("serial")
 public class SamplerApplication extends Application {
 
     // All features in one container
index 02f670f4f4a229ce2cded859035dcd5c6ed81097..80ed8482059aa64a062a4797a500840cf18cd42a 100644 (file)
 package com.itmill.toolkit.demo.tutorial.addressbook.data;
 
-public class Person {
-       private String firstName = "";
-       private String lastName = "";
-       private String email = "";
-       private String phoneNumber = "";
-       private String streetAddress = "";
-       private Integer postalCode = null;
-       private String city = "";
-
-       /**
-        * @return the firstName
-        */
-       public String getFirstName() {
-               return firstName;
-       }
-
-       /**
-        * @param firstName
-        *            the firstName to set
-        */
-       public void setFirstName(String firstName) {
-               this.firstName = firstName;
-       }
-
-       /**
-        * @return the lastName
-        */
-       public String getLastName() {
-               return lastName;
-       }
-
-       /**
-        * @param lastName
-        *            the lastName to set
-        */
-       public void setLastName(String lastName) {
-               this.lastName = lastName;
-       }
-
-       /**
-        * @return the email
-        */
-       public String getEmail() {
-               return email;
-       }
-
-       /**
-        * @param email
-        *            the email to set
-        */
-       public void setEmail(String email) {
-               this.email = email;
-       }
-
-       /**
-        * @return the phoneNumber
-        */
-       public String getPhoneNumber() {
-               return phoneNumber;
-       }
-
-       /**
-        * @param phoneNumber
-        *            the phoneNumber to set
-        */
-       public void setPhoneNumber(String phoneNumber) {
-               this.phoneNumber = phoneNumber;
-       }
-
-       /**
-        * @return the streetAddress
-        */
-       public String getStreetAddress() {
-               return streetAddress;
-       }
-
-       /**
-        * @param streetAddress
-        *            the streetAddress to set
-        */
-       public void setStreetAddress(String streetAddress) {
-               this.streetAddress = streetAddress;
-       }
-
-       /**
-        * @return the postalCode
-        */
-       public Integer getPostalCode() {
-               return postalCode;
-       }
-
-       /**
-        * @param postalCode
-        *            the postalCode to set
-        */
-       public void setPostalCode(Integer postalCode) {
-               this.postalCode = postalCode;
-       }
-
-       /**
-        * @return the city
-        */
-       public String getCity() {
-               return city;
-       }
-
-       /**
-        * @param city
-        *            the city to set
-        */
-       public void setCity(String city) {
-               this.city = city;
-       }
+import java.io.Serializable;
+
+public class Person implements Serializable {
+    private String firstName = "";
+    private String lastName = "";
+    private String email = "";
+    private String phoneNumber = "";
+    private String streetAddress = "";
+    private Integer postalCode = null;
+    private String city = "";
+
+    /**
+     * @return the firstName
+     */
+    public String getFirstName() {
+        return firstName;
+    }
+
+    /**
+     * @param firstName
+     *            the firstName to set
+     */
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    /**
+     * @return the lastName
+     */
+    public String getLastName() {
+        return lastName;
+    }
+
+    /**
+     * @param lastName
+     *            the lastName to set
+     */
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    /**
+     * @return the email
+     */
+    public String getEmail() {
+        return email;
+    }
+
+    /**
+     * @param email
+     *            the email to set
+     */
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    /**
+     * @return the phoneNumber
+     */
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    /**
+     * @param phoneNumber
+     *            the phoneNumber to set
+     */
+    public void setPhoneNumber(String phoneNumber) {
+        this.phoneNumber = phoneNumber;
+    }
+
+    /**
+     * @return the streetAddress
+     */
+    public String getStreetAddress() {
+        return streetAddress;
+    }
+
+    /**
+     * @param streetAddress
+     *            the streetAddress to set
+     */
+    public void setStreetAddress(String streetAddress) {
+        this.streetAddress = streetAddress;
+    }
+
+    /**
+     * @return the postalCode
+     */
+    public Integer getPostalCode() {
+        return postalCode;
+    }
+
+    /**
+     * @param postalCode
+     *            the postalCode to set
+     */
+    public void setPostalCode(Integer postalCode) {
+        this.postalCode = postalCode;
+    }
+
+    /**
+     * @return the city
+     */
+    public String getCity() {
+        return city;
+    }
+
+    /**
+     * @param city
+     *            the city to set
+     */
+    public void setCity(String city) {
+        this.city = city;
+    }
 
 }
\ No newline at end of file
index b627f7e0390c2dfdc9500f6074f5b6ddca24d523..3c84ac47641b2b6c886863fa42b36fefbe6845da 100644 (file)
@@ -1,91 +1,93 @@
 package com.itmill.toolkit.demo.tutorial.addressbook.data;
 
+import java.io.Serializable;
 import java.util.Random;
 
 import com.itmill.toolkit.data.util.BeanItemContainer;
 
-public class PersonContainer extends BeanItemContainer<Person> {
+public class PersonContainer extends BeanItemContainer<Person> implements
+        Serializable {
 
-       /**
-        * Natural property order for Person bean. Used in tables and forms.
-        */
-       public static final Object[] NATURAL_COL_ORDER = new Object[] {
-                       "firstName", "lastName", "email", "phoneNumber", "streetAddress",
-                       "postalCode", "city" };
+    /**
+     * Natural property order for Person bean. Used in tables and forms.
+     */
+    public static final Object[] NATURAL_COL_ORDER = new Object[] {
+            "firstName", "lastName", "email", "phoneNumber", "streetAddress",
+            "postalCode", "city" };
 
-       /**
-        * "Human readable" captions for properties in same order as in
-        * NATURAL_COL_ORDER.
-        */
-       public static final String[] COL_HEADERS_ENGLISH = new String[] {
-                       "First name", "Last name", "Email", "Phone number",
-                       "Street Address", "Postal Code", "City" };
+    /**
+     * "Human readable" captions for properties in same order as in
+     * NATURAL_COL_ORDER.
+     */
+    public static final String[] COL_HEADERS_ENGLISH = new String[] {
+            "First name", "Last name", "Email", "Phone number",
+            "Street Address", "Postal Code", "City" };
 
-       public PersonContainer() throws InstantiationException,
-                       IllegalAccessException {
-               super(Person.class);
-       }
+    public PersonContainer() throws InstantiationException,
+            IllegalAccessException {
+        super(Person.class);
+    }
 
-       public static PersonContainer createWithTestData() {
-               final String[] fnames = { "Peter", "Alice", "Joshua", "Mike", "Olivia",
-                               "Nina", "Alex", "Rita", "Dan", "Umberto", "Henrik", "Rene",
-                               "Lisa", "Marge" };
-               final String[] lnames = { "Smith", "Gordon", "Simpson", "Brown",
-                               "Clavel", "Simons", "Verne", "Scott", "Allison", "Gates",
-                               "Rowling", "Barks", "Ross", "Schneider", "Tate" };
-               final String cities[] = { "Amsterdam", "Berlin", "Helsinki",
-                               "Hong Kong", "London", "Luxemburg", "New York", "Oslo",
-                               "Paris", "Rome", "Stockholm", "Tokyo", "Turku" };
-               final String streets[] = { "4215 Blandit Av.", "452-8121 Sem Ave",
-                               "279-4475 Tellus Road", "4062 Libero. Av.", "7081 Pede. Ave",
-                               "6800 Aliquet St.", "P.O. Box 298, 9401 Mauris St.",
-                               "161-7279 Augue Ave", "P.O. Box 496, 1390 Sagittis. Rd.",
-                               "448-8295 Mi Avenue", "6419 Non Av.",
-                               "659-2538 Elementum Street", "2205 Quis St.",
-                               "252-5213 Tincidunt St.", "P.O. Box 175, 4049 Adipiscing Rd.",
-                               "3217 Nam Ave", "P.O. Box 859, 7661 Auctor St.",
-                               "2873 Nonummy Av.", "7342 Mi, Avenue",
-                               "539-3914 Dignissim. Rd.", "539-3675 Magna Avenue",
-                               "Ap #357-5640 Pharetra Avenue", "416-2983 Posuere Rd.",
-                               "141-1287 Adipiscing Avenue", "Ap #781-3145 Gravida St.",
-                               "6897 Suscipit Rd.", "8336 Purus Avenue", "2603 Bibendum. Av.",
-                               "2870 Vestibulum St.", "Ap #722 Aenean Avenue",
-                               "446-968 Augue Ave", "1141 Ultricies Street",
-                               "Ap #992-5769 Nunc Street", "6690 Porttitor Avenue",
-                               "Ap #105-1700 Risus Street",
-                               "P.O. Box 532, 3225 Lacus. Avenue", "736 Metus Street",
-                               "414-1417 Fringilla Street", "Ap #183-928 Scelerisque Road",
-                               "561-9262 Iaculis Avenue" };
-               PersonContainer c = null;
-               Random r = new Random(0);
-               try {
-                       c = new PersonContainer();
-                       for (int i = 0; i < 100; i++) {
-                               Person p = new Person();
-                               p.setFirstName(fnames[r.nextInt(fnames.length)]);
-                               p.setLastName(lnames[r.nextInt(lnames.length)]);
-                               p.setCity(cities[r.nextInt(cities.length)]);
-                               p.setEmail(p.getFirstName().toLowerCase() + "."
-                                               + p.getLastName().toLowerCase() + "@itmill.com");
-                               p.setPhoneNumber("+358 02 555 " + r.nextInt(10) + r.nextInt(10)
-                                               + r.nextInt(10) + r.nextInt(10));
-                               int n = r.nextInt(100000);
-                               if (n < 10000) {
-                                       n += 10000;
-                               }
-                               p.setPostalCode(n);
-                               p.setStreetAddress(streets[r.nextInt(streets.length)]);
-                               c.addItem(p);
-                       }
-               } catch (InstantiationException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } catch (IllegalAccessException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
+    public static PersonContainer createWithTestData() {
+        final String[] fnames = { "Peter", "Alice", "Joshua", "Mike", "Olivia",
+                "Nina", "Alex", "Rita", "Dan", "Umberto", "Henrik", "Rene",
+                "Lisa", "Marge" };
+        final String[] lnames = { "Smith", "Gordon", "Simpson", "Brown",
+                "Clavel", "Simons", "Verne", "Scott", "Allison", "Gates",
+                "Rowling", "Barks", "Ross", "Schneider", "Tate" };
+        final String cities[] = { "Amsterdam", "Berlin", "Helsinki",
+                "Hong Kong", "London", "Luxemburg", "New York", "Oslo",
+                "Paris", "Rome", "Stockholm", "Tokyo", "Turku" };
+        final String streets[] = { "4215 Blandit Av.", "452-8121 Sem Ave",
+                "279-4475 Tellus Road", "4062 Libero. Av.", "7081 Pede. Ave",
+                "6800 Aliquet St.", "P.O. Box 298, 9401 Mauris St.",
+                "161-7279 Augue Ave", "P.O. Box 496, 1390 Sagittis. Rd.",
+                "448-8295 Mi Avenue", "6419 Non Av.",
+                "659-2538 Elementum Street", "2205 Quis St.",
+                "252-5213 Tincidunt St.", "P.O. Box 175, 4049 Adipiscing Rd.",
+                "3217 Nam Ave", "P.O. Box 859, 7661 Auctor St.",
+                "2873 Nonummy Av.", "7342 Mi, Avenue",
+                "539-3914 Dignissim. Rd.", "539-3675 Magna Avenue",
+                "Ap #357-5640 Pharetra Avenue", "416-2983 Posuere Rd.",
+                "141-1287 Adipiscing Avenue", "Ap #781-3145 Gravida St.",
+                "6897 Suscipit Rd.", "8336 Purus Avenue", "2603 Bibendum. Av.",
+                "2870 Vestibulum St.", "Ap #722 Aenean Avenue",
+                "446-968 Augue Ave", "1141 Ultricies Street",
+                "Ap #992-5769 Nunc Street", "6690 Porttitor Avenue",
+                "Ap #105-1700 Risus Street",
+                "P.O. Box 532, 3225 Lacus. Avenue", "736 Metus Street",
+                "414-1417 Fringilla Street", "Ap #183-928 Scelerisque Road",
+                "561-9262 Iaculis Avenue" };
+        PersonContainer c = null;
+        Random r = new Random(0);
+        try {
+            c = new PersonContainer();
+            for (int i = 0; i < 100; i++) {
+                Person p = new Person();
+                p.setFirstName(fnames[r.nextInt(fnames.length)]);
+                p.setLastName(lnames[r.nextInt(lnames.length)]);
+                p.setCity(cities[r.nextInt(cities.length)]);
+                p.setEmail(p.getFirstName().toLowerCase() + "."
+                        + p.getLastName().toLowerCase() + "@itmill.com");
+                p.setPhoneNumber("+358 02 555 " + r.nextInt(10) + r.nextInt(10)
+                        + r.nextInt(10) + r.nextInt(10));
+                int n = r.nextInt(100000);
+                if (n < 10000) {
+                    n += 10000;
+                }
+                p.setPostalCode(n);
+                p.setStreetAddress(streets[r.nextInt(streets.length)]);
+                c.addItem(p);
+            }
+        } catch (InstantiationException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
 
-               return c;
-       }
+        return c;
+    }
 
 }
index 137917a3419e05bd0c7f7bb7ed895c5aa58380db..1ebd9fa3725094d4e25baad05d3aa272dfe8e5f2 100644 (file)
@@ -1,41 +1,43 @@
 package com.itmill.toolkit.demo.tutorial.addressbook.data;
 
-public class SearchFilter {
-
-       private final String term;
-       private final Object propertyId;
-       private String searchName;
-
-       public SearchFilter(Object propertyId, String searchTerm, String name) {
-               this.propertyId = propertyId;
-               this.term = searchTerm;
-               this.searchName = name;
-       }
-
-       /**
-        * @return the term
-        */
-       public String getTerm() {
-               return term;
-       }
-
-       /**
-        * @return the propertyId
-        */
-       public Object getPropertyId() {
-               return propertyId;
-       }
-
-       /**
-        * @return the name of the search
-        */
-       public String getSearchName() {
-               return searchName;
-       }
-
-       @Override
-       public String toString() {
-               return getSearchName();
-       }
+import java.io.Serializable;
+
+public class SearchFilter implements Serializable {
+
+    private final String term;
+    private final Object propertyId;
+    private String searchName;
+
+    public SearchFilter(Object propertyId, String searchTerm, String name) {
+        this.propertyId = propertyId;
+        term = searchTerm;
+        searchName = name;
+    }
+
+    /**
+     * @return the term
+     */
+    public String getTerm() {
+        return term;
+    }
+
+    /**
+     * @return the propertyId
+     */
+    public Object getPropertyId() {
+        return propertyId;
+    }
+
+    /**
+     * @return the name of the search
+     */
+    public String getSearchName() {
+        return searchName;
+    }
+
+    @Override
+    public String toString() {
+        return getSearchName();
+    }
 
 }
index 3657a95c28c0917633756f9b2f92752f92a2fd1b..3c9074bc9483a9b587f86548d43c96cfc616c26f 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.event;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.terminal.Resource;
 
 /**
@@ -16,7 +18,8 @@ import com.itmill.toolkit.terminal.Resource;
  * @VERSION@
  * @since 3.0
  */
-public class Action {
+@SuppressWarnings("serial")
+public class Action implements Serializable {
 
     /**
      * Action title.
@@ -77,7 +80,7 @@ public class Action {
      * @VERSION@
      * @since 3.0
      */
-    public interface Handler {
+    public interface Handler extends Serializable {
 
         /**
          * Gets the list of actions applicable to this handler.
@@ -120,7 +123,7 @@ public class Action {
      * @VERSION@
      * @since 3.0
      */
-    public interface Container {
+    public interface Container extends Serializable {
 
         /**
          * Registers a new action handler for this container
index 8ccd9b47d0e28d1c85a51481ec90a7998bee5557..6d802a6fdca2db68c00a9fb3ad1f6962ae00329a 100644 (file)
@@ -20,6 +20,7 @@ import java.util.Set;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class EventRouter implements MethodEventSource {
 
     /**
index 62d109b5836a7540ba98b0ba4ebb5f9e8e05958f..c68bc9878855087662faade835b76f52c588c9cf 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.event;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 
 import com.itmill.toolkit.data.Container;
@@ -26,7 +27,8 @@ import com.itmill.toolkit.ui.Component.Event;
  *        TODO extract generic super class/interfaces if we implement some other
  *        click events.
  */
-public class ItemClickEvent extends Event {
+@SuppressWarnings("serial")
+public class ItemClickEvent extends Event implements Serializable {
     public static final int BUTTON_LEFT = MouseEventDetails.BUTTON_LEFT;
     public static final int BUTTON_MIDDLE = MouseEventDetails.BUTTON_MIDDLE;
     public static final int BUTTON_RIGHT = MouseEventDetails.BUTTON_RIGHT;
@@ -107,11 +109,6 @@ public class ItemClickEvent extends Event {
         return details.isShiftKey();
     }
 
-    /**
-     * Serial generated by eclipse
-     */
-    private static final long serialVersionUID = 3576399524236787971L;
-
     public static final Method ITEM_CLICK_METHOD;
 
     static {
@@ -124,7 +121,7 @@ public class ItemClickEvent extends Event {
         }
     }
 
-    public interface ItemClickListener {
+    public interface ItemClickListener extends Serializable {
         public void itemClick(ItemClickEvent event);
     }
 
@@ -134,7 +131,7 @@ public class ItemClickEvent extends Event {
      * @link {@link Container} interface may support emitting
      *       {@link ItemClickEvent}s.
      */
-    public interface ItemClickSource {
+    public interface ItemClickSource extends Serializable {
         /**
          * Register listener to handle ItemClickEvents.
          * 
index 1984dd83801b4956c5561cc4c037c27aa096d2cf..b0732398c7e316d376d376856071b58d0a7ae789 100644 (file)
@@ -4,6 +4,9 @@
 
 package com.itmill.toolkit.event;
 
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.EventListener;
@@ -35,24 +38,25 @@ import java.util.EventObject;
  * @VERSION@
  * @since 3.0
  */
-public class ListenerMethod implements EventListener {
+@SuppressWarnings("serial")
+public class ListenerMethod implements EventListener, Serializable {
 
     /**
      * Type of the event that should trigger this listener. Also the subclasses
      * of this class are accepted to trigger the listener.
      */
-    private final Class eventType;
+    private final Class<?> eventType;
 
     /**
      * The object containing the trigger method.
      */
-    private final Object object;
+    private Object object;
 
     /**
      * The trigger method to call when an event passing the given criteria
      * fires.
      */
-    private final Method method;
+    private transient Method method;
 
     /**
      * Optional argument set to pass to the trigger method.
@@ -66,6 +70,67 @@ public class ListenerMethod implements EventListener {
      */
     private int eventArgumentIndex;
 
+    /* Special serialization to handle method references */
+    private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+        try {
+            out.defaultWriteObject();
+            String name = method.getName();
+            Class<?>[] paramTypes = method.getParameterTypes();
+            out.writeObject(name);
+            out.writeObject(paramTypes);
+        } catch (NotSerializableException e) {
+            System.err
+                    .println("Fatal error in serialization of the application: Class "
+                            + object.getClass().getName()
+                            + " must implement serialization.");
+            throw e;
+        }
+
+    };
+
+    /* Special serialization to handle method references */
+    private void readObject(java.io.ObjectInputStream in) throws IOException,
+            ClassNotFoundException {
+        in.defaultReadObject();
+        try {
+            String name = (String) in.readObject();
+            Class<?>[] paramTypes = (Class<?>[]) in.readObject();
+            // We can not use getMethod directly as we want to support anonymous
+            // inner classes
+            method = findHighestMethod(object.getClass(), name, paramTypes);
+        } catch (SecurityException e) {
+            System.err.println("Internal deserialization error");
+            e.printStackTrace();
+        }
+    };
+
+    private static Method findHighestMethod(Class<?> cls, String method,
+            Class<?>[] paramTypes) {
+        Class<?>[] ifaces = cls.getInterfaces();
+        for (int i = 0; i < ifaces.length; i++) {
+            Method ifaceMethod = findHighestMethod(ifaces[i], method,
+                    paramTypes);
+            if (ifaceMethod != null) {
+                return ifaceMethod;
+            }
+        }
+        if (cls.getSuperclass() != null) {
+            Method parentMethod = findHighestMethod(cls.getSuperclass(),
+                    method, paramTypes);
+            if (parentMethod != null) {
+                return parentMethod;
+            }
+        }
+        Method[] methods = cls.getMethods();
+        for (int i = 0; i < methods.length; i++) {
+            // we ignore parameter types for now - you need to add this
+            if (methods[i].getName().equals(method)) {
+                return methods[i];
+            }
+        }
+        return null;
+    }
+
     /**
      * <p>
      * Constructs a new event listener from a trigger method, it's arguments and
@@ -98,7 +163,7 @@ public class ListenerMethod implements EventListener {
      *             if <code>method</code> is not a member of <code>object</code>
      *             .
      */
-    public ListenerMethod(Class eventType, Object object, Method method,
+    public ListenerMethod(Class<?> eventType, Object object, Method method,
             Object[] arguments, int eventArgumentIndex)
             throws java.lang.IllegalArgumentException {
 
@@ -157,7 +222,7 @@ public class ListenerMethod implements EventListener {
      *             unless exactly one match <code>methodName</code> is found in
      *             <code>object</code>.
      */
-    public ListenerMethod(Class eventType, Object object, String methodName,
+    public ListenerMethod(Class<?> eventType, Object object, String methodName,
             Object[] arguments, int eventArgumentIndex)
             throws java.lang.IllegalArgumentException {
 
@@ -218,7 +283,7 @@ public class ListenerMethod implements EventListener {
      *             if <code>method</code> is not a member of <code>object</code>
      *             .
      */
-    public ListenerMethod(Class eventType, Object object, Method method,
+    public ListenerMethod(Class<?> eventType, Object object, Method method,
             Object[] arguments) throws java.lang.IllegalArgumentException {
 
         // Check that the object is of correct type
@@ -262,7 +327,7 @@ public class ListenerMethod implements EventListener {
      *             unless exactly one match <code>methodName</code> is found in
      *             <code>object</code>.
      */
-    public ListenerMethod(Class eventType, Object object, String methodName,
+    public ListenerMethod(Class<?> eventType, Object object, String methodName,
             Object[] arguments) throws java.lang.IllegalArgumentException {
 
         // Find the correct method
@@ -307,7 +372,7 @@ public class ListenerMethod implements EventListener {
      *             if <code>method</code> is not a member of <code>object</code>
      *             .
      */
-    public ListenerMethod(Class eventType, Object object, Method method)
+    public ListenerMethod(Class<?> eventType, Object object, Method method)
             throws java.lang.IllegalArgumentException {
 
         // Checks that the object is of correct type
@@ -320,7 +385,7 @@ public class ListenerMethod implements EventListener {
         this.method = method;
         eventArgumentIndex = -1;
 
-        final Class[] params = method.getParameterTypes();
+        final Class<?>[] params = method.getParameterTypes();
 
         if (params.length == 0) {
             arguments = new Object[0];
@@ -358,7 +423,7 @@ public class ListenerMethod implements EventListener {
      *             unless exactly one match <code>methodName</code> is found in
      *             <code>object</code>.
      */
-    public ListenerMethod(Class eventType, Object object, String methodName)
+    public ListenerMethod(Class<?> eventType, Object object, String methodName)
             throws java.lang.IllegalArgumentException {
 
         // Finds the correct method
@@ -378,7 +443,7 @@ public class ListenerMethod implements EventListener {
         this.method = method;
         eventArgumentIndex = -1;
 
-        final Class[] params = method.getParameterTypes();
+        final Class<?>[] params = method.getParameterTypes();
 
         if (params.length == 0) {
             arguments = new Object[0];
@@ -447,7 +512,7 @@ public class ListenerMethod implements EventListener {
      *         the one stored in this object and <code>eventType</code> equals
      *         the event type stored in this object. *
      */
-    public boolean matches(Class eventType, Object target) {
+    public boolean matches(Class<?> eventType, Object target) {
         return (target == object) && (eventType.equals(this.eventType));
     }
 
@@ -469,7 +534,7 @@ public class ListenerMethod implements EventListener {
      *         the event type stored in this object and <code>method</code>
      *         equals with the method stored in this object
      */
-    public boolean matches(Class eventType, Object target, Method method) {
+    public boolean matches(Class<?> eventType, Object target, Method method) {
         return (target == object)
                 && (eventType.equals(this.eventType) && method
                         .equals(this.method));
@@ -524,12 +589,8 @@ public class ListenerMethod implements EventListener {
      * @VERSION@
      * @since 3.0
      */
-    public class MethodException extends RuntimeException {
-
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257005445242894135L;
+    public class MethodException extends RuntimeException implements
+            Serializable {
 
         private final Throwable cause;
 
index 8b5d9d797fc65cb40be6921420a5118dd1694985..16aca6520807096acdaa97bc94cf1e1542d69931 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.event;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 
 /**
@@ -22,7 +23,7 @@ import java.lang.reflect.Method;
  * @VERSION@
  * @since 3.0
  */
-public interface MethodEventSource {
+public interface MethodEventSource extends Serializable {
 
     /**
      * <p>
index 4b4cca83b5a415330f7410e471df5692e47312bc..665add30b3142771a7bb68a8f00dc3c12d5f386d 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.event;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.terminal.Resource;
 
 /**
@@ -13,6 +15,7 @@ import com.itmill.toolkit.terminal.Resource;
  * @version
  * @since 4.0.1
  */
+@SuppressWarnings("serial")
 public class ShortcutAction extends Action {
 
     private final int keyCode;
@@ -43,7 +46,7 @@ public class ShortcutAction extends Action {
      * Key codes that can be used for shortcuts
      * 
      */
-    public interface KeyCode {
+    public interface KeyCode extends Serializable {
         public static final int ENTER = 13;
 
         public static final int ESCAPE = 27;
@@ -173,7 +176,7 @@ public class ShortcutAction extends Action {
      * Modifier key constants
      * 
      */
-    public interface ModifierKey {
+    public interface ModifierKey extends Serializable {
         public static final int SHIFT = 16;
 
         public static final int CTRL = 17;
index 0fc76c13cd74a724985f7608017a508d93e6d290..3bc0a29822c93ca3211b5daac6d57820fa567069 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.service;
 
 import java.io.File;
+import java.io.Serializable;
 import java.util.Collection;
 
 import com.itmill.toolkit.Application;
@@ -19,7 +20,7 @@ import com.itmill.toolkit.Application;
  * @VERSION@
  * @since 3.1
  */
-public interface ApplicationContext {
+public interface ApplicationContext extends Serializable {
 
     /**
      * Returns application context base directory.
@@ -68,7 +69,7 @@ public interface ApplicationContext {
      * between the client and the application.
      * 
      */
-    public interface TransactionListener {
+    public interface TransactionListener extends Serializable {
 
         /**
          * Invoked at the beginning of every transaction.
index 7c57fece6f3083eaa6bf395484253a0217b4d5c6..97cd161681ef8dfde49219af062926fb4e8924ed 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.service;
 
 import java.io.File;
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.Hashtable;
 import java.util.Map;
@@ -25,7 +26,8 @@ import com.itmill.toolkit.terminal.ThemeResource;
  * @VERSION@
  * @since 3.0
  */
-public class FileTypeResolver {
+@SuppressWarnings("serial")
+public class FileTypeResolver implements Serializable {
 
     /**
      * Default icon given if no icon is specified for a mime-type.
index 94f3a21a2eecd0c1e5ecb23858039eb72a0d820d..c67de1a7a4127de468354d9b9139ee388cb4686f 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.Application;
 
 /**
@@ -21,7 +23,7 @@ import com.itmill.toolkit.Application;
  * @VERSION@
  * @since 3.0
  */
-public interface ApplicationResource extends Resource {
+public interface ApplicationResource extends Resource, Serializable {
 
     /**
      * Default cache time.
index 60ac7e311ffecb6545fc40a8b097d64d000b903d..a8062940bb600c82ee9fd137ed4bc41a6f1bce84 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.Application;
 import com.itmill.toolkit.service.FileTypeResolver;
 
@@ -20,7 +22,8 @@ import com.itmill.toolkit.service.FileTypeResolver;
  * @VERSION@
  * @since 3.0
  */
-public class ClassResource implements ApplicationResource {
+@SuppressWarnings("serial")
+public class ClassResource implements ApplicationResource, Serializable {
 
     /**
      * Default buffer size for this stream resource.
index 47a50b1e262e9132c72521ca3e5607a29fe48b25..7af3ac4628e677ea82cb8a2be8afdd7fdc949b85 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -17,7 +18,8 @@ import java.util.List;
  * @VERSION@
  * @since 3.0
  */
-public class CompositeErrorMessage implements ErrorMessage {
+@SuppressWarnings("serial")
+public class CompositeErrorMessage implements ErrorMessage, Serializable {
 
     /**
      * Array of all the errors.
index 1703dc2b92858b451bae255074349699a318c379..8b91e15bb1ec88d7d9d3d4cb7e3a209ae322fa9c 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.terminal;
 
 import java.io.InputStream;
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -17,7 +18,8 @@ import java.util.Map;
  * @VERSION@
  * @since 3.0
  */
-public class DownloadStream {
+@SuppressWarnings("serial")
+public class DownloadStream implements Serializable {
 
     /**
      * Maximum cache time.
index d3cf40ba6dfedc3b06333bf978257a695708f0f3..5b07dcc4f79f90e6d1e8d3d2b8e5b5fa48403e1b 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 /**
  * Interface for rendering error messages to terminal. All the visible errors
  * shown to user must implement this interface.
@@ -13,7 +15,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
-public interface ErrorMessage extends Paintable {
+public interface ErrorMessage extends Paintable, Serializable {
 
     /**
      * Error code for system errors and bugs.
index 1a210a059e533ae48afd7ebfa9b5fc6abe015b00..80feae3d00f74308095a49e0e1033328d011f914 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.net.URL;
 
 import com.itmill.toolkit.service.FileTypeResolver;
@@ -18,7 +19,7 @@ import com.itmill.toolkit.service.FileTypeResolver;
  * @VERSION@
  * @since 3.0
  */
-public class ExternalResource implements Resource {
+public class ExternalResource implements Resource, Serializable {
 
     /**
      * Url of the download.
index 571d22ecfb587fd5be26de855ef2050196e9f527..6fa26405e4f2ec2f63a1b3748c474e11fb8fc073 100644 (file)
@@ -22,6 +22,7 @@ import com.itmill.toolkit.service.FileTypeResolver;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class FileResource implements ApplicationResource {
 
     /**
index de6fbd27ba4026c57ec779ec63da4bf0bc89cc96..4747cd4e98fe8216eb9f0cec4072ac1171996177 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.util.Hashtable;
 
 /**
@@ -15,7 +16,8 @@ import java.util.Hashtable;
  * @VERSION@
  * @since 3.0
  */
-public class KeyMapper {
+@SuppressWarnings("serial")
+public class KeyMapper implements Serializable {
 
     private int lastKey = 0;
 
index c421edf94ab54f1a0ea5fdfb55f5ffa97c752b51..8464a418bf513df6d92447ca8275368c2bd4bcdc 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.terminal;
 
 import java.io.IOException;
+import java.io.Serializable;
 
 /**
  * <code>PaintExcepection</code> is thrown if painting of a component fails.
@@ -14,12 +15,8 @@ import java.io.IOException;
  * @VERSION@
  * @since 3.0
  */
-public class PaintException extends IOException {
-
-    /**
-     * Serial generated by eclipse.
-     */
-    private static final long serialVersionUID = 3762535607221891897L;
+@SuppressWarnings("serial")
+public class PaintException extends IOException implements Serializable {
 
     /**
      * Constructs an instance of <code>PaintExeception</code> with the specified
index 43f134bfd84f026473c8e624308bb0891521b621..b232325831dd5f64d61cec0e0d49ed07e6def04f 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 /**
  * This interface defines the methods for painting XML to the UIDL stream.
  * 
@@ -12,7 +14,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
-public interface PaintTarget {
+public interface PaintTarget extends Serializable{
 
     /**
      * Prints single XMLsection.
index 61dbc27fc5f9b1b1be2f3b517a6c831e86aa3657..be09df281a151b5a4ccc90e771a432563c21e9b6 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.util.EventObject;
 
 /**
@@ -16,7 +17,7 @@ import java.util.EventObject;
  * @VERSION@
  * @since 3.0
  */
-public interface Paintable extends java.util.EventListener {
+public interface Paintable extends java.util.EventListener, Serializable {
 
     /**
      * <p>
@@ -65,13 +66,9 @@ public interface Paintable extends java.util.EventListener {
      * This is typically done when the <code>paint</code> method would return
      * dissimilar UIDL from the previous call of the method.
      */
+    @SuppressWarnings("serial")
     public class RepaintRequestEvent extends EventObject {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3256725095530442805L;
-
         /**
          * Constructs a new event.
          * 
@@ -99,7 +96,7 @@ public interface Paintable extends java.util.EventListener {
      * when the <code>paint</code> method would return dissimilar UIDL from the
      * previous call of the method.
      */
-    public interface RepaintRequestListener {
+    public interface RepaintRequestListener extends Serializable {
 
         /**
          * Receives repaint request events.
index 640292bc97ed211d215829a3f53d8f294ba18a25..88ba0ae1c27a069d7ae7fcd59ccc95f9169042e2 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.util.Map;
 
 /**
@@ -24,7 +25,7 @@ import java.util.Map;
  * @VERSION@
  * @since 3.0
  */
-public interface ParameterHandler {
+public interface ParameterHandler extends Serializable{
 
     /**
      * <p>
index 5cf07729aa98c8a6962bdeb6fa181c4356e7e334..7e29ae250ac06975c5a52f9bb6840e95beac6c92 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 /**
  * <code>Resource</code> provided to the client terminal. Support for actually
  * displaying the resource type is left to the terminal.
@@ -13,7 +15,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
-public interface Resource {
+public interface Resource extends Serializable{
 
     /**
      * Gets the MIME type of the resource.
index 4b9260c70d055cf3a5dfc0f831667194b6c40bc2..3ab1a5df5c58a8940bc233cb2b739bd5fcb2eace 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * This interface is implemented by all visual objects that can be scrolled. The
@@ -15,7 +17,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
-public interface Scrollable {
+public interface Scrollable extends Serializable {
 
     /**
      * Gets scroll left offset.
index e4030be7bcf2dafd384db34bb2e64521cefa794a..8b83012157cb8ca154f3ce297696e3ba947abf0f 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 /**
  * Interface to be implemented by components wishing to display some object that
  * may be dynamically resized during runtime.
@@ -13,7 +15,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
-public interface Sizeable {
+public interface Sizeable extends Serializable{
 
     /**
      * Unit code representing pixels.
index b1ad8f9c1527986046376386e7f6cdb33f9e90d2..49bcc81d6fce7ebb5090d59206c563067318628b 100644 (file)
@@ -20,6 +20,7 @@ import com.itmill.toolkit.service.FileTypeResolver;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class StreamResource implements ApplicationResource {
 
     /**
index b5d2fae5d022b8d514e3da655d3d88191d558fab..8f7f19a5a6bf4768bbaa87abc6af47f9ab8ff532 100644 (file)
@@ -18,13 +18,9 @@ import java.io.StringWriter;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class SystemError extends RuntimeException implements ErrorMessage {
 
-    /**
-     * Serial generated by eclipse.
-     */
-    private static final long serialVersionUID = 3256445789512675891L;
-
     /**
      * The cause of the system error. The cause is stored separately as JDK 1.3
      * does not support causes natively.
index e7a61b6457e0d497895562e867f74a3028172ea1..5f136679d9e71ba077525e2ced2ebdc5675bafda 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
+
 /**
  * Interface for different terminal types.
  * 
@@ -12,7 +14,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
-public interface Terminal {
+public interface Terminal extends Serializable {
 
     /**
      * Gets the name of the default theme.
@@ -38,7 +40,7 @@ public interface Terminal {
     /**
      * Terminal error event.
      */
-    public interface ErrorEvent {
+    public interface ErrorEvent extends Serializable{
 
         /**
          * Gets the contained throwable.
@@ -50,7 +52,7 @@ public interface Terminal {
     /**
      * Terminal error listener interface.
      */
-    public interface ErrorListener {
+    public interface ErrorListener extends Serializable{
 
         /**
          * Invoked when terminal error occurs.
index 809f5a2bc8c68aeaac430f31db2f278ff9ae3522..1fcf0dd5f376bc3d78c2a14d667a4e91c0d83107 100644 (file)
@@ -17,6 +17,7 @@ import com.itmill.toolkit.service.FileTypeResolver;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class ThemeResource implements Resource {
 
     /**
index fc72c0c2041329aa229fbe8e681733fbbfb57b34..46fb322b0de37578b0472c43079dbc7e599e6be5 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.net.URL;
 
 /**
@@ -19,7 +20,7 @@ import java.net.URL;
  * @VERSION@
  * @since 3.0
  */
-public interface URIHandler {
+public interface URIHandler extends Serializable {
 
     /**
      * Handles a given relative URI. If the URI handling wants to emit a
index b15bb1db15a0c6555c598825452da8aa5dd07005..225740ed439cdf8f30e18a399deea3a75f35bff2 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.terminal;
 
 import java.io.InputStream;
+import java.io.Serializable;
 
 /**
  * Defines a variable type, that is used for passing uploaded files from
@@ -16,7 +17,7 @@ import java.io.InputStream;
  * @VERSION@
  * @since 3.0
  */
-public interface UploadStream {
+public interface UploadStream extends Serializable {
 
     /**
      * Gets the name of the stream.
index 92b33e4f8bc43123a79bf05ce6fe42315ff444ec..e7c2df90048c10a3acd6c5f012adb897e269211c 100644 (file)
@@ -13,6 +13,7 @@ package com.itmill.toolkit.terminal;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class UserError implements ErrorMessage {
 
     /**
index c97497aedef4d5ea9dc9f7879cc4ec20a1f9c721..fc1fe2ba16aa728352e391d3c4a5ade23eca3562 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.terminal;
 
+import java.io.Serializable;
 import java.util.Map;
 
 /**
@@ -20,7 +21,7 @@ import java.util.Map;
  * @VERSION@
  * @since 3.0
  */
-public interface VariableOwner {
+public interface VariableOwner extends Serializable {
 
     /**
      * Called when one or more variables handled by the implementing class are
index 725659c9160efe0e92f0a2506f27a76be49a7ac7..62ef12a9bdac7583c89df49eedab6f1b18044564 100644 (file)
@@ -4,7 +4,10 @@
 
 package com.itmill.toolkit.terminal.gwt.client.ui;
 
-public class IMarginInfo {
+import java.io.Serializable;
+
+@SuppressWarnings("serial")
+public class IMarginInfo implements Serializable {
 
     private static final int TOP = 1;
     private static final int RIGHT = 2;
index 894eba519b390162f531bee3cf0566ea67b3f981..eff1fe3a665d106f3b11839b0761ab7f981e0023 100644 (file)
@@ -2,6 +2,7 @@ package com.itmill.toolkit.terminal.gwt.server;
 \r
 import java.io.IOException;\r
 import java.io.PrintWriter;\r
+import java.io.Serializable;\r
 \r
 import javax.portlet.ActionRequest;\r
 import javax.portlet.ActionResponse;\r
@@ -15,7 +16,8 @@ import javax.portlet.RenderResponse;
 \r
 import com.itmill.toolkit.Application;\r
 \r
-public class ApplicationPortlet implements Portlet {\r
+@SuppressWarnings("serial")\r
+public class ApplicationPortlet implements Portlet, Serializable {\r
     // The application to show\r
     protected String app = null;\r
     // some applications might require forced height (and, more seldom, width)\r
index b9c8d58ff504043fcadd3a84c078e4857ca58b69..6fd6bfaa8c17ccaef5649933daeb64473cb50677 100644 (file)
@@ -10,6 +10,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -19,7 +20,6 @@ import java.security.GeneralSecurityException;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
@@ -55,10 +55,9 @@ import com.itmill.toolkit.ui.Window;
  * @since 5.0
  */
 
+@SuppressWarnings("serial")
 public class ApplicationServlet extends HttpServlet {
 
-    private static final long serialVersionUID = -4937882979845826574L;
-
     /**
      * Version number of this release. For example "5.0.0".
      */
@@ -127,10 +126,6 @@ public class ApplicationServlet extends HttpServlet {
 
     private static final int MAX_BUFFER_SIZE = 64 * 1024;
 
-    // TODO This is session specific not servlet wide data. No need to store
-    // this here, move it to Session from where it can be queried when required
-    protected static HashMap<Application, CommunicationManager> applicationToAjaxAppMgrMap = new HashMap<Application, CommunicationManager>();
-
     private static final String RESOURCE_URI = "/RES/";
 
     private static final String AJAX_UIDL_URI = "/UIDL";
@@ -162,8 +157,6 @@ public class ApplicationServlet extends HttpServlet {
     // If servlet is application runner, store request's classname
     String applicationRunnerClassname = null;
 
-    private ClassLoader classLoader;
-
     /**
      * Called by the servlet container to indicate to a servlet that the servlet
      * is being placed into service.
@@ -229,28 +222,6 @@ public class ApplicationServlet extends HttpServlet {
             System.err.println(NOT_PRODUCTION_MODE_INFO);
         }
 
-        // Gets custom class loader
-        final String classLoaderName = getApplicationOrSystemProperty(
-                "ClassLoader", null);
-        ClassLoader classLoader;
-        if (classLoaderName == null) {
-            classLoader = getClass().getClassLoader();
-        } else {
-            try {
-                final Class classLoaderClass = getClass().getClassLoader()
-                        .loadClass(classLoaderName);
-                final Constructor c = classLoaderClass
-                        .getConstructor(new Class[] { ClassLoader.class });
-                classLoader = (ClassLoader) c
-                        .newInstance(new Object[] { getClass().getClassLoader() });
-            } catch (final Exception e) {
-                throw new ServletException(
-                        "Could not find specified class loader: "
-                                + classLoaderName, e);
-            }
-        }
-        this.classLoader = classLoader;
-
         // Loads the application class using the same class loader
         // as the servlet itself
         if (!isApplicationRunnerServlet) {
@@ -262,7 +233,8 @@ public class ApplicationServlet extends HttpServlet {
                         "Application not specified in servlet parameters");
             }
             try {
-                applicationClass = classLoader.loadClass(applicationClassName);
+                applicationClass = getClassLoader().loadClass(
+                        applicationClassName);
             } catch (final ClassNotFoundException e) {
                 throw new ServletException("Failed to load application class: "
                         + applicationClassName);
@@ -274,6 +246,30 @@ public class ApplicationServlet extends HttpServlet {
 
     }
 
+    private ClassLoader getClassLoader() throws ServletException {
+        // Gets custom class loader
+        final String classLoaderName = getApplicationOrSystemProperty(
+                "ClassLoader", null);
+        ClassLoader classLoader;
+        if (classLoaderName == null) {
+            classLoader = getClass().getClassLoader();
+        } else {
+            try {
+                final Class<?> classLoaderClass = getClass().getClassLoader()
+                        .loadClass(classLoaderName);
+                final Constructor<?> c = classLoaderClass
+                        .getConstructor(new Class[] { ClassLoader.class });
+                classLoader = (ClassLoader) c
+                        .newInstance(new Object[] { getClass().getClassLoader() });
+            } catch (final Exception e) {
+                throw new ServletException(
+                        "Could not find specified class loader: "
+                                + classLoaderName, e);
+            }
+        }
+        return classLoader;
+    }
+
     /**
      * Gets an application or system property value.
      * 
@@ -371,8 +367,9 @@ public class ApplicationServlet extends HttpServlet {
                 // note: endTransaction is called on finalize below
                 ((WebApplicationContext) application.getContext())
                         .startTransaction(application, request);
-                getApplicationManager(application).handleFileUpload(request,
-                        response);
+                ((WebApplicationContext) application.getContext())
+                        .getApplicationManager(application, this)
+                        .handleFileUpload(request, response);
                 return;
             }
 
@@ -417,8 +414,9 @@ public class ApplicationServlet extends HttpServlet {
                             .startTransaction(application, request);
 
                     // Handle UIDL request
-                    getApplicationManager(application).handleUidlRequest(
-                            request, response, this);
+                    ((WebApplicationContext) application.getContext())
+                            .getApplicationManager(application, this)
+                            .handleUidlRequest(request, response, this);
                     return;
                 }
             }
@@ -432,7 +430,7 @@ public class ApplicationServlet extends HttpServlet {
                     application.close();
                     final HttpSession session = request.getSession(false);
                     if (session != null) {
-                        ApplicationServlet.applicationToAjaxAppMgrMap
+                        WebApplicationContext.getApplicationContext(session).applicationToAjaxAppMgrMap
                                 .remove(application);
                         WebApplicationContext.getApplicationContext(session)
                                 .removeApplication(application);
@@ -474,8 +472,9 @@ public class ApplicationServlet extends HttpServlet {
             DownloadStream download = null;
 
             // Handles the URI if the application is still running
-            download = getApplicationManager(application).handleURI(window,
-                    request, response);
+            download = ((WebApplicationContext) application.getContext())
+                    .getApplicationManager(application, this).handleURI(window,
+                            request, response);
 
             // If this is not a download request
             if (download == null) {
@@ -623,9 +622,10 @@ public class ApplicationServlet extends HttpServlet {
      * @param request
      * @param response
      * @throws IOException
+     * @throws ServletException
      */
     private void serveStaticResourcesInITMILL(String filename,
-            HttpServletResponse response) throws IOException {
+            HttpServletResponse response) throws IOException, ServletException {
 
         final ServletContext sc = getServletContext();
         InputStream is = sc.getResourceAsStream(filename);
@@ -634,7 +634,7 @@ public class ApplicationServlet extends HttpServlet {
 
             // strip leading "/" otherwise stream from JAR wont work
             filename = filename.substring(1);
-            is = classLoader.getResourceAsStream(filename);
+            is = getClassLoader().getResourceAsStream(filename);
 
             if (is == null) {
                 // cannot serve requested file
@@ -1430,10 +1430,12 @@ public class ApplicationServlet extends HttpServlet {
      * @throws SAXException
      * @throws IllegalAccessException
      * @throws InstantiationException
+     * @throws ServletException
      */
     private Application getNewApplication(HttpServletRequest request,
             HttpServletResponse response) throws MalformedURLException,
-            SAXException, IllegalAccessException, InstantiationException {
+            SAXException, IllegalAccessException, InstantiationException,
+            ServletException {
 
         // Create application
         final WebApplicationContext context = WebApplicationContext
@@ -1446,7 +1448,8 @@ public class ApplicationServlet extends HttpServlet {
             applicationUrl = new URL(getApplicationUrl(request).toString()
                     + applicationClassname + "/");
             try {
-                applicationClass = classLoader.loadClass(applicationClassname);
+                applicationClass = getClassLoader().loadClass(
+                        applicationClassname);
             } catch (final ClassNotFoundException e) {
                 throw new InstantiationException(
                         "Failed to load application class: "
@@ -1586,7 +1589,7 @@ public class ApplicationServlet extends HttpServlet {
      * Implementation of ParameterHandler.ErrorEvent interface.
      */
     public class ParameterHandlerErrorImpl implements
-            ParameterHandler.ErrorEvent {
+            ParameterHandler.ErrorEvent, Serializable {
 
         private ParameterHandler owner;
 
@@ -1615,7 +1618,8 @@ public class ApplicationServlet extends HttpServlet {
     /**
      * Implementation of URIHandler.ErrorEvent interface.
      */
-    public class URIHandlerErrorImpl implements URIHandler.ErrorEvent {
+    public class URIHandlerErrorImpl implements URIHandler.ErrorEvent,
+            Serializable {
 
         private final URIHandler owner;
 
@@ -1650,25 +1654,6 @@ public class ApplicationServlet extends HttpServlet {
         }
     }
 
-    /**
-     * Gets communication manager for an application.
-     * 
-     * If this application has not been running before, new manager is created.
-     * 
-     * @param application
-     * @return CommunicationManager
-     */
-    private CommunicationManager getApplicationManager(Application application) {
-        CommunicationManager mgr = applicationToAjaxAppMgrMap.get(application);
-
-        if (mgr == null) {
-            // Creates new manager
-            mgr = new CommunicationManager(application, this);
-            applicationToAjaxAppMgrMap.put(application, mgr);
-        }
-        return mgr;
-    }
-
     /**
      * Gets resource path using different implementations. Required to
      * supporting different servlet container implementations (application
@@ -1697,7 +1682,7 @@ public class ApplicationServlet extends HttpServlet {
         return resultPath;
     }
 
-    public class RequestError implements Terminal.ErrorEvent {
+    public class RequestError implements Terminal.ErrorEvent, Serializable {
 
         private final Throwable throwable;
 
index 76bd1822c04798dd235daca6b0c5d21d9e8c0a6e..53523bea5ad07cef57a0118f39eb2047b3d16708 100644 (file)
@@ -5,6 +5,7 @@ import java.util.Map;
 import com.itmill.toolkit.ui.Component;\r
 import com.itmill.toolkit.ui.AbstractComponent.ComponentErrorEvent;\r
 \r
+@SuppressWarnings("serial")\r
 public class ChangeVariablesErrorEvent implements ComponentErrorEvent {\r
 \r
     private Throwable throwable;\r
index 5cb8405d2a8f9206c839020def80f36771d7a2c5..4905b858c5db1a5aa30fa9ced2edc186879d772c 100644 (file)
@@ -12,6 +12,7 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -70,7 +71,9 @@ import com.itmill.toolkit.ui.Window;
  * @VERSION@
  * @since 5.0
  */
-public class CommunicationManager implements Paintable.RepaintRequestListener {
+@SuppressWarnings("serial")
+public class CommunicationManager implements Paintable.RepaintRequestListener,
+        Serializable {
 
     private static String GET_PARAM_REPAINT_ALL = "repaintAll";
 
@@ -776,8 +779,7 @@ public class CommunicationManager implements Paintable.RepaintRequestListener {
         return success;
     }
 
-    public class ErrorHandlerErrorEvent implements ErrorEvent {
-
+    public class ErrorHandlerErrorEvent implements ErrorEvent, Serializable {
         private final Throwable throwable;
 
         public ErrorHandlerErrorEvent(Throwable throwable) {
@@ -1207,7 +1209,9 @@ public class CommunicationManager implements Paintable.RepaintRequestListener {
         p.requestRepaintRequests();
     }
 
-    private final class SingleValueMap implements Map {
+    private final class SingleValueMap implements Map<Object, Object>,
+            Serializable {
+
         private final String name;
 
         private final Object value;
@@ -1298,7 +1302,8 @@ public class CommunicationManager implements Paintable.RepaintRequestListener {
     /**
      * Implementation of URIHandler.ErrorEvent interface.
      */
-    public class URIHandlerErrorImpl implements URIHandler.ErrorEvent {
+    public class URIHandlerErrorImpl implements URIHandler.ErrorEvent,
+            Serializable {
 
         private final URIHandler owner;
 
@@ -1356,7 +1361,9 @@ public class CommunicationManager implements Paintable.RepaintRequestListener {
      * FileUpload can determine content length. Used to detect files total size,
      * uploads progress can be tracked inside upload.
      */
-    private class UploadProgressListener implements ProgressListener {
+    private class UploadProgressListener implements ProgressListener,
+            Serializable {
+
         Upload uploadComponent;
 
         boolean updated = false;
index 7aeee6b10bc09bab10f464bd16895e78f0047446..afc7f4f554e60c0fdcd15a7c8431efc372276378 100644 (file)
@@ -2,6 +2,7 @@ package com.itmill.toolkit.terminal.gwt.server;
 
 import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -26,7 +27,8 @@ import com.itmill.toolkit.ui.VerticalLayout;
 import com.itmill.toolkit.ui.Window;
 import com.itmill.toolkit.ui.GridLayout.Area;
 
-public class ComponentSizeValidator {
+@SuppressWarnings("serial")
+public class ComponentSizeValidator implements Serializable {
 
     private final static int LAYERS_SHOWN = 4;
 
@@ -72,12 +74,14 @@ public class ComponentSizeValidator {
             }
         } else if (component instanceof Form) {
             Form form = (Form) component;
-            if (form.getLayout() != null)
+            if (form.getLayout() != null) {
                 errors = validateComponentRelativeSizes(form.getLayout(),
                         errors, parent);
-            if (form.getFooter() != null)
+            }
+            if (form.getFooter() != null) {
                 errors = validateComponentRelativeSizes(form.getFooter(),
                         errors, parent);
+            }
         }
 
         return errors;
@@ -148,7 +152,7 @@ public class ComponentSizeValidator {
         }
     }
 
-    public static class InvalidLayout {
+    public static class InvalidLayout implements Serializable {
 
         private Component component;
 
@@ -265,7 +269,7 @@ public class ComponentSizeValidator {
         }
     }
 
-    private static class ComponentInfo {
+    private static class ComponentInfo implements Serializable {
         Component component;
         String info;
 
@@ -561,8 +565,9 @@ public class ComponentSizeValidator {
                     || parent instanceof TabSheet
                     || parent instanceof CustomComponent) {
                 // FIXME Could we use com.itmill.toolkit package name here and
-                // fail for all component containers? 
-                // FIXME Actually this should be moved to containers so it can be implemented for custom containers
+                // fail for all component containers?
+                // FIXME Actually this should be moved to containers so it can
+                // be implemented for custom containers
                 // TODO vertical splitpanel with another non relative component?
                 return false;
             } else if (parent instanceof Window) {
@@ -610,7 +615,7 @@ public class ComponentSizeValidator {
     private static Map<Object, FileLocation> widthLocations = new HashMap<Object, FileLocation>();
     private static Map<Object, FileLocation> heightLocations = new HashMap<Object, FileLocation>();
 
-    public static class FileLocation {
+    public static class FileLocation implements Serializable {
         public String method;
         public String file;
         public String className;
index 5d789ac386e7f41ad6cce9a9b97901df34d63906..8026215088c5ac44290e35b3ef9de7b980115ca8 100644 (file)
@@ -14,6 +14,7 @@ import java.io.InputStream;
  * @VERSION@
  * @since 5.0
  */
+@SuppressWarnings("serial")
 public class HttpUploadStream implements
         com.itmill.toolkit.terminal.UploadStream {
 
index 81351daf0cf07dc4a61d8ef3be08da5bd387118e..95818a4e4661232819a9f27f29ad7560abfbd012 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.terminal.gwt.server;
 
 import java.io.PrintWriter;
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -31,6 +32,7 @@ import com.itmill.toolkit.ui.Component;
  * @VERSION@
  * @since 5.0
  */
+@SuppressWarnings("serial")
 public class JsonPaintTarget implements PaintTarget {
 
     /* Document type declarations */
@@ -813,7 +815,7 @@ public class JsonPaintTarget implements PaintTarget {
      * @author mattitahvonen
      * 
      */
-    class JsonTag {
+    class JsonTag implements Serializable {
         boolean firstField = false;
 
         Vector variables = new Vector();
@@ -963,14 +965,14 @@ public class JsonPaintTarget implements PaintTarget {
         }
     }
 
-    abstract class Variable {
+    abstract class Variable implements Serializable {
 
         String name;
 
         public abstract String getJsonPresentation();
     }
 
-    class BooleanVariable extends Variable {
+    class BooleanVariable extends Variable implements Serializable {
         boolean value;
 
         public BooleanVariable(VariableOwner owner, String name, boolean v) {
@@ -985,7 +987,7 @@ public class JsonPaintTarget implements PaintTarget {
 
     }
 
-    class StringVariable extends Variable {
+    class StringVariable extends Variable implements Serializable {
         String value;
 
         public StringVariable(VariableOwner owner, String name, String v) {
@@ -1000,7 +1002,7 @@ public class JsonPaintTarget implements PaintTarget {
 
     }
 
-    class IntVariable extends Variable {
+    class IntVariable extends Variable implements Serializable {
         int value;
 
         public IntVariable(VariableOwner owner, String name, int v) {
@@ -1014,7 +1016,7 @@ public class JsonPaintTarget implements PaintTarget {
         }
     }
 
-    class LongVariable extends Variable {
+    class LongVariable extends Variable implements Serializable {
         long value;
 
         public LongVariable(VariableOwner owner, String name, long v) {
@@ -1028,7 +1030,7 @@ public class JsonPaintTarget implements PaintTarget {
         }
     }
 
-    class FloatVariable extends Variable {
+    class FloatVariable extends Variable implements Serializable {
         float value;
 
         public FloatVariable(VariableOwner owner, String name, float v) {
@@ -1042,7 +1044,7 @@ public class JsonPaintTarget implements PaintTarget {
         }
     }
 
-    class DoubleVariable extends Variable {
+    class DoubleVariable extends Variable implements Serializable {
         double value;
 
         public DoubleVariable(VariableOwner owner, String name, double v) {
@@ -1056,7 +1058,7 @@ public class JsonPaintTarget implements PaintTarget {
         }
     }
 
-    class ArrayVariable extends Variable {
+    class ArrayVariable extends Variable implements Serializable {
         String[] value;
 
         public ArrayVariable(VariableOwner owner, String name, String[] v) {
index 1ec2d9f93bf8a23fe9756f94fabae850e9b31a14..20df917afbcf28402f63a7f89b09d433c43399da 100644 (file)
@@ -6,6 +6,7 @@ package com.itmill.toolkit.terminal.gwt.server;
 import java.io.IOException;\r
 import java.io.OutputStream;\r
 import java.io.PrintWriter;\r
+import java.io.Serializable;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
 import java.util.LinkedHashSet;\r
@@ -28,7 +29,9 @@ import com.itmill.toolkit.Application;
  * @author marc\r
  * \r
  */\r
-public class PortletApplicationContext extends WebApplicationContext {\r
+@SuppressWarnings("serial")\r
+public class PortletApplicationContext extends WebApplicationContext implements\r
+        Serializable {\r
 \r
     protected PortletSession portletSession;\r
 \r
@@ -182,7 +185,7 @@ public class PortletApplicationContext extends WebApplicationContext {
         }\r
     }\r
 \r
-    public interface PortletListener {\r
+    public interface PortletListener extends Serializable {\r
         public void handleRenderRequest(RenderRequest request,\r
                 RenderResponse response);\r
 \r
@@ -190,7 +193,8 @@ public class PortletApplicationContext extends WebApplicationContext {
                 ActionResponse response);\r
     }\r
 \r
-    private class RestrictedRenderResponse implements RenderResponse {\r
+    private class RestrictedRenderResponse implements RenderResponse,\r
+            Serializable {\r
 \r
         private RenderResponse response;\r
 \r
index bd085725a3f9bfddf762ecfcf0022f29143dc02f..c6a5238e9035f42c79d99ab835143416cfd1d60a 100644 (file)
@@ -1,7 +1,6 @@
 package com.itmill.toolkit.terminal.gwt.server;
 
+@SuppressWarnings("serial")
 public class SessionExpired extends Exception {
 
-    private static final long serialVersionUID = -2211425033877155423L;
-
 }
index 9ec3b5a2e1274dbc9c1f9b47dd4dc53afa5acaba..098c728587e7725ba096b0b4b03b7f7ca728ea96 100644 (file)
@@ -1,12 +1,8 @@
 package com.itmill.toolkit.terminal.gwt.server;\r
 \r
+@SuppressWarnings("serial")\r
 public class SystemMessageException extends RuntimeException {\r
 \r
-    /**\r
-     * Serial generated by eclipse.\r
-     */\r
-    private static final long serialVersionUID = -8249486543123286960L;\r
-\r
     /**\r
      * Cause of the method exception\r
      */\r
index 143811789a1b7e001fd2dd7c8c50cd2c7e9a6ee4..0193b4d3d77c84a67e103f1f0d42530d71756b69 100644 (file)
@@ -6,9 +6,11 @@ package com.itmill.toolkit.terminal.gwt.server;
 
 import java.io.File;
 import java.io.PrintWriter;
+import java.io.Serializable;
 import java.io.StringWriter;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -30,17 +32,20 @@ import com.itmill.toolkit.service.ApplicationContext;
  * @VERSION@
  * @since 3.1
  */
+@SuppressWarnings("serial")
 public class WebApplicationContext implements ApplicationContext,
-        HttpSessionBindingListener {
+        HttpSessionBindingListener, Serializable {
 
     protected List listeners;
 
-    protected HttpSession session;
+    protected transient HttpSession session;
 
     protected final HashSet applications = new HashSet();
 
     protected WebBrowser browser = new WebBrowser();
 
+    protected HashMap<Application, CommunicationManager> applicationToAjaxAppMgrMap = new HashMap<Application, CommunicationManager>();
+
     /**
      * Creates a new Web Application Context.
      * 
@@ -230,7 +235,7 @@ public class WebApplicationContext implements ApplicationContext,
                 final Application app = (Application) applications.iterator()
                         .next();
                 app.close();
-                ApplicationServlet.applicationToAjaxAppMgrMap.remove(app);
+                applicationToAjaxAppMgrMap.remove(app);
                 removeApplication(app);
             }
         } catch (Exception e) {
@@ -257,4 +262,25 @@ public class WebApplicationContext implements ApplicationContext,
     public WebBrowser getBrowser() {
         return browser;
     }
+
+    /**
+     * Gets communication manager for an application.
+     * 
+     * If this application has not been running before, new manager is created.
+     * 
+     * @param application
+     * @return CommunicationManager
+     */
+    protected CommunicationManager getApplicationManager(
+            Application application, ApplicationServlet servlet) {
+        CommunicationManager mgr = applicationToAjaxAppMgrMap.get(application);
+
+        if (mgr == null) {
+            // Creates new manager
+            mgr = new CommunicationManager(application, servlet);
+            applicationToAjaxAppMgrMap.put(application, mgr);
+        }
+        return mgr;
+    }
+
 }
index 027a8361deb51d68cd441972f0ec09a3b7f46ad8..789c28b84392a7540ae65fe2be76d70d68fba7bd 100644 (file)
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 
 import com.itmill.toolkit.terminal.Terminal;
 
+@SuppressWarnings("serial")
 public class WebBrowser implements Terminal {
 
     private int screenHeight = 0;
diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket695.java b/src/com/itmill/toolkit/tests/tickets/Ticket695.java
new file mode 100644 (file)
index 0000000..fc040d8
--- /dev/null
@@ -0,0 +1,40 @@
+package com.itmill.toolkit.tests.tickets;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.Window;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+public class Ticket695 extends Application {
+
+       private static final long serialVersionUID = 3803150085397590662L;
+
+       @Override
+       public void init() {
+               final Window w = new Window("Serialization test #695");
+               setMainWindow(w);
+               Button b = new Button("Serialize ApplicationContext");
+               w.addComponent(b);
+               b.addListener(new Button.ClickListener() {
+
+                       public void buttonClick(ClickEvent event) {
+                               ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+                               try {
+                                       ObjectOutputStream oos = new ObjectOutputStream(buffer);
+                                       oos.writeObject(getContext());
+                                       w.showNotification("ApplicationContext serialized ("
+                                                       + buffer.size() + "bytes)");
+                               } catch (IOException e) {
+                                       e.printStackTrace();
+                                       w
+                                                       .showNotification("ApplicationContext serialization failed - see console for stacktrace");
+                               }
+
+                       }
+               });
+       }
+
+}
index 72e9526552169b81fb53570f9058ad55dee6b0b8..f3b65e2111e32cbd1a08877f193b4ee8bfbcad52 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -15,6 +16,7 @@ import com.itmill.toolkit.terminal.gwt.client.ui.IAbsoluteLayout;
  * positioning.
  * 
  */
+@SuppressWarnings("serial")
 public class AbsoluteLayout extends AbstractLayout {
 
     private Collection<Component> components = new LinkedHashSet<Component>();
@@ -72,7 +74,7 @@ public class AbsoluteLayout extends AbstractLayout {
      * in generic java tools
      * 
      */
-    public class ComponentPosition {
+    public class ComponentPosition implements Serializable {
 
         private int zIndex = -1;
         private float top = -1;
index 0d7f40d5b230ac68e3c88603ad6c40695e22b98b..f067b52b88ae4cc2081ac59d2ce82a337f57ab31 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -35,6 +36,7 @@ import com.itmill.toolkit.terminal.gwt.server.ComponentSizeValidator;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public abstract class AbstractComponent implements Component, MethodEventSource {
 
     /* Private members */
@@ -1236,7 +1238,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
     public interface ComponentErrorEvent extends Terminal.ErrorEvent {
     }
 
-    public interface ComponentErrorHandler {
+    public interface ComponentErrorHandler extends Serializable {
         /**
          * Handle the component error
          * 
index b9e96533e6e6f53c24df34c83684f764ccd41d0b..b46117d115c9f6b485879f54ce681cbe948d9a05 100644 (file)
@@ -19,6 +19,7 @@ import java.util.LinkedList;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public abstract class AbstractComponentContainer extends AbstractComponent
         implements ComponentContainer {
 
index 4d717826e617f088ede26e91eb1d96bcdc78ed4b..3cbc788d6b9ef8cac9186debfe6da0b9e6d0a37a 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.Collections;
@@ -49,6 +50,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public abstract class AbstractField extends AbstractComponent implements Field,
         Property.ReadOnlyStatusChangeNotifier {
 
@@ -873,12 +875,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
      * @since 3.0
      */
     public class ReadOnlyStatusChangeEvent extends Component.Event implements
-            Property.ReadOnlyStatusChangeEvent {
-
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3258688823264161846L;
+            Property.ReadOnlyStatusChangeEvent, Serializable {
 
         /**
          * New instance of text change event.
index d250501b46fe2e5453db95f706881c5e50b9e3e6..63e70b8350169df47e0c2c7f4a837b559aa5227e 100644 (file)
@@ -17,6 +17,7 @@ import com.itmill.toolkit.ui.Layout.MarginHandler;
  * @VERSION@
  * @since 5.0
  */
+@SuppressWarnings("serial")
 public abstract class AbstractLayout extends AbstractComponentContainer
         implements Layout, MarginHandler {
 
index 8d4b78b3edd16b6cb35b9bcd2f082dfaea239d8d..94a3bf3778f14d9f1b0cc5ad653a004dcb11f37b 100644 (file)
@@ -14,6 +14,7 @@ import com.itmill.toolkit.terminal.PaintException;
 import com.itmill.toolkit.terminal.PaintTarget;
 import com.itmill.toolkit.terminal.Sizeable;
 
+@SuppressWarnings("serial")
 public abstract class AbstractOrderedLayout extends AbstractLayout implements
         Layout.AlignmentHandler, Layout.SpacingHandler {
 
index 86fbc7adc286e902f575c03f1bc937218d60df3a..05f08c5a8f15ea15a524d7a1a77866d0a300a0de 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -41,6 +42,7 @@ import com.itmill.toolkit.terminal.Resource;
  * @VERSION@
  * @since 5.0
  */
+@SuppressWarnings("serial")
 public abstract class AbstractSelect extends AbstractField implements
         Container, Container.Viewer, Container.PropertySetChangeListener,
         Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier,
@@ -90,7 +92,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in the
      * caption.
      */
-    public interface Filtering {
+    public interface Filtering extends Serializable {
         public static final int FILTERINGMODE_OFF = 0;
         public static final int FILTERINGMODE_STARTSWITH = 1;
         public static final int FILTERINGMODE_CONTAINS = 2;
@@ -459,7 +461,7 @@ public abstract class AbstractSelect extends AbstractField implements
         return newItemHandler;
     }
 
-    public interface NewItemHandler {
+    public interface NewItemHandler extends Serializable {
         void addNewItem(String newItemCaption);
     }
 
@@ -1464,7 +1466,8 @@ public abstract class AbstractSelect extends AbstractField implements
     /**
      * Implementation of item set change event.
      */
-    private class ItemSetChangeEvent implements Container.ItemSetChangeEvent {
+    private class ItemSetChangeEvent implements Serializable,
+            Container.ItemSetChangeEvent {
 
         /**
          * Gets the Property where the event occurred.
@@ -1481,7 +1484,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Implementation of property set change event.
      */
     private class PropertySetChangeEvent implements
-            Container.PropertySetChangeEvent {
+            Container.PropertySetChangeEvent, Serializable {
 
         /**
          * Retrieves the Container whose contents have been modified.
index 78d9c42743214cb5450b6ff8843c3cf221a1171a..c7aeb369e6e306d4eaac29a2ad9d873b549a6835 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.ui;
 
+@SuppressWarnings("serial")
 public class Accordion extends TabSheet {
 
     @Override
index 6d7ad9accf353e2593da86dd64eb587b29e7588a..91afc090fe1cf816768dd184579c8ef292d87943 100644 (file)
@@ -1,12 +1,15 @@
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo.Bits;
 
 /**
  * Class containing information about alignment of a component. Use the
  * pre-instantiated classes.
  */
-public final class Alignment {
+@SuppressWarnings("serial")
+public final class Alignment implements Serializable {
 
     public static final Alignment TOP_RIGHT = new Alignment(Bits.ALIGNMENT_TOP
             + Bits.ALIGNMENT_RIGHT);
index 6a3c556241b24293c5a5a673dd807bc9d87272a8..f9962bef2268c5b56d4c1d8eeb23f81d608d7b4b 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -23,7 +24,8 @@ import com.itmill.toolkit.ui.Layout.AlignmentHandler;
  * r,right for right alignment
  * 
  */
-public class AlignmentUtils {
+@SuppressWarnings("serial")
+public class AlignmentUtils implements Serializable {
 
     private static int horizontalMask = AlignmentHandler.ALIGNMENT_LEFT
             | AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER
index 00e27fdfcc908bdb88204fc1beab6d9d86a56ad6..d5fd225322fe4d47e945a70d9a6860e0a186e454 100644 (file)
@@ -25,6 +25,7 @@ import com.itmill.toolkit.data.Property;
  * @since 3.1
  */
 
+@SuppressWarnings("serial")
 public class BaseFieldFactory implements FieldFactory {
 
     /**
index e90ac2f12abee4696132674b73dc0e386b5aa9de..2af5ba49a3039fbf0daa1d5938cb1ef3b356e5c9 100644 (file)
@@ -5,6 +5,7 @@
 package com.itmill.toolkit.ui;
 
 import java.io.IOException;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Map;
 
@@ -20,6 +21,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Button extends AbstractField {
 
     /* Private members */
@@ -269,11 +271,6 @@ public class Button extends AbstractField {
      */
     public class ClickEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3546647602931118393L;
-
         /**
          * New instance of text change event.
          * 
@@ -302,7 +299,7 @@ public class Button extends AbstractField {
      * @VERSION@
      * @since 3.0
      */
-    public interface ClickListener {
+    public interface ClickListener extends Serializable {
 
         /**
          * Button has been pressed.
index abb8d7bff66b0272f90caec29ebc2edcf4f0883a..731808a55edf71b05b5aecda7f0b72c77a52a9d0 100644 (file)
@@ -8,6 +8,7 @@ import java.lang.reflect.Method;
 
 import com.itmill.toolkit.data.Property;
 
+@SuppressWarnings("serial")
 public class CheckBox extends Button {
     /**
      * Creates a new switch button.
index 1c251ef0a00c84cbfba66f03b1c47d528a72a786..a901d00540a1951c968f44493f0ffc21fb3c464a 100644 (file)
@@ -18,6 +18,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * can not turn on multi-select mode.\r
  * \r
  */\r
+@SuppressWarnings("serial")\r
 public class ComboBox extends Select {\r
 \r
     private String inputPrompt = null;\r
@@ -74,6 +75,7 @@ public class ComboBox extends Select {
         this.inputPrompt = inputPrompt;\r
     }\r
 \r
+    @Override\r
     public void paintContent(PaintTarget target) throws PaintException {\r
         if (inputPrompt != null) {\r
             target.addAttribute("prompt", inputPrompt);\r
index 5368bca2cc57ed32cd2354662c9c9d0db4088b19..9fbc6231cc039b979d66bdc2a5d3169f9ffa45e2 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.EventListener;
 import java.util.EventObject;
@@ -25,7 +26,8 @@ import com.itmill.toolkit.terminal.VariableOwner;
  * @VERSION@
  * @since 3.0
  */
-public interface Component extends Paintable, VariableOwner, Sizeable {
+public interface Component extends Paintable, VariableOwner, Sizeable,
+        Serializable {
 
     /**
      * Gets style for component. Multiple styles are joined with spaces.
@@ -316,11 +318,6 @@ public interface Component extends Paintable, VariableOwner, Sizeable {
      */
     public class Event extends EventObject {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 4048791277653274933L;
-
         /**
          * Constructs a new event with a specified source component.
          * 
@@ -335,7 +332,7 @@ public interface Component extends Paintable, VariableOwner, Sizeable {
     /**
      * Listener interface for receiving <code>Component.Event</code>s.
      */
-    public interface Listener extends EventListener {
+    public interface Listener extends EventListener, Serializable {
 
         /**
          * Notifies the listener of a component event.
@@ -366,13 +363,9 @@ public interface Component extends Paintable, VariableOwner, Sizeable {
     /**
      * Class of all component originated <code>ErrorEvent</code>s.
      */
+    @SuppressWarnings("serial")
     public class ErrorEvent extends Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 4051323457293857333L;
-
         private final ErrorMessage message;
 
         /**
@@ -401,7 +394,7 @@ public interface Component extends Paintable, VariableOwner, Sizeable {
     /**
      * Listener interface for receiving <code>Component.Errors</code>s.
      */
-    public interface ErrorListener extends EventListener {
+    public interface ErrorListener extends EventListener, Serializable {
 
         /**
          * Notifies the listener of a component error.
index a73c8f4d6eb9a292ce7c143e12180bf04665b370..b696c0730d19c5bf5eb4abacc3f5d464de73c198 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.Iterator;
 
 /**
@@ -116,7 +117,7 @@ public interface ComponentContainer extends Component {
     /**
      * Component attach listener interface.
      */
-    public interface ComponentAttachListener {
+    public interface ComponentAttachListener extends Serializable {
 
         /**
          * A new component is attached to container.
@@ -130,7 +131,7 @@ public interface ComponentContainer extends Component {
     /**
      * Component detach listener interface.
      */
-    public interface ComponentDetachListener {
+    public interface ComponentDetachListener extends Serializable {
 
         /**
          * A component has been detached from container.
@@ -144,13 +145,9 @@ public interface ComponentContainer extends Component {
     /**
      * Component attach event sent when a component is attached to container.
      */
+    @SuppressWarnings("serial")
     public class ComponentAttachEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257285812184692019L;
-
         private final Component component;
 
         /**
@@ -192,13 +189,9 @@ public interface ComponentContainer extends Component {
     /**
      * Component detach event sent when a component is detached from container.
      */
+    @SuppressWarnings("serial")
     public class ComponentDetachEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3618140052337930290L;
-
         private final Component component;
 
         /**
index b0bc392f269a72fb0c979491b962daa91dd03642..83136094750df347ef5f70e60a89ff327313dd5b 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.Iterator;
 
 import com.itmill.toolkit.terminal.PaintException;
@@ -23,6 +24,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class CustomComponent extends AbstractComponentContainer {
 
     /**
@@ -146,23 +148,26 @@ public class CustomComponent extends AbstractComponentContainer {
         return "customcomponent";
     }
 
-    public Iterator getComponentIterator() {
-        return new Iterator() {
-            boolean first = getCompositionRoot() != null;
+    private class ComponentIterator implements Iterator, Serializable {
+        boolean first = getCompositionRoot() != null;
 
-            public boolean hasNext() {
-                return first;
-            }
+        public boolean hasNext() {
+            return first;
+        }
 
-            public Object next() {
-                first = false;
-                return root;
-            }
+        public Object next() {
+            first = false;
+            return root;
+        }
 
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        };
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public Iterator getComponentIterator() {
+        return new ComponentIterator();
     }
 
     /**
index 826ddfb9b2aae5eb1bbb950afcca7f4f5b3ca5cc..5fdfe24770cf17bc63d10b11a0478bd12ee35bf5 100644 (file)
@@ -40,6 +40,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class CustomLayout extends AbstractLayout {
 
     private static final int BUFFER_SIZE = 10000;
index 96ddc08b9e1698d0174e29a9fa57de2861f294c0..6f76de48c5e6f521770cbf87a718e49f15840831 100644 (file)
@@ -33,6 +33,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class DateField extends AbstractField {
 
     /* Private members */
index 9577a2b643c307a5a7c59654951dd68fd36f0cb9..6b1e2af445d44f29569c174b96c2497cc1e1127a 100644 (file)
@@ -19,6 +19,7 @@ import com.itmill.toolkit.terminal.Resource;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Embedded extends AbstractComponent {
 
     /**
index 352d11d1fddc0ff76a9986bd41379bc6651f011b..ea6f037daa234ec5ae31bb347e19cea930d152af 100644 (file)
@@ -18,6 +18,7 @@ package com.itmill.toolkit.ui;
  * 
  * @deprecated Deprecated in favor of the new OrderedLayout
  */
+@SuppressWarnings("serial")
 @Deprecated
 public class ExpandLayout extends OrderedLayout {
 
index 9f63fe0f18d50412b380d5f5730e00f0f15c3b3a..8fb339a35d6ab6bb6e3932c99b7eddc907504800 100644 (file)
@@ -79,14 +79,10 @@ public interface Field extends Component, BufferedValidatable, Property,
      * @VERSION@
      * @since 3.0
      */
+    @SuppressWarnings("serial")
     public class ValueChangeEvent extends Component.Event implements
             Property.ValueChangeEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3545803169444672816L;
-
         /**
          * Constructs a new event object with the specified source field object.
          * 
index 01bc707cc711d1476cde315d4e291090add39302..6598577f48004efb3805e180bb9dc9ea52435307 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.data.Container;
 import com.itmill.toolkit.data.Item;
 import com.itmill.toolkit.data.Property;
@@ -17,7 +19,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@
  * @since 3.1
  */
-public interface FieldFactory {
+public interface FieldFactory extends Serializable {
 
     /**
      * Creates a field based on type of data.
index b31feaea6872be500dc4a942aeb37f719606190a..ee45ec0478d6c476fc279395ce9fc701bf6007db 100644 (file)
@@ -53,6 +53,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         Validatable {
 
index ddff9fa07ff1eeae51c6b98eda057cf1a13451d2..54074f05f9f0901c91508d57e3058d798156c211 100644 (file)
@@ -19,6 +19,7 @@ package com.itmill.toolkit.ui;
  * bottom are by default on.
  * 
  */
+@SuppressWarnings( { "deprecation", "serial" })
 public class FormLayout extends OrderedLayout {
 
     public FormLayout() {
index 17cdc6754f7e0ef21cfc5df58d363ff664d764e2..608871bcf50d3c49f9fc04371d59be46d23bacc5 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -34,6 +35,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class GridLayout extends AbstractLayout implements
         Layout.AlignmentHandler, Layout.SpacingHandler {
 
@@ -656,7 +658,7 @@ public class GridLayout extends AbstractLayout implements
      * @VERSION@
      * @since 3.0
      */
-    public class Area {
+    public class Area implements Serializable {
 
         /**
          * The column of the upper left corner cell of the area.
@@ -843,11 +845,6 @@ public class GridLayout extends AbstractLayout implements
      */
     public class OverlapsException extends java.lang.RuntimeException {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3978144339870101561L;
-
         private final Area existingArea;
 
         /**
@@ -880,11 +877,6 @@ public class GridLayout extends AbstractLayout implements
      */
     public class OutOfBoundsException extends java.lang.RuntimeException {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3618985589664592694L;
-
         private final Area areaOutOfBounds;
 
         /**
index 1ae5d7a375aab850467e0c9a048f2d66750cebbc..f648ba157a10ef8993d09d12f2517ce0d89900fd 100644 (file)
@@ -11,6 +11,7 @@ package com.itmill.toolkit.ui;
  * @VERSION@
  * @since 5.3
  */
+@SuppressWarnings("serial")
 public class HorizontalLayout extends AbstractOrderedLayout {
 
     public HorizontalLayout() {
index 46db9c7fc71a9d088ec529d4f28ea4f492fc75c5..d24f1ecba511ab35ff877bb62b4d4bfb04479053 100644 (file)
@@ -21,6 +21,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@\r
  * @since 5.0\r
  */\r
+@SuppressWarnings("serial")\r
 public class InlineDateField extends DateField {\r
 \r
     public InlineDateField() {\r
index 1a9e497e9c51acb7ca45b72db7260f1d4626d2cb..4a272ed1d1b5ab603a1480798c01e809939e0559 100644 (file)
@@ -36,6 +36,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Label extends AbstractComponent implements Property,
         Property.Viewer, Property.ValueChangeListener,
         Property.ValueChangeNotifier, Comparable {
@@ -403,11 +404,6 @@ public class Label extends AbstractComponent implements Property,
     public class ValueChangeEvent extends Component.Event implements
             Property.ValueChangeEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3906084563938586935L;
-
         /**
          * New instance of text change event
          * 
index 78de97eaa83475a77fd54a70c50f76465b3f215c..d18cd93ea1105152aaf683aa8d2890bfc2bd95dd 100644 (file)
@@ -4,6 +4,8 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
+
 import com.itmill.toolkit.terminal.gwt.client.ui.IMarginInfo;
 import com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo.Bits;
 
@@ -18,7 +20,7 @@ import com.itmill.toolkit.terminal.gwt.client.ui.AlignmentInfo.Bits;
  * @VERSION@
  * @since 3.0
  */
-public interface Layout extends ComponentContainer {
+public interface Layout extends ComponentContainer, Serializable {
 
     /**
      * Enable layout margins. Affects all four sides of the layout. This will
@@ -48,7 +50,7 @@ public interface Layout extends ComponentContainer {
      * AlignmentHandler is most commonly an advanced {@link Layout} that can
      * align its components.
      */
-    public interface AlignmentHandler {
+    public interface AlignmentHandler extends Serializable {
 
         /**
          * Contained component should be aligned horizontally to the left.
@@ -149,7 +151,7 @@ public interface Layout extends ComponentContainer {
      * components.
      * 
      */
-    public interface SpacingHandler {
+    public interface SpacingHandler extends Serializable {
         /**
          * Enable spacing between child components within this layout.
          * 
@@ -184,7 +186,7 @@ public interface Layout extends ComponentContainer {
      * This type of layout supports automatic addition of margins (space around
      * its components).
      */
-    public interface MarginHandler {
+    public interface MarginHandler extends Serializable {
         /**
          * Enable margins for this layout.
          * 
@@ -212,7 +214,8 @@ public interface Layout extends ComponentContainer {
         public MarginInfo getMargin();
     }
 
-    public static class MarginInfo extends IMarginInfo {
+    @SuppressWarnings("serial")
+    public static class MarginInfo extends IMarginInfo implements Serializable {
 
         public MarginInfo(boolean enabled) {
             super(enabled, enabled, enabled, enabled);
index 50c1470acd22027e568fda88e9a0aadd173d43ad..53f28373861a60536f42517415e3e98fe1d00dd4 100644 (file)
@@ -16,6 +16,7 @@ import com.itmill.toolkit.terminal.Resource;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Link extends AbstractComponent {
 
     /* Target window border type constant: No window border */
index 508ac5085830f9691417df61c1bee4c7758fe5be..9d3fe70fdbb408045f1e1d8d6ae909d38c8276c1 100644 (file)
@@ -14,6 +14,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * This is a simple list select without, for instance, support for new items,
  * lazyloading, and other advanced features.
  */
+@SuppressWarnings("serial")
 public class ListSelect extends AbstractSelect {
 
     private int columns = 0;
index 4aa5c704e8001c14ec1aa89e30f47e0f28141b74..06b9de2a7df4f67a3441eb28a6104e7e210224c9 100644 (file)
@@ -1,6 +1,7 @@
 package com.itmill.toolkit.ui;
 
 import java.io.ByteArrayInputStream;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.HashMap;
@@ -33,6 +34,7 @@ import com.itmill.toolkit.terminal.URIHandler;
  * 
  * @since 5.3
  */
+@SuppressWarnings("serial")
 public class LoginForm extends CustomComponent {
 
     private Embedded iframe = new Embedded();
@@ -185,8 +187,6 @@ public class LoginForm extends CustomComponent {
      */
     public class LoginEvent extends Event {
 
-        private static final long serialVersionUID = 1966036438671224308L;
-
         private Map params;
 
         private LoginEvent(Map params) {
@@ -213,7 +213,7 @@ public class LoginForm extends CustomComponent {
      * Login listener is a class capable to listen LoginEvents sent from
      * LoginBox
      */
-    public interface LoginListener {
+    public interface LoginListener extends Serializable {
         /**
          * This method is fired on each login form post.
          * 
index c0f400933cc8ae96896e25cf4f9268dc4603bd2d..e3004eb196155efda78270694956afe0dd075171 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -17,6 +18,7 @@ import com.itmill.toolkit.terminal.Resource;
  * are represented as vertical menu.
  * </p>
  */
+@SuppressWarnings("serial")
 public class MenuBar extends AbstractComponent {
 
     // Items of the top-level menu
@@ -70,7 +72,7 @@ public class MenuBar extends AbstractComponent {
         // This generates the tree from the contents of the menu
         while (itr.hasNext()) {
 
-            MenuItem item = (MenuItem) itr.next();
+            MenuItem item = itr.next();
 
             target.startTag("item");
 
@@ -127,7 +129,7 @@ public class MenuBar extends AbstractComponent {
 
             // Go through all the items in the menu
             while (!found && !items.empty()) {
-                tmpItem = (MenuItem) items.pop();
+                tmpItem = items.pop();
                 found = (clickedId.intValue() == tmpItem.getId());
 
                 if (tmpItem.hasChildren()) {
@@ -343,7 +345,7 @@ public class MenuBar extends AbstractComponent {
      * {@link com.itmill.toolkit.ui.MenuBar.MenuItem}. The selected item is
      * given as an argument.
      */
-    public interface Command {
+    public interface Command extends Serializable {
         public void menuSelected(MenuBar.MenuItem selectedItem);
     }
 
@@ -354,7 +356,7 @@ public class MenuBar extends AbstractComponent {
      * multiple MenuItems to a MenuItem and create a sub-menu.
      * 
      */
-    public class MenuItem {
+    public class MenuItem implements Serializable {
 
         /** Private members * */
         private final int itsId;
index 2cd78ac69924d7ad991f84dca71dd3185069f764..33a88c4cebac5531af4f73df1474a323b792fcf5 100644 (file)
@@ -16,6 +16,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * "native" select without all the bells-and-whistles of the ComboBox is a
  * better choice.
  */
+@SuppressWarnings("serial")
 public class NativeSelect extends AbstractSelect {
 
     // width in characters, mimics TextField
index 2ebaaea3ea1483d17f76d6c28e46ca3b3280e53d..25664b2a7a597a773328dcec9da2d5c637eed685 100644 (file)
@@ -13,6 +13,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
 /**
  * Configures select to be used as an option group.
  */
+@SuppressWarnings("serial")
 public class OptionGroup extends AbstractSelect {
 
     public OptionGroup() {
index e95c490ee154572ffd5eacc324339697b8c599e2..61c59b31aa1efc72766abf3cf190e155802b6361 100644 (file)
@@ -18,6 +18,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  *             OrderedLayout but AbstractOrderedLayout (which also OrderedLayout
  *             extends).
  */
+@SuppressWarnings("serial")
 @Deprecated
 public class OrderedLayout extends AbstractOrderedLayout {
     /* Predefined orientations */
index 1a8871e7e3d3d7518c00af3405165913fde672f2..b471a0d33028952ea4281f81c1c5a7f3b079edda 100644 (file)
@@ -24,6 +24,7 @@ import com.itmill.toolkit.terminal.Scrollable;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Panel extends AbstractComponentContainer implements Scrollable,
         ComponentContainer.ComponentAttachListener,
         ComponentContainer.ComponentDetachListener, Action.Container {
index b00f55ae9222d9b58a91c894c11938d3e2720ffd..873b991cd3cbdbeef4a15a352308642247c31462 100644 (file)
@@ -21,6 +21,7 @@ import com.itmill.toolkit.data.Property;
  * @VERSION@\r
  * @since 5.0\r
  */\r
+@SuppressWarnings("serial")\r
 public class PopupDateField extends DateField {\r
 \r
     public PopupDateField() {\r
index 183187ebae366796be214d988aecd48deffcb280..a9b9cb13be00be305e6d70e64fceb961328febf7 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Iterator;
 import java.util.Map;
@@ -16,6 +17,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * 
  * @author IT Mill Ltd.
  */
+@SuppressWarnings("serial")
 public class PopupView extends AbstractComponentContainer {
 
     private Content content;
@@ -330,7 +332,7 @@ public class PopupView extends AbstractComponentContainer {
      * dynamically loaded when they are redrawn. The user must take care that
      * neither of these methods ever return null.
      */
-    public interface Content {
+    public interface Content extends Serializable {
 
         /**
          * This should return a small view of the full data.
@@ -385,10 +387,6 @@ public class PopupView extends AbstractComponentContainer {
      * 
      */
     public class PopupVisibilityEvent extends Event {
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = -130167162207143457L;
 
         public PopupVisibilityEvent(PopupView source) {
             super(source);
@@ -418,7 +416,7 @@ public class PopupView extends AbstractComponentContainer {
      * visibility of the popup changes.
      * 
      */
-    public interface PopupVisibilityListener {
+    public interface PopupVisibilityListener extends Serializable {
         /**
          * Pass to {@link PopupView#PopupVisibilityEvent} to start listening for
          * popup visibility changes.
index fc5b308b64e156960ce712d497efdf6ec74f0714..6f05db772daf569ffa1b9983eadc4c7bd5783c05 100644 (file)
@@ -23,6 +23,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 4
  */
+@SuppressWarnings("serial")
 public class ProgressIndicator extends AbstractField implements Property,
         Property.Viewer, Property.ValueChangeListener {
 
index fad763819d81a9a73bb63f398e1f4e1f5920314f..4e2830329b456a6c4dbb0357e5169dbf6acc4319 100644 (file)
@@ -14,6 +14,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * {@link RichTextArea} may produce unexpected results as formatting is counted
  * into length of field.
  */
+@SuppressWarnings("serial")
 public class RichTextArea extends TextField {
 
     @Override
index a778155b75baa02f6252449f4dd184c9330bd533..a1acec5e3e7218b3b301b984925fd39ad098abd0 100644 (file)
@@ -35,6 +35,7 @@ import com.itmill.toolkit.terminal.Resource;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Select extends AbstractSelect implements AbstractSelect.Filtering {
 
     /**
index 0fb3496404a285549bd0386da47b0d57714e67d9..e47eb9a7d4c0d9cc2333d1e5161cc2cdc49a6676 100644 (file)
@@ -10,9 +10,9 @@ import com.itmill.toolkit.terminal.PaintException;
 import com.itmill.toolkit.terminal.PaintTarget;\r
 \r
 /**\r
- * A component for selecting a numerical value within a range. A Slider\r
- * can have the appearance of a scroll bar or e.g. look like an Adobe Photoshop\r
- * style of a slider.\r
+ * A component for selecting a numerical value within a range. A Slider can have\r
+ * the appearance of a scroll bar or e.g. look like an Adobe Photoshop style of\r
+ * a slider.\r
  * \r
  * Example code: <code>\r
  *     class MyPlayer extends CustomComponent implements ValueChangeListener {\r
@@ -46,6 +46,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * \r
  * @author IT Mill Ltd.\r
  */\r
+@SuppressWarnings("serial")\r
 public class Slider extends AbstractField {\r
 \r
     public static final int ORIENTATION_HORIZONTAL = 0;\r
@@ -485,11 +486,6 @@ public class Slider extends AbstractField {
      */\r
     public class ValueOutOfBoundsException extends Exception {\r
 \r
-        /**\r
-         * Serial generated by Eclipse.\r
-         */\r
-        private static final long serialVersionUID = -6451298598644446340L;\r
-\r
         private final Double value;\r
 \r
         /**\r
index 2af72da31069366e03ffc988aded987eca17804e..06b8073c6cd9872a1c5eebfaa34fef56aa5e7cfe 100644 (file)
@@ -22,6 +22,7 @@ import com.itmill.toolkit.terminal.gwt.client.RenderInformation.Size;
  * @VERSION@
  * @since 5.0
  */
+@SuppressWarnings("serial")
 public class SplitPanel extends AbstractLayout {
 
     /* Predefined orientations */
index 25a5c65455a4e4cb28966f2116fa004af96a0af6..5d2e9ac57fb0007f04ee69d18a8c7f8034eabed2 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -23,6 +24,7 @@ import com.itmill.toolkit.terminal.Paintable.RepaintRequestListener;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class TabSheet extends AbstractComponentContainer implements
         RepaintRequestListener {
 
@@ -203,7 +205,7 @@ public class TabSheet extends AbstractComponentContainer implements
              * not) we select this tab instead
              */
             if (selected == null || !selected.isVisible()
-                    || (!selected.isEnabled() && this.isEnabled())) {
+                    || (!selected.isEnabled() && isEnabled())) {
                 selected = c;
             }
             target.startTag("tab");
@@ -451,11 +453,6 @@ public class TabSheet extends AbstractComponentContainer implements
      */
     public class SelectedTabChangeEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3258129141914940469L;
-
         /**
          * New instance of selected tab change event
          * 
@@ -485,7 +482,7 @@ public class TabSheet extends AbstractComponentContainer implements
      * @VERSION@
      * @since 3.0
      */
-    public interface SelectedTabChangeListener {
+    public interface SelectedTabChangeListener extends Serializable {
 
         /**
          * Visible tab in tab sheet has has been changed.
index 1ad0eda6ad253a8ba3cf94eb190e58e6be9c7ecd..4d4fdba7fb50eee78c934c6bbacee7e5c3345539 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -49,6 +50,7 @@ import com.itmill.toolkit.terminal.gwt.client.MouseEventDetails;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Table extends AbstractSelect implements Action.Container,
         Container.Ordered, Container.Sortable, ItemClickSource {
 
@@ -3067,7 +3069,7 @@ public class Table extends AbstractSelect implements Action.Container,
      * Table.addGeneratedColumn along with an id for the column to be generated.
      * 
      */
-    public interface ColumnGenerator {
+    public interface ColumnGenerator extends Serializable {
 
         /**
          * Called by Table when a cell in a generated column needs to be
@@ -3112,7 +3114,7 @@ public class Table extends AbstractSelect implements Action.Container,
      * to the cell content is <tt>i-table-cell-content-[style name]</tt>, and
      * the row style will be <tt>i-table-row-[style name]</tt>.
      */
-    public interface CellStyleGenerator {
+    public interface CellStyleGenerator extends Serializable {
 
         /**
          * Called by Table when a cell (and row) is painted.
index e5572f0b9fec32d1024d5b3837b9886b3ff07296..8c124799d8932016c0bf7379fa25e3d0fe1bdb75 100644 (file)
@@ -31,6 +31,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class TextField extends AbstractField {
 
     /* Private members */
index 20c7e03961c8ccd18e9d38f85eb2e852db28aac3..18b18651f9f4f55ade8378329454bce51bceec97 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -40,11 +41,10 @@ import com.itmill.toolkit.terminal.gwt.client.MouseEventDetails;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Tree extends AbstractSelect implements Container.Hierarchical,
         Action.Container, ItemClickSource {
 
-    /* Static members */
-
     private static final Method EXPAND_METHOD;
 
     private static final Method COLLAPSE_METHOD;
@@ -723,11 +723,6 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      */
     public class ExpandEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3832624001804481075L;
-
         private final Object expandedItemId;
 
         /**
@@ -760,7 +755,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      * @VERSION@
      * @since 3.0
      */
-    public interface ExpandListener {
+    public interface ExpandListener extends Serializable {
 
         /**
          * A node has been expanded.
@@ -813,11 +808,6 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      */
     public class CollapseEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = 3257009834783290160L;
-
         private final Object collapsedItemId;
 
         /**
@@ -850,7 +840,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
      * @VERSION@
      * @since 3.0
      */
-    public interface CollapseListener {
+    public interface CollapseListener extends Serializable {
 
         /**
          * A node has been collapsed.
index 0876ec81d8fd356483425f5db18b95e8187d7b01..ac004984181b6324bd822c8380334f4bd2c29ff9 100644 (file)
@@ -14,6 +14,7 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * Multiselect component with two lists: left side for available items and right
  * side for selected items.
  */
+@SuppressWarnings("serial")
 public class TwinColSelect extends AbstractSelect {
 
     private int columns = 0;
index a6fe4df8730d10cffab47629e314742bd6d48396..e053d99fabecc5fc5421598f2646c4d30d4b30bd 100644 (file)
@@ -6,6 +6,7 @@ package com.itmill.toolkit.ui;
 
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
@@ -42,6 +43,7 @@ import com.itmill.toolkit.terminal.UploadStream;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Upload extends AbstractComponent implements Component.Focusable {
 
     private boolean delayedFocus;
@@ -235,7 +237,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @VERSION@
      * @since 3.0
      */
-    public interface Receiver {
+    public interface Receiver extends Serializable {
 
         /**
          * Invoked when a new upload arrives.
@@ -291,9 +293,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      */
     public class FinishedEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
         private static final long serialVersionUID = 3257288015385670969L;
 
         /**
@@ -379,9 +378,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      */
     public class FailedEvent extends FinishedEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
         private static final long serialVersionUID = 3833746590157386293L;
 
         private Exception reason = null;
@@ -429,9 +425,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      */
     public class NoOutputStreamEvent extends FailedEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
         private static final long serialVersionUID = 4745219890852396500L;
 
         /**
@@ -452,9 +445,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      */
     public class NoInputStreamEvent extends FailedEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
         private static final long serialVersionUID = -529960205445737170L;
 
         /**
@@ -481,9 +471,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      */
     public class SucceededEvent extends FinishedEvent {
 
-        /**
-         * Serial generated by eclipse.
-         */
         private static final long serialVersionUID = 3256445798169524023L;
 
         /**
@@ -510,9 +497,6 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      */
     public class StartedEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
         private static final long serialVersionUID = -3984393770487403525L;
         private final String filename;
         private final String type;
@@ -567,7 +551,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @VERSION@
      * @since 5.0
      */
-    public interface StartedListener {
+    public interface StartedListener extends Serializable {
 
         /**
          * Upload has started.
@@ -586,7 +570,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @VERSION@
      * @since 3.0
      */
-    public interface FinishedListener {
+    public interface FinishedListener extends Serializable {
 
         /**
          * Upload has finished.
@@ -605,7 +589,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @VERSION@
      * @since 3.0
      */
-    public interface FailedListener {
+    public interface FailedListener extends Serializable {
 
         /**
          * Upload has finished unsuccessfully.
@@ -624,7 +608,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @VERSION@
      * @since 3.0
      */
-    public interface SucceededListener {
+    public interface SucceededListener extends Serializable {
 
         /**
          * Upload successfull..
@@ -966,7 +950,7 @@ public class Upload extends AbstractComponent implements Component.Focusable {
     /**
      * ProgressListener receives events to track progress of upload.
      */
-    public interface ProgressListener {
+    public interface ProgressListener extends Serializable {
         /**
          * Updates progress to listener
          * 
index 11d141e05c7346c4da80486a2b6a18b9fa6d432c..3852bdc7d2f04ee5e022ed85cff9dc8c1122f1ad 100644 (file)
@@ -1,5 +1,6 @@
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Map;
 
@@ -15,12 +16,13 @@ import com.itmill.toolkit.terminal.PaintTarget;
  * bookmarking a program state and back button.
  * 
  */
+@SuppressWarnings("serial")
 public class UriFragmentUtility extends AbstractComponent {
 
     /**
      * Listener that listens changes in URI fragment.
      */
-    public interface FragmentChangedListener {
+    public interface FragmentChangedListener extends Serializable {
 
         public void fragmentChanged(FragmentChangedEvent source);
 
@@ -31,11 +33,6 @@ public class UriFragmentUtility extends AbstractComponent {
      */
     public class FragmentChangedEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse
-         */
-        private static final long serialVersionUID = -4142140007700263197L;
-
         /**
          * Creates a new instance of UriFragmentReader change event.
          * 
index 1bc5e997947457b026c7fdd9c8c91a7dc0e5e69e..21934bbd0f6bb1245723b3873ee945325f5233bb 100644 (file)
@@ -12,6 +12,7 @@ package com.itmill.toolkit.ui;
  * @VERSION@
  * @since 5.3
  */
+@SuppressWarnings("serial")
 public class VerticalLayout extends AbstractOrderedLayout {
 
     public VerticalLayout() {
index 530bd8441d033a94468c5e35bb25ba6c6c649154..9dac2c2c2a392943642abaa72be2e5176bf42c20 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.itmill.toolkit.ui;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -32,6 +33,7 @@ import com.itmill.toolkit.terminal.URIHandler;
  * @VERSION@
  * @since 3.0
  */
+@SuppressWarnings("serial")
 public class Window extends Panel implements URIHandler, ParameterHandler {
 
     /**
@@ -787,7 +789,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
     /**
      * Private data structure for storing opening window properties.
      */
-    private class OpenResource {
+    private class OpenResource implements Serializable {
 
         private final Resource resource;
 
@@ -1000,11 +1002,6 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
 
     public class CloseEvent extends Component.Event {
 
-        /**
-         * Serial generated by eclipse.
-         */
-        private static final long serialVersionUID = -7235770057344367327L;
-
         /**
          * 
          * @param source
@@ -1023,7 +1020,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
         }
     }
 
-    public interface CloseListener {
+    public interface CloseListener extends Serializable {
         public void windowClose(CloseEvent e);
     }
 
@@ -1073,9 +1070,6 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      */
     public class ResizeEvent extends Component.Event {
 
-        // Generated serial
-        private static final long serialVersionUID = 8569831802323447687L;
-
         /**
          * 
          * @param source
@@ -1099,7 +1093,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      * 
      * @see com.itmill.toolkit.ui.Window.ResizeEvent
      */
-    public interface ResizeListener {
+    public interface ResizeListener extends Serializable {
         public void windowResized(ResizeEvent e);
     }
 
@@ -1403,7 +1397,7 @@ public class Window extends Panel implements URIHandler, ParameterHandler {
      * </p>
      * 
      */
-    public static class Notification {
+    public static class Notification implements Serializable {
         public static final int TYPE_HUMANIZED_MESSAGE = 1;
         public static final int TYPE_WARNING_MESSAGE = 2;
         public static final int TYPE_ERROR_MESSAGE = 3;