jford 2004/09/02 21:10:23
Modified: applications/pam/src/java/org/apache/jetspeed/portlets/pam
PortletApplicationDetail.java
Added: applications/pam/src/java/org/apache/jetspeed/portlets/pam/beans
PortletApplicationBean.java TabBean.java
Log:
Added tab navigation
Revision Changes Path
1.4 +3 -4
jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java
Index: PortletApplicationDetail.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationDetail.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PortletApplicationDetail.java 2 Sep 2004 22:03:53 -0000 1.3
+++ PortletApplicationDetail.java 3 Sep 2004 04:10:23 -0000 1.4
@@ -1,10 +1,9 @@
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.jetspeed.portlets.pam;
-import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.jetspeed.portlet.ServletPortlet;
import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.pluto.om.portlet.PortletDefinition;
-/**
* This portlet is a browser over all the portlet applications in the system.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Ford</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
*/
public class PortletApplicationDetail extends ServletPortlet
{
private final String VIEW_PA = "portletApplication";
private final String VIEW_PD = "portletDefinition";
private PortletContext context;
private PortletRegistryComponent registry;
public void init(PortletConfig config)
throws PortletException
{
super.init(config);
context = getPortletContext();
registry =
(PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
if (null == registry)
{
throw new PortletException("Failed to find the Portlet Registry on portlet
initialization");
}
}
public void doView(RenderRequest request, RenderResponse response)
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.jetspeed.portlet.ServletPortlet;
import org.apache.jetspeed.portlets.pam.beans.PortletApplicationBean;
import org.apache.jetspeed.portlets.pam.beans.TabBean;
import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
import org.apache.pluto.om.portlet.PortletDefinition;
/**
* This portlet is a browser over all the portlet applications in the system.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Ford</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
*/
public class PortletApplicationDetail extends ServletPortlet
{
private final String VIEW_PA = "portletApplication";
private final String VIEW_PD = "portletDefinition";
private PortletContext context;
private PortletRegistryComponent registry;
private HashMap tabMap = new HashMap();
public void init(PortletConfig config)
throws PortletException
{
super.init(config);
context = getPortletContext();
registry =
(PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
if (null == registry)
{
throw new PortletException("Failed to find the Portlet Registry on portlet
initialization");
}
TabBean tb1 = new TabBean("Details", "Details");
TabBean tb2 = new TabBean("Metadata", "Metadata");
TabBean tb3 = new TabBean("Portlets", "Portlets");
tabMap.put(tb1.getId(), tb1);
tabMap.put(tb2.getId(), tb2);
tabMap.put(tb3.getId(), tb3);
}
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException
- {
response.setContentType("text/html");
MutablePortletApplication pa = (MutablePortletApplication)
request.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA,
PortletSession.APPLICATION_SCOPE);
if (null != pa)
{
request.setAttribute(VIEW_PA, new PortletApplicationBean(pa));
PortletDefinition pdef = (PortletDefinition)
request.getPortletSession().getAttribute("select_portlet");
request.setAttribute(VIEW_PD, pdef);
}
+ {
response.setContentType("text/html");
MutablePortletApplication pa = (MutablePortletApplication)
request.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA,
PortletSession.APPLICATION_SCOPE);
if (null != pa)
{
request.setAttribute(VIEW_PA, new PortletApplicationBean(pa));
PortletDefinition pdef = (PortletDefinition)
request.getPortletSession().getAttribute("select_portlet");
request.setAttribute(VIEW_PD, pdef);
request.setAttribute("tabs", tabMap.values());
TabBean selectedTab = (TabBean)
request.getPortletSession().getAttribute("selected_tab");
if(selectedTab == null) {
selectedTab = (TabBean) tabMap.values().iterator().next();
}
request.setAttribute("selected_tab", selectedTab);
}
super.doView(request, response);
}
-
public void processAction(ActionRequest actionRequest, ActionResponse
actionResponse) throws PortletException, IOException
{
System.out.println("PorletApplicationDetail: processAction()");
String selectedPortlet = actionRequest.getParameter("select_portlet");
MutablePortletApplication pa = (MutablePortletApplication)
actionRequest.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA,
PortletSession.APPLICATION_SCOPE);
PortletDefinition pdef = pa.getPortletDefinitionByName(selectedPortlet);
actionRequest.getPortletSession().setAttribute("select_portlet", pdef);
}
+
public void processAction(ActionRequest actionRequest, ActionResponse
actionResponse) throws PortletException, IOException
{
System.out.println("PorletApplicationDetail: processAction()");
String selectedPortlet = actionRequest.getParameter("select_portlet");
if(selectedPortlet != null)
{
MutablePortletApplication pa = (MutablePortletApplication)
actionRequest.getPortletSession().getAttribute(PortletApplicationResources.PAM_CURRENT_PA,
PortletSession.APPLICATION_SCOPE);
PortletDefinition pdef =
pa.getPortletDefinitionByName(selectedPortlet);
actionRequest.getPortletSession().setAttribute("select_portlet", pdef);
}
String selectedTab = actionRequest.getParameter("selected_tab");
if(selectedTab != null)
{
TabBean tab = (TabBean) tabMap.get(selectedTab);
actionRequest.getPortletSession().setAttribute("selected_tab", tab);
}
}
}
1.1
jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/beans/PortletApplicationBean.java
Index: PortletApplicationBean.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.jetspeed.portlets.pam.beans;
import java.util.Collection;
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.portlet.PortletApplication;
import org.apache.pluto.om.common.ObjectID;
import org.apache.pluto.om.portlet.PortletDefinition;
import org.apache.pluto.om.portlet.PortletDefinitionList;
import org.apache.pluto.om.servlet.WebApplicationDefinition;
/**
* This portlet is a browser over all the portlet applications in the system.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Ford</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: PortletApplicationBean.java,v 1.1 2004/09/03 04:10:23 jford Exp $
*/
public class PortletApplicationBean implements PortletApplication
{
PortletApplication pa;
public PortletApplicationBean(PortletApplication pa)
{
this.pa = pa;
}
/* (non-Javadoc)
* @see org.apache.jetspeed.om.common.portlet.PortletApplication#getMetadata()
*/
public GenericMetadata getMetadata()
{
return pa.getMetadata();
}
/* (non-Javadoc)
* @see org.apache.jetspeed.om.common.portlet.PortletApplication#getName()
*/
public String getName()
{
return pa.getName();
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.om.common.portlet.PortletApplication#getPortletDefinitions()
*/
public Collection getPortletDefinitions()
{
return pa.getPortletDefinitions();
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.om.common.portlet.PortletApplication#getPortletDefinitionByName(java.lang.String)
*/
public PortletDefinition getPortletDefinitionByName(String name)
{
return pa.getPortletDefinitionByName(name);
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.om.common.portlet.PortletApplication#getUserAttributeRefs()
*/
public Collection getUserAttributeRefs()
{
return pa.getUserAttributeRefs();
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.om.common.portlet.PortletApplication#getUserAttributes()
*/
public Collection getUserAttributes()
{
return pa.getUserAttributes();
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.om.common.portlet.PortletApplication#getApplicationIdentifier()
*/
public String getApplicationIdentifier()
{
return pa.getApplicationIdentifier();
}
/* (non-Javadoc)
* @see org.apache.jetspeed.om.common.portlet.PortletApplication#getDescription()
*/
public String getDescription()
{
return pa.getDescription();
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.om.common.portlet.PortletApplication#getApplicationType()
*/
public int getApplicationType()
{
return pa.getApplicationType();
}
/* (non-Javadoc)
* @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getId()
*/
public ObjectID getId()
{
return pa.getId();
}
/* (non-Javadoc)
* @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getVersion()
*/
public String getVersion()
{
return pa.getVersion();
}
/* (non-Javadoc)
* @see
org.apache.pluto.om.portlet.PortletApplicationDefinition#getPortletDefinitionList()
*/
public PortletDefinitionList getPortletDefinitionList()
{
return pa.getPortletDefinitionList();
}
/* (non-Javadoc)
* @see
org.apache.pluto.om.portlet.PortletApplicationDefinition#getWebApplicationDefinition()
*/
public WebApplicationDefinition getWebApplicationDefinition()
{
return pa.getWebApplicationDefinition();
}
public Collection getJetspeedServices()
{
return pa.getJetspeedServices();
}
}
1.1
jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/beans/TabBean.java
Index: TabBean.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed 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.jetspeed.portlets.pam.beans;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Ford</a>
* @version $ID$
*/
public class TabBean
{
private String id;
private String messageId;
private String description;
public TabBean()
{
}
public TabBean(String id, String description)
{
this.id = id;
this.description = description;
}
/**
* @return Returns the description.
*/
public String getDescription()
{
return description;
}
/**
* @param description The description to set.
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @return Returns the id.
*/
public String getId()
{
return id;
}
/**
* @param id The id to set.
*/
public void setId(String id)
{
this.id = id;
}
/**
* @return Returns the messageId.
*/
public String getMessageId()
{
return messageId;
}
/**
* @param messageId The messageId to set.
*/
public void setMessageId(String messageId)
{
this.messageId = messageId;
}
public boolean equals(Object obj)
{
boolean result = false;
if(obj instanceof TabBean)
{
TabBean tab = (TabBean)obj;
result = tab.id.equals(id);
}
return result;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]