Package org.thechiselgroup.choosel.core.client.visualization.model

Examples of org.thechiselgroup.choosel.core.client.visualization.model.VisualItemContainerChangeEventHandler


    /**
     * delta=removed, old_state=errors ==> ignore
     */
    @Test
    public void eventHandlerRemovedVisualItemsWithErrorsGetIgnoredWhenResourcesChange() {
        VisualItemContainerChangeEventHandler handler = registerHandler();

        Resource validResource = createResource(TYPE_1, 1);
        Resource errorResource = createResource(ResourceSetTestUtils.TYPE_2, 1);

        setCanResolveIfContainsResourceExactlyResolver(ResourceSetTestUtils
View Full Code Here


    /**
     * delta=updated, old_state=errors, current_state=valid ==> add
     */
    @Test
    public void eventHandlerUpdatedVisualItemsChangingFromErrorsToValidGetAddedWhenResourcesChange() {
        VisualItemContainerChangeEventHandler handler = registerHandler();

        Resource resource1 = createResource(TYPE_1, 1);
        Resource resource2 = createResource(TYPE_1, 2);

        setCanResolveIfContainsResourceExactlyResolver(ResourceSetTestUtils
View Full Code Here

    /**
     * delta=updated, old_state=valid, current_state=errors ==> remove
     */
    @Test
    public void eventHandlerUpdatedVisualItemsChangingFromValidToErrorsGetRemovedWhenResourcesChange() {
        VisualItemContainerChangeEventHandler handler = registerHandler();

        Resource resource1 = createResource(TYPE_1, 1);
        Resource resource2 = createResource(TYPE_1, 2);

        setCanResolveIfContainsResourceExactlyResolver(toResourceSet(resource1,
View Full Code Here

    /**
     * delta=updated, old_state=valid, current_state=valid ==> updated
     */
    @Test
    public void eventHandlerUpdatedVisualItemsThatAreValidNowAndBeforeGetUpdatedWhenResourcesChange() {
        VisualItemContainerChangeEventHandler handler = registerHandler();

        Resource resource1 = createResource(TYPE_1, 1);
        Resource resource2 = createResource(TYPE_1, 2);

        visualizationModel
View Full Code Here

    /**
     * delta=updated, old_state=errors, current_state=errors ==> ignore
     */
    @Test
    public void eventHandlerUpdatedVisualItemsWithErrorsNowAndBeforeGetIgnoredWhenResourcesChange() {
        VisualItemContainerChangeEventHandler handler = registerHandler();

        Resource validResource = createResource(TYPE_1, 3);

        setCanResolveIfContainsResourceExactlyResolver(ResourceSetTestUtils
                .toResourceSet(validResource));
View Full Code Here

    public void eventHandlerVisualItemsThatBecomeInvalidAfterSlotResolverChangeGetRemoved() {
        visualizationModel
                .setResolver(slot, mockResolverThatCanAlwaysResolve());
        helper.addToContainedResources(createResource(1));

        VisualItemContainerChangeEventHandler handler = registerHandler();
        visualizationModel.setResolver(slot, mockResolverThatCanNeverResolve());

        assertThat(captureDelta(handler).getRemovedElements(),
                containsVisualItemsForExactResourceSets(createResources(1)));
    }
View Full Code Here

        assertThat(underTest.getVisualItems(),
                containsVisualItemsForExactResourceSets(resources));
    }

    private VisualItemContainerChangeEventHandler registerHandler() {
        VisualItemContainerChangeEventHandler handler = mock(VisualItemContainerChangeEventHandler.class);
        underTest.addHandler(handler);
        return handler;
    }
View Full Code Here

     * 2 view items get added to trigger call, we check that one is ignored
     * </p>
     */
    @Test
    public void eventHandlerAddedVisualItemsWithErrorsGetIgnoredWhenResourcesChange() {
        VisualItemContainerChangeEventHandler handler = registerHandler();

        Resource validResource = createResource(TYPE_1, 1);

        setCanResolveIfContainsResourceExactlyResolver(toResourceSet(validResource));

View Full Code Here

                initialSlotMapping);

        underTest = new DefaultManagedSlotMappingConfiguration(resolverProvider,
                initializer, visualizationModel, errorModel);

        VisualItemContainerChangeEventHandler handler = captureVisualItemContainerChangeEventHandler();

        when(visualizationModel.getFullVisualItemContainer()).thenReturn(
                visualItemContainer);
        when(visualItemContainer.getVisualItems()).thenReturn(
                CollectionFactory.<VisualItem> createLightweightList());

        LightweightList<Slot> badSlots = CollectionFactory
                .createLightweightList();
        badSlots.add(slots[0]);
        when(visualizationModel.getSlotsWithErrors()).thenReturn(badSlots);

        LightweightCollection<VisualItem> addedElements = VisualItemTestUtils
                .createVisualItems(1);

        Delta<VisualItem> delta = Delta.createAddedDelta(addedElements);
        // XXX right now underTest does not care what the event is, but it may
        // in the future, feel free to implement the event in this test in the
        // future
        handler.onVisualItemContainerChanged(new VisualItemContainerChangeEvent(
                visualItemContainer, delta));

        // verify that we set the viewModel
        verify(visualizationModel, times(1)).setResolver(slots[0], resolver1);
    }
View Full Code Here

        setUpResolverProvider(factory1, factory2);

        underTest = new DefaultManagedSlotMappingConfiguration(resolverProvider,
                slotMappingInitializer, visualizationModel, errorModel);

        VisualItemContainerChangeEventHandler visualItemContainerHandler = captureVisualItemContainerChangeEventHandler();

        ManagedSlotMappingConfigurationChangedEventHandler handler = mock(ManagedSlotMappingConfigurationChangedEventHandler.class);
        underTest
                .addManagedSlotMappingConfigurationChangedEventHandler(handler);

        VisualItemContainerChangeEvent event = new VisualItemContainerChangeEvent(
                visualItemContainer, Delta.createAddedDelta(visualItems));
        visualItemContainerHandler.onVisualItemContainerChanged(event);

        verify(handler, times(1)).onSlotMappingStateChanged(
                any(ManagedSlotMappingConfigurationChangedEvent.class));
    }
View Full Code Here

TOP

Related Classes of org.thechiselgroup.choosel.core.client.visualization.model.VisualItemContainerChangeEventHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.