• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ItemSetChangeEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vaadin.data.Container.ItemSetChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java ItemSetChangeEvent类的具体用法?Java ItemSetChangeEvent怎么用?Java ItemSetChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ItemSetChangeEvent类属于com.vaadin.data.Container包,在下文中一共展示了ItemSetChangeEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fireItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
/**
 * Sends an Item set change event to all registered interested listeners.
 * 
 * @param event
 *            the item set change event to send, optionally with additional
 *            information
 */
protected void fireItemSetChange(ItemSetChangeEvent event) {
    if (getItemSetChangeListeners() != null) {
        final Object[] l = getItemSetChangeListeners().toArray();
        for (int i = 0; i < l.length; i++) {
            ((Container.ItemSetChangeListener) l[i])
                    .containerItemSetChange(event);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:17,代码来源:ItemSetChangeNotifier.java


示例2: removeItemSetChangeistener

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
private void removeItemSetChangeistener(final AbstractField<?> field) {
    if (!(field instanceof Table)) {
        return;
    }
    for (final Object listener : field.getListeners(ItemSetChangeEvent.class)) {
        if (listener instanceof ChangeListener) {
            ((Table) field).removeItemSetChangeListener((ChangeListener) listener);
        }
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:11,代码来源:CommonDialogWindow.java


示例3: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Override
public void containerItemSetChange(final ItemSetChangeEvent event) {
    if (!(field instanceof Table)) {
        return;
    }
    final Table table = (Table) field;
    saveButton.setEnabled(
            isSaveButtonEnabledAfterValueChange(table, table.getContainerDataSource().getItemIds()));
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:10,代码来源:CommonDialogWindow.java


示例4: testApplyFilters_Immediately

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
    public void testApplyFilters_Immediately() {
        QPerson person = QPerson.person;
        final boolean[] listenerCalled = new boolean[1];
        container.addListener(new ItemSetChangeListener() {

            public void containerItemSetChange(ItemSetChangeEvent event) {
                assertTrue(event instanceof JPAContainer.FiltersAppliedEvent);
                listenerCalled[0] = true;
            }
        });
        // Applied filters should not result in any direct calls to the entity
        // provider
        replay(entityProviderMock);
        container.setEntityProvider(entityProviderMock);

        assertTrue(container.isApplyFiltersImmediately());
        assertFalse(listenerCalled[0]);
//        container.addContainerFilter(new Equal("firstName", "Hello"));
        container.addContainerFilter(person.firstName.eq("Hello"));

        assertEquals(container.getFilters(), container.getAppliedFilters());
        assertTrue(container.getFilters().contains(
                new Equal("firstName", "Hello")));
        assertTrue(listenerCalled[0]);
        assertFalse(container.hasUnappliedFilters());

        // Tro to remove all the filters
        listenerCalled[0] = false;

        container.removeAllContainerFilters();
        assertTrue(container.getFilters().isEmpty());
        assertTrue(container.getAppliedFilters().isEmpty());
        assertTrue(listenerCalled[0]);
        assertFalse(container.hasUnappliedFilters());

        verify(entityProviderMock);
    }
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:39,代码来源:QuerydslJPAContainerExtTest.java


示例5: testApplyFilters_Immediately

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testApplyFilters_Immediately() {
    final boolean[] listenerCalled = new boolean[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.FiltersAppliedEvent);
            listenerCalled[0] = true;
        }
    });
    // Applied filters should not result in any direct calls to the entity
    // provider
    replay(entityProviderMock);
    container.setEntityProvider(entityProviderMock);

    assertTrue(container.isApplyFiltersImmediately());
    assertFalse(listenerCalled[0]);
    container.addContainerFilter(new Equal("firstName", "Hello"));

    assertEquals(container.getFilters(), container.getAppliedFilters());
    assertTrue(container.getFilters().contains(
            new Equal("firstName", "Hello")));
    assertTrue(listenerCalled[0]);
    assertFalse(container.hasUnappliedFilters());

    // Tro to remove all the filters
    listenerCalled[0] = false;

    container.removeAllContainerFilters();
    assertTrue(container.getFilters().isEmpty());
    assertTrue(container.getAppliedFilters().isEmpty());
    assertTrue(listenerCalled[0]);
    assertFalse(container.hasUnappliedFilters());

    verify(entityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:37,代码来源:QuerydslJPAContainerTest.java


示例6: testSort

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testSort() {
    final boolean[] listenerCalled = new boolean[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.ContainerSortedEvent);
            listenerCalled[0] = true;
        }
    });
    // A resort should not result in any direct calls to the entity provider
    replay(entityProviderMock);
    container.setEntityProvider(entityProviderMock);

    assertFalse(listenerCalled[0]);
    assertTrue(container.getSortByList().isEmpty());
    container.sort(new Object[] { "firstName", "lastName" }, new boolean[] {
            true, false });
    assertTrue(listenerCalled[0]);
    assertEquals(2, container.getSortByList().size());
    assertEquals("firstName", container.getSortByList().get(0)
            .getPropertyId());
    assertEquals("lastName", container.getSortByList().get(1)
            .getPropertyId());
    assertTrue(container.getSortByList().get(0).isAscending());
    assertFalse(container.getSortByList().get(1).isAscending());

    verify(entityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:30,代码来源:QuerydslJPAContainerTest.java


示例7: testAddEntity_WriteThrough

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testAddEntity_WriteThrough() {
    Person newEntity = new Person();
    Person persistentEntity = new Person();
    persistentEntity.setId(123l);
    persistentEntity.setVersion(1l);
    expect(mutableEntityProviderMock.addEntity(newEntity)).andReturn(
            persistentEntity);
    replay(mutableEntityProviderMock);
    container.setEntityProvider(mutableEntityProviderMock);

    final boolean[] listenerCalled = new boolean[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.ItemAddedEvent);
            assertEquals(123l,
                    ((JPAContainer.ItemAddedEvent) event).getItemId());
            listenerCalled[0] = true;
        }
    });

    assertFalse(listenerCalled[0]);
    assertEquals(123l, container.addEntity(newEntity));
    assertTrue(listenerCalled[0]);

    verify(mutableEntityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:29,代码来源:QuerydslJPAContainerTest.java


示例8: testRemoveItem_WriteThrough

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testRemoveItem_WriteThrough() {
    expect(mutableEntityProviderMock.containsEntity(container, 123l, null)).andReturn(
            true);
    mutableEntityProviderMock.removeEntity(123l);
    expect(mutableEntityProviderMock.containsEntity(container, 456l, null)).andReturn(
            false);
    replay(mutableEntityProviderMock);
    container.setEntityProvider(mutableEntityProviderMock);

    final boolean[] listenerCalled = new boolean[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.ItemRemovedEvent);
            assertEquals(123l,
                    ((JPAContainer.ItemRemovedEvent) event).getItemId());
            listenerCalled[0] = true;
        }
    });

    assertFalse(listenerCalled[0]);
    assertTrue(container.removeItem(123l));
    assertTrue(listenerCalled[0]);

    listenerCalled[0] = false;
    assertFalse(container.removeItem(456l));
    assertFalse(listenerCalled[0]);

    verify(mutableEntityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:32,代码来源:QuerydslJPAContainerTest.java


示例9: replaceFormInstanceReferences

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
private void replaceFormInstanceReferences(VaadinFormInstance delegate, VaadinBindingFormInstance<?> real) {
	for (String fieldId : delegate.getFieldIds()) {
		AbstractComponent component = delegate.getComponentById(fieldId);
		if (component.getData() instanceof VaadinDataObject) {
			VaadinDataObject dataObject = (VaadinDataObject) component.getData();
			Field field = dataObject.getField();
			if (field.getType().equals(SelectorConstants.TYPE_SELECTOR)) {
				if (component instanceof Container.Viewer) {
					final Container.Viewer viewer = (Container.Viewer) component;
					SelectorProviderFactory factory = (SelectorProviderFactory) field
							.getExtra(SelectorConstants.EXTRA_SELECTOR_PROVIDER_FACTORY);
					final VaadinSelectorContainer container = new VaadinSelectorContainer(factory.createSelectorProvider(real));

					if (viewer instanceof AbstractSelect) {
						final AbstractSelect abstractSelect = (AbstractSelect) viewer;
						container.addListener(new Container.ItemSetChangeListener() {

							@Override
							public void containerItemSetChange(ItemSetChangeEvent event) {
								boolean readOnly = abstractSelect.isReadOnly();
								abstractSelect.setReadOnly(false);
								abstractSelect.sanitizeSelection();
								abstractSelect.setReadOnly(readOnly);
							}

						});
						viewer.setContainerDataSource(container);
					}
				}
			}
		}
	}
}
 
开发者ID:frincon,项目名称:abstractform,代码行数:34,代码来源:VaadinBindingFormToolkit.java


示例10: testApplyFilters_Delayed

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testApplyFilters_Delayed() {
    QPerson person = QPerson.person;
    final boolean[] listenerCalled = new boolean[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.FiltersAppliedEvent);
            listenerCalled[0] = true;
        }
    });
    // Applied filters should not result in any direct calls to the entity
    // provider
    replay(entityProviderMock);
    container.setEntityProvider(entityProviderMock);

    container.setApplyFiltersImmediately(false);
    assertFalse(container.isApplyFiltersImmediately());
    assertFalse(listenerCalled[0]);
    //container.addContainerFilter(new Equal("firstName", "Hello"));
    container.addContainerFilter(person.firstName.eq("Hello"));

    assertFalse(listenerCalled[0]);
    assertTrue(container.getFilters().contains(
            new Equal("firstName", "Hello")));
    assertTrue(container.getAppliedFilters().isEmpty());
    assertTrue(container.hasUnappliedFilters());

    container.applyFilters();
    assertTrue(listenerCalled[0]);
    assertEquals(container.getFilters(), container.getAppliedFilters());
    assertTrue(container.getFilters().contains(
            new Equal("firstName", "Hello")));
    assertFalse(container.hasUnappliedFilters());

    // Try to remove the filters
    listenerCalled[0] = false;

    container.removeAllContainerFilters();
    assertTrue(container.getFilters().isEmpty());
    assertFalse(container.getAppliedFilters().isEmpty());
    assertTrue(container.hasUnappliedFilters());

    container.applyFilters();
    assertTrue(listenerCalled[0]);
    assertTrue(container.getAppliedFilters().isEmpty());
    assertFalse(container.hasUnappliedFilters());

    verify(entityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:51,代码来源:QuerydslJPAContainerExtTest.java


示例11: testApplyFilters_Delayed

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testApplyFilters_Delayed() {
    final boolean[] listenerCalled = new boolean[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.FiltersAppliedEvent);
            listenerCalled[0] = true;
        }
    });
    // Applied filters should not result in any direct calls to the entity
    // provider
    replay(entityProviderMock);
    container.setEntityProvider(entityProviderMock);

    container.setApplyFiltersImmediately(false);
    assertFalse(container.isApplyFiltersImmediately());
    assertFalse(listenerCalled[0]);
    container.addContainerFilter(new Equal("firstName", "Hello"));

    assertFalse(listenerCalled[0]);
    assertTrue(container.getFilters().contains(
            new Equal("firstName", "Hello")));
    assertTrue(container.getAppliedFilters().isEmpty());
    assertTrue(container.hasUnappliedFilters());

    container.applyFilters();
    assertTrue(listenerCalled[0]);
    assertEquals(container.getFilters(), container.getAppliedFilters());
    assertTrue(container.getFilters().contains(
            new Equal("firstName", "Hello")));
    assertFalse(container.hasUnappliedFilters());

    // Try to remove the filters
    listenerCalled[0] = false;

    container.removeAllContainerFilters();
    assertTrue(container.getFilters().isEmpty());
    assertFalse(container.getAppliedFilters().isEmpty());
    assertTrue(container.hasUnappliedFilters());

    container.applyFilters();
    assertTrue(listenerCalled[0]);
    assertTrue(container.getAppliedFilters().isEmpty());
    assertFalse(container.hasUnappliedFilters());

    verify(entityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:49,代码来源:QuerydslJPAContainerTest.java


示例12: testAddEntity_Buffered_Discard

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Test
public void testAddEntity_Buffered_Discard() {
    // Setup test data
    Person p = new Person();
    LinkedList<SortBy> orderby = new LinkedList<SortBy>();
    orderby.add(new SortBy("firstName", true));

    // Instruct mocks
    expect(
            batchableEntityProviderMock.getFirstEntityIdentifier(container, null,
                    orderby)).andStubReturn(122l);
    expect(
            batchableEntityProviderMock.getNextEntityIdentifier(container, 122l, null,
                    orderby)).andStubReturn(null);
    expect(
            batchableEntityProviderMock.getPreviousEntityIdentifier(container, 122l,
                    null, orderby)).andStubReturn(null);
    expect(batchableEntityProviderMock.getEntity((EntityContainer<Person>) anyObject(), anyObject()))
            .andStubReturn(null);
    replay(batchableEntityProviderMock);

    // Run test
    container.setEntityProvider(batchableEntityProviderMock);
    container.setWriteThrough(false);
    container.sort(new Object[] { "firstName" }, new boolean[] { true });

    assertFalse(container.isModified());

    Object id = container.addEntity(p);

    assertTrue(container.isModified());

    // Check that we can access the item using the temporary ID
    EntityItem<Person> item = container.getItem(id);
    assertEquals(id, item.getItemId());
    assertFalse(item.isPersistent());

    // Check that the item shows up in the list
    assertEquals(id, container.firstItemId());
    assertEquals(122l, container.nextItemId(id));
    assertEquals(id, container.prevItemId(122l));

    final int[] listenerCalled = new int[1];
    container.addListener(new ItemSetChangeListener() {

        public void containerItemSetChange(ItemSetChangeEvent event) {
            assertTrue(event instanceof JPAContainer.ChangesDiscardedEvent);
            listenerCalled[0]++;
        }
    });

    container.discard();

    assertEquals(1, listenerCalled[0]);
    assertFalse(container.isModified());

    // Check that the item is not in the list
    assertEquals(122l, container.firstItemId());
    assertNull(container.nextItemId(122l));
    assertNull(container.prevItemId(122l));
    assertNull(container.getItem(id));

    // Verify mocks
    verify(batchableEntityProviderMock);
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:66,代码来源:QuerydslJPAContainerTest.java


示例13: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
public void containerItemSetChange(ItemSetChangeEvent event) {
    called++;
    lastEvent = event;
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:5,代码来源:QuerydslJPAContainerTest.java


示例14: getLastEvent

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
public ItemSetChangeEvent getLastEvent() {
    return lastEvent;
}
 
开发者ID:mysema,项目名称:vaadin-querydsl-prototype,代码行数:4,代码来源:QuerydslJPAContainerTest.java


示例15: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
public void containerItemSetChange(ItemSetChangeEvent event) {
	m_graph.update();
	requestRepaint();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:5,代码来源:TopologyComponent.java


示例16: commitContainerAndGetEntityFromDB

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
/**
 * commits the container and retrieves the new recordid
 *
 * we have to hook the ItemSetChangeListener to be able to get the database
 * id of a new record.
 */
private E commitContainerAndGetEntityFromDB()
{
	// don't really need an AtomicReference, just using it as a mutable
	// final variable to be used in the callback
	final AtomicReference<E> newEntity = new AtomicReference<>();

	// call back to collect the id of the new record when the container
	// fires the ItemSetChangeEvent
	ItemSetChangeListener tmp = new ItemSetChangeListener()
	{

		/**
		 *
		 */
		private static final long serialVersionUID = 9132090066374531277L;

		@Override
		public void containerItemSetChange(ItemSetChangeEvent event)
		{
			if (event instanceof ProviderChangedEvent)
			{
				@SuppressWarnings("rawtypes")
				ProviderChangedEvent pce = (ProviderChangedEvent) event;
				@SuppressWarnings("unchecked")
				Collection<E> affectedEntities = pce.getChangeEvent().getAffectedEntities();

				if (affectedEntities.size() > 0)
				{
					@SuppressWarnings("unchecked")
					E id = (E) affectedEntities.toArray()[0];
					newEntity.set(id);

				}
			}
		}
	};

	try
	{
		// add the listener
		container.addItemSetChangeListener(tmp);
		// call commit
		container.commit();
		newEntity.set(EntityManagerProvider.getEntityManager().merge(newEntity.get()));
	}
	catch (com.vaadin.data.Buffered.SourceException e)
	{
		if (e.getCause() instanceof javax.persistence.PersistenceException)
		{
			javax.persistence.PersistenceException cause = (javax.persistence.PersistenceException) e.getCause();
			Notification.show(cause.getCause().getMessage(), Type.ERROR_MESSAGE);
		}
	}
	finally
	{
		// detach the listener
		container.removeItemSetChangeListener(tmp);
	}

	// return the entity
	return newEntity.get();
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:69,代码来源:SingleEntityWizardStep.java


示例17: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void containerItemSetChange(ItemSetChangeEvent event) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:chelu,项目名称:jdal,代码行数:8,代码来源:EntityItemIdStrategy.java


示例18: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void containerItemSetChange(ItemSetChangeEvent event) {
	getItemIds();
}
 
开发者ID:chelu,项目名称:jdal,代码行数:7,代码来源:PkItemIdStrategy.java


示例19: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void containerItemSetChange(ItemSetChangeEvent event) {
	this.paginator.refresh();
}
 
开发者ID:chelu,项目名称:jdal,代码行数:7,代码来源:PageableTable.java


示例20: containerItemSetChange

import com.vaadin.data.Container.ItemSetChangeEvent; //导入依赖的package包/类
@Override
public void containerItemSetChange(ItemSetChangeEvent event) {
	updateContainers(containerDataSource, true);
}
 
开发者ID:kimppa,项目名称:FilterableTwinColSelect,代码行数:5,代码来源:FilterableTwinColSelect.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContentDescriptor类代码示例发布时间:2022-05-22
下一篇:
Java IORToSocketInfo类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap