Author: julien(a)jboss.com
Date: 2008-03-17 10:59:17 -0400 (Mon, 17 Mar 2008)
New Revision: 10292
Added:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/demo4.jsp
Removed:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventProduction.java
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/DebuggerPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventRoute.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
Log:
updated debugger portlet
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/DebuggerPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/DebuggerPortlet.java 2008-03-17
14:23:26 UTC (rev 10291)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/DebuggerPortlet.java 2008-03-17
14:59:17 UTC (rev 10292)
@@ -47,12 +47,30 @@
if (eventCC != null)
{
PrintWriter writer = resp.getWriter();
+ writer.print("<ul>\n");
+ for (EventRoute route : eventCC.getRoots())
+ {
+ writer.println("<li>\n");
+ printRoute(route, writer);
+ writer.println("</li>\n");
+ }
+ writer.println("</ul>\n");
+ }
+ }
-// for (EventRoute route : eventCC.getRoutings())
-// {
-// writer.println("from:" + route.getSource() + " to:" +
route.getDestination() + " acknowledgement:" + route.getAcknowledgment());
-// writer.println("<hr/>");
-// }
+ private void printRoute(EventRoute route, PrintWriter writer)
+ {
+ writer.print("<div>Source: " +
route.getSource().getName().getLocalPart() + "</div>\n");
+ writer.print("<div>Destination: " +
route.getDestination().getName().getLocalPart() + "</div>\n");
+ writer.print("<div>Acknowledgement: " + route.getAcknowledgment() +
"</div>\n");
+ writer.print("<ul>\n");
+ for (EventRoute child : route.getChildren())
+ {
+ writer.println("<li>\n");
+ printRoute(child, writer);
+ writer.println("</li>\n");
}
+ writer.println("</ul>\n");
}
+
}
Deleted:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventProduction.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventProduction.java 2008-03-17
14:23:26 UTC (rev 10291)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventProduction.java 2008-03-17
14:59:17 UTC (rev 10292)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.portal.jsp;
-
-import org.jboss.portal.portlet.controller.event.Event;
-
-import java.util.Map;
-import java.util.LinkedHashMap;
-
-/**
- * The production of an event by a portlet.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class EventProduction
-{
-
- /** . */
- private final Event event;
-
- /** . */
- final Map<Event, EventRoute> routings;
-
- public EventProduction(Event event)
- {
- this.event = event;
- this.routings = new LinkedHashMap<Event, EventRoute>();
- }
-
- public Event getEvent()
- {
- return event;
- }
-
- public Iterable<EventRoute> getRoutings()
- {
- return routings.values();
- }
-}
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventRoute.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventRoute.java 2008-03-17
14:23:26 UTC (rev 10291)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/EventRoute.java 2008-03-17
14:59:17 UTC (rev 10292)
@@ -35,34 +35,43 @@
{
/** . */
- private final EventProduction parent;
+ private final EventRoute parent;
/** . */
+ private final Event source;
+
+ /** . */
private final Event destination;
/** . */
- final LinkedList<EventProduction> children;
+ final LinkedList<EventRoute> children;
/** . */
EventAcknowledgement acknowledgement;
- public EventRoute(EventProduction parent, Event destination)
+ public EventRoute(EventRoute parent, Event source, Event destination)
{
this.parent = parent;
+ this.source = source;
this.destination = destination;
- this.children = new LinkedList<EventProduction>();
+ this.children = new LinkedList<EventRoute>();
}
- public EventProduction getParent()
+ public EventRoute getParent()
{
return parent;
}
- public List<EventProduction> getChildren()
+ public List<EventRoute> getChildren()
{
return children;
}
+ public Event getSource()
+ {
+ return source;
+ }
+
public Event getDestination()
{
return destination;
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-17
14:23:26 UTC (rev 10291)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-03-17
14:59:17 UTC (rev 10292)
@@ -32,6 +32,8 @@
import java.util.Map;
import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.ArrayList;
/**
* Route events according to the portlets discovered on the page. For now it is pretty
trivial.
@@ -52,6 +54,9 @@
/** Used internally. */
private final Map<Event, EventRoute> routings;
+ /** . */
+ private final List<EventRoute> roots;
+
public PageEventControllerContext(
PagePortletControllerContext context,
PortalPrepareResponse prepareResponse)
@@ -59,18 +64,17 @@
this.context = context;
this.prepareResponse = prepareResponse;
this.routings = new LinkedHashMap<Event, EventRoute>();
+ this.roots = new ArrayList<EventRoute>();
}
+ public List<EventRoute> getRoots()
+ {
+ return roots;
+ }
+
public void eventProduced(EventPhaseContext context, Event producedEvent, Event
causeEvent)
{
- EventProduction production = new EventProduction(producedEvent);
-
- //
EventRoute relatedRoute = routings.get(causeEvent);
- if (relatedRoute != null)
- {
- relatedRoute.children.add(production);
- }
//
for (String windowId : prepareResponse.getWindowIds())
@@ -90,10 +94,22 @@
Event destinationEvent = new Event(producedEvent.getName(),
producedEvent.getPayload(), windowId);
//
- EventRoute eventRoute = new EventRoute(production, destinationEvent);
- production.routings.put(destinationEvent, eventRoute);
+ EventRoute eventRoute;
+ if (relatedRoute != null)
+ {
+ eventRoute = new EventRoute(relatedRoute, producedEvent,
destinationEvent);
+ relatedRoute.children.add(eventRoute);
+ }
+ else
+ {
+ eventRoute = new EventRoute(relatedRoute, producedEvent,
destinationEvent);
+ roots.add(eventRoute);
+ }
//
+ routings.put(destinationEvent, eventRoute);
+
+ //
context.queueEvent(destinationEvent);
}
}
Added: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/demo4.jsp
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/demo4.jsp
(rev 0)
+++
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/demo4.jsp 2008-03-17
14:59:17 UTC (rev 10292)
@@ -0,0 +1,23 @@
+<%@ page contentType="text/html" %>
+<%@ page language="java" %>
+<%@ taglib prefix="xportal" tagdir="/WEB-INF/tags/portal" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+<%@ page isELIgnored="false" %>
+
+<%@ include file="/layouts/header.jsp" %>
+
+<portal:page>
+
+ <xportal:2columns>
+ <jsp:attribute name="leftcol">
+ <xportal:portlet name="RandomEventPortlet1"
applicationName="samples-basic-portlet"/>
+ <xportal:portlet name="RandomEventPortlet2"
applicationName="samples-basic-portlet"/>
+ <xportal:portlet name="RandomEventPortlet3"
applicationName="samples-basic-portlet"/>
+ </jsp:attribute>
+ <jsp:attribute name="rightcol">
+ <xportal:portlet name="DebuggerPortlet"
applicationName="simple-portal"/>
+ </jsp:attribute>
+
+ </xportal:2columns>
+</portal:page>
+<%@ include file="/layouts/footer.jsp" %>
\ No newline at end of file