Author: thomas.heute(a)jboss.com
Date: 2008-05-22 10:41:22 -0400 (Thu, 22 May 2008)
New Revision: 10796
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/css/
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/css/master.css
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-maximize.gif
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-minimize.gif
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-normal.gif
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
branches/JBoss_Portal_Branch_2_7/core/.classpath
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/SignOutResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
Log:
- Fix portlet 2.0 samples portlet
- Make the signOut event works
- Started on portlet->portal events mechanism
Modified: branches/JBoss_Portal_Branch_2_7/core/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-05-22 13:34:23 UTC (rev 10795)
+++ branches/JBoss_Portal_Branch_2_7/core/.classpath 2008-05-22 14:41:22 UTC (rev 10796)
@@ -53,8 +53,8 @@
<classpathentry kind="lib"
path="/thirdparty/jboss/backport-concurrent/lib/jboss-backport-concurrent.jar"/>
<classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar"/>
<classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-federation-lib.jar"/>
- <classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"
sourcepath="/module-portlet"/>
+ <classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"
sourcepath="/module-portlet-2.0.0.CR2"/>
<classpathentry kind="lib"
path="/thirdparty/portlet/lib/portlet-api.jar"/>
- <classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-controller-lib.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-controller-lib.jar"
sourcepath="/module-portlet-2.0.0.CR2"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java 2008-05-22
13:34:23 UTC (rev 10795)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java 2008-05-22
14:41:22 UTC (rev 10796)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.aspects.portlet;
+import org.jboss.portal.core.controller.portlet.CoreEventControllerContext;
import org.jboss.portal.core.controller.portlet.SignOutResponse;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -41,12 +42,13 @@
protected Object invoke(PortletInvocation invocation) throws Exception
{
PortletInvocationResponse response =
(PortletInvocationResponse)invocation.invokeNext();
+
if (response instanceof UpdateNavigationalStateResponse)
{
UpdateNavigationalStateResponse unsr =
(UpdateNavigationalStateResponse)response;
for (UpdateNavigationalStateResponse.Event event : unsr.getEvents())
{
- if (event.getName().equals(new
QName("http://www.jboss.com/portal",
"signOut")))
+ if (event.getName().equals(new
QName(CoreEventControllerContext.PORTAL_NAMESPACE, "signOut")))
{
String location = (String)event.getPayload();
return new SignOutResponse(location);
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java 2008-05-22
13:34:23 UTC (rev 10795)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/command/response/SignOutResponse.java 2008-05-22
14:41:22 UTC (rev 10796)
@@ -40,10 +40,6 @@
public SignOutResponse(String location)
{
- if (location == null)
- {
- throw new IllegalArgumentException();
- }
this.location = location;
}
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java 2008-05-22
13:34:23 UTC (rev 10795)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java 2008-05-22
14:41:22 UTC (rev 10796)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.controller.portlet;
+import java.util.LinkedList;
+
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.Event;
@@ -36,15 +38,22 @@
public class CoreEventControllerContext implements EventControllerContext
{
+ public final static String PORTAL_NAMESPACE = "urn:jboss:portal";
+
/** . */
private final Logger log = Logger.getLogger(CoreEventControllerContext.class);
/** . */
private final ControllerPortletControllerContext portletControllerContext;
+
+ /** Events to be consumed by the portal, unused at the moment */
+ private LinkedList<Event> toConsumeEvents;
+
public CoreEventControllerContext(ControllerPortletControllerContext
portletControllerContext)
{
this.portletControllerContext = portletControllerContext;
+ this.toConsumeEvents = new LinkedList<Event>();
}
public void eventProduced(EventPhaseContext context, Event producedEvent, Event
sourceEvent)
@@ -62,6 +71,12 @@
context.queueEvent(distributedEvent);
}
}
+
+ // Portal events unused at the moment
+ if (PORTAL_NAMESPACE.equals(producedEvent.getName().getNamespaceURI()))
+ {
+ toConsumeEvents.addLast(producedEvent);
+ }
}
catch (Exception e)
{
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/SignOutResponse.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/SignOutResponse.java 2008-05-22
13:34:23 UTC (rev 10795)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/SignOutResponse.java 2008-05-22
14:41:22 UTC (rev 10796)
@@ -42,10 +42,6 @@
public SignOutResponse(String location)
{
- if (location == null)
- {
- throw new IllegalArgumentException();
- }
this.location = location;
}
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-05-22
13:34:23 UTC (rev 10795)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-05-22
14:41:22 UTC (rev 10796)
@@ -38,6 +38,7 @@
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.core.aspects.controller.node.Navigation;
+import org.jboss.portal.core.controller.portlet.CoreEventControllerContext;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -153,7 +154,8 @@
*/
public void signOut() throws IllegalStateException
{
- setEvent(new
QName("http://www.jboss.com/portal", "signOut"),
null);
+
+ setEvent(new QName(CoreEventControllerContext.PORTAL_NAMESPACE,
"signOut"), null);
/*
if (!PortletRequest.FORM_AUTH.equals(preq.getAuthType()))
{
@@ -179,7 +181,7 @@
*/
public void signOut(String location) throws IllegalStateException
{
- setEvent(new
QName("http://www.jboss.com/portal", "signOut"),
location);
+ setEvent(new QName(CoreEventControllerContext.PORTAL_NAMESPACE,
"signOut"), location);
// throw new NotYetImplemented();
/*
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-05-22 13:34:23 UTC (rev
10795)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-05-22 14:41:22 UTC (rev
10796)
@@ -252,6 +252,7 @@
<!-- portal-portlet-samples.war -->
<copy todir="${build.resources}/portal-portlet-samples.war">
<fileset dir="${build.resources}/portal-portlet-samples-war"/>
+ <fileset dir="${source.bin}/portal-portlet-samples-war"/>
</copy>
<mkdir
dir="${build.resources}/portal-portlet-samples.war/WEB-INF/lib/"/>
<copy
file="${jboss.portal/modules/portlet.lib}/portal-portlet-samples-lib.jar"
todir="${build.resources}/portal-portlet-samples.war/WEB-INF/lib/"/>
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/css/master.css
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/css/master.css
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/css/master.css 2008-05-22
14:41:22 UTC (rev 10796)
@@ -0,0 +1,388 @@
+body,
+div.container {
+ font: normal 12px Lucida Sans, Trebuchet, tahoma, sans-serif;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center-margin {
+ margin: 0 auto 0 auto;
+}
+
+.float-left {
+ float: left;
+}
+
+.float-right {
+ float: right;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-right {
+ text-align: right;
+}
+
+.half-width {
+ width: 49%;
+}
+
+.quarter-width {
+ width: 24.9%;
+}
+
+.three-quarter-width {
+ width: 74.9%;
+}
+
+.full-width {
+ width: 100%;
+}
+
+.third-width {
+ width: 32.9%;
+}
+
+.two-third-width {
+ width: 65.5%;
+}
+
+.tenpx-top-bottom {
+ margin: 10px 0 10px 0;
+}
+
+.relative {
+ position: relative
+}
+
+.absolute {
+ position: absolute
+}
+
+p.white-padded {
+ color: #fff;
+ padding: 5px;
+}
+
+.clear {
+ clear: both;
+}
+
+img {
+ margin: 0;
+ padding: 0;
+ border: 0;
+}
+
+.zero {
+ margin: 0;
+ padding: 0;
+ border: 0;
+}
+
+body,
+ div,
+ form,
+ ul,
+ li {
+ margin: 0;
+ padding: 0;
+}
+
+ul {
+
+}
+
+ul li {
+ list-style-position:inside;
+}
+
+.hidden {
+ display: none;
+}
+
+/*--------------------------------Decoration*/
+
+h2 {
+ font-size: 1.9em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+h2.title {
+ font-size: 1.9em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+h3 {
+ font-size: 1.0em;
+ color: #fff;
+ margin: 0;
+ padding: 0;
+}
+
+a {
+ color: #990000;
+}
+
+p {
+ margin: 0;
+ padding: 0;
+}
+
+/*-------------------------------Container Decoration*/
+
+div#container>div.header {
+ height: 40px;
+ background-color: #000;
+}
+
+div#container div.header div.logo {
+ background-image: url( /simple-portal/images/logo-header.gif );
+ background-repeat: no-repeat;
+ background-position: top left;
+ height: 40px;
+}
+
+div#container div.header div.pc20 {
+ text-align: right;
+}
+
+div#container div.header div.secondary-nav {
+ font-size: 11px;
+ padding: 3px 5px 0 0;
+ text-align: right;
+}
+
+div#container div.header div.pc20 img {
+ margin: 5px 10px 0 0;
+}
+
+div#container div.nav {
+ background-image: url( /simple-portal/images/nav-bg.gif );
+ background-repeat: repeat-x;
+ background-position: top left;
+ border-top: 1px solid #878787;
+ border-bottom: 1px solid #383838;
+ height: 24px;
+}
+
+div#container div.nav ul {
+ height: 24px;
+ margin: 0 0 0 10px;
+}
+
+div#container div.nav ul li {
+ display: inline;
+ float: left;
+ text-align: center;
+ height: 24px; /*border: 1px solid #929292;*/
+}
+
+div#container div.nav ul li a,
+ div#container div.nav ul li a:hover {
+ display: block;
+ height: 16px;
+ padding: 5px 14px 4px 14px;
+ background-repeat: repeat-x;
+ background-position: top left;
+ text-decoration: none;
+ font: bold 11px;
+}
+
+div#container div.nav ul li a {
+ color: #fff; /*background-image: url( /simple-portal/images/inactive-button-bg.gif
);*/
+}
+
+div#container div.nav ul li a:hover,
+ div#container div.nav ul li a.selected {
+ color: #fff;
+ background-image: url( /simple-portal/images/active-button2-bg.gif );
+}
+
+div#container div#content {
+ background-image: url( /simple-portal/images/portal-bg.gif );
+ background-repeat: repeat-x;
+ background-position: top left;
+ min-height: 600px;
+ padding: 10px;
+}
+
+/*-------------------------------Portlet Decoration*/
+
+div#container div#content div.portlet {
+ border: 1px solid #969696;
+ background-color: #e2e2e2;
+ padding: 2px;
+ float: left;
+ margin: 10px;
+ width: 95%;
+}
+
+div#container div#content div.portlet-frame {
+ background-color: #fff;
+ border: 1px solid #fff;
+}
+
+div#container div#content div.portlet div.header {
+ background-image: url( /simple-portal/images/portlet-titlebg.gif );
+ background-repeat: repeat-x;
+ background-position: top left;
+ height: 20px;
+}
+
+div#container div#content div.portlet div.header div.header-layer {
+ background-image: url( /simple-portal/images/portlet-title-rt-bg.gif );
+ background-repeat: no-repeat;
+ background-position: top right;
+ height: 20px;
+}
+
+div#container div#content div.portlet div.header div.header-layer div.title h2 {
+ font: bold 12px Lucida Sans, Trebuchet, tahoma, sans-serif;
+ color: #fff;
+ padding: 2px;
+}
+
+div#container div#content div.portlet div.header div.header-layer div.controls {
+ text-align: right;
+ padding: 3px 0 0 0;
+}
+
+div#container div#content div.portlet div.header div.header-layer div.controls
span.mode-button {
+ text-align: right;
+ padding: 0 5px 0 0;
+}
+
+div#container div#content div.portlet div.header div.header-layer div.controls
span.mode-button a {
+ color: #e1d77e;
+ font: normal 11px;
+ text-decoration: none;
+}
+
+/*----------------------------------Error portlet*/
+
+div.error-container {
+ padding: 5px;
+ background-color: #fff;
+}
+
+h3.error-header {
+ background-color: #cc1100;
+ color: #fff;
+ padding: 3px;
+}
+
+div.error-container ul {
+ list-style: none;
+ list-style-position: inside;
+}
+
+div.error-container ul li {
+ padding: 3px 0 3px 0;
+ border-bottom: 1px solid #777777;
+}
+
+div.error-container ul li span {
+ font-weight: bold;
+ color: #cc1100
+}
+
+div.exception code {
+ color: #33ff00;
+}
+
+/*-------------------------------------Remote Window*/
+
+div.remote-container {
+ padding: 8px 0 0 0;
+}
+
+div.remote-container ul {
+ list-style: none;
+ list-style-position: inside;
+ width: 90%;
+ margin: 0 auto 0 auto;
+}
+
+div.remote-container ul li {
+ padding: 3px 0 3px 0;
+ border-bottom: 1px solid #777777;
+}
+
+div.remote-container ul li a {
+ color: #332299
+}
+
+/*-------------------------------------Home page*/
+
+div#container div#content div.main-content {
+ padding: 5px;
+ width: 950px;
+ border-bottom: 1px solid #777777;
+}
+
+div#container div#content div.main-content p {
+ padding: 5px;
+}
+
+div#container div#content div.content-box {
+ background-image: url( /simple-portal/images/content-box-bg.gif );
+ background-repeat: repeat-x;
+ background-position: top right;
+ height: 200px ;
+ width: 300px;
+ margin: 0 13px 0 13px;
+}
+
+div#container div#content div.content-box div.box-header {
+ position: relative;
+ height: 28px;
+ width: 100%;
+}
+
+div#container div#content div.content-box div.box-header h3{
+ padding: 4px 0 0 10px;
+ font-size:1.2em;
+}
+
+
+div#container div#content div.content-box div.box-header img.left {
+ position: absolute;
+ top: 0;
+ left: 0;
+}
+
+div#container div#content div.content-box div.box-header img.right {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+
+div#container div#content div.content-box div.box-content {
+ padding: 5px;
+}
+
+/*-------------------------------------Wiki page*/
+
+div#container div#content div.wiki-content {
+ padding: 5px;
+ border-bottom: 1px solid #777777;
+}
+
+div#container div#content div.wiki-content p {
+ padding: 5px;
+}
+
+/*-------------------------------------Debugger*/
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-maximize.gif
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-maximize.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-minimize.gif
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-minimize.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-normal.gif
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/core-samples/src/bin/portal-portlet-samples-war/images/icon-normal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java 2008-05-22
13:34:23 UTC (rev 10795)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java 2008-05-22
14:41:22 UTC (rev 10796)
@@ -37,6 +37,8 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.PortletURL;
import javax.transaction.Transaction;
+import javax.xml.namespace.QName;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
@@ -73,6 +75,19 @@
resp.setRenderParameter("name", "value");
}
+ public void testsignout(JBossActionRequest req, JBossActionResponse resp)
+ {
+ resp.setEvent(new QName("urn:jboss:portal", "signOut"),
"");
+ }
+ public void testsignout2(JBossActionRequest req, JBossActionResponse resp)
+ {
+ resp.signOut();
+ }
+ public void testsignout3(JBossActionRequest req, JBossActionResponse resp)
+ {
+ resp.signOut("http://www.redhat.com");
+ }
+
protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws
PortletException, PortletSecurityException, IOException
{
resp.setContentType("text/html");
@@ -245,6 +260,35 @@
writer.write("</p>");
//
+ actionURL = resp.createActionURL();
+
+ actionURL.setParameter("op", "testsignout");
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Test sign
out</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + actionURL +
"\">sign out with signout event</a></div>");
+ writer.write("</div>");
+
+ actionURL = resp.createActionURL();
+ actionURL.setParameter("op", "testsignout2");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + actionURL +
"\">sign out with former API and no parameter</a></div>");
+ writer.write("</div>");
+
+ writer.write("</p>");
+
+ //
+
+ //
+ actionURL = resp.createActionURL();
+ actionURL.setParameter("op", "testsignout3");
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Test sign
out 3</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + actionURL +
"\">sign out with former API and redirect to Red
Hat</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+//
writer.close();
}