]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixed item set change listening. Broken since [5281]
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 2 Sep 2008 05:57:33 +0000 (05:57 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 2 Sep 2008 05:57:33 +0000 (05:57 +0000)
svn changeset:5320/svn branch:trunk

src/com/itmill/toolkit/ui/AbstractSelect.java

index 9f9fbc7b0aa55bdbb635ea797ea23a4d52b37ce2..c1f192586e6bc5ce2b7f91a9a0d004f5cffc92fe 100644 (file)
@@ -47,8 +47,8 @@ public abstract class AbstractSelect extends AbstractField implements
         Container.ItemSetChangeListener {
 
     /**
-     * Item caption mode: Item's ID's <code>String</code> representation is used
-     * as caption.
+     * Item caption mode: Item's ID's <code>String</code> representation is
+     * used as caption.
      */
     public static final int ITEM_CAPTION_MODE_ID = 0;
     /**
@@ -87,8 +87,8 @@ public abstract class AbstractSelect extends AbstractField implements
      * entered value. The value is matched to the item caption.
      * <code>FILTERINGMODE_OFF</code> (0) turns the filtering off.
      * <code>FILTERINGMODE_STARTSWITH</code> (1) matches from the start of the
-     * caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in the
-     * caption.
+     * caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in
+     * the caption.
      */
     public interface Filtering {
         public static final int FILTERINGMODE_OFF = 0;
@@ -99,7 +99,7 @@ public abstract class AbstractSelect extends AbstractField implements
          * Sets the option filtering mode.
          * 
          * @param filteringMode
-         *            the filtering mode to use
+         *                the filtering mode to use
          */
         public void setFilteringMode(int filteringMode);
 
@@ -206,9 +206,10 @@ public abstract class AbstractSelect extends AbstractField implements
      * Creates a new select that is connected to a data-source.
      * 
      * @param caption
-     *            the Caption of the component.
+     *                the Caption of the component.
      * @param dataSource
-     *            the Container datasource to be selected from by this select.
+     *                the Container datasource to be selected from by this
+     *                select.
      */
     public AbstractSelect(String caption, Container dataSource) {
         setCaption(caption);
@@ -219,9 +220,9 @@ public abstract class AbstractSelect extends AbstractField implements
      * Creates a new select that is filled from a collection of option values.
      * 
      * @param caption
-     *            the Caption of this field.
+     *                the Caption of this field.
      * @param options
-     *            the Collection containing the options.
+     *                the Collection containing the options.
      */
     public AbstractSelect(String caption, Collection options) {
 
@@ -243,9 +244,9 @@ public abstract class AbstractSelect extends AbstractField implements
      * Paints the content of this component.
      * 
      * @param target
-     *            the Paint Event.
+     *                the Paint Event.
      * @throws PaintException
-     *             if the paint operation failed.
+     *                 if the paint operation failed.
      */
     public void paintContent(PaintTarget target) throws PaintException {
 
@@ -530,9 +531,9 @@ public abstract class AbstractSelect extends AbstractField implements
 
     /**
      * Returns the type of the property. <code>getValue</code> and
-     * <code>setValue</code> methods must be compatible with this type: one can
-     * safely cast <code>getValue</code> to given type and pass any variable
-     * assignable to this type as a parameter to <code>setValue</code>.
+     * <code>setValue</code> methods must be compatible with this type: one
+     * can safely cast <code>getValue</code> to given type and pass any
+     * variable assignable to this type as a parameter to <code>setValue</code>.
      * 
      * @return the Type of the property.
      */
@@ -585,7 +586,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * @param newValue
-     *            the New selected item or collection of selected items.
+     *                the New selected item or collection of selected items.
      * @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object)
      */
     public void setValue(Object newValue) throws Property.ReadOnlyException,
@@ -607,9 +608,9 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * @param newValue
-     *            the New selected item or collection of selected items.
+     *                the New selected item or collection of selected items.
      * @param repaintIsNotNeeded
-     *            True if caller is sure that repaint is not needed.
+     *                True if caller is sure that repaint is not needed.
      * @see com.itmill.toolkit.ui.AbstractField#setValue(java.lang.Object,
      *      java.lang.Boolean)
      */
@@ -635,7 +636,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * contain the requested item, null is returned.
      * 
      * @param itemId
-     *            the item id.
+     *                the item id.
      * @return the item from the container.
      */
     public Item getItem(Object itemId) {
@@ -664,7 +665,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Gets the property type.
      * 
      * @param propertyId
-     *            the Id identifying the property.
+     *                the Id identifying the property.
      * @see com.itmill.toolkit.data.Container#getType(java.lang.Object)
      */
     public Class getType(Object propertyId) {
@@ -686,7 +687,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Tests, if the collection contains an item with given id.
      * 
      * @param itemId
-     *            the Id the of item to be tested.
+     *                the Id the of item to be tested.
      */
     public boolean containsId(Object itemId) {
         if (itemId != null) {
@@ -779,7 +780,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * returns null.
      * 
      * @param itemId
-     *            the Identification of the item to be created.
+     *                the Identification of the item to be created.
      * @return the Created item with the given id, or null in case of failure.
      * @see com.itmill.toolkit.data.Container#addItem(java.lang.Object)
      */
@@ -839,7 +840,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Sets the container as data-source for viewing.
      * 
      * @param newDataSource
-     *            the new data source.
+     *                the new data source.
      */
     public void setContainerDataSource(Container newDataSource) {
         if (newDataSource == null) {
@@ -852,7 +853,7 @@ public abstract class AbstractSelect extends AbstractField implements
 
             // Removes listeners from the old datasource
             if (items != null) {
-                if (items instanceof Container.ItemSetChangeListener) {
+                if (items instanceof Container.ItemSetChangeNotifier) {
                     ((Container.ItemSetChangeNotifier) items)
                             .removeListener(this);
                 }
@@ -870,7 +871,7 @@ public abstract class AbstractSelect extends AbstractField implements
 
             // Adds listeners
             if (items != null) {
-                if (items instanceof Container.ItemSetChangeListener) {
+                if (items instanceof Container.ItemSetChangeNotifier) {
                     ((Container.ItemSetChangeNotifier) items).addListener(this);
                 }
                 if (items instanceof Container.PropertySetChangeNotifier) {
@@ -910,7 +911,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * selected items, only one of the selected items is kept as selected.
      * 
      * @param multiSelect
-     *            the New value of property multiSelect.
+     *                the New value of property multiSelect.
      */
     public void setMultiSelect(boolean multiSelect) {
         if (multiSelect && getNullSelectionItemId() != null) {
@@ -962,7 +963,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Enables or disables possibility to add new options by the user.
      * 
      * @param allowNewOptions
-     *            the New value of property allowNewOptions.
+     *                the New value of property allowNewOptions.
      */
     public void setNewItemsAllowed(boolean allowNewOptions) {
 
@@ -980,9 +981,9 @@ public abstract class AbstractSelect extends AbstractField implements
      * item and index captions.
      * 
      * @param itemId
-     *            the id of the item to be recaptioned.
+     *                the id of the item to be recaptioned.
      * @param caption
-     *            the New caption.
+     *                the New caption.
      */
     public void setItemCaption(Object itemId, String caption) {
         if (itemId != null) {
@@ -997,7 +998,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * details.
      * 
      * @param itemId
-     *            the id of the item to be queried.
+     *                the id of the item to be queried.
      * @return the caption for specified item.
      */
     public String getItemCaption(Object itemId) {
@@ -1059,9 +1060,9 @@ public abstract class AbstractSelect extends AbstractField implements
      * Sets the icon for an item.
      * 
      * @param itemId
-     *            the id of the item to be assigned an icon.
+     *                the id of the item to be assigned an icon.
      * @param icon
-     *            the New icon.
+     *                the New icon.
      */
     public void setItemIcon(Object itemId, Resource icon) {
         if (itemId != null) {
@@ -1078,7 +1079,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Gets the item icon.
      * 
      * @param itemId
-     *            the id of the item to be assigned an icon.
+     *                the id of the item to be assigned an icon.
      * @return the Icon for the item or null, if not specified.
      */
     public Resource getItemIcon(Object itemId) {
@@ -1117,13 +1118,13 @@ public abstract class AbstractSelect extends AbstractField implements
      * <code>toString</code> is used as item caption.</li>
      * <li><code>ITEM_CAPTION_MODE_ITEM</code> : Item-objects
      * <code>toString</code> is used as item caption.</li>
-     * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is used
-     * as item caption. The index mode can only be used with the containers
+     * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is
+     * used as item caption. The index mode can only be used with the containers
      * implementing <code>Container.Indexed</code> interface.</li>
-     * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must be
-     * explicitly specified.</li>
-     * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are read
-     * from property, that must be specified with
+     * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must
+     * be explicitly specified.</li>
+     * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are
+     * read from property, that must be specified with
      * <code>setItemCaptionPropertyId</code>.</li>
      * </ul>
      * The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default
@@ -1131,7 +1132,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * @param mode
-     *            the One of the modes listed above.
+     *                the One of the modes listed above.
      */
     public void setItemCaptionMode(int mode) {
         if (ITEM_CAPTION_MODE_ID <= mode && mode <= ITEM_CAPTION_MODE_PROPERTY) {
@@ -1153,13 +1154,13 @@ public abstract class AbstractSelect extends AbstractField implements
      * <code>toString</code> is used as item caption.</li>
      * <li><code>ITEM_CAPTION_MODE_ITEM</code> : Item-objects
      * <code>toString</code> is used as item caption.</li>
-     * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is used
-     * as item caption. The index mode can only be used with the containers
+     * <li><code>ITEM_CAPTION_MODE_INDEX</code> : The index of the item is
+     * used as item caption. The index mode can only be used with the containers
      * implementing <code>Container.Indexed</code> interface.</li>
-     * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must be
-     * explicitly specified.</li>
-     * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are read
-     * from property, that must be specified with
+     * <li><code>ITEM_CAPTION_MODE_EXPLICIT</code> : The item captions must
+     * be explicitly specified.</li>
+     * <li><code>ITEM_CAPTION_MODE_PROPERTY</code> : The item captions are
+     * read from property, that must be specified with
      * <code>setItemCaptionPropertyId</code>.</li>
      * </ul>
      * The <code>ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID</code> is the default
@@ -1178,19 +1179,18 @@ public abstract class AbstractSelect extends AbstractField implements
      * <p>
      * Setting the id to a existing property implicitly sets the item caption
      * mode to <code>ITEM_CAPTION_MODE_PROPERTY</code>. If the object is in
-     * <code>ITEM_CAPTION_MODE_PROPERTY</code> mode, setting caption property id
-     * null resets the item caption mode to
+     * <code>ITEM_CAPTION_MODE_PROPERTY</code> mode, setting caption property
+     * id null resets the item caption mode to
      * <code>ITEM_CAPTION_EXPLICIT_DEFAULTS_ID</code>.
      * </p>
      * 
      * <p>
      * Setting the property id to null disables this feature. The id is null by
      * default
-     * </p>
-     * .
+     * </p> .
      * 
      * @param propertyId
-     *            the id of the property.
+     *                the id of the property.
      * 
      */
     public void setItemCaptionPropertyId(Object propertyId) {
@@ -1226,18 +1226,17 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * <p>
-     * Note : The icons set with <code>setItemIcon</code> function override the
-     * icons from the property.
+     * Note : The icons set with <code>setItemIcon</code> function override
+     * the icons from the property.
      * </p>
      * 
      * <p>
      * Setting the property id to null disables this feature. The id is null by
      * default
-     * </p>
-     * .
+     * </p> .
      * 
      * @param propertyId
-     *            the Id of the property that specifies icons for items.
+     *                the Id of the property that specifies icons for items.
      */
     public void setItemIconPropertyId(Object propertyId) {
         if ((propertyId != null)
@@ -1259,15 +1258,14 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * <p>
-     * Note : The icons set with <code>setItemIcon</code> function override the
-     * icons from the property.
+     * Note : The icons set with <code>setItemIcon</code> function override
+     * the icons from the property.
      * </p>
      * 
      * <p>
      * Setting the property id to null disables this feature. The id is null by
      * default
-     * </p>
-     * .
+     * </p> .
      * 
      * @return the Id of the property containing the item icons.
      */
@@ -1285,7 +1283,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * @param itemId
-     *            the Id the of the item to be tested.
+     *                the Id the of the item to be tested.
      * @see #getNullSelectionItemId()
      * @see #setNullSelectionItemId(Object)
      * 
@@ -1312,7 +1310,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * @param itemId
-     *            the tem to be selected.
+     *                the tem to be selected.
      * @see #getNullSelectionItemId()
      * @see #setNullSelectionItemId(Object)
      * 
@@ -1332,7 +1330,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * Unselects an item.
      * 
      * @param itemId
-     *            the Item to be unselected.
+     *                the Item to be unselected.
      * @see #getNullSelectionItemId()
      * @see #setNullSelectionItemId(Object)
      * 
@@ -1491,11 +1489,11 @@ public abstract class AbstractSelect extends AbstractField implements
     /**
      * Allow of disallow empty selection. If the select is in single-select
      * mode, you can make an item represent the empty selection by calling
-     * <code>setNullSelectionItemId()</code>. This way you can for instance set
-     * an icon and caption for the null selection item.
+     * <code>setNullSelectionItemId()</code>. This way you can for instance
+     * set an icon and caption for the null selection item.
      * 
      * @param nullSelectionAllowed
-     *            whether or not to allow empty selection
+     *                whether or not to allow empty selection
      * @see #setNullSelectionItemId(Object)
      * @see #isNullSelectionAllowed()
      */
@@ -1542,7 +1540,7 @@ public abstract class AbstractSelect extends AbstractField implements
      * </p>
      * 
      * @param nullSelectionItemId
-     *            the nullSelectionItemId to set.
+     *                the nullSelectionItemId to set.
      * @see #getNullSelectionItemId()
      * @see #isSelected(Object)
      * @see #select(Object)