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


Java ItemSetChangeEvent类代码示例

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


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


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