Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vaadin SQLContainer Refreshing

Tags:

vaadin

vaadin7

The Vaadin book says:

Normally, the SQLContainer will handle refreshing automatically when required.

However, where is this defined? How often will the container refresh?

I have tried to test this but unable to resolve

like image 475
Santiago Avatar asked May 20 '26 16:05

Santiago


1 Answers

You can simply check SQLContainer code.

The phrase

Normally, the SQLContainer will handle refreshing automatically when required.

means SQLContainer will refresh itself after some changes made to it's state. For example, after adding orderBy refresh() will be called:

   /**
     * Adds the given OrderBy to this container and refreshes the container
     * contents with the new sorting rules.
     * 
     * Note that orderBy.getColumn() must return a column name that exists in
     * this container.
     * 
     * @param orderBy
     *            OrderBy to be added to the container sorting rules
     */
    public void addOrderBy(OrderBy orderBy) {
        if (orderBy == null) {
            return;
        }
        if (!propertyIds.contains(orderBy.getColumn())) {
            throw new IllegalArgumentException(
                    "The column given for sorting does not exist in this container.");
        }
        sorters.add(orderBy);
        refresh();
    }

This is true for all other operations (please note refresh() call):

  public void rollback() throws UnsupportedOperationException, SQLException {
        debug(null, "Rolling back changes...");
        removedItems.clear();
        addedItems.clear();
        modifiedItems.clear();
        refresh();
    }
like image 184
Renat Gilmanov Avatar answered May 23 '26 15:05

Renat Gilmanov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!