]> source.dussan.org Git - vaadin-framework.git/commitdiff
1. Removed obsolete dependency framework methods and interface definitions.
authorJani Laakso <jani.laakso@itmill.com>
Wed, 6 Feb 2008 13:06:00 +0000 (13:06 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Wed, 6 Feb 2008 13:06:00 +0000 (13:06 +0000)
2. "Undeprecated" reflection based listeners, we still wish to support these.
But I noted on javadoc that using these methods is discouraged and suggested better methods.

svn changeset:3718/svn branch:trunk

src/com/itmill/toolkit/terminal/VariableOwner.java
src/com/itmill/toolkit/ui/AbstractComponent.java
src/com/itmill/toolkit/ui/Button.java
src/com/itmill/toolkit/ui/CheckBox.java
src/com/itmill/toolkit/ui/CustomComponent.java
src/com/itmill/toolkit/ui/Form.java
src/com/itmill/toolkit/ui/Panel.java

index b14c83d1ef4ac1702c122455dac888935a94bb54..cdb3321ba0d1fedf85d7a983e555f3080fcdfd3b 100644 (file)
@@ -5,7 +5,6 @@
 package com.itmill.toolkit.terminal;
 
 import java.util.Map;
-import java.util.Set;
 
 /**
  * <p>
@@ -16,20 +15,6 @@ import java.util.Set;
  * changes.
  * </p>
  * 
- * <p>
- * The variable-owning components can be linked with <i>dependency relationships</i>.
- * A dependency between two components means that all variable change events to
- * the depended component will be handled before any such events to the
- * depending component.
- * </p>
- * 
- * <p>
- * For example, the commit button for a text field will depend on that text
- * field. This is because we want to handle any pending changes the user makes
- * to the contents on the text field before we accept the click of the commit
- * button which starts processing the text field contents.
- * </p>
- * 
  * @author IT Mill Ltd.
  * @version
  * @VERSION@
@@ -37,17 +22,6 @@ import java.util.Set;
  */
 public interface VariableOwner {
 
-    /**
-     * Dependencies are not needed anymore as HTML-mode is deprecated in Toolkit
-     * 5. *
-     * 
-     * @return Set of <code>VariableOwners</code> this component directly
-     *         depend on, <code>null</code> if this component does not depend
-     *         on anybody.
-     * @deprecated
-     */
-    public Set getDirectDependencies();
-
     /**
      * Called when one or more variables handled by the implementing class are
      * changed.
@@ -60,28 +34,6 @@ public interface VariableOwner {
      */
     public void changeVariables(Object source, Map variables);
 
-    /**
-     * Dependencies are not needed anymore as HTML-mode is deprecated in Toolkit
-     * 5.
-     * 
-     * @param depended
-     *                the <code>VariableOwner</code> component who this
-     *                component depends on.
-     * @deprecated
-     */
-    public void dependsOn(VariableOwner depended);
-
-    /**
-     * Dependencies are not needed anymore as HTML-mode is deprecated in Toolkit
-     * 5.
-     * 
-     * @param depended
-     *                the component to be removed from this component's
-     *                dependency list.
-     * @deprecated
-     */
-    public void removeDirectDependency(VariableOwner depended);
-
     /**
      * <p>
      * Tests if the variable owner is enabled or not. The terminal should not
index 3508266d91754b81513a48c1dd2c274ad26b22d9..07292b885989398ebca2129f9211f51695b048d9 100644 (file)
@@ -11,7 +11,6 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Set;
 
 import com.itmill.toolkit.Application;
 import com.itmill.toolkit.event.EventRouter;
@@ -20,7 +19,6 @@ import com.itmill.toolkit.terminal.ErrorMessage;
 import com.itmill.toolkit.terminal.PaintException;
 import com.itmill.toolkit.terminal.PaintTarget;
 import com.itmill.toolkit.terminal.Resource;
-import com.itmill.toolkit.terminal.VariableOwner;
 
 /**
  * An abstract class that defines default implementation for the
@@ -581,7 +579,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * here, we use the default documentation from implemented interface.
      */
     public final void paint(PaintTarget target) throws PaintException {
-
         if (!target.startTag(this, getTag()) || repaintRequestListenersNotified) {
 
             // Paint the contents of the component
@@ -667,7 +664,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
 
     /* Documentation copied from interface */
     public void childRequestedRepaint(Collection alreadyNotified) {
-
         // Invisible components do not need repaints
         if (!isVisible()) {
             return;
@@ -682,10 +678,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * @param alreadyNotified
      */
     private void fireRequestRepaintEvent(Collection alreadyNotified) {
-
         // Notify listeners only once
         if (!repaintRequestListenersNotified) {
-
             // Notify the listeners
             if (repaintRequestListeners != null
                     && !repaintRequestListeners.isEmpty()) {
@@ -740,18 +734,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * interface.
      */
     public void changeVariables(Object source, Map variables) {
-
-    }
-
-    /* Dependency -framework is deprecated */
-    public void dependsOn(VariableOwner depended) {
-    }
-
-    public void removeDirectDependency(VariableOwner depended) {
-    }
-
-    public Set getDirectDependencies() {
-        return null;
     }
 
     /* General event framework *************************************** */
@@ -800,10 +782,10 @@ public abstract class AbstractComponent implements Component, MethodEventSource
 
     /**
      * <p>
-     * Registers a new listener with the specified activation method to listen
-     * events generated by this component. If the activation method does not
-     * have any arguments the event object will not be passed to it when it's
-     * called.
+     * Convenience method for registering a new listener with the specified
+     * activation method to listen events generated by this component. If the
+     * activation method does not have any arguments the event object will not
+     * be passed to it when it's called.
      * </p>
      * 
      * <p>
@@ -818,6 +800,12 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * {@link com.itmill.toolkit.event com.itmill.toolkit.event package documentation}.
      * </p>
      * 
+     * <p>
+     * Note: Using this method is discouraged because it cannot be checked
+     * during compilation. Use {@link #addListener(Class, Object, Method)} or
+     * {@link #addListener(com.itmill.toolkit.ui.Component.Listener)} instead.
+     * </p>
+     * 
      * @param eventType
      *                the type of the listened event. Events of this type or its
      *                subclasses activate the listener.
@@ -825,10 +813,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      *                the object instance who owns the activation method.
      * @param methodName
      *                the name of the activation method.
-     * @deprecated Use {@link #addListener(Class, Object, Method)} or
-     *             {@link #addListener(com.itmill.toolkit.ui.Component.Listener)}
-     *             instead. Using this method is discouraged because it cannot
-     *             be checked during compilation.
      */
     public void addListener(Class eventType, Object object, String methodName) {
         if (eventRouter == null) {
@@ -929,7 +913,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      *                the Event to be sent to all listeners.
      */
     protected void fireEvent(Component.Event event) {
-
         if (eventRouter != null) {
             eventRouter.fireEvent(event);
         }
@@ -944,7 +927,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * implemented interface.
      */
     public void addListener(Component.Listener listener) {
-
         if (eventRouter == null) {
             eventRouter = new EventRouter();
         }
@@ -959,7 +941,6 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      * interface.
      */
     public void removeListener(Component.Listener listener) {
-
         if (eventRouter != null) {
             eventRouter.removeListener(Component.Event.class, listener,
                     COMPONENT_EVENT_METHOD);
index 605cac85b7479d5b4afffe0600ee2dcdf71f9ab1..538c8953d6565a35bb692832cb83a3e8a395b369 100644 (file)
@@ -63,9 +63,12 @@ public class Button extends AbstractField {
     }
 
     /**
-     * Creates a new push button with a method listening button clicks. The
-     * method must have either no parameters, or only one parameter of
-     * Button.ClickEvent type.
+     * Creates a new push button with a method listening button clicks. Using
+     * this method is discouraged because it cannot be checked during
+     * compilation. Use
+     * {@link #Button(String, com.itmill.toolkit.ui.Button.ClickListener)}
+     * instead. The method must have either no parameters, or only one parameter
+     * of Button.ClickEvent type.
      * 
      * @param caption
      *                the Button caption.
@@ -74,10 +77,6 @@ public class Button extends AbstractField {
      * @param methodName
      *                the name of the method in target object, that receives
      *                button click events.
-     * @deprecated Use
-     *             {@link #Button(String, com.itmill.toolkit.ui.Button.ClickListener)}
-     *             instead. Using this method is discouraged because it cannot
-     *             be checked during compilation.
      */
     public Button(String caption, Object target, String methodName) {
         this(caption);
index 12edb77bff206552389cd3562bb9f37d55202e2a..86ba0fee95fb2ab096b6d9cad09709a194967923 100644 (file)
@@ -45,8 +45,12 @@ public class CheckBox extends Button {
     }
 
     /**
-     * Creates a new switch button with a method listening button clicks. The
-     * method must have either no parameters, or only one parameter of
+     * Convenience method for creating a new switch button with a method
+     * listening button clicks. Using this method is discouraged because it
+     * cannot be checked during compilation. Use
+     * {@link #addListener(Class, Object, Method)} or
+     * {@link #addListener(com.itmill.toolkit.ui.Component.Listener)} instead.
+     * The method must have either no parameters, or only one parameter of
      * Button.ClickEvent type.
      * 
      * @param caption
@@ -56,10 +60,6 @@ public class CheckBox extends Button {
      * @param methodName
      *                the name of the method in target object, that receives
      *                button click events.
-     * @deprecated Use {@link #addListener(Class, Object, Method)} or
-     *             {@link #addListener(com.itmill.toolkit.ui.Component.Listener)}
-     *             instead. Using this method is discouraged because it cannot
-     *             be checked during compilation.
      */
     public CheckBox(String caption, Object target, String methodName) {
         setCaption(caption);
index ef531aa12f33076f4f62757890455aeb43ba0504..7c165df6874b519023cac9f85f0576667116217c 100644 (file)
@@ -8,13 +8,11 @@ import java.util.Collection;
 import java.util.LinkedList;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Set;
 
 import com.itmill.toolkit.Application;
 import com.itmill.toolkit.terminal.PaintException;
 import com.itmill.toolkit.terminal.PaintTarget;
 import com.itmill.toolkit.terminal.Resource;
-import com.itmill.toolkit.terminal.VariableOwner;
 
 /**
  * Custom component provides simple implementation of Component interface for
@@ -424,17 +422,6 @@ public class CustomComponent implements Component {
     public void changeVariables(Object source, Map variables) {
     }
 
-    /* Dependency -framework is deprecated */
-    public void dependsOn(VariableOwner depended) {
-    }
-
-    public void removeDirectDependency(VariableOwner depended) {
-    }
-
-    public Set getDirectDependencies() {
-        return null;
-    }
-
     /* Event functions are not implemented by default -------------------- */
 
     /**
index 4ceebcb186d98aa81e87ce060fba5effd1cfe49b..f818c99481dd7e008aa592b029a2379926f06a1d 100644 (file)
@@ -368,7 +368,6 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
     public void addField(Object propertyId, Field field) {
 
         if (propertyId != null && field != null) {
-            dependsOn(field);
             fields.put(propertyId, field);
             propertyIds.addLast(propertyId);
             field.setReadThrough(readThrough);
@@ -437,7 +436,6 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         if (field != null) {
             propertyIds.remove(id);
             fields.remove(id);
-            removeDirectDependency(field);
             layout.removeComponent(field);
             return true;
         }
@@ -672,9 +670,6 @@ public class Form extends AbstractField implements Item.Editor, Buffered, Item,
         // Replaces the old field with new one
         layout.replaceComponent(oldField, newField);
         fields.put(propertyId, newField);
-        removeDirectDependency(oldField);
-        dependsOn(newField);
-        newField.dependsOn(this);
 
         return newField;
     }
index a155759761fbca9c5d4c809b508df6c11c64ef8b..db1f58646f9a08aa769982de03649c4008264a10 100644 (file)
@@ -124,13 +124,11 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
 
         // Sets the panel to be parent for the layout
         layout.setParent(this);
-        dependsOn(layout);
 
         // If panel already contains a layout, move the contents to new one
         // and detach old layout from the panel
         if (this.layout != null) {
             layout.moveComponentsFrom(this.layout);
-            removeDirectDependency(this.layout);
             this.layout.setParent(null);
         }