Package org.apache.rave.provider.w3c.service.impl

Examples of org.apache.rave.provider.w3c.service.impl.W3CWidget


        subPage.setName(VALID_SUBPAGE_NAME);
        subPage.setParentPage(page);
        subPage.setPageType(PageType.SUB_PAGE);
        page.getSubPages().add(subPage);

        W3CWidget w = new W3CWidget("1");
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl("http://example.com/widgets/1");
        Region region = new RegionImpl(REGION_ID);
        region.setPage(subPage);
        RegionWidget rw = new RegionWidgetImpl(REGION_WIDGET_ID);
        rw.setWidgetId(w.getId());
        rw.setRegion(region);

        W3CWidget wookieWidget = new W3CWidget();
        wookieWidget.setUrl(VALID_WIDGET_INSTANCE_URL);

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        expect(wookieService.getWidget(eq(user), eq(rw.getId()), isA(Widget.class))).andReturn(wookieWidget);
        replay(wookieService);
View Full Code Here


        String sharedDataKey = String.valueOf(item.getEntityId());
       
        //
        // Get the Rave Widget for this regionWidget instance
        //
        W3CWidget contextualizedWidget = (W3CWidget) widgetService.getWidget(user, sharedDataKey, item.getWidget());
       
        //
        // TODO make this do something useful; currently these preferences aren't
        // actually available in the Widget Instance as prefs are managed separately in Wookie
        //
        JSONObject userPrefs = new JSONObject();
        if (item.getPreferences() != null) {
            for (RegionWidgetPreference regionWidgetPreference : item.getPreferences()) {
                try {
                    userPrefs.put(regionWidgetPreference.getName(), regionWidgetPreference.getValue());
                } catch (JSONException e) {
                    logger.error("Exception caught adding preference to JSONObject: " + regionWidgetPreference, e);
                }
            }
        }
       
        //
        // Use width and height attributes if available, otherwise set to "100%"
        //
        String width = "100%";
        String height = "100%";
        if (contextualizedWidget.getWidth() > 0)
           width = String.valueOf(contextualizedWidget.getWidth()) + "px";
        if (contextualizedWidget.getHeight() > 0)
          height = String.valueOf(contextualizedWidget.getHeight()) + "px";

        //
        // Construct and return script block
        //
        return String.format(SCRIPT_BLOCK,
                item.getRegion().getEntityId(),
                WIDGET_TYPE,
                item.getEntityId(),
                contextualizedWidget.getUrl(),
                height,
                width,
                item.isCollapsed(),
                item.getWidget().getEntityId());
    }
View Full Code Here

        User user = new UserImpl(9999L, "testUser");
        expect(userService.getAuthenticatedUser()).andReturn(user);
        replay(userService);
       
        W3CWidget w = new W3CWidget();
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl("http://example.com/widgets/1");
        Region region = new RegionImpl(REGION_ID);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(REGION_WIDGET_ID);
        rw.setWidget(w);
        rw.setRegion(region);

        W3CWidget wookieWidget = new W3CWidget();
        wookieWidget.setUrl(VALID_WIDGET_INSTANCE_URL);

        expect(wookieService.getWidget(eq(user), eq(rw.getId().toString()), isA(Widget.class))).andReturn(wookieWidget);
        replay(wookieService);

        String placeholder = renderer.render(rw, renderContext);
