Author: taylor
Date: Tue May 12 06:17:34 2009
New Revision: 773798
URL: http://svn.apache.org/viewvc?rev=773798&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-998
Portlet 2.0 Event feature demo
Added:
portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp
(with props)
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java
(with props)
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java
(with props)
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties
(with props)
Modified:
portals/applications/demo/trunk/src/main/webapp/WEB-INF/other/googlemaps/GoogleMaps.vm
portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml
portals/applications/gems/trunk/pom.xml
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java
Modified:
portals/applications/demo/trunk/src/main/webapp/WEB-INF/other/googlemaps/GoogleMaps.vm
URL:
http://svn.apache.org/viewvc/portals/applications/demo/trunk/src/main/webapp/WEB-INF/other/googlemaps/GoogleMaps.vm?rev=773798&r1=773797&r2=773798&view=diff
==============================================================================
---
portals/applications/demo/trunk/src/main/webapp/WEB-INF/other/googlemaps/GoogleMaps.vm
(original)
+++
portals/applications/demo/trunk/src/main/webapp/WEB-INF/other/googlemaps/GoogleMaps.vm
Tue May 12 06:17:34 2009
@@ -16,7 +16,19 @@
*#
<script language="JavaScript" type="text/javascript">
function ${renderResponse.namespace}mapsLoaded() {
- var loc = escape("$renderRequest.getPreferences().getValue('Location','')");
+ var loc = escape("$!renderRequest.getParameter('address')");
+ if (loc == null)
+ {
+ loc = escape("$renderRequest.getPreferences().getValue('Location','')");
+ }
+ else
+ {
+ loc = loc.replace(/^\s*/, "").replace(/\s*$/, "");
+ if (loc == "")
+ {
+ loc =
escape("$renderRequest.getPreferences().getValue('Location','')");
+ }
+ }
var appid = escape("$renderRequest.getPreferences().getValue('APIKey','')");
var getLatitudeLongitudeUrl =
"$renderRequest.getScheme():\/\/$renderRequest.getServerName():$renderRequest.getServerPort()$renderRequest.getContextPath()\/yahoogeocode?location="
+ loc + "&appid=" + appid;
dojo.io.bind({
Modified: portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml
URL:
http://svn.apache.org/viewvc/portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml?rev=773798&r1=773797&r2=773798&view=diff
==============================================================================
--- portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml
(original)
+++ portals/applications/demo/trunk/src/main/webapp/WEB-INF/portlet.xml Tue May
12 06:17:34 2009
@@ -601,8 +601,12 @@
<value>ABQIAAAAMDRA8-wV3kKZLHtfyDUJGhTwM0brOpm-All5BF6PoaKBxRWWERQ4jdA2WxzK62g0E2Xk-DF9JJccFg</value>
</preference>
</portlet-preferences>
+ <supported-processing-event>
+ <qname
xmlns:apa="http:applications.portals.apache.org/events">apa:AddressEvent</qname>
+ </supported-processing-event>
</portlet>
-
+
+
<portlet id="weather">
<description>Weather Underground Portlet. Go to edit mode to configure the
weather for your city.</description>
<portlet-name>WeatherPortlet</portlet-name>
@@ -973,7 +977,32 @@
</portlet-info>
</portlet>
-
+ <portlet>
+ <description>Publishes Address events using Portlet 2.0
events</description>
+ <portlet-name>AddressEventPortlet</portlet-name>
+ <display-name>Address Event Publisher</display-name>
+
<portlet-class>org.apache.portals.gems.address.AddressEventPortlet</portlet-class>
+ <init-param>
+ <name>ViewPage</name>
+ <value>/WEB-INF/view/address-view.jsp</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+
<resource-bundle>org.apache.portals.gems.address.resources.AddressEventResources</resource-bundle>
+ <portlet-info>
+ <title>Address Event</title>
+ <short-title>Address</short-title>
+ <keywords>event,address,address</keywords>
+ </portlet-info>
+ <supported-publishing-event>
+ <qname
xmlns:apa="http:applications.portals.apache.org/events">apa:AddressEvent</qname>
+ </supported-publishing-event>
+ </portlet>
+
<custom-portlet-mode>
<description>a Custom About Mode</description>
<portlet-mode>about</portlet-mode>
Added:
portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp
URL:
http://svn.apache.org/viewvc/portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp?rev=773798&view=auto
==============================================================================
---
portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp
(added)
+++
portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp
Tue May 12 06:17:34 2009
@@ -0,0 +1,36 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+
+<portlet:defineObjects/>
+<fmt:setBundle
basename="org.apache.portals.gems.address.resources.AddressEventResources" />
+<%
+String lastAddress = renderRequest.getParameter("address");
+if (lastAddress == null)
+ lastAddress = "";
+%>
+<form action="<portlet:actionURL/>">
+<table style="border-collapse: collapse; width: 350px; margin-top: 8px; float:
left;">
+ <tr>
+ <th class="portlet-section-subheader" style="text-align:
right"><fmt:message key="apa.address.event.address"/></td>
+ <td class="portlet-section-body"><input name='address' size='60'
value='<%= lastAddress %>'></input></td>
+ <td class="portlet-section-body"><input type='submit'
value="<fmt:message key='apa.address.event.submit'/>"/></td>
+ </tr>
+</table>
+</form>
Propchange:
portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/applications/demo/trunk/src/main/webapp/WEB-INF/view/address-view.jsp
------------------------------------------------------------------------------
svn:keywords = Id
Modified: portals/applications/gems/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/portals/applications/gems/trunk/pom.xml?rev=773798&r1=773797&r2=773798&view=diff
==============================================================================
--- portals/applications/gems/trunk/pom.xml (original)
+++ portals/applications/gems/trunk/pom.xml Tue May 12 06:17:34 2009
@@ -138,6 +138,17 @@
</exclusions>
</dependency>
</dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/portals/applications/gems/trunk/</connection>
Added:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java
URL:
http://svn.apache.org/viewvc/portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java?rev=773798&view=auto
==============================================================================
---
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java
(added)
+++
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java
Tue May 12 06:17:34 2009
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.gems.address;
+
+import java.io.Serializable;
+
+/**
+ * Publishes address events with Portlet 2.0 eventing
+ *
+ * @author <a href="mailto:[email protected]">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class AddressEvent implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private String address;
+
+ public AddressEvent()
+ {}
+
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
+}
Propchange:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEvent.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java
URL:
http://svn.apache.org/viewvc/portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java?rev=773798&view=auto
==============================================================================
---
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java
(added)
+++
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java
Tue May 12 06:17:34 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.gems.address;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.xml.namespace.QName;
+
+import org.apache.portals.bridges.common.GenericServletPortlet;
+
+/**
+ * Publishes address events with Portlet 2.0 eventing
+ *
+ * @author <a href="mailto:[email protected]">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class AddressEventPortlet extends GenericServletPortlet
+{
+ public void processAction(ActionRequest request, ActionResponse response)
throws PortletException,IOException
+ {
+ QName qname = new QName("http:applications.portals.apache.org/events"
, "AddressEvent");
+ String address = request.getParameter("address");
+ if (address == null)
+ {
+ address = "";
+ }
+ AddressEvent addressEvent = new AddressEvent();
+ addressEvent.setAddress(address);
+ response.setRenderParameter("address", address);
+ response.setEvent(qname, addressEvent);
+ }
+}
\ No newline at end of file
Propchange:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/AddressEventPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties
URL:
http://svn.apache.org/viewvc/portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties?rev=773798&view=auto
==============================================================================
---
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties
(added)
+++
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties
Tue May 12 06:17:34 2009
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# $Id$
+#
+
+# DO NOT TRANSLATE & DO NOT INCLUDE IN L10N PROPERTIES FILE
+apa.address.event.title=Address Event Demo
+apa.address.event.address=Full-address:
+apa.address.event.submit=Submit
+
\ No newline at end of file
Propchange:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/address/resources/AddressEventResources.properties
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java
URL:
http://svn.apache.org/viewvc/portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java?rev=773798&r1=773797&r2=773798&view=diff
==============================================================================
---
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java
(original)
+++
portals/applications/gems/trunk/src/main/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java
Tue May 12 06:17:34 2009
@@ -22,11 +22,15 @@
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
+import javax.portlet.Event;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletPreferences;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import org.apache.portals.gems.address.AddressEvent;
import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
import org.apache.portals.gems.dojo.DojoPortletHelper;
@@ -102,4 +106,16 @@
DojoPortletHelper.contributeDojoRequire(response,
"dojo.widget.Button");
}
+ @Override
+ public void processEvent(EventRequest request, EventResponse response)
+ {
+ Event event = request.getEvent();
+ if(event.getName().equals("AddressEvent"))
+ {
+ AddressEvent payload = (AddressEvent)event.getValue();
+ response.setRenderParameter("address", payload.getAddress());
+ }
+ }
+
+
}