当前位置: 首页>>代码示例>>Java>>正文


Java CollectionDatasource.addCollectionChangeListener方法代码示例

本文整理汇总了Java中com.haulmont.cuba.gui.data.CollectionDatasource.addCollectionChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionDatasource.addCollectionChangeListener方法的具体用法?Java CollectionDatasource.addCollectionChangeListener怎么用?Java CollectionDatasource.addCollectionChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.gui.data.CollectionDatasource的用法示例。


在下文中一共展示了CollectionDatasource.addCollectionChangeListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ItemWrapper

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
public ItemWrapper(Object item, MetaClass metaClass, Collection<MetaPropertyPath> properties) {
    this.item = item;
    this.metaClass = metaClass;

    for (MetaPropertyPath property : properties) {
        this.properties.put(property, createPropertyWrapper(item, property));
    }

    if (item instanceof CollectionDatasource) {
        cdsCollectionChangeListener = e -> fireItemPropertySetChanged();

        CollectionDatasource datasource = (CollectionDatasource) item;
        weakCollectionChangeListener = new WeakCollectionChangeListener(datasource, cdsCollectionChangeListener);
        //noinspection unchecked
        datasource.addCollectionChangeListener(weakCollectionChangeListener);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:ItemWrapper.java

示例2: setDatasource

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void setDatasource(CollectionDatasource datasource) {
    this.datasource = datasource;

    collectionChangeListener = e -> {
        if (lookupPickerField != null) {
            if (isLookup()) {
                if (getLookupScreen() != null)
                    lookupAction.setLookupScreen(getLookupScreen());
                else
                    lookupAction.setLookupScreen(null);

                lookupAction.setLookupScreenOpenType(lookupOpenMode);
                lookupAction.setLookupScreenParams(lookupScreenParams);
                lookupAction.setLookupScreenDialogParams(lookupScreenDialogParams);
            }
        }
        rootPanel.refreshComponent();
        rootPanel.refreshClickListeners(itemClickListener);
    };
    datasource.addCollectionChangeListener(new WeakCollectionChangeListener(datasource, collectionChangeListener));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:DesktopTokenList.java

示例3: EntityCalendarEventProvider

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
public EntityCalendarEventProvider (CollectionDatasource datasource) {
    this.datasource = datasource;

    collectionChangeListener = e -> {
        itemsCache = null;
        fireDataChanged();
    };

    itemPropertyChangeListener = e -> {
        if (e.getProperty() != null) {
            if (e.getProperty().equals(startDateProperty)
                    || e.getProperty().equals(endDateProperty)
                    || e.getProperty().equals(captionProperty)
                    || e.getProperty().equals(descriptionProperty)
                    || e.getProperty().equals(styleNameProperty)
                    || e.getProperty().equals(allDayProperty)) {
                itemsCache = null;
                fireDataChanged();
            }
        }
    };

    datasource.addCollectionChangeListener(collectionChangeListener);
    datasource.addItemPropertyChangeListener(itemPropertyChangeListener);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:EntityCalendarEventProvider.java

示例4: setDatasource

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void setDatasource(CollectionDatasource datasource) {
    Preconditions.checkNotNullArgument(datasource, "datasource is null");

    if (this.datasource != null) {
        //noinspection unchecked
        this.datasource.removeCollectionChangeListener(weakCollectionChangeListener);
        weakCollectionChangeListener = null;
    } else {
        //noinspection unchecked
        collectionChangeListener = e -> {
            samePage = Operation.REFRESH != e.getOperation()
                    && Operation.CLEAR != e.getOperation();
            onCollectionChanged();
        };

    }

    this.datasource = datasource;

    weakCollectionChangeListener = new WeakCollectionChangeListener(datasource, collectionChangeListener);
    //noinspection unchecked
    datasource.addCollectionChangeListener(weakCollectionChangeListener);

    component.getCountButton().addClickListener(event -> onLinkClick());
    component.getPrevButton().addClickListener(event -> onPrevClick());
    component.getNextButton().addClickListener(event -> onNextClick());
    component.getFirstButton().addClickListener(event -> onFirstClick());
    component.getLastButton().addClickListener(event -> onLastClick());

    if (datasource.getState() == Datasource.State.VALID) {
        onCollectionChanged();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:WebRowsCount.java

示例5: bind

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void bind(CollectionDatasource ds) {
    weakItemChangeListener = new WeakItemChangeListener(ds, this);
    ds.addItemChangeListener(weakItemChangeListener);

    weakItemPropertyChangeListener = new WeakItemPropertyChangeListener(ds, this);
    ds.addItemPropertyChangeListener(weakItemPropertyChangeListener);

    weakStateChangeListener = new WeakStateChangeListener(ds, this);
    ds.addStateChangeListener(weakStateChangeListener);

    weakCollectionChangeListener = new WeakCollectionChangeListener(ds, this);
    ds.addCollectionChangeListener(weakCollectionChangeListener);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:WebDataGrid.java

示例6: setDatasource

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@Override
public void setDatasource(CollectionDatasource datasource) {
    Preconditions.checkNotNullArgument(datasource, "datasource is null");

    if (this.datasource != null) {
        throw new UnsupportedOperationException("Changing datasource is not supported by the TokenList component");
    }

    this.datasource = datasource;

    collectionChangeListener = e -> {
        if (lookupPickerField != null) {
            if (isLookup()) {
                if (getLookupScreen() != null) {
                    lookupAction.setLookupScreen(getLookupScreen());
                } else {
                    lookupAction.setLookupScreen(null);
                }

                lookupAction.setLookupScreenOpenType(lookupOpenMode);
                lookupAction.setLookupScreenParams(lookupScreenParams);
                lookupAction.setLookupScreenDialogParams(lookupScreenDialogParams);
            }
        }
        component.refreshComponent();
        component.refreshClickListeners(itemClickListener);
    };
    //noinspection unchecked
    datasource.addCollectionChangeListener(new WeakCollectionChangeListener(datasource, collectionChangeListener));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:WebTokenList.java

示例7: bind

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void bind(CollectionDatasource ds) {
    ds.addItemChangeListener(new WeakItemChangeListener(ds, this));
    ds.addItemPropertyChangeListener(new WeakItemPropertyChangeListener(ds, this));
    ds.addStateChangeListener(new WeakStateChangeListener(ds, this));
    ds.addCollectionChangeListener(new WeakCollectionChangeListener(ds, this));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:CollectionDsActionsNotifier.java

示例8: OptionsDsWrapper

import com.haulmont.cuba.gui.data.CollectionDatasource; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public OptionsDsWrapper(CollectionDatasource datasource, Collection<MetaPropertyPath> properties, boolean autoRefresh) {
    this.datasource = datasource;
    this.autoRefresh = autoRefresh;

    final View view = datasource.getView();
    final MetaClass metaClass = datasource.getMetaClass();

    if (properties == null) {
        createProperties(view, metaClass);
    } else {
        this.properties.addAll(properties);
    }

    dsStateChangeListener = e -> itemsCache.clear();

    dsItemPropertyChangeListener = e -> {
        Item wrapper = getItemWrapper(e.getItem());

        // MetaProperty worked wrong with properties from inherited superclasses
        MetaPropertyPath metaPropertyPath = datasource.getMetaClass().getPropertyPath(e.getProperty());
        if (metaPropertyPath == null) {
            return;
        }
        Property itemProperty = wrapper.getItemProperty(metaPropertyPath);
        if (itemProperty instanceof PropertyWrapper) {
            ((PropertyWrapper) itemProperty).fireValueChangeEvent();
        }
    };

    cdsCollectionChangeListener = e -> {
        final boolean prevIgnoreListeners = ignoreListeners;
        try {
            itemsCache.clear();
            fireItemSetChanged();
        } finally {
            ignoreListeners = prevIgnoreListeners;
        }
    };

    weakDsListenerAdapter = new WeakDsListenerAdapter(datasource, dsItemPropertyChangeListener, dsStateChangeListener, cdsCollectionChangeListener);
    datasource.addCollectionChangeListener(weakDsListenerAdapter);
    datasource.addStateChangeListener(weakDsListenerAdapter);
    datasource.addItemPropertyChangeListener(weakDsListenerAdapter);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:46,代码来源:OptionsDsWrapper.java


注:本文中的com.haulmont.cuba.gui.data.CollectionDatasource.addCollectionChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。