Package org.apache.rave.model

Examples of org.apache.rave.model.Region


        String id = "1111L";
        String id2 = "2222L";
        Page page = new PageImpl("1234L");
        List<Page> pages = Lists.newArrayList();
        List<Region> regions = Lists.newArrayList();
        Region region = new RegionImpl(id);
        Region region2 = new RegionImpl(id2);
        regions.add(region);
        regions.add(region2);
        pages.add(page);
        page.setRegions(regions);
View Full Code Here



    private void removeRegion(Page page, Region item) {
        Iterator<Region> iterator = page.getRegions().iterator();
        while(iterator.hasNext()) {
            Region region = iterator.next();
            if(region.getId().equals(item.getId())) {
                iterator.remove();
                return;
            }
        }
    }
View Full Code Here

    public void removeWidgetFromPage_validWidget() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setRegion(new RegionImpl(REGION_ID));
        Region region = new RegionImpl();

        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget);
        regionWidgetRepository.delete(regionWidget);
        expectLastCall();
        replay(regionWidgetRepository);
        expect(regionRepository.get(REGION_ID)).andReturn(region);
        replay(regionRepository);

        Region result = pageService.removeWidgetFromPage(WIDGET_ID);
        verify(regionWidgetRepository);
        verify(regionRepository);
        assertThat(result, is(sameInstance(region)));
    }
View Full Code Here

    @Test(expected = UnsupportedOperationException.class)
    public void removeWidgetFromPage_lockedRegion() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        Region region = new RegionImpl(REGION_ID);
        region.setLocked(true);
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setRegion(region);

        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget);
        regionWidgetRepository.delete(regionWidget);
View Full Code Here

    @Test(expected = UnsupportedOperationException.class)
    public void removeWidgetFromPage_lockedRegionWidget() {
        String WIDGET_ID = "1";
        String REGION_ID = "2";
        Region region = new RegionImpl(REGION_ID);
        region.setLocked(true);
        RegionWidget regionWidget = new RegionWidgetImpl(WIDGET_ID);
        regionWidget.setLocked(true);
        regionWidget.setRegion(region);

        expect(regionWidgetRepository.get(WIDGET_ID)).andReturn(regionWidget);
View Full Code Here

        String newName = "new page name";
        String layoutName = "layout name";
        String layoutCode = "CODE";

        List<Region> regions = new ArrayList<Region>();
        Region region = new RegionImpl("99");
        region.setRenderOrder(1);
        regions.add(new RegionImpl());
        regions.add(region);

        PageLayout prevLayout = new PageLayoutImpl();
        prevLayout.setNumberOfRegions(2L);
View Full Code Here

    public void updatePage_removeRegion_noWidgets() {
        String newName = "new page name";
        String layoutName = "layout name";

        List<Region> regions = new ArrayList<Region>();
        Region region = createStrictMock(Region.class);
        expect(region.getRegionWidgets()).andReturn(new ArrayList<RegionWidget>());
        expect(region.getRenderOrder()).andReturn(1);
        replay(region);
        regions.add(region);

        Region deletedRegion = createStrictMock(Region.class);
        expect(deletedRegion.getRegionWidgets()).andReturn(new ArrayList<RegionWidget>());
        replay(deletedRegion);
        regions.add(deletedRegion);

        PageLayout prevLayout = createStrictMock(PageLayoutImpl.class);
        expect(prevLayout.getNumberOfRegions()).andReturn(new Long(2)).anyTimes();
View Full Code Here


        List<RegionWidget> newLastWidgetColumn = new ArrayList<RegionWidget>();

        List<Region> regions = new ArrayList<Region>();
        Region region = createStrictMock(Region.class);
        expect(region.getRegionWidgets()).andReturn(newLastWidgetColumn).times(2);
        expect(region.getRenderOrder()).andReturn(1);
        replay(region);
        regions.add(region);


        RegionWidget widget = createStrictMock(RegionWidget.class);
        widget.setRegion(region);
        widget.setRenderOrder(1);
        replay(widget);
        List<RegionWidget> movedWidgets = new ArrayList<RegionWidget>();
        movedWidgets.add(widget);

        Region deletedRegion = createStrictMock(Region.class);
        expect(deletedRegion.getRegionWidgets()).andReturn(movedWidgets);
        replay(deletedRegion);
        regions.add(deletedRegion);

        PageLayout prevLayout = createStrictMock(PageLayoutImpl.class);
        expect(prevLayout.getNumberOfRegions()).andReturn(new Long(2)).anyTimes();
View Full Code Here

        replay(widget);
        List<RegionWidget> newLastWidgetColumn = new ArrayList<RegionWidget>();
        newLastWidgetColumn.add(widget);

        List<Region> regions = new ArrayList<Region>();
        Region region = createStrictMock(Region.class);
        expect(region.getRegionWidgets()).andReturn(newLastWidgetColumn).times(2);
        expect(region.getRenderOrder()).andReturn(1);
        replay(region);
        regions.add(region);


        widget = createStrictMock(RegionWidget.class);
        widget.setRegion(region);
        widget.setRenderOrder(1);
        expect(widget.getRenderOrder()).andReturn(1).anyTimes();
        replay(widget);
        List<RegionWidget> movedWidgets = new ArrayList<RegionWidget>();
        movedWidgets.add(widget);

        Region deletedRegion = createStrictMock(Region.class);
        expect(deletedRegion.getRegionWidgets()).andReturn(movedWidgets);
        replay(deletedRegion);
        regions.add(deletedRegion);

        PageLayout prevLayout = createStrictMock(PageLayoutImpl.class);
        expect(prevLayout.getNumberOfRegions()).andReturn(new Long(2)).anyTimes();
View Full Code Here

    private List<Region> createEmptyRegionList(long numberOfRegions) {
        List<Region> regions = new ArrayList<Region>();
        int regionCount;
        for (regionCount = 0; regionCount < numberOfRegions; regionCount++) {
              Region region = new RegionImpl();
              regions.add(region);
        }
        return regions;
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.model.Region

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.