Index: rave-portal/src/main/java/org/apache/rave/provider/w3c/web/renderer/W3cWidgetRenderer.java
===================================================================
--- rave-portal/src/main/java/org/apache/rave/provider/w3c/web/renderer/W3cWidgetRenderer.java (revision 1132637)
+++ rave-portal/src/main/java/org/apache/rave/provider/w3c/web/renderer/W3cWidgetRenderer.java (revision )
@@ -19,8 +19,6 @@
package org.apache.rave.provider.w3c.web.renderer;
-import static org.apache.rave.provider.w3c.Constants.WIDGET_TYPE;
-
import org.apache.rave.exception.NotSupportedException;
import org.apache.rave.portal.model.RegionWidget;
import org.apache.rave.portal.model.Widget;
@@ -30,6 +28,8 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
+import static org.apache.rave.provider.w3c.Constants.WIDGET_TYPE;
+
/**
* Creates the appropriate markup to represent a W3C widget
*/
@@ -37,11 +37,9 @@
public class W3cWidgetRenderer implements RegionWidgetRenderer {
- private static final String IFRAME_MARKUP = "";
+ " widgetUrl: '%3$s'});";
private static final String INLINE_MARKUP = "";
Index: rave-portal/src/main/webapp/WEB-INF/views/home.jsp
===================================================================
--- rave-portal/src/main/webapp/WEB-INF/views/home.jsp (revision 1132804)
+++ rave-portal/src/main/webapp/WEB-INF/views/home.jsp (revision )
@@ -38,20 +38,8 @@
">Widget Store
-
-">
-">
-">
-">
-
-
Hello ${defaultPage.owner.username}, welcome to Rave!
-
@@ -64,53 +52,50 @@
${regionWidget.widget.title}
-
-
-
-
+
+
+
+
-
-
-
-
+
+
-
+
+
+
+">
+">
+">
+">
";
+ " userPrefs: {}});";
@Override
public String getSupportedContext() {
Index: rave-portal/src/main/webapp/script/rave.js
===================================================================
--- rave-portal/src/main/webapp/script/rave.js (revision 1132804)
+++ rave-portal/src/main/webapp/script/rave.js (revision )
@@ -188,8 +188,26 @@
function getContext() {
return context;
}
-
- /**
+
+ /**
+ * Takes care of the UI part of the widget rendering. Depends heavily on the HTML structure
+ * @param widgets array of widgets
+ */
+ function initGadgetUI(widgets) {
+ $("div[id^='region-']").each(function(regionIndex) {
+ var regionElement = $(this);
+ var regionId = regionElement.attr("id");
+ regionId = regionId.substring("region-".length, regionId.lastIndexOf('-'));
+ regionElement.children("div[id^='widget-wrapper-']").each(function(wrapperIndex) {
+ var widgetElement = $(this);
+ var widgetId = widgetElement.attr("id").substr("widget-wrapper-".length);
+ mapGadgetToRegion(widgetId, regionId);
+ styleGadgetButtons(widgetId);
+ });
+ });
+ }
+
+ /**
* Map a widget to the region where it is located.
*
* @param widgetId: id of the widget (not DOM id)
@@ -212,6 +230,27 @@
}
/**
+ * Applies styling to the several buttons in the widget / gadget toolbar
+ * @param widgetId identifier of the widget / gadget
+ */
+ function styleGadgetButtons(widgetId) {
+ $("#widget-" + widgetId + "-max").button({
+ text: false,
+ icons: {
+ primary: "ui-icon-arrow-4-diag"
+ }
+ });
+
+ $("#widget-" + widgetId + "-remove").button({
+ text: false,
+ icons: {
+ primary: "ui-icon-close"
+ }
+ });
+ }
+
+
+ /**
* Public API
*/
return {
@@ -271,7 +310,9 @@
*/
getContext: getContext,
+ initGadgetUI : initGadgetUI,
+
/**
* Change or delete gadget to region map entry.
*/