Package org.apache.rave.portal.model

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


        w.setType("OpenSocial");
        w.setEntityId(1L);
        w.setTitle("Gadget Title");
        w.setUrl("http://www.example.com/gadget.xml");

        RegionWidget rw = new RegionWidget(1L, w, region);
        region.setRegionWidgets(Arrays.asList(rw));

        RenderContext context = new RenderContext();
        context.setProperties(new HashMap());
        String rendered = service.render(rw, context);
View Full Code Here


    }

    // returns a trusted RegionWidget object, either from the RegionWidgetRepository, or the
    // cached container list
    private RegionWidget getTrustedRegionWidget(long regionWidgetId, List<RegionWidget> trustedRegionWidgetContainer) {
        RegionWidget regionWidget = null;
        if (trustedRegionWidgetContainer.isEmpty()) {
            regionWidget = regionWidgetRepository.get(regionWidgetId);
            trustedRegionWidgetContainer.add(regionWidget);
        } else {
            regionWidget = trustedRegionWidgetContainer.get(0);
View Full Code Here

    // checks to see if the Authentication object principal is the owner of the supplied regionWidget object
    // if trustedDomainObject is false, pull the entity from the database first to ensure
    // the model object is trusted and hasn't been modified
    private boolean isRegionWidgetOwner(Authentication authentication, RegionWidget regionWidget, List<RegionWidget> trustedRegionWidgetContainer, boolean trustedDomainObject) {
        RegionWidget trustedRegionWidget = null;
        if (trustedDomainObject) {
            trustedRegionWidget = regionWidget;
        } else {
            trustedRegionWidget = getTrustedRegionWidget(regionWidget.getEntityId(), trustedRegionWidgetContainer);
        }
View Full Code Here

    @Test(expected = NotSupportedException.class)
    public void render_invalid() {
        Widget w = new Widget();
        w.setType("NONE");
        w.setUrl("http://www.example.com/gadget.xml");
        RegionWidget rw = new RegionWidget();
        rw.setEntityId(1L);
        rw.setWidget(w);

        renderer.render(rw, null);
    }
View Full Code Here

        Widget w = new Widget();
        w.setEntityId(1L);
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl(VALID_GADGET_URL);
        Region region = new Region(1L);
        RegionWidget rw = new RegionWidget();
        rw.setEntityId(1L);
        rw.setCollapsed(VALID_COLLAPSED);
        rw.setWidget(w);
        rw.setRegion(region);
        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>rave.registerWidget(widgetsByRegionIdMap, 1, {type: 'OpenSocial'," +
View Full Code Here

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

        final String markup =
            "<script>rave.registerWidget(widgetsByRegionIdMap, 1, {type: 'OpenSocial'," +
            " regionWidgetId: null," +
            " widgetUrl: 'null', " +
View Full Code Here

        tag.setPageContext(pageContext);
    }

    @Test
    public void doStartTag_valid() throws IOException, JspException {
        RegionWidget regionWidget = new RegionWidget();
        Widget widget = new Widget();
        regionWidget.setWidget(widget);
        widget.setType(WIDGET_TYPE);

        Set<String> strings = new HashSet<String>();
        strings.add(WIDGET_TYPE);
View Full Code Here


    @Test(expected = JspException.class)
    public void doStartTag_IOException() throws JspException, IOException {

        RegionWidget regionWidget = new RegionWidget();
        Widget widget = new Widget();
        regionWidget.setWidget(widget);
        widget.setType("INVALID");

        Set<String> strings = new HashSet<String>();
        strings.add(WIDGET_TYPE);
View Full Code Here

    @Test(expected = JspException.class)
    public void doStartTag_unsupportedWidget() throws JspException {
        replay(pageContext);

        RegionWidget regionWidget = new RegionWidget();
        Widget widget = new Widget();
        regionWidget.setWidget(widget);
        widget.setType("INVALID");

        Set<String> strings = new HashSet<String>();
        strings.add(WIDGET_TYPE);
View Full Code Here

    @Test
    public void moveWidget_validParams() {
        final long TO_REGION = 1;
        final long FROM_REGION = 2;

        expect(pageService.moveRegionWidget(REGION_WIDGET_ID, NEW_POSITION, TO_REGION, FROM_REGION)).andReturn(new RegionWidget());
        replay(pageService);
        RpcResult<RegionWidget> result = pageApi.moveWidgetOnPage(REGION_WIDGET_ID, NEW_POSITION, TO_REGION, FROM_REGION);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(notNullValue()));
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.