View Full Code Here

        String sharedDataKey = String.valueOf(item.getId());

        //
        // Get the Rave Widget for this regionWidget instance
        //
        W3CWidget contextualizedWidget = (W3CWidget) widgetService.getWidget(user, sharedDataKey, item.getWidget());

        //
        // TODO make this do something useful; currently these preferences aren't
        // actually available in the Widget Instance as prefs are managed separately in Wookie
        //
        JSONObject userPrefs = new JSONObject();
        if (item.getPreferences() != null) {
            for (RegionWidgetPreference regionWidgetPreference : item.getPreferences()) {
                try {
                    userPrefs.put(regionWidgetPreference.getName(), regionWidgetPreference.getValue());
                } catch (JSONException e) {
                    logger.error("Exception caught adding preference to JSONObject: " + regionWidgetPreference, e);
                }
            }
        }

        //
        // Use width and height attributes if available, otherwise set to "100%"
        //
        String width = "100%";
        String height = "100%";
        if (contextualizedWidget.getWidth() > 0)
           width = String.valueOf(contextualizedWidget.getWidth()) + "px";
        if (contextualizedWidget.getHeight() > 0)
          height = String.valueOf(contextualizedWidget.getHeight()) + "px";

        //
        // Construct and return script block
        //
        return String.format(SCRIPT_BLOCK,
                item.getRegion().getId(),
                WIDGET_TYPE,
                item.getId(),
                contextualizedWidget.getUrl(),
                height,
                width,
                item.isCollapsed(),
                item.getWidget().getId(),
                item.isLocked(),
View Full Code Here

        subPage.setName(VALID_SUBPAGE_NAME);
        subPage.setParentPage(page);
        subPage.setPageType(PageType.SUB_PAGE);
        page.getSubPages().add(subPage);

        W3CWidget w = new W3CWidget();
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl("http://example.com/widgets/1");
        Region region = new RegionImpl(REGION_ID);
        region.setPage(subPage);
        RegionWidget rw = new RegionWidgetImpl();
        rw.setId(REGION_WIDGET_ID);
        rw.setWidget(w);
        rw.setRegion(region);

        W3CWidget wookieWidget = new W3CWidget();
        wookieWidget.setUrl(VALID_WIDGET_INSTANCE_URL);

        expect(wookieService.getWidget(eq(user), eq(rw.getId().toString()), isA(Widget.class))).andReturn(wookieWidget);
        replay(wookieService);

        String placeholder = renderer.render(rw, renderContext);
View Full Code Here

        String sharedDataKey = String.valueOf(item.getId());

        //
        // Get the Rave Widget for this regionWidget instance
        //
        W3CWidget contextualizedWidget = (W3CWidget) widgetService.getWidget(user, sharedDataKey, item.getWidget());

        //
        // TODO make this do something useful; currently these preferences aren't
        // actually available in the Widget Instance as prefs are managed separately in Wookie
        //
        JSONObject userPrefs = new JSONObject();
        if (item.getPreferences() != null) {
            for (RegionWidgetPreference regionWidgetPreference : item.getPreferences()) {
                try {
                    userPrefs.put(regionWidgetPreference.getName(), regionWidgetPreference.getValue());
                } catch (JSONException e) {
                    logger.error("Exception caught adding preference to JSONObject: " + regionWidgetPreference, e);
                }
            }
        }

        //
        // Use width and height attributes if available, otherwise set to "100%"
        //
        String width = "100%";
        String height = "100%";
        if (contextualizedWidget.getWidth() > 0)
           width = String.valueOf(contextualizedWidget.getWidth()) + "px";
        if (contextualizedWidget.getHeight() > 0)
          height = String.valueOf(contextualizedWidget.getHeight()) + "px";

        // get attributes about the sub page this regionWidget is on.  This is needed to assist the client in
        // determining which gadgets are on visible tabs/sub pages initially to make widget rendering more efficient
        Long pageId = null;
        String pageName = "";
        boolean isDefault = false;
        Page page =  item.getRegion().getPage();
        if (PageType.SUB_PAGE.equals(page.getPageType())) {
            pageId = page.getId();
            pageName = page.getName();
            // check to see if this regionWidget is on the first sub page, which will be the default
            // subpage rendered if the user doesn't specify which subpage via the URL hash
            isDefault = isDefaultSubPage(page);
        }

        //
        // Construct and return script block
        //
        return String.format(SCRIPT_BLOCK,
                item.getRegion().getId(),
                WIDGET_TYPE,
                item.getId(),
                contextualizedWidget.getUrl(),
                height,
                width,
                item.isCollapsed(),
                item.getWidget().getId(),
                item.isLocked(),
View Full Code Here

        String sharedDataKey = String.valueOf(item.getEntityId());

        //
        // Get the Rave Widget for this regionWidget instance
        //
        W3CWidget contextualizedWidget = (W3CWidget) widgetService.getWidget(user, sharedDataKey, item.getWidget());

        //
        // TODO make this do something useful; currently these preferences aren't
        // actually available in the Widget Instance as prefs are managed separately in Wookie
        //
        JSONObject userPrefs = new JSONObject();
        if (item.getPreferences() != null) {
            for (RegionWidgetPreference regionWidgetPreference : item.getPreferences()) {
                try {
                    userPrefs.put(regionWidgetPreference.getName(), regionWidgetPreference.getValue());
                } catch (JSONException e) {
                    logger.error("Exception caught adding preference to JSONObject: " + regionWidgetPreference, e);
                }
            }
        }

        //
        // Use width and height attributes if available, otherwise set to "100%"
        //
        String width = "100%";
        String height = "100%";
        if (contextualizedWidget.getWidth() > 0)
           width = String.valueOf(contextualizedWidget.getWidth()) + "px";
        if (contextualizedWidget.getHeight() > 0)
          height = String.valueOf(contextualizedWidget.getHeight()) + "px";

        //
        // Construct and return script block
        //
        return String.format(SCRIPT_BLOCK,
                item.getRegion().getEntityId(),
                WIDGET_TYPE,
                item.getEntityId(),
                contextualizedWidget.getUrl(),
                height,
                width,
                item.isCollapsed(),
                item.getWidget().getEntityId());
    }
View Full Code Here

        String sharedDataKey = String.valueOf(item.getId());

        //
        // Get the Rave Widget for this regionWidget instance
        //
        W3CWidget contextualizedWidget = (W3CWidget) widgetService.getWidget(user, sharedDataKey, widget);

        //
        // TODO make this do something useful; currently these preferences aren't
        // actually available in the Widget Instance as prefs are managed separately in Wookie
        //
        JSONObject userPrefs = new JSONObject();
        if (item.getPreferences() != null) {
            for (RegionWidgetPreference regionWidgetPreference : item.getPreferences()) {
                try {
                    userPrefs.put(regionWidgetPreference.getName(), regionWidgetPreference.getValue());
                } catch (JSONException e) {
                    logger.error("Exception caught adding preference to JSONObject: " + regionWidgetPreference, e);
                }
            }
        }

        //
        // Use width and height attributes if available, otherwise set to "100%"
        //
        String width = "100%";
        String height = "100%";
        if (contextualizedWidget.getWidth() > 0)
           width = String.valueOf(contextualizedWidget.getWidth()) + "px";
        if (contextualizedWidget.getHeight() > 0)
          height = String.valueOf(contextualizedWidget.getHeight()) + "px";

        // get attributes about the sub page this regionWidget is on.  This is needed to assist the client in
        // determining which gadgets are on visible tabs/sub pages initially to make widget rendering more efficient
        String pageId = null;
        String pageName = "";
        boolean isDefault = false;
        Page page =  item.getRegion().getPage();
        if (PageType.SUB_PAGE.equals(page.getPageType())) {
            pageId = page.getId();
            pageName = page.getName();
            // check to see if this regionWidget is on the first sub page, which will be the default
            // subpage rendered if the user doesn't specify which subpage via the URL hash
            isDefault = isDefaultSubPage(page);
        }

        //
        // Construct and return script block
        //
        return String.format(SCRIPT_BLOCK,
                item.getRegion().getId(),
                WIDGET_TYPE,
                item.getId(),
                contextualizedWidget.getUrl(),
                height,
                width,
                item.isCollapsed(),
                item.getWidgetId(),
                item.isLocked(),
View Full Code Here

        subPage.setName(VALID_SUBPAGE_NAME);
        subPage.setParentPage(page);
        subPage.setPageType(PageType.SUB_PAGE);
        page.getSubPages().add(subPage);

        W3CWidget w = new W3CWidget("1");
        w.setType(Constants.WIDGET_TYPE);
        w.setUrl("http://example.com/widgets/1");
        Region region = new RegionImpl(REGION_ID);
        region.setPage(subPage);
        RegionWidget rw = new RegionWidgetImpl(REGION_WIDGET_ID);
        rw.setWidgetId(w.getId());
        rw.setRegion(region);

        W3CWidget wookieWidget = new W3CWidget();
        wookieWidget.setUrl(VALID_WIDGET_INSTANCE_URL);

        RegionWidgetWrapper wrapper = new RegionWidgetWrapper(w, rw);

        expect(wookieService.getWidget(eq(user), eq(rw.getId()), isA(Widget.class))).andReturn(wookieWidget);
        replay(wookieService);
View Full Code Here

        String sharedDataKey = String.valueOf(item.getId());

        //
        // Get the Rave Widget for this regionWidget instance
        //
        W3CWidget contextualizedWidget = (W3CWidget) widgetService.getWidget(user, sharedDataKey, widget);

        //
        // TODO make this do something useful; currently these preferences aren't
        // actually available in the Widget Instance as prefs are managed separately in Wookie
        //
        JSONObject userPrefs = new JSONObject();
        if (item.getPreferences() != null) {
            for (RegionWidgetPreference regionWidgetPreference : item.getPreferences()) {
                try {
                    userPrefs.put(regionWidgetPreference.getName(), regionWidgetPreference.getValue());
                } catch (JSONException e) {
                    logger.error("Exception caught adding preference to JSONObject: " + regionWidgetPreference, e);
                }
            }
        }

        //
        // Use width and height attributes if available, otherwise set to "100%"
        //
        String width = "100%";
        String height = "100%";
        if (contextualizedWidget.getWidth() > 0)
           width = String.valueOf(contextualizedWidget.getWidth()) + "px";
        if (contextualizedWidget.getHeight() > 0)
          height = String.valueOf(contextualizedWidget.getHeight()) + "px";

        // get attributes about the sub page this regionWidget is on.  This is needed to assist the client in
        // determining which gadgets are on visible tabs/sub pages initially to make widget rendering more efficient
        String pageId = null;
        String pageName = "";
        boolean isDefault = false;
        Page page =  item.getRegion().getPage();
        if (PageType.SUB_PAGE.equals(page.getPageType())) {
            pageId = page.getId();
            pageName = page.getName();
            // check to see if this regionWidget is on the first sub page, which will be the default
            // subpage rendered if the user doesn't specify which subpage via the URL hash
            isDefault = isDefaultSubPage(page);
        }

        //
        // Construct and return script block
        //
        return String.format(SCRIPT_BLOCK,
                item.getRegion().getId(),
                WIDGET_TYPE,
                item.getId(),
                contextualizedWidget.getUrl(),
                height,
                width,
                item.isCollapsed(),
                item.getWidgetId(),
                item.isLocked(),
View Full Code Here

TOP

Related Classes of org.apache.rave.provider.w3c.service.impl.W3CWidget

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.