Author: thomas.heute(a)jboss.com
Date: 2008-04-24 08:47:26 -0400 (Thu, 24 Apr 2008)
New Revision: 10709
Added:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletEventEvent.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java
Log:
- A bit more on the Content framework eventing mechanism
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2008-04-24
10:47:47 UTC (rev 10708)
+++
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2008-04-24
12:47:26 UTC (rev 10709)
@@ -35,10 +35,12 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.faces.component.portlet.PortletActionEvent;
+import org.jboss.portal.faces.component.portlet.PortletEventEvent;
import org.jboss.portal.faces.component.portlet.PortletRenderEvent;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
import org.jboss.portal.portlet.PortletInvoker;
+import
org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse.Event;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.ThemeConstants;
@@ -384,18 +386,30 @@
// Keep window name and region defined
setWindowName(((String[])renderParams.get("windowName"))[0]);
}
+ else if (event instanceof PortletEventEvent)
+ {
+ PortletEventEvent eventEvent = (PortletEventEvent)event;
+ // TODO: Check the QName of the event
+ Event portletEvent = eventEvent.getEvent();
+ String uri = (String)portletEvent.getPayload();
+ this.selectedContentURI = uri;
+ // TODO: Get params from the payload (for widgets)
+ this.selectedContentParameters = new HashMap();
+ }
else if (event instanceof PortletActionEvent)
{
PortletActionEvent actionEvent = (PortletActionEvent)event;
Map actionParams = actionEvent.getParameterMap();
+ /*
// Keep window name and region defined
String[] windowNames = ((String[])actionParams.get("windowName"));
if (windowNames != null && windowNames.length > 0)
{
setWindowName(windowNames[0]);
}
-
+ */
+ /*
//
if (actionParams.get(CONTENT_ACTION_SELECT) != null)
{
@@ -423,6 +437,7 @@
this.selectedContentParameters = parameters;
}
}
+ */
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2008-04-24
10:47:47 UTC (rev 10708)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2008-04-24
12:47:26 UTC (rev 10709)
@@ -33,10 +33,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.xml.namespace.QName;
-import java.io.Serializable;
-import java.util.List;
import java.util.Map;
/**
@@ -107,6 +104,8 @@
}
this.windowState = WindowState.create(windowState);
}
+
+ protected PortletInvocationResponse pir;
void execute(FacesContext faces)
{
@@ -121,7 +120,7 @@
//
try
{
- PortletInvocationResponse pir = invocation.action(portlet, mode, windowState,
ParametersStateString.create(interactionState));
+ pir = invocation.action(portlet, mode, windowState,
ParametersStateString.create(interactionState));
if (pir instanceof UpdateNavigationalStateResponse)
{
UpdateNavigationalStateResponse response =
(UpdateNavigationalStateResponse)pir;
@@ -140,6 +139,7 @@
{
uiportlet.setInternalMode(response.getMode());
}
+
}
}
catch (PortletInvokerException e)
Added:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletEventEvent.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletEventEvent.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletEventEvent.java 2008-04-24
12:47:26 UTC (rev 10709)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.faces.component.portlet;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletEventEvent extends PortletEvent
+{
+ /** . */
+ private final ParameterMap interactionState;
+
+ /** . */
+ private UpdateNavigationalStateResponse.Event event;
+
+ public PortletEventEvent(UIComponent uiComponent, ParameterMap interactionState,
UpdateNavigationalStateResponse.Event event)
+ {
+ // FIXME PortletEventEvent constructor
+ super(uiComponent);
+ this.event = event;
+ this.interactionState = interactionState;
+ }
+
+ public UpdateNavigationalStateResponse.Event getEvent()
+ {
+ return event;
+ }
+
+ public Map getParameterMap()
+ {
+ return interactionState;
+ }
+
+}
+
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java 2008-04-24
10:47:47 UTC (rev 10708)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/UIPortlet.java 2008-04-24
12:47:26 UTC (rev 10709)
@@ -24,6 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.faces.util.ActionEventDispatcher;
import org.jboss.portal.portlet.Portlet;
@@ -35,6 +36,7 @@
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import javax.faces.component.UICommand;
import javax.faces.context.FacesContext;
@@ -45,11 +47,13 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
import javax.portlet.ActionRequest;
+import javax.portlet.EventRequest;
import javax.portlet.RenderRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -376,6 +380,22 @@
//
pevent.execute(faces);
+
+ if (pevent instanceof PortletActionEvent)
+ {
+ PortletActionEvent actionEvent = (PortletActionEvent)pevent;
+ if (actionEvent.pir instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse response =
(UpdateNavigationalStateResponse)actionEvent.pir;
+
+ // This is a Hack
+ List<UpdateNavigationalStateResponse.Event> events =
response.getEvents();
+ for (UpdateNavigationalStateResponse.Event tmpEvent: events)
+ {
+ queueEvent(new PortletEventEvent(this,
ParameterMap.clone(actionEvent.getParameterMap()), tmpEvent));
+ }
+ }
+ }
}
else
{
@@ -487,6 +507,10 @@
paevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
queueEvent(paevent);
}
+ else if (obj instanceof EventRequest)
+ {
+ throw new NotYetImplemented();
+ }
}
}