【问题标题】:Vaadin SQLContainer RefreshingVaadin SQLContainer 刷新
【发布时间】:2013-07-25 18:59:28
【问题描述】:

Vaadin book 说:

通常,SQLContainer 会在需要时自动处理刷新。

但是,这是在哪里定义的?容器多久刷新一次?

我已尝试对此进行测试,但无法解决

【问题讨论】:

    标签: vaadin vaadin7


    【解决方案1】:

    您可以简单地查看SQLContainer 代码。

    短语

    通常情况下,SQLContainer 会自动处理刷新 必填。

    表示 SQLContainer 将在对其状态进行一些更改后自行刷新。例如添加orderBy后会调用refresh()

       /**
         * 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();
        }
    

    这适用于所有其他操作(请注意 refresh() 调用):

      public void rollback() throws UnsupportedOperationException, SQLException {
            debug(null, "Rolling back changes...");
            removedItems.clear();
            addedItems.clear();
            modifiedItems.clear();
            refresh();
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-12
      相关资源
      最近更新 更多