gatein SVN: r6966 - portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-08-01 11:07:06 -0400 (Mon, 01 Aug 2011)
New Revision: 6966
Modified:
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
Log:
- Removed unneeded code.
Modified: portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
===================================================================
--- portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-08-01 15:03:18 UTC (rev 6965)
+++ portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-08-01 15:07:06 UTC (rev 6966)
@@ -59,18 +59,17 @@
IterableIdentifiableCollection<Navigation> adminNodes = navigation.getAll();
PrintWriter writer = response.getWriter();
- String portalURI = request.getParameterMap().get("navigation_uri")[0];
writer.println("<ul>");
for (Navigation adminNode : adminNodes)
{
- outputNode(writer, adminNode, portalURI);
+ outputNode(writer, adminNode);
}
writer.println("</ul>");
}
- private void outputNode(PrintWriter writer, Navigation node, String portalURI)
+ private void outputNode(PrintWriter writer, Navigation node)
{
IterableIdentifiableCollection<Navigation> children = node.getAll();
int size = children.size();
@@ -85,7 +84,7 @@
writer.println("<ul>");
for (Navigation child : children)
{
- outputNode(writer, child, portalURI);
+ outputNode(writer, child);
}
writer.println("</ul>");
}
13 years, 4 months
gatein SVN: r6965 - portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-08-01 11:03:18 -0400 (Mon, 01 Aug 2011)
New Revision: 6965
Modified:
portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
Log:
- Basic group navigation with node URIs.
Modified: portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java
===================================================================
--- portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-08-01 15:00:03 UTC (rev 6964)
+++ portal/branches/api/examples/portlets/api/src/main/java/org/gatein/portal/samples/api/NavigationPortlet.java 2011-08-01 15:03:18 UTC (rev 6965)
@@ -23,6 +23,8 @@
package org.gatein.portal.samples.api;
import org.gatein.api.GateIn;
+import org.gatein.api.id.Id;
+import org.gatein.api.portal.Navigation;
import org.gatein.api.portal.Site;
import org.gatein.api.util.IterableIdentifiableCollection;
@@ -32,6 +34,7 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import java.io.IOException;
+import java.io.PrintWriter;
/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
public class NavigationPortlet extends GenericPortlet
@@ -48,13 +51,43 @@
@Override
protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
{
+ Id groupId = gateIn.groupId("platform", "administrators");
- IterableIdentifiableCollection<? extends Site> portals = gateIn.getSites();
- for (Site portal : portals)
+ Site adminSite = gateIn.getGroupSite(groupId);
+ Navigation navigation = adminSite.getNavigation();
+
+ IterableIdentifiableCollection<Navigation> adminNodes = navigation.getAll();
+
+ PrintWriter writer = response.getWriter();
+ String portalURI = request.getParameterMap().get("navigation_uri")[0];
+ writer.println("<ul>");
+
+ for (Navigation adminNode : adminNodes)
{
- String s = portal.toString();
- System.out.println(s);
- response.getWriter().println(s);
+ outputNode(writer, adminNode, portalURI);
}
+
+ writer.println("</ul>");
}
+
+ private void outputNode(PrintWriter writer, Navigation node, String portalURI)
+ {
+ IterableIdentifiableCollection<Navigation> children = node.getAll();
+ int size = children.size();
+ boolean isLeaf = size == 0;
+ writer.println("<li>"
+ + (isLeaf ? "<a href='" + node.getURI() + "'>" : "")
+ + node.getDisplayName()
+ + (isLeaf ? "</a>" : "")
+ + "</li>");
+ if (size != 0)
+ {
+ writer.println("<ul>");
+ for (Navigation child : children)
+ {
+ outputNode(writer, child, portalURI);
+ }
+ writer.println("</ul>");
+ }
+ }
}
13 years, 4 months
gatein SVN: r6964 - portal/branches/api/component/api-impl.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-08-01 11:00:03 -0400 (Mon, 01 Aug 2011)
New Revision: 6964
Modified:
portal/branches/api/component/api-impl/pom.xml
Log:
- Added missing dependency and removed useless one.
Modified: portal/branches/api/component/api-impl/pom.xml
===================================================================
--- portal/branches/api/component/api-impl/pom.xml 2011-08-01 14:57:53 UTC (rev 6963)
+++ portal/branches/api/component/api-impl/pom.xml 2011-08-01 15:00:03 UTC (rev 6964)
@@ -30,11 +30,6 @@
<artifactId>exo.portal.component.portal</artifactId>
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>r09</version>
- </dependency>
- <dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.component.application-registry</artifactId>
</dependency>
@@ -44,6 +39,12 @@
<version>5.14.10</version>
<scope>test</scope>
</dependency>
+
+ <!-- To be able to access Util to generate Navigation URI -->
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.webui.portal</artifactId>
+ </dependency>
</dependencies>
<build>
13 years, 4 months
gatein SVN: r6963 - portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-08-01 10:57:53 -0400 (Mon, 01 Aug 2011)
New Revision: 6963
Modified:
portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
Log:
- Use label for display name but it's issuing i18n commands...
- Generate usable URIs.
Modified: portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java
===================================================================
--- portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-07-31 23:58:58 UTC (rev 6962)
+++ portal/branches/api/component/api-impl/src/main/java/org/gatein/portal/api/impl/portal/NavigationImpl.java 2011-08-01 14:57:53 UTC (rev 6963)
@@ -22,11 +22,13 @@
package org.gatein.portal.api.impl.portal;
+import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.mop.navigation.NavigationService;
import org.exoplatform.portal.mop.navigation.NodeContext;
import org.exoplatform.portal.mop.navigation.NodeModel;
import org.exoplatform.portal.mop.navigation.NodeState;
import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.webui.util.Util;
import org.gatein.api.GateIn;
import org.gatein.api.id.Context;
import org.gatein.api.id.GenericContext;
@@ -38,6 +40,7 @@
import org.gatein.api.util.Filter;
import org.gatein.api.util.IterableIdentifiableCollection;
import org.gatein.api.util.Query;
+import org.gatein.common.net.URLTools;
import org.gatein.portal.api.impl.GateInImpl;
import org.gatein.portal.api.impl.util.AdaptedIterableIdentifiableCollection;
@@ -105,7 +108,10 @@
{
try
{
- uri = new URI(buildURI().toString());
+ PortalRequestContext requestContext = Util.getPortalRequestContext();
+ String host = URLTools.getServerAddressFrom(requestContext.getRequest());
+ String portalURI = host + requestContext.getPortalURI();
+ uri = new URI(portalURI + buildURI().toString());
}
catch (URISyntaxException e)
{
@@ -267,7 +273,7 @@
public String getDisplayName()
{
- return getName();
+ return context.getState().getLabel();
}
public GateIn getGateIn()
13 years, 4 months