Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

removeContainerProperty

rana osman
1 decade ago Apr 05, 2010 11:34am
Joonas Lehtinen
1 decade ago Apr 05, 2010 11:46am
rana osman
1 decade ago Apr 05, 2010 12:07pm
Joonas Lehtinen
1 decade ago Apr 05, 2010 2:45pm

Use a container that allows it. For example IndexedContainer (which is also used by default in the Table)

Kim Leppänen
1 decade ago Apr 07, 2010 5:40am

Joonas Lehtinen: Returns false if the container implementing this does not allow removing container properties.

Isn't that what the UnsupportedOperationException is for.

/**
     * Removes a Property specified by the given Property ID from the Container.
     * Note that the Property will be removed from all Items in the Container.
     * 
     * This functionality is optional.
     * 
     * @param propertyId
     *            ID of the Property to remove
     * @return <code>true</code> if the operation succeeded, <code>false</code>
     *         if not
     */
    public boolean removeContainerProperty(Object propertyId)
            throws UnsupportedOperationException;
Joonas Lehtinen
1 decade ago Apr 07, 2010 12:40pm

True. My mistake. Sorry.

API is quite loosely documented on what is the difference between returning false and UnsupportedOperationException. It should be more clearly stated that the UnsupportedOperationException is only thrown if the container does not support such operation at all and false is returned if just this specific property could not be removed at the time (and some other property could be removed or this property could be removed in some other state of the container).

Stll - API design could be better for this. This is also my mistake ;-) (from year 2002).