Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.RegionWidget


    @Test
    public void addWidget_validParams() {
        final int PAGE_ID = 1;
        final long WIDGET_ID = 2;

        expect(pageService.addWidgetToPage(PAGE_ID, WIDGET_ID)).andReturn(new RegionWidget());
        replay(pageService);
        RpcResult result = pageApi.addWidgetToPage(PAGE_ID, WIDGET_ID);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(notNullValue()));
View Full Code Here


    }

    @Override
    @Transactional
    public Region removeWidgetFromPage(long regionWidgetId) {
        RegionWidget widget = getFromRepository(regionWidgetId, regionWidgetRepository);
        regionWidgetRepository.delete(widget);
        return getFromRepository(widget.getRegion().getEntityId(), regionRepository);
    }
View Full Code Here

        regionWidget.setRenderOrder(renderOrder);
        moveToRegion.getRegionWidgets().add(regionWidget);       
    }
   
    private RegionWidget createWidgetInstance(Widget widget, Region region, int position) {
        RegionWidget regionWidget = new RegionWidget();
        regionWidget.setRenderOrder(position);
        regionWidget.setWidget(widget);
        region.getRegionWidgets().add(position, regionWidget);
        updateRenderSequences(region.getRegionWidgets());
        Region persistedRegion = regionRepository.save(region);
        return persistedRegion.getRegionWidgets().get(position);
    }
View Full Code Here

        updateRenderSequences(target.getRegionWidgets());
        regionRepository.save(source);
    }

    private void replaceRegionWidget(long regionWidgetId, int newPosition, Region target, Region source) {
        RegionWidget widget = findRegionWidgetById(regionWidgetId, source.getRegionWidgets());
        source.getRegionWidgets().remove(widget);
        target.getRegionWidgets().add(newPosition, widget);
    }
View Full Code Here

    @Override
    @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId")
    public List<RegionWidgetPreference> saveRegionWidgetPreferences(long regionWidgetId,
                                                                    List<RegionWidgetPreference> preferences) {
        RegionWidget regionWidget = this.getValidRegionWidget(regionWidgetId);
        ModelUtils.normalizeRegionWidgetPreferences(regionWidgetId, preferences);
        reconcileRegionWidgetPreferences(regionWidget.getPreferences(), preferences, true);
        return this.saveRegionWidget(regionWidget).getPreferences();
    }
View Full Code Here

    }

    @Override
    @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId")
    public RegionWidgetPreference saveRegionWidgetPreference(long regionWidgetId, RegionWidgetPreference preference) {
        RegionWidget regionWidget = this.getValidRegionWidget(regionWidgetId);
        ModelUtils.normalizeRegionWidgetPreference(regionWidgetId, preference);
        reconcileRegionWidgetPreferences(regionWidget.getPreferences(), Arrays.asList(preference), false);
        regionWidget = this.saveRegionWidget(regionWidget);

        for (RegionWidgetPreference regionWidgetPreference : regionWidget.getPreferences()) {
            if (regionWidgetPreference.getName().equals(preference.getName())) {
                preference = regionWidgetPreference;
                break;
            }
        }
View Full Code Here

    }

    @Override
    @Transactional
    public RegionWidget saveRegionWidgetCollapsedState(long regionWidgetId, boolean collapsed) {
        RegionWidget regionWidget = getValidRegionWidget(regionWidgetId);
        regionWidget.setCollapsed(collapsed);
        return saveRegionWidget(regionWidget);
    }
View Full Code Here

        regionWidget.setCollapsed(collapsed);
        return saveRegionWidget(regionWidget);
    }
   
    private RegionWidget getValidRegionWidget(long regionWidgetId) {
        RegionWidget regionWidget = this.getRegionWidget(regionWidgetId);
        if (regionWidget == null) {
            throw new IllegalArgumentException("Invalid RegionWidget ID");
        }
        return regionWidget;
    }
View Full Code Here

        Widget w = new Widget();
        w.setEntityId(1L);
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl(VALID_GADGET_URL);
        RegionWidget rw = new RegionWidget();
        rw.setEntityId(1L);
        rw.setCollapsed(VALID_COLLAPSED);
        rw.setWidget(w);
        rw.setPreferences(Arrays.asList(new RegionWidgetPreference(1L, 1L, "color", "blue"),
                                        new RegionWidgetPreference(2L, 1L, "speed", "fast"),
                                        new RegionWidgetPreference(3L, 1L, null, null)));

        final String markup =
            "<script>widgets.push({type: 'OpenSocial'," +
View Full Code Here

    @Test
    public void render_null() {
        Widget w = new Widget();
        w.setType(Constants.WIDGET_TYPE);
        RegionWidget rw = new RegionWidget();
        rw.setWidget(w);

        String result = renderer.render(rw, null);

        final String markup =
            "<script>widgets.push({type: 'OpenSocial'," +
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.RegionWidget

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.