JBoss Portal SVN: r6675 - in trunk/wsrp/src: main/org/jboss/portal/wsrp/admin/ui and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-15 01:19:32 -0400 (Thu, 15 Mar 2007)
New Revision: 6675
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
Log:
- More WSRP consumer UI: register/deregister seem to work, activate/deactivate doesn't.
- Need to find a way to return properly to the list view.
- Added registerOrDeregisterConsumerWith method on ConsumerRegistry.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java 2007-03-15 05:19:32 UTC (rev 6675)
@@ -107,4 +107,9 @@
{
// do nothing
}
+
+ public void registerOrDeregisterConsumerWith(String id, boolean register)
+ {
+ // do nothing
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-15 05:19:32 UTC (rev 6675)
@@ -64,11 +64,42 @@
public String activateConsumer()
{
- return null;
+ if (refreshConsumerId() != null)
+ {
+ boolean activate = Boolean.valueOf(getParameter("activate")).booleanValue();
+ if (activate)
+ {
+ registry.activateConsumerWith(selectedId);
+ }
+ else
+ {
+ registry.deactivateConsumerWith(selectedId);
+ }
+ }
+ else
+ {
+ // todo: error message
+ }
+
+ return "index";
}
public String registerConsumer()
{
+ if (refreshConsumerId() != null)
+ {
+ boolean register = Boolean.valueOf(getParameter("register")).booleanValue();
+
+ registry.registerOrDeregisterConsumerWith(selectedId, register);
+
+ // show consumer configuration
+ return "configureConsumer";
+ }
+ else
+ {
+ // todo: error message
+ }
+
return null;
}
@@ -79,7 +110,7 @@
public String configureConsumer()
{
- if (getSelectedConsumerId() != null)
+ if (refreshConsumerId() != null)
{
return "configureConsumer";
}
@@ -87,10 +118,15 @@
return null;
}
- private String getSelectedConsumerId()
+ private String refreshConsumerId()
{
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- selectedId = (String)pmap.get("id");
+ selectedId = getParameter("id");
return selectedId;
}
+
+ private String getParameter(String key)
+ {
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ return (String)pmap.get(key);
+ }
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-15 05:19:32 UTC (rev 6675)
@@ -58,4 +58,6 @@
RegistrationInfo getDefaultRegistrationInfo();
void deactivateConsumerWith(String id) throws ConsumerException;
+
+ void registerOrDeregisterConsumerWith(String id, boolean register);
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-15 05:19:32 UTC (rev 6675)
@@ -28,6 +28,7 @@
import org.hibernate.SessionFactory;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
@@ -228,6 +229,34 @@
return nullRegistration;
}
+ public void registerOrDeregisterConsumerWith(String id, boolean register)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "registerConsumerWith");
+
+ WSRPConsumer consumer = getConsumer(id);
+
+ if (consumer == null)
+ {
+ throw new ConsumerException("Consumer with id '" + id + "' doesn't exist!");
+ }
+
+ try
+ {
+ if (register)
+ {
+ consumer.getProducerInfo().register();
+ }
+ else
+ {
+ consumer.getProducerInfo().deregister();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ConsumerException("Couldn't " + (register ? "register" : "deregister") + " Consumer '" + id + "'", e);
+ }
+ }
+
private void startOrStopConsumer(String id, boolean start)
{
WSRPConsumer consumer = getConsumer(id);
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml 2007-03-15 05:19:32 UTC (rev 6675)
@@ -53,4 +53,12 @@
<to-view-id>/WEB-INF/jsf/consumers/editConsumer.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/WEB-INF/jsf/consumers/editConsumer.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>index</from-outcome>
+ <to-view-id>/WEB-INF/jsf/consumers/consumers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-15 05:19:32 UTC (rev 6675)
@@ -38,11 +38,13 @@
<h:outputText value="Configure"/>
</h:commandLink> | <h:commandLink action="#{consumersMgr.activateConsumer}">
<f:param name="id" value="#{consumer.producerId}"/>
+ <f:param name="activate" value="#{!consumer.producerInfo.active}"/>
<h:outputText value='#{consumer.producerInfo.active ? "Deactivate" : "Activate"}'/>
</h:commandLink>
<c:if test="#{consumer.producerInfo.active}"> | <h:commandLink
action="#{consumersMgr.registerConsumer}">
<f:param name="id" value="#{consumer.producerId}"/>
+ <f:param name="register" value="#{!consumer.producerInfo.registered}"/>
<h:outputText value="#{consumer.producerInfo.registered ? 'Deregister' : 'Register'}"/>
</h:commandLink>
</c:if> | <h:commandLink action="#{consumersMgr.destroyConsumer}">
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-03-15 02:28:26 UTC (rev 6674)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-03-15 05:19:32 UTC (rev 6675)
@@ -5,99 +5,103 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
- <h1 class="portlet">Consumer '#{consumersMgr.selectedConsumer.producerId}' configuration</h1>
+<h1 class="portlet">Consumer '#{consumersMgr.selectedConsumer.producerId}' configuration</h1>
- <hr/>
+<hr/>
- <h:form>
- <table width="100%" class="portlet-table-body">
- <tr>
- <th>Producer id:</th>
- <td><h:inputText value="#{consumersMgr.selectedConsumer.producerId}"/></td>
- </tr>
- <tr>
- <th>Cache expiration:</th>
- <td><h:inputText value="#{consumersMgr.selectedConsumer.producerInfo.expirationCacheSeconds}"/> (seconds
- before expiration)
- </td>
- </tr>
- <tr>
- <th>Endpoint configuration:</th>
- <td>
- <table border="0" class='portlet-table-body'>
- <tr>
- <th class="portlet-form-field-label">Service Description URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Markup URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Registration URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Portlet Management URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">WSDL URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <th><h:selectBooleanCheckbox
- value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.requiresRegistration}"/>Requires
- registration?
- </th>
- <td>
- <c:choose>
- <c:when
- test="#{!empty consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationPropertyNames}">
- <table border='1' cellspacing='0' class='portlet-table-body'>
+<h:form>
+ <table width="100%" class="portlet-table-body">
+ <tr>
+ <th>Producer id:</th>
+ <td><h:inputText value="#{consumersMgr.selectedConsumer.producerId}"/></td>
+ </tr>
+ <tr>
+ <th>Cache expiration:</th>
+ <td><h:inputText value="#{consumersMgr.selectedConsumer.producerInfo.expirationCacheSeconds}"/> (seconds
+ before expiration)
+ </td>
+ </tr>
+ <tr>
+ <th>Endpoint configuration:</th>
+ <td>
+ <table border="0" class='portlet-table-body'>
+ <tr>
+ <th class="portlet-form-field-label">Service Description URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Markup URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Registration URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Portlet Management URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">WSDL URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th><h:selectBooleanCheckbox
+ value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.requiresRegistration}"/>Requires
+ registration?
+ </th>
+ <td>
+ <c:choose>
+ <c:when
+ test="#{!empty consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationPropertyNames}">
+ <table border='1' cellspacing='0' class='portlet-table-body'>
+ <tr>
+ <th>Name</th>
+ <th>Value</th>
+ <th>Description</th>
+ </tr>
+ <c:forEach
+ items="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationProperties}"
+ var="prop">
<tr>
- <th>Name</th>
- <th>Value</th>
- <th>Description</th>
+ <td><h:inputText value="#{prop.name}"/></td>
+ <td><h:inputText value="#{prop.value}"/></td>
+ <td><h:outputText value="#{prop.description.label.value}"/></td>
</tr>
- <c:forEach
- items="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationProperties}"
- var="prop">
- <tr>
- <td><h:inputText value="#{prop.name}"/></td>
- <td><h:inputText value="#{prop.value}"/></td>
- <td><h:outputText value="#{prop.description.label.value}"/></td>
- </tr>
- </c:forEach>
- </table>
- </c:when>
- <c:otherwise>
- No required registration properties.
- </c:otherwise>
- </c:choose>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ No required registration properties.
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <c:if test="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationValid}">
+ <tr>
+ <th>Registration context:</th>
+ <td>Handle: <h:outputText
+ value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationContext.registrationHandle}"/>
</td>
</tr>
- <c:if test="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationValid}">
- <tr>
- <th>Registration context:</th>
- <td>Handle: <h:outputText
- value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationContext.registrationHandle}"/>
- </td>
- </tr>
- </c:if>
- </table>
- </h:form>
+ </c:if>
+ </table>
+
+ <hr/>
+
+ <h:commandButton action="index" value="Back"/>
+</h:form>
</div>
\ No newline at end of file
17 years, 6 months
JBoss Portal SVN: r6674 - in trunk/portlet/src/resources: test-sar/META-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 22:28:26 -0400 (Wed, 14 Mar 2007)
New Revision: 6674
Modified:
trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml
trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
Log:
remove usage of org.jboss.portal.portlet.test.UserInterceptor since it is obsolete now
Modified: trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml 2007-03-15 01:28:41 UTC (rev 6673)
+++ trunk/portlet/src/resources/tck-sar/META-INF/jboss-service.xml 2007-03-15 02:28:26 UTC (rev 6674)
@@ -26,13 +26,6 @@
<!-- Server stack -->
<mbean
- code="org.jboss.portal.portlet.test.UserInterceptor"
- name="portal:service=Interceptor,type=Server,name=User"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
code="org.jboss.portal.server.aspects.server.LocaleInterceptor"
name="portal:service=Interceptor,type=Server,name=Locale"
xmbean-dd=""
Modified: trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-15 01:28:41 UTC (rev 6673)
+++ trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-15 02:28:26 UTC (rev 6674)
@@ -56,13 +56,6 @@
<!-- Server stack -->
<mbean
- code="org.jboss.portal.portlet.test.UserInterceptor"
- name="portal:service=Interceptor,type=Server,name=User"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
code="org.jboss.portal.server.aspects.server.LocaleInterceptor"
name="portal:service=Interceptor,type=Server,name=Locale"
xmbean-dd=""
17 years, 6 months
JBoss Portal SVN: r6673 - in trunk: core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 21:28:41 -0400 (Wed, 14 Mar 2007)
New Revision: 6673
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java
Log:
bug fixes
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2007-03-15 00:55:48 UTC (rev 6672)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2007-03-15 01:28:41 UTC (rev 6673)
@@ -59,24 +59,23 @@
public class PageManagerBean
{
- public PageManagerBean(Page page, LayoutService layoutService, PortletInvoker portletInvoker)
+ public PageManagerBean(LayoutService layoutService, PortletInvoker portletInvoker)
{
- this.page = page;
this.layoutService = layoutService;
this.portletInvoker = portletInvoker;
this.selectedContentType = ContentType.PORTLET;
}
/** . */
- public final Page page;
-
- /** . */
public final LayoutService layoutService;
/** . */
public final PortletInvoker portletInvoker;
/** . */
+ public Page page;
+
+ /** . */
public ContentType selectedContentType;
public List getContentTypeItems()
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-03-15 00:55:48 UTC (rev 6672)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-03-15 01:28:41 UTC (rev 6673)
@@ -76,16 +76,13 @@
public Portal userPortal;
/** . */
- public Page selectedPage;
-
- /** . */
public String selectedPageTheme;
/** . */
public String selectedPageLayout;
/** . */
- public PageManagerBean selectedPageManager;
+ public PageManagerBean pageManager;
/** . */
public SelectItem[] pageItems;
@@ -105,8 +102,19 @@
refresh();
}
+ public Page getSelectedPage()
+ {
+ return pageManager.page;
+ }
+
private void refresh()
{
+ // Create page manager if it doees not exit
+ if (pageManager == null)
+ {
+ pageManager = new PageManagerBean(layoutService, new PortletDefinitionInvoker(instanceContainer));
+ }
+
// Get user name
String userId = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
@@ -116,19 +124,16 @@
// Page for editting
if (selectedPageName != null)
{
- selectedPage = userPortal.getPage(selectedPageName);
+ pageManager.page = userPortal.getPage(selectedPageName);
}
- if (selectedPage == null)
+ if (pageManager.page == null)
{
- selectedPage = userPortal.getDefaultPage();
+ pageManager.page = userPortal.getDefaultPage();
+ selectedPageName = pageManager.page.getName();
}
//
- selectedPageName = selectedPage.getName();
- selectedPageManager = new PageManagerBean(selectedPage, layoutService, new PortletDefinitionInvoker(instanceContainer));
-
- //
- String defaultPageName = selectedPage.getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
+ String defaultPageName = pageManager.page.getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
if (defaultPageName == null)
{
defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
@@ -153,8 +158,8 @@
refresh();
//
- selectedPageTheme = selectedPage.getProperty(ThemeConstants.PORTAL_PROP_THEME);
- selectedPageLayout = selectedPage.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ selectedPageTheme = pageManager.page.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ selectedPageLayout = pageManager.page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
}
public void updateTheme()
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml 2007-03-15 00:55:48 UTC (rev 6672)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml 2007-03-15 01:28:41 UTC (rev 6673)
@@ -115,7 +115,7 @@
<tr>
<td>
<ui:include src="/WEB-INF/jsf/common/editPageLayout.xhtml">
- <ui:param name="pageManager" value="#{dashboard.selectedPageManager}"/>
+ <ui:param name="pageManager" value="#{dashboard.pageManager}"/>
</ui:include>
</td>
</tr>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java 2007-03-15 00:55:48 UTC (rev 6672)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java 2007-03-15 01:28:41 UTC (rev 6673)
@@ -81,16 +81,7 @@
DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(rresp, dresp);
//
- try
- {
- // Set the filter command
- dreq.setAttribute(FilterCommand.REQ_ATT_KEY, this);
- dispatcher.include(direq, diresp);
- }
- finally
- {
- dreq.removeAttribute(FilterCommand.REQ_ATT_KEY);
- }
+ dispatcher.include(direq, diresp);
}
catch (ServletException e)
{
17 years, 6 months
JBoss Portal SVN: r6672 - in trunk: core/src/resources/portal-core-sar/META-INF and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 20:55:48 -0400 (Wed, 14 Mar 2007)
New Revision: 6672
Modified:
trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
Log:
redone the dashboard editor using facelet
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-03-15 00:29:31 UTC (rev 6671)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-03-15 00:55:48 UTC (rev 6672)
@@ -181,7 +181,7 @@
// Edit page
PortletParametersStateString navState = new PortletParametersStateString();
navState.setValue("editPageSelect", pageName);
- InvokePortletInstanceRenderCommand command = new InvokePortletInstanceRenderCommand("ConfiguratorPortletInstance", navState);
+ InvokePortletInstanceRenderCommand command = new InvokePortletInstanceRenderCommand("DashboardConfigPortletInstance", navState);
dashboardActionURL = controllerCtx.renderURL(command, null, null);
dashboardActionLabel = "Edit Content";
}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-15 00:29:31 UTC (rev 6671)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-15 00:55:48 UTC (rev 6672)
@@ -842,29 +842,6 @@
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
</mbean>
- <!-- The content editor registry -->
- <mbean
- code="org.jboss.portal.core.portlet.dashboard.ContentEditorRegistryService"
- name="portal:service=ContentEditorRegistry"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- </mbean>
- <mbean
- code="org.jboss.portal.core.portlet.dashboard.PortletContentEditor"
- name="portal:service=ContentEditor,type=portlet"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Registry"
- proxy-type="attribute">portal:service=ContentEditorRegistry</depends>
- <depends
- optional-attribute-name="InstanceContainer"
- proxy-type="attribute">portal:container=Instance</depends>
- <attribute name="ContentType">portlet</attribute>
- </mbean>
-
<!-- The content renderer registry -->
<mbean
code="org.jboss.portal.core.impl.model.portal.content.ContentRendererRegistryService"
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-03-15 00:29:31 UTC (rev 6671)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-03-15 00:55:48 UTC (rev 6672)
@@ -119,9 +119,4 @@
<service-class>org.jboss.portal.portlet.federation.FederatingPortletInvoker</service-class>
<service-ref>:service=PortletInvoker,type=Federating</service-ref>
</service>
- <service>
- <service-name>ContentEditorRegistry</service-name>
- <service-class>org.jboss.portal.core.portlet.dashboard.ContentEditorRegistry</service-class>
- <service-ref>:service=ContentEditorRegistry</service-ref>
- </service>
</portlet-app>
Modified: trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml 2007-03-15 00:29:31 UTC (rev 6671)
+++ trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml 2007-03-15 00:55:48 UTC (rev 6672)
@@ -29,7 +29,7 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
+ <attribute name="InstanceId">DashboardConfigPortletInstance</attribute>
</mbean>
<mbean
@@ -53,7 +53,7 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
+ <attribute name="InstanceId">DashboardConfigPortletInstance</attribute>
<attribute name="Path">/configure</attribute>
<depends
optional-attribute-name="Factory"
17 years, 6 months
JBoss Portal SVN: r6671 - in trunk: core and 18 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 20:29:31 -0400 (Wed, 14 Mar 2007)
New Revision: 6671
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
Removed:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/
Modified:
trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java
trunk/core-admin/build.xml
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
Log:
redone the dashboard editor using facelet
Modified: trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -24,6 +24,7 @@
import java.util.Arrays;
import java.util.Map;
+import java.util.HashMap;
/**
* A decorator that enforce the map content to be <String,String[]>
@@ -40,6 +41,11 @@
/** If true returned values will be cloned when provided by the client. */
private boolean cloneExternalValue;
+ public ParameterMap(boolean cloneInternalValue, boolean cloneExternalValue)
+ {
+ this(new HashMap(), cloneInternalValue, cloneExternalValue);
+ }
+
public ParameterMap(MapAccessor accessor, boolean cloneInternalValue, boolean cloneExternalValue)
{
super(accessor);
@@ -68,6 +74,11 @@
this(delegate, false, false);
}
+ public ParameterMap()
+ {
+ this(false, false);
+ }
+
/**
* Return true if values returned by the map are cloned.
*
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/build.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -121,7 +121,6 @@
<path id="dependentmodule.classpath">
<path refid="jboss.portal-format.classpath"/>
<path refid="jboss.portal-common.classpath"/>
- <path refid="jboss.portal-faces.classpath"/>
<path refid="jboss.portal-server.classpath"/>
<path refid="jboss.portal-registration.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
@@ -317,7 +316,6 @@
<fileset dir="${build.lib}" includes="jboss-portlet-api-lib.jar"/>
<fileset dir="${jboss.portal-format.root}/lib" includes="portal-format-lib.jar"/>
<fileset dir="${jboss.portal-common.root}/lib" includes="portal-common-lib.jar"/>
- <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-lib.jar"/>
<fileset dir="${jboss.portal-bridge.root}/lib" includes="portal-bridge-lib.jar"/>
<fileset dir="${jboss.portal-server.root}/lib" includes="portal-server-lib.jar"/>
<fileset dir="${jboss.portal-portlet.root}/lib" includes="portal-portlet-lib.jar"/>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -100,10 +100,27 @@
}
}
- public String renderURL(ControllerCommand cmd, URLContext urlContext, URLFormat format)
+ /**
+ * Render the command as an URL or return null if it is not possible.
+ *
+ * @param cmd the command to render
+ * @param urlContext the url context
+ * @param urlFormat the url format
+ * @return the URL as a string or null
+ */
+ public String renderURL(ControllerCommand cmd, URLContext urlContext, URLFormat urlFormat)
{
ServerURL serverURL = controller.getURLFactory().doMapping(serverInvocation, cmd);
- return serverInvocation.getResponse().renderURL(serverURL, urlContext, format);
+
+ //
+ if (serverURL == null)
+ {
+ return null;
+ }
+ else
+ {
+ return serverInvocation.getResponse().renderURL(serverURL, urlContext, urlFormat);
+ }
}
public ServerInvocation getServerInvocation()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -68,6 +68,7 @@
private Map childrenMap;
private Map properties;
+ private Map unmodifiableProperties;
private PortalObjectIdImpl id;
private DashboardContext dashboardContext;
@@ -360,17 +361,20 @@
ObjectNode parent = objectNode.getParent();
if (parent == null)
{
- properties = Collections.unmodifiableMap(declaredPropertyMap);
+ this.properties = declaredPropertyMap;
}
else
{
Map properties = new HashMap();
properties.putAll(parent.getObject().getProperties());
properties.putAll(declaredPropertyMap);
- this.properties = Collections.unmodifiableMap(properties);
+ this.properties = properties;
}
+
+ //
+ this.unmodifiableProperties = Collections.unmodifiableMap(properties);
}
- return properties;
+ return unmodifiableProperties;
}
public Map getDeclaredPropertyMap()
@@ -406,10 +410,22 @@
if (value == null)
{
declaredPropertyMap.remove(name);
+
+ // If aggregated properties is loaded then we udpate it
+ if (properties != null)
+ {
+ properties.remove(name);
+ }
}
else
{
declaredPropertyMap.put(name, value);
+
+ // If aggregated properties is loaded then we udpate it
+ if (properties != null)
+ {
+ properties.put(name, value);
+ }
}
}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -712,50 +712,6 @@
optional-attribute-name="DelegateFactory"
proxy-type="attribute">portal:commandFactory=Dashboard</depends>
</mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
- name="portal:commandFactory=Configurator"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
- </mbean>
- <mbean
- code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
- name="portal:commandFactory=Delegate,path=configure"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="Path">/configure</attribute>
- <depends
- optional-attribute-name="DelegatingFactory"
- proxy-type="attribute">portal:commandFactory=Delegating</depends>
- <depends
- optional-attribute-name="DelegateFactory"
- proxy-type="attribute">portal:commandFactory=Configurator</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
- name="portal:commandFactory=Delegate,path=test"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="Path">/test</attribute>
- <depends
- optional-attribute-name="DelegatingFactory"
- proxy-type="attribute">portal:commandFactory=Delegating</depends>
- <depends
- optional-attribute-name="DelegateFactory"
- proxy-type="attribute">portal:commandFactory=Test</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
- name="portal:commandFactory=Test"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="InstanceId">TestPortletInstance</attribute>
- </mbean>
<!-- URL factories -->
<mbean
@@ -800,30 +756,6 @@
optional-attribute-name="Factory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
</mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceURLFactory"
- name="portal:urlFactory=Configurator"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
- <attribute name="Path">/configure</attribute>
- <depends
- optional-attribute-name="Factory"
- proxy-type="attribute">portal:urlFactory=Delegating</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceURLFactory"
- name="portal:urlFactory=Test"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="InstanceId">TestPortletInstance</attribute>
- <attribute name="Path">/test</attribute>
- <depends
- optional-attribute-name="Factory"
- proxy-type="attribute">portal:urlFactory=Delegating</depends>
- </mbean>
<!-- The federating portlet invoker -->
<mbean
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -57,12 +57,6 @@
<trans-attribute>Required</trans-attribute>
</transaction>
</portlet>
- <portlet>
- <portlet-name>ConfiguratorPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- </portlet>
<!-- Service injected in the portlet context. -->
<service>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -45,18 +45,4 @@
<portlet-ref>CatalogPortlet</portlet-ref>
</instance>
</deployment>
- <deployment>
- <instance>
- <instance-id>ConfiguratorPortletInstance</instance-id>
- <portlet-ref>ConfiguratorPortlet</portlet-ref>
-<!--
- <security-constraint>
- <policy-permission>
- <role-name>User</role-name>
- <action-name>personalize</action-name>
- </policy-permission>
- </security-constraint>
--->
- </instance>
- </deployment>
</deployments>
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -110,20 +110,6 @@
<title>Catalog</title>
</portlet-info>
</portlet>
- <portlet>
- <description>Configurator portlet for personal dashboard</description>
- <portlet-name>ConfiguratorPortlet</portlet-name>
- <display-name>Dashboard Configurator Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.dashboard.Configurator</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>Dashboard Portlet</title>
- <keywords>management,admin</keywords>
- </portlet-info>
- </portlet>
<user-attribute>
<name>user.name.nickName</name>
</user-attribute>
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/build.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -199,8 +199,8 @@
<!--<fileset dir="." includes="jsf-portlet.jar"/>-->
<!-- For JSF -->
+ <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-lib.jar"/>
<fileset dir="../core-admin/src/etc/sun-jsf" includes="jsf-example.jar"/>
- <!--<fileset dir="${apache.lang.lib}" includes="commons-lang-2.0.jar"/>-->
<fileset dir="${facelets.facelets.lib}" includes="jsf-facelets.jar"/>
<fileset dir="${el.el.lib}" includes="el-api.jar,el-ri.jar"/>
</copy>
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -30,6 +30,7 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.util.IteratorStatus;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
@@ -39,12 +40,21 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
+import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.security.spi.provider.AuthorizationDomain;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.PortalTheme;
import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
import java.util.Set;
import java.util.Locale;
import java.util.ArrayList;
import java.util.List;
+import java.util.Collection;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -239,6 +249,65 @@
}
});
+ //
+ DelegatingPropertyResolver.registerDecorator(AuthorizationDomainRegistry.class, new AbstractBeanDecorator()
+ {
+ protected PropertyDecorator getProperty(final Object propertyName)
+ {
+ return new AbstractPropertyDecorator(AuthorizationDomain.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ return ((AuthorizationDomainRegistry)bean).getDomain((String)propertyName);
+ }
+ };
+ }
+ });
+
+ //
+ SimpleBeanDecorator layoutServiceDecorator = new SimpleBeanDecorator();
+ layoutServiceDecorator.setProperty("layoutItems", new AbstractPropertyDecorator(SelectItem[].class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ LayoutService layoutService = (LayoutService)bean;
+ Collection layouts = layoutService.getLayouts();
+ SelectItem[] items = new SelectItem[layouts.size()];
+ for (IteratorStatus i = new IteratorStatus(layouts.iterator());i.hasNext();)
+ {
+ PortalLayout layout = (PortalLayout)i.next();
+ SelectItem item = new SelectItem();
+ String layoutName = layout.getLayoutInfo().getName();
+ item.setValue(layoutName);
+ item.setLabel(layoutName);
+ items[i.getElementIndex()] = item;
+ }
+ return items;
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(LayoutService.class, layoutServiceDecorator);
+
+ //
+ SimpleBeanDecorator themeServiceDecorator = new SimpleBeanDecorator();
+ themeServiceDecorator.setProperty("themeItems", new AbstractPropertyDecorator(SelectItem[].class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ ThemeService layoutService = (ThemeService)bean;
+ Collection themes = layoutService.getThemes();
+ SelectItem[] items = new SelectItem[themes.size()];
+ for (IteratorStatus i = new IteratorStatus(themes.iterator());i.hasNext();)
+ {
+ PortalTheme name = (PortalTheme)i.next();
+ SelectItem item = new SelectItem();
+ String themeName = name.getThemeInfo().getName();
+ item.setValue(themeName);
+ item.setLabel(themeName);
+ items[i.getElementIndex()] = item;
+ }
+ return items;
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(ThemeService.class, themeServiceDecorator);
}
-
}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.core.admin.ui.dashboard.DashboardBean;
+
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
@@ -45,8 +47,7 @@
public void beforePhase(PhaseEvent phaseEvent)
{
- if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW ||
- phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
+ if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW)
{
FacesContext ctx = phaseEvent.getFacesContext();
@@ -61,7 +62,31 @@
//
PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
portletmgr.refresh();
+
+ //
+ DashboardBean dashboard = (DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
+ dashboard.actionRefresh();
}
+ else if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
+ {
+ FacesContext ctx = phaseEvent.getFacesContext();
+
+ //
+ PortalObjectManagerBean pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
+ pomgr.refresh();
+
+ //
+ InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
+ instancemgr.refresh();
+
+ //
+ PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
+ portletmgr.refresh();
+
+ //
+ DashboardBean dashboard = (DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
+ dashboard.renderRefresh();
+ }
}
public PhaseId getPhaseId()
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * 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.core.admin.ui.actions;
+
+import org.jboss.portal.core.model.portal.PageContainer;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
+
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5763 $
+ */
+public class AddPageAction2
+{
+
+ /** . */
+ public PageContainer pageContainer;
+
+ /** . */
+ public DomainConfigurator domainConfigurator;
+
+ /** . */
+ public String pageName;
+
+ /** . */
+ public Listener listener;
+
+ /** . */
+// private static final String ERROR_DUPE_NAME = "Duplicate Page name found on this portal!";
+
+ /** . */
+// private static final String ERROR_EMPTY_NAME = "Page name cannot be blank!";
+
+ /*
+ * Checks for duplicate page names on the portal instance. Blank page names are not allowed and are controlled by the
+ * required attribute in the presentation page.
+ */
+// public void validatePageName(FacesContext context, UIComponent toValidate, Object value)
+// {
+// String pageName = (String)value;
+//
+// // check for empty string
+// if (pageName.startsWith(" "))
+// {
+// FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_EMPTY_NAME, ERROR_EMPTY_NAME);
+// throw new ValidatorException(message);
+// }
+//
+// // Check for duplicate child name
+// if (pageContainer.getChild(pageName) != null)
+// {
+// FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_DUPE_NAME, ERROR_DUPE_NAME);
+// throw new ValidatorException(message);
+// }
+// }
+
+ public void execute()
+ {
+ try
+ {
+ Page page = pageContainer.createPage(pageName);
+
+ //
+ Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
+ domainConfigurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+
+ //
+ if (listener != null)
+ {
+ listener.pageCreated(page);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public interface Listener
+ {
+ void pageCreated(Page page);
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -0,0 +1,325 @@
+/******************************************************************************
+ * 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.core.admin.ui.common;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.Content;
+import org.jboss.portal.core.admin.ui.actions.WindowComparator;
+import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.faces.component.portlet.PortletActionEvent;
+import org.jboss.portal.portlet.PortletInvoker;
+
+import javax.faces.model.SelectItem;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Iterator;
+import java.util.TreeSet;
+import java.util.SortedSet;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PageManagerBean
+{
+
+ public PageManagerBean(Page page, LayoutService layoutService, PortletInvoker portletInvoker)
+ {
+ this.page = page;
+ this.layoutService = layoutService;
+ this.portletInvoker = portletInvoker;
+ this.selectedContentType = ContentType.PORTLET;
+ }
+
+ /** . */
+ public final Page page;
+
+ /** . */
+ public final LayoutService layoutService;
+
+ /** . */
+ public final PortletInvoker portletInvoker;
+
+ /** . */
+ public ContentType selectedContentType;
+
+ public List getContentTypeItems()
+ {
+ LinkedList types = new LinkedList();
+ for (Iterator i = ContentEditorRegistry.getInstance().getContentTypes().iterator();i.hasNext();)
+ {
+ ContentType contentType = (ContentType)i.next();
+ SelectItem item = new SelectItem();
+ item.setValue(contentType);
+ item.setLabel(contentType.toString());
+ if (contentType.equals(ContentType.PORTLET))
+ {
+ types.addFirst(item);
+ }
+ else
+ {
+ types.addLast(item);
+ }
+ }
+ return types;
+ }
+
+ public String getSelectedEditorPortletId()
+ {
+ if (selectedContentType != null)
+ {
+ return ContentEditorRegistry.getInstance().getEditor(selectedContentType);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected String createWindowName()
+ {
+ return "" + (int)(100 * Math.random());
+ }
+
+ public void assignWindow(ActionEvent event)
+ {
+ if (event instanceof PortletActionEvent)
+ {
+ PortletActionEvent actionEvent = (PortletActionEvent)event;
+ Map actionParams = actionEvent.getParameterMap();
+ if (actionParams.get("meta_action") != null)
+ {
+ String[] uris = (String[])actionParams.get("uri");
+ if (uris != null && uris.length > 0)
+ {
+ String uri = uris[0];
+
+ // Obtain a window name
+ String windowName = ((String[])actionParams.get("windowName"))[0];
+ if (windowName.trim().length() == 0)
+ {
+ windowName = createWindowName();
+ while (page.getWindow(windowName) != null)
+ {
+ windowName = "" + createWindowName();
+ }
+ }
+
+ // Check for duplicate window name
+ if (page.getWindow(windowName) != null)
+ {
+ FacesContext faces = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Duplicate window name found on this page!", null);
+ faces.addMessage("windowName", message);
+ throw new AbortProcessingException();
+ }
+
+ // Get the target region
+ String targetRegion = ((String[])actionParams.get("targetRegion"))[0];
+
+ //
+ Map params = new HashMap();
+ for (Iterator i = actionParams.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ if (name.startsWith("param."))
+ {
+ String paramName = name.substring(6);
+ String paramValue = ((String[])entry.getValue())[0];
+ params.put(paramName, paramValue);
+ }
+ }
+
+ try
+ {
+ Window window = page.createWindow(windowName, selectedContentType, uri);
+ Content content = window.getContent();
+ for (Iterator i = params.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String paramName = (String)entry.getKey();
+ String paramValue = (String)entry.getValue();
+ content.setParameter(paramName, paramValue);
+ }
+
+ //
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, targetRegion);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
+
+ // Get the windows belonging to the selected region sorted by order
+ List windows = new ArrayList();
+ for (Iterator i = page.getChildren(PortalObject.WINDOW_MASK).iterator();i.hasNext();)
+ {
+ Window tmp = (Window)i.next();
+ if (targetRegion.equals(tmp.getProperty(ThemeConstants.PORTAL_PROP_REGION)))
+ {
+ windows.add(tmp);
+ }
+ }
+
+ // Sort windows
+ Collections.sort(windows, new WindowComparator());
+
+ // Add the created one
+ windows.add(window);
+
+ // Update the order states
+ for (int i = 0;i < windows.size();i++)
+ {
+ Window tmp = (Window)windows.get(i);
+ tmp.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ }
+ }
+ catch (DuplicatePortalObjectException unexpected)
+ {
+ unexpected.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ /** Return the <Region>List on the selected object which must be a page. */
+ public List getRegionNames()
+ {
+ try
+ {
+ Map windows = getWindows(page);
+
+ //
+ List regions = new ArrayList(windows.keySet());
+ regions.remove("unknown");
+ Collections.sort(regions);
+
+ //
+ return regions;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ //
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public List getRegionItems()
+ {
+ try
+ {
+ Map windows = getWindows(page);
+
+ // We don't want the unknown region
+ windows.remove("unknown");
+
+ //
+ ArrayList regions = new ArrayList(windows.keySet());
+ Collections.sort(regions);
+ for (int i = 0; i < regions.size();i++)
+ {
+ String regionName = (String)regions.get(i);
+ SelectItem regionItem = new SelectItem(regionName, regionName);
+ regions.set(i, regionItem);
+ }
+
+ //
+ return regions;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ //
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public Map getWindowItemsMap() throws Exception
+ {
+ Map windowMap = getWindows(page);
+ for (Iterator i = windowMap.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ SortedSet windows = (SortedSet)entry.getValue();
+ ArrayList windowItems = new ArrayList(windows.size());
+ for (Iterator j = windows.iterator();j.hasNext();)
+ {
+ Window window = (Window)j.next();
+ SelectItem windowItem = new SelectItem();
+ windowItem.setValue(window.getName());
+ windowItem.setLabel(window.getName());
+ windowItems.add(windowItem);
+ }
+ entry.setValue(windowItems);
+ }
+ return windowMap;
+ }
+
+ /** Returns a <Region,<Window>SortedSet>Map. */
+ private Map getWindows(Page page) throws Exception
+ {
+ // Get the layout
+ String layoutId = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ PortalLayout layout = layoutService.getLayout(layoutId, false);
+
+ //
+ LinkedHashMap windows = new LinkedHashMap();
+ for (Iterator i = layout.getLayoutInfo().getRegionNames().iterator(); i.hasNext();)
+ {
+ String region = (String)i.next();
+ windows.put(region, new TreeSet(new WindowComparator()));
+ }
+ windows.put("unknown", new TreeSet(new WindowComparator()));
+
+ //
+ for (Iterator j = page.getChildren(PortalObject.WINDOW_MASK).iterator(); j.hasNext();)
+ {
+ PortalObject window = (PortalObject)j.next();
+ String region = window.getProperty(ThemeConstants.PORTAL_PROP_REGION);
+ if (!windows.containsKey(region))
+ {
+ region = "unknown";
+ }
+ SortedSet set = (SortedSet)windows.get(region);
+ set.add(window);
+ }
+ return windows;
+ }
+}
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -0,0 +1,190 @@
+/******************************************************************************
+ * 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.core.admin.ui.dashboard;
+
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.NoSuchPortalObjectException;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.admin.ui.common.PageManagerBean;
+import org.jboss.portal.core.admin.ui.portlet.PortletDefinitionInvoker;
+import org.jboss.portal.core.admin.ui.actions.AddPageAction2;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.common.util.IteratorStatus;
+
+import javax.faces.model.SelectItem;
+import javax.faces.context.FacesContext;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DashboardBean implements AddPageAction2.Listener
+{
+
+ /** . */
+ private static final PortalObjectId dashboardId = PortalObjectId.parse("/dashboard", PortalObjectId.CANONICAL_FORMAT);
+
+ // Wired services
+
+ /** . */
+ public PortalObjectContainer portalObjectContainer;
+
+ /** . */
+ public LayoutService layoutService;
+
+ /** . */
+ public ThemeService themeService;
+
+ /** . */
+ public InstanceContainer instanceContainer;
+
+ // Navigational state
+
+ /** . */
+ public String selectedPageName;
+
+ // Runtime fields
+
+ /** . */
+ public Portal userPortal;
+
+ /** . */
+ public Page selectedPage;
+
+ /** . */
+ public String selectedPageTheme;
+
+ /** . */
+ public String selectedPageLayout;
+
+ /** . */
+ public PageManagerBean selectedPageManager;
+
+ /** . */
+ public SelectItem[] pageItems;
+
+ /** . */
+ public boolean selectePageIsDefault;
+
+ //
+
+ public void pageCreated(Page page)
+ {
+ selectedPageName = page.getName();
+ }
+
+ public void actionRefresh()
+ {
+ refresh();
+ }
+
+ private void refresh()
+ {
+ // Get user name
+ String userId = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
+
+ // Load portal
+ userPortal = (Portal)portalObjectContainer.getObject(dashboardId).getChild(userId);
+
+ // Page for editting
+ if (selectedPageName != null)
+ {
+ selectedPage = userPortal.getPage(selectedPageName);
+ }
+ if (selectedPage == null)
+ {
+ selectedPage = userPortal.getDefaultPage();
+ }
+
+ //
+ selectedPageName = selectedPage.getName();
+ selectedPageManager = new PageManagerBean(selectedPage, layoutService, new PortletDefinitionInvoker(instanceContainer));
+
+ //
+ String defaultPageName = selectedPage.getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
+ if (defaultPageName == null)
+ {
+ defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
+ }
+ selectePageIsDefault = selectedPageName.equals(defaultPageName);
+
+ //
+ Collection pages = userPortal.getChildren(PortalObject.PAGE_MASK);
+ pageItems = new SelectItem[pages.size()];
+ for (IteratorStatus i = new IteratorStatus(pages);i.hasNext();)
+ {
+ PortalObject object = (PortalObject)i.next();
+ SelectItem item = new SelectItem();
+ item.setValue(object.getName());
+ item.setLabel(object.getName());
+ pageItems[i.getElementIndex()] = item;
+ }
+ }
+
+ public void renderRefresh()
+ {
+ refresh();
+
+ //
+ selectedPageTheme = selectedPage.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ selectedPageLayout = selectedPage.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ }
+
+ public void updateTheme()
+ {
+ String previousTheme = userPortal.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ if (!selectedPageTheme.equals(previousTheme))
+ {
+ userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, selectedPageTheme);
+ }
+ }
+
+ public void updateLayout()
+ {
+ String previousLayout = userPortal.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ if (!selectedPageLayout.equals(previousLayout))
+ {
+ userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, selectedPageLayout);
+ }
+ }
+
+ public void destroyPage()
+ {
+ try
+ {
+ userPortal.destroyChild(selectedPageName);
+ selectedPageName = null;
+ }
+ catch (NoSuchPortalObjectException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Modified: trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -22,4 +22,42 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<server>
+
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
+ name="portal:commandFactory=Configurator"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=configure"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/configure</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+ proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+ proxy-type="attribute">portal:commandFactory=Configurator</depends>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceURLFactory"
+ name="portal:urlFactory=Configurator"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="InstanceId">ConfiguratorPortletInstance</attribute>
+ <attribute name="Path">/configure</attribute>
+ <depends
+ optional-attribute-name="Factory"
+ proxy-type="attribute">portal:urlFactory=Delegating</depends>
+ </mbean>
+
</server>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -217,6 +217,46 @@
</managed-property>
</managed-bean>
+ <!-- The dashboard bean -->
+ <managed-bean>
+ <managed-bean-name>dashboard</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.dashboard.DashboardBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>portalObjectContainer</property-name>
+ <value>#{applicationScope.PortalObjectContainer}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>layoutService</property-name>
+ <value>#{applicationScope.LayoutService}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>themeService</property-name>
+ <value>#{applicationScope.ThemeService}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>instanceContainer</property-name>
+ <value>#{applicationScope.InstanceContainer}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>addPageAction2</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AddPageAction2</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>pageContainer</property-name>
+ <value>#{sessionScope.dashboard.userPortal}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>domainConfigurator</property-name>
+ <value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>listener</property-name>
+ <value>#{sessionScope.dashboard}</value>
+ </managed-property>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>index</from-outcome>
@@ -290,6 +330,11 @@
<from-outcome>newWindowWizardConfirm</from-outcome>
<to-view-id>/WEB-INF/jsf/wizard/newWindowWizardConfirm.xhtml</to-view-id>
</navigation-case>
+
+ <navigation-case>
+ <from-outcome>dashboard</from-outcome>
+ <to-view-id>/WEB-INF/jsf/dashboard/dashboard.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
<lifecycle>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -44,6 +44,12 @@
<link rel="stylesheet" type="text/css" href="/style.css" title="" media="screen"/>
</header-content>
</portlet>
+ <portlet>
+ <portlet-name>DashboardConfigPortlet</portlet-name>
+ <transaction>
+ <trans-attribute>Required</trans-attribute>
+ </transaction>
+ </portlet>
<!-- Service injected in the portlet context. -->
<service>
Added: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml (rev 0)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -0,0 +1,150 @@
+<div
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:jbp="http://www.jboss.org/portal"
+ xmlns:c="http://java.sun.com/jstl/core">
+
+<div style="float:left; padding:0 2em 0 2em">
+ <h:form id="layoutForm">
+ <table>
+ <c:forEach items="#{pageManager.regionNames}" var="regionName"
+ varStatus="status">
+ <tbody>
+ <c:choose>
+ <c:when test="#{status.index > 0}">
+ <tr>
+ <td colspan="2" class="portlet-form-field-label"
+ style="border-width:0px;border-top:1px dashed #d5d5d5">#{regionName}
+ Region
+ </td>
+ </tr>
+ </c:when>
+ <c:otherwise>
+ <tr>
+ <td colspan="2" class="portlet-form-field-label">#{regionName}
+ Region
+ </td>
+ </tr>
+ </c:otherwise>
+ </c:choose>
+ <tr>
+ <td>
+ <div>
+ <h:commandButton value="Up" id="u_#{regionName}"
+ actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ <div>
+ <h:commandButton value="Down" id="d_#{regionName}"
+ actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ <div style="margin-top: 1em">
+ <h:commandButton
+ value="Delete" id="l_#{regionName}"
+ actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ <td>
+ <h:selectManyListbox
+ value="#{assignWindowsAction.assignedWindows[regionName]}"
+ size="7" styleClass="windowList portlet-form-field">
+ <f:selectItems
+ value="#{pageManager.windowItemsMap[regionName]}"/>
+ </h:selectManyListbox>
+ </td>
+ </tr>
+ </tbody>
+ </c:forEach>
+ <tbody>
+ <tr>
+ <td colspan="2" class="portlet-form-field-label"
+ style="border-width:0px;border-top:1px dashed #d5d5d5">Unassigned
+ windows
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div style="margin-top: 1em">
+ <h:commandButton value="Delete"
+ id="l_unknown" actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ <td>
+ <h:selectManyListbox
+ value="#{assignWindowsAction.assignedWindows['unknown']}"
+ size="7" styleClass="windowList portlet-form-field">
+ <f:selectItems
+ value="#{pageManager.windowItemsMap['unknown']}"/>
+ </h:selectManyListbox>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </h:form>
+</div>
+<div style="float:left">
+ <table class="form">
+ <tr>
+ <td class="label">
+ <span class="portlet-form-field-label">Content type:</span>
+ </td>
+ <td class="widget">
+ <h:form id="abc">
+ <h:selectOneMenu
+ id="instanceId"
+ value="#{pageManager.selectedContentType}"
+ styleClass="portlet-form-field contentType">
+ <f:selectItems value="#{pageManager.contentTypeItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Change" styleClass="portlet-form-button"/>
+ <h:message for="instanceId" errorClass="portlet-msg-error"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <span class="portlet-form-field-label">Window Name:</span>
+ </td>
+ <td class="widget">
+ <h:inputText id="windowName" value="#{assignWindowsAction.windowName}"
+ styleClass="portlet-form-input-field"/>
+ <h:message for="windowName" errorClass="portlet-msg-error"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <span class="portlet-form-field-label">Target Region:</span>
+ </td>
+ <td class="widget">
+ <h:selectOneMenu id="targetRegion" styleClass="portlet-form-input-field">
+ <f:selectItems value="#{pageManager.regionItems}"/>
+ </h:selectOneMenu>
+ <h:message for="targetRegion" errorClass="portlet-msg-error"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ </td>
+ <td class="widget">
+ <div style="margin-top:3em;">
+ <jbp:portlet
+ portletId="#{pageManager.selectedEditorPortletId}"
+ portletInvoker="#{pageManager.portletInvoker}"
+ actionListener="#{pageManager.assignWindow}"
+ supportedModes="edit_content"
+ supportedWindowStates="normal"
+ initialMode="edit_content"
+ initialWindowState="normal"
+ onClick="url.setParameter('windowName', document.getElementById('windowName').value).setParameter('targetRegion', document.getElementById('targetRegion').value);"/>
+ </div>
+ </td>
+ </tr>
+ </table>
+</div>
+
+</div>
\ No newline at end of file
Added: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml (rev 0)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -0,0 +1,143 @@
+<div
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jstl/core">
+
+
+<div align="center">
+ <h:message id="error" for="error" errorClass="portlet-msg-error"/>
+</div>
+
+<table width="100%">
+<tr>
+ <th colspan="2" class="portlet-section-header" align="center">Personal Dashboard Editor</th>
+</tr>
+<tr>
+ <td class="portlet-section-body" align="center">
+ <table width="100%">
+ <tr>
+ <td width="250">
+ <table class="bottombuttonbar">
+ <tr>
+ <td align="left" valign="top"><b>Create a New Page:</b><br/>Page name: 
+ <h:form style="padding:0;margin:0">
+ <h:inputText id="pageName" value="#{addPageAction2.pageName}"
+ styleClass="portlet-form-input-field"/>
+ <h:commandButton value="Save"
+ action="#{addPageAction2.execute}"
+ styleClass="portlet-form-button"/>
+ </h:form>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td align="left" valign="top">
+ Use this page to manage the content and appearance of your dashboard pages. <br/>
+ You can control the page titles, column layouts, page themes,
+ and add,
+ order, or remove portlets.
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+<tr>
+ <th colspan="2" class="portlet-section-header" align="center">Currently editing page #{dashboard.selectedPage.name}</th>
+</tr>
+<tr>
+ <td class="portlet-section-body" align="center">
+ <h:form style="padding:0;margin:0">
+ Select: <h:selectOneMenu
+ id="pageNameSelector"
+ value="#{dashboard.selectedPageName}"
+ styleClass="portlet-form-field">
+ <f:selectItems value="#{dashboard.pageItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Go" styleClass="portlet-form-button"/>
+ </h:form>
+ <br/>
+ </td>
+</tr>
+<tr>
+ <td>
+ <table width="100%">
+ <tr>
+ <td valign="top" width="250">
+ <table class="bottombuttonbar">
+ <tr>
+ <td valign="top">
+ <b>Theme and Layout</b>
+ <br/>
+ Apply a theme to your dashboard, or select the number of columns for the layout.
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h:form>
+ Choose a layout:<br/>
+ <h:selectOneMenu
+ id="layoutSelector"
+ value="#{dashboard.selectedPageLayout}"
+ styleClass="portlet-form-field">
+ <f:selectItems value="#{applicationScope.LayoutService.layoutItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Select" styleClass="portlet-form-button" action="#{dashboard.updateLayout}"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td height="20"></td>
+ </tr>
+ <tr>
+ <td>
+ <h:form>
+ Choose a theme:<br/>
+ <h:selectOneMenu
+ id="themeSelector"
+ value="#{dashboard.selectedPageTheme}"
+ styleClass="portlet-form-field">
+ <f:selectItems value="#{applicationScope.ThemeService.themeItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Select" styleClass="portlet-form-button" action="#{dashboard.updateTheme}"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td height="20"></td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <ui:include src="/WEB-INF/jsf/common/editPageLayout.xhtml">
+ <ui:param name="pageManager" value="#{dashboard.selectedPageManager}"/>
+ </ui:include>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
+<hr/>
+<c:if test="#{dashboard.selectePageIsDefault == false}">
+ <table width="100%">
+ <tr>
+ <td align="left">
+ <h:form style="padding:0;margin:0">
+ <h:commandButton value="Delete this Page" styleClass="portlet-form-button" action="#{dashboard.destroyPage}"/>
+ <br/>
+ <font color="red">You cannot undo this action!</font>
+ </h:form>
+ </td>
+ </tr>
+ </table>
+</c:if>
+</div>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -41,6 +41,12 @@
</deployment>
<deployment>
<instance>
+ <instance-id>DashboardConfigPortletInstance</instance-id>
+ <portlet-ref>DashboardConfigPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
<instance-id>PortletContentEditorInstance</instance-id>
<portlet-ref>PortletContentEditorPortlet</portlet-ref>
<security-constraint>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -47,6 +47,25 @@
</portlet-info>
</portlet>
<portlet>
+ <description>Dashboard Configurator Portlet</description>
+ <portlet-name>DashboardConfigPortlet</portlet-name>
+ <display-name>Dashboard Configurator Portlet</display-name>
+ <portlet-class>org.jboss.portal.faces.portlet.JSFMetaBridgePortlet</portlet-class>
+ <init-param>
+ <name>VIEW</name>
+ <value>/WEB-INF/jsf/dashboard/dashboard.xhtml</value>
+ </init-param>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Dashboard Configurator Portlet</title>
+ <keywords>management,admin</keywords>
+ </portlet-info>
+ </portlet>
+ <portlet>
<description>Portlet Content Editor</description>
<portlet-name>PortletContentEditorPortlet</portlet-name>
<display-name>Portlet Content Editor</display-name>
Deleted: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java 2007-03-15 00:29:31 UTC (rev 6671)
@@ -1,94 +0,0 @@
-/******************************************************************************
- * 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.core.cms.content;
-
-import org.jboss.portal.core.portlet.dashboard.AddWindowContext;
-import org.jboss.portal.core.portlet.dashboard.AbstractContentEditor;
-import org.jboss.portal.core.cms.content.CMSContent;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.cms.CMS;
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.model.File;
-import org.jboss.portal.cms.model.Folder;
-
-import javax.portlet.RenderRequest;
-import javax.portlet.ActionRequest;
-import java.io.PrintWriter;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CMSContentEditor extends AbstractContentEditor
-{
-
- /** . */
- private CMS cms;
-
- public CMS getCMS()
- {
- return cms;
- }
-
- public void setCMS(CMS cms)
- {
- this.cms = cms;
- }
-
- public void show(RenderRequest req, PrintWriter writer)
- {
- Command listCMD = cms.getCommandFactory().createFolderGetListCommand("/default");
- Folder folder = (Folder)cms.execute(listCMD);
- List list = folder.getFiles();
- writer.println("<select name=\"available_instances\" multiple=\"true\" size=\"20\">\n");
- for (int i = 0; i < list.size(); i++)
- {
- File file = (File)list.get(i);
- writer.print("<option value=\"");
- writer.print(file.getBasePath());
- writer.print("\">");
- writer.print(file.getName());
- writer.println("</option>\n");
- }
- writer.println("</select>");
- }
-
- public void add(ActionRequest req, AddWindowContext ctx)
- {
- String[] files = req.getParameterValues("available_instances");
- try
- {
- for (int i = 0; i < files.length; i++)
- {
- String file = files[i];
- CMSContent content = (CMSContent)ctx.createWindow(ContentType.CMS, file);
-
- }
- }
- catch (Exception e)
- {
- log.error("Error adding window to region", e);
- }
- }
-}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -662,22 +662,6 @@
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Server</depends>
</mbean>
- <!-- Content editor integration -->
- <mbean
- code="org.jboss.portal.core.cms.content.CMSContentEditor"
- name="portal:service=ContentEditor,type=cms"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Registry"
- proxy-type="attribute">portal:service=ContentEditorRegistry</depends>
- <depends
- optional-attribute-name="CMS"
- proxy-type="attribute">portal:service=CMS</depends>
- <attribute name="ContentType">cms</attribute>
- </mbean>
-
<!-- Content renderer integration -->
<mbean
code="org.jboss.portal.core.cms.content.CMSContentRenderer"
17 years, 6 months
JBoss Portal SVN: r6670 - in trunk/wsrp: src/main/org/jboss/portal/wsrp/admin/ui and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-14 19:21:37 -0400 (Wed, 14 Mar 2007)
New Revision: 6670
Added:
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/style.css
Log:
- Beginning of consumer configuration.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-03-14 16:17:33 UTC (rev 6669)
+++ trunk/wsrp/build.xml 2007-03-14 23:21:37 UTC (rev 6670)
@@ -123,6 +123,10 @@
<path refid="apache.httpclient.classpath"/>
<path refid="apache.logging.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
+ <path refid="apache.myfaces.classpath"/>
+ <path refid="facelets.facelets.classpath"/>
+ <path refid="el.el.classpath"/>
+ <pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
</path>
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-14 16:17:33 UTC (rev 6669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-14 23:21:37 UTC (rev 6670)
@@ -22,10 +22,14 @@
package org.jboss.portal.wsrp.admin.ui;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
+import javax.faces.context.FacesContext;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Map;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -35,6 +39,7 @@
public class ConsumerManagerBean
{
private ConsumerRegistry registry;
+ private String selectedId;
public ConsumerRegistry getRegistry()
{
@@ -46,28 +51,46 @@
this.registry = registry;
}
+ public WSRPConsumer getSelectedConsumer()
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(selectedId, "consumer id", null);
+ return registry.getConsumer(selectedId);
+ }
+
public Collection getConsumers()
{
return new ArrayList(registry.getConfiguredConsumers());
}
- public void activateConsumer()
+ public String activateConsumer()
{
+ return null;
+ }
+ public String registerConsumer()
+ {
+ return null;
}
- public void registerConsumer()
+ public String destroyConsumer()
{
-
+ return null;
}
- public void destroyConsumer()
+ public String configureConsumer()
{
-
+ if (getSelectedConsumerId() != null)
+ {
+ return "configureConsumer";
+ }
+ // todo: error message
+ return null;
}
- public void configureConsumer()
+ private String getSelectedConsumerId()
{
-
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ selectedId = (String)pmap.get("id");
+ return selectedId;
}
}
\ No newline at end of file
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml 2007-03-14 16:17:33 UTC (rev 6669)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/faces-config.xml 2007-03-14 23:21:37 UTC (rev 6670)
@@ -48,5 +48,9 @@
<from-outcome>index</from-outcome>
<to-view-id>/WEB-INF/jsf/consumers/consumers.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>configureConsumer</from-outcome>
+ <to-view-id>/WEB-INF/jsf/consumers/editConsumer.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-14 16:17:33 UTC (rev 6669)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-14 23:21:37 UTC (rev 6670)
@@ -28,20 +28,25 @@
<tr class="status.index % 2 == 0 ? 'portlet-table-body' : 'portlet-table-alternate'">
<td>
<h:commandLink action="#{consumersMgr.configureConsumer}">
+ <f:param name="id" value="#{consumer.producerId}"/>
<h:outputText value="#{consumer.producerId}"/>
</h:commandLink>
</td>
<td>
<h:commandLink action="#{consumersMgr.configureConsumer}">
+ <f:param name="id" value="#{consumer.producerId}"/>
<h:outputText value="Configure"/>
</h:commandLink> | <h:commandLink action="#{consumersMgr.activateConsumer}">
+ <f:param name="id" value="#{consumer.producerId}"/>
<h:outputText value='#{consumer.producerInfo.active ? "Deactivate" : "Activate"}'/>
</h:commandLink>
<c:if test="#{consumer.producerInfo.active}"> | <h:commandLink
action="#{consumersMgr.registerConsumer}">
+ <f:param name="id" value="#{consumer.producerId}"/>
<h:outputText value="#{consumer.producerInfo.registered ? 'Deregister' : 'Register'}"/>
</h:commandLink>
</c:if> | <h:commandLink action="#{consumersMgr.destroyConsumer}">
+ <f:param name="id" value="#{consumer.producerId}"/>
<h:outputText value="Destroy"/>
</h:commandLink>
</td>
Added: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml (rev 0)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-03-14 23:21:37 UTC (rev 6670)
@@ -0,0 +1,103 @@
+<div class="wsrp-consumer-ui"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core">
+
+ <h1 class="portlet">Consumer '#{consumersMgr.selectedConsumer.producerId}' configuration</h1>
+
+ <hr/>
+
+ <h:form>
+ <table width="100%" class="portlet-table-body">
+ <tr>
+ <th>Producer id:</th>
+ <td><h:inputText value="#{consumersMgr.selectedConsumer.producerId}"/></td>
+ </tr>
+ <tr>
+ <th>Cache expiration:</th>
+ <td><h:inputText value="#{consumersMgr.selectedConsumer.producerInfo.expirationCacheSeconds}"/> (seconds
+ before expiration)
+ </td>
+ </tr>
+ <tr>
+ <th>Endpoint configuration:</th>
+ <td>
+ <table border="0" class='portlet-table-body'>
+ <tr>
+ <th class="portlet-form-field-label">Service Description URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Markup URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Registration URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">Portlet Management URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th class="portlet-form-field-label">WSDL URL:</th>
+ <td><h:inputText size="50"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th><h:selectBooleanCheckbox
+ value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.requiresRegistration}"/>Requires
+ registration?
+ </th>
+ <td>
+ <c:choose>
+ <c:when
+ test="#{!empty consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationPropertyNames}">
+ <table border='1' cellspacing='0' class='portlet-table-body'>
+ <tr>
+ <th>Name</th>
+ <th>Value</th>
+ <th>Description</th>
+ </tr>
+ <c:forEach
+ items="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationProperties}"
+ var="prop">
+ <tr>
+ <td><h:inputText value="#{prop.name}"/></td>
+ <td><h:inputText value="#{prop.value}"/></td>
+ <td><h:outputText value="#{prop.description.label.value}"/></td>
+ </tr>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ No required registration properties.
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <c:if test="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationValid}">
+ <tr>
+ <th>Registration context:</th>
+ <td>Handle: <h:outputText
+ value="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationContext.registrationHandle}"/>
+ </td>
+ </tr>
+ </c:if>
+ </table>
+ </h:form>
+</div>
\ No newline at end of file
Modified: trunk/wsrp/src/resources/portal-wsrp-war/style.css
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-03-14 16:17:33 UTC (rev 6669)
+++ trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-03-14 23:21:37 UTC (rev 6670)
@@ -1,4 +1,4 @@
-.wsrp-consumers-ui table {
+.wsrp-consumers-ui table, .wsrp-consumer-ui table {
border: 0;
border-collapse: separate;
}
@@ -14,3 +14,16 @@
padding-bottom: 2px;
padding-top: 2px;
}
+
+.wsrp-consumer-ui th {
+ text-align: left;
+ border: 0;
+ border-right: 2px solid;
+ vertical-align: top;
+}
+
+.wsrp-consumer-ui td {
+ border: 0;
+ padding-bottom: 2px;
+ padding-top: 2px;
+}
\ No newline at end of file
17 years, 6 months
JBoss Portal SVN: r6669 - trunk/theme/src/main/org/jboss/portal/theme/tag.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-14 12:17:33 -0400 (Wed, 14 Mar 2007)
New Revision: 6669
Modified:
trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java
Log:
Broken theme portlet tag. [JBPORTAL-1316]
Patch provided by Antoine Herzog, thanks !
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java 2007-03-14 16:12:13 UTC (rev 6668)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java 2007-03-14 16:17:33 UTC (rev 6669)
@@ -96,44 +96,54 @@
return;
}
- if (page.getWindowContext(windowName) == null)
- {
- log.debug("no such window on this page. Page [" + page.getPageName() + "] Window [" + windowName + "]");
- return;
- }
-
- WindowContext windowContext = page.getWindowContext(windowName);
- RenderContext renderContext = (RenderContext)request.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
-
- String windowID;
- // we have the windowName (which is the window name), but we need the window id
+ String windowID = null;
+ // we have the windowName (which is the window name), but we need the
+ // window id
Map portletContexts = page.getWindowContextMap();
for (Iterator i = portletContexts.keySet().iterator(); i.hasNext();)
{
- windowID = (String)i.next();
- WindowContext portletContext = (WindowContext)portletContexts.get(windowID);
+ windowID = (String) i.next();
+ WindowContext portletContext = (WindowContext) portletContexts.get(windowID);
if (windowName.equals(portletContext.getWindowName()))
{
if (log.isDebugEnabled())
{
log.debug("found the portlet to render: " + windowName);
}
-
- renderContext = renderContext.getContext(windowContext);
-
- try
- {
- renderContext.render();
- out.write(renderContext.getMarkupFragment().toString());
- out.flush();
- }
- catch (RenderException e)
- {
- throw new JspException(e);
- }
break;
}
}
+
+ if (windowID == null)
+ {
+ log.warn("can't find the window id of the window name on this page. Page [" + page.getPageName()
+ + "] Window [" + windowName + "]. This window won't be shown in page.");
+ return;
+ }
+
+ if (page.getWindowContext(windowID) == null)
+ {
+ log.warn("no such window on this page. Page [" + page.getPageName() + "] Window name [" + windowName + "]"
+ + "] Window Id [" + windowID + "]");
+ return;
+ }
+
+ WindowContext windowContext = page.getWindowContext(windowID);
+ RenderContext renderContext = (RenderContext) request.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
+
+ renderContext = renderContext.getContext(windowContext);
+
+ try
+ {
+ renderContext.render();
+ out.write(renderContext.getMarkupFragment().toString());
+ out.flush();
+ }
+ catch (RenderException e)
+ {
+ throw new JspException(e);
+ }
+
}
public String getWindowName()
17 years, 6 months
JBoss Portal SVN: r6668 - in trunk/common: src/main/org/jboss/portal/common/reflect and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 12:12:13 -0400 (Wed, 14 Mar 2007)
New Revision: 6668
Added:
trunk/common/src/main/org/jboss/portal/common/util/IteratorStatus.java
trunk/common/src/main/org/jboss/portal/test/common/IteratorStatusTestCase.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java
trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java
Log:
added an IteratorStatus class which helps to keep the index of the latest obtained value from an iterator
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-03-14 14:32:08 UTC (rev 6667)
+++ trunk/common/build.xml 2007-03-14 16:12:13 UTC (rev 6668)
@@ -232,6 +232,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.URLToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ModifierTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified: trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java 2007-03-14 14:32:08 UTC (rev 6667)
+++ trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java 2007-03-14 16:12:13 UTC (rev 6668)
@@ -25,13 +25,23 @@
import java.lang.reflect.Field;
/**
+ * Extends the java Modifier object in order to add more utility methods.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public class Modifier extends java.lang.reflect.Modifier
{
- public static boolean isReadableProperty(Field f)
+ /**
+ * Return true if the field is considered as a readable property which means that
+ * it is public and non static.
+ *
+ * @param f the field to test
+ * @return true if the field is a readable property
+ * @throws IllegalArgumentException if the field argument is null
+ */
+ public static boolean isReadableProperty(Field f) throws IllegalArgumentException
{
if (f == null)
{
@@ -43,6 +53,14 @@
return (modifiers & STATIC) == 0 && (modifiers & PUBLIC) != 0;
}
+ /**
+ * Return true if the field is considered as a writable property which means that
+ * it is public, non static and non final.
+ *
+ * @param f the field to test
+ * @return true if the field is a writable property
+ * @throws IllegalArgumentException if the field argument is null
+ */
public static boolean isWritableProperty(Field f)
{
if (f == null)
Added: trunk/common/src/main/org/jboss/portal/common/util/IteratorStatus.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/IteratorStatus.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/IteratorStatus.java 2007-03-14 16:12:13 UTC (rev 6668)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * 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.common.util;
+
+import java.util.Iterator;
+import java.util.Collection;
+
+/**
+ * An java.util.Iterator wrapper which keep additional state associated with the wrapped iterator.
+ * The implementation of the Iterator interface delegates all operations to the wrapped iterator.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class IteratorStatus implements Iterator
+{
+
+ /** The real iterator. */
+ private final Iterator delegate;
+
+ /** The iterator index. */
+ private int index;
+
+ /**
+ * @param delegate the wrapped iterator
+ * @throws IllegalArgumentException if the wrapped iterator is null
+ */
+ public IteratorStatus(Iterator delegate) throws IllegalArgumentException
+ {
+ if (delegate == null)
+ {
+ throw new IllegalArgumentException("No iterator is provided");
+ }
+ this.delegate = delegate;
+ this.index = -1;
+ }
+
+ /**
+ * @param c the collection to iterate
+ * @throws IllegalArgumentException if the collection is null
+ */
+ public IteratorStatus(Collection c) throws IllegalArgumentException
+ {
+ if (c == null)
+ {
+ throw new IllegalArgumentException("No collection is provided");
+ }
+ this.delegate = c.iterator();
+ this.index = -1;
+ }
+
+ /**
+ * Returns the index of the last element obtained or -1 if no element has been returned yet.
+ *
+ * @return the index of the last element obtained
+ */
+ public int getElementIndex()
+ {
+ return index;
+ }
+
+ public boolean hasNext()
+ {
+ return delegate.hasNext();
+ }
+
+ public Object next()
+ {
+ Object o = delegate.next();
+
+ // Increment after getting the next object since the call to the next() method
+ // can throw a NoSuchElementException
+ index++;
+ return o;
+ }
+
+ public void remove()
+ {
+ delegate.remove();
+ }
+}
Added: trunk/common/src/main/org/jboss/portal/test/common/IteratorStatusTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/IteratorStatusTestCase.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/IteratorStatusTestCase.java 2007-03-14 16:12:13 UTC (rev 6668)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.test.common;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.NoSuchElementException;
+
+import org.jboss.portal.common.util.IteratorStatus;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class IteratorStatusTestCase extends TestCase
+{
+
+ public void testA()
+ {
+ ArrayList list = new ArrayList();
+ list.add("a");
+ list.add("b");
+ list.add("c");
+
+ //
+ test(new IteratorStatus(list));
+ test(new IteratorStatus(list.iterator()));
+ }
+
+ private void test(IteratorStatus iterator)
+ {
+ assertTrue(iterator.hasNext());
+ assertEquals(-1, iterator.getElementIndex());
+
+ //
+ assertEquals("a", iterator.next());
+ assertTrue(iterator.hasNext());
+ assertEquals(0, iterator.getElementIndex());
+
+ //
+ assertEquals("b", iterator.next());
+ assertTrue(iterator.hasNext());
+ assertEquals(1, iterator.getElementIndex());
+
+ //
+ assertEquals("c", iterator.next());
+ assertFalse(iterator.hasNext());
+ assertEquals(2, iterator.getElementIndex());
+
+ //
+ try
+ {
+ iterator.next();
+ fail("Was expecting a NoSuchElementException");
+ }
+ catch (NoSuchElementException expected)
+ {
+ }
+ assertFalse(iterator.hasNext());
+ assertEquals(2, iterator.getElementIndex());
+ }
+}
Modified: trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java 2007-03-14 14:32:08 UTC (rev 6667)
+++ trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java 2007-03-14 16:12:13 UTC (rev 6668)
@@ -34,6 +34,15 @@
public void testIsReadableProperty() throws Exception
{
+ try
+ {
+ Modifier.isReadableProperty(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("publicField")));
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("privateField")));
assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("protectedField")));
@@ -57,6 +66,15 @@
public void testIsWritableProperty() throws Exception
{
+ try
+ {
+ Modifier.isWritableProperty(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
assertTrue(Modifier.isWritableProperty(Bean.class.getDeclaredField("publicField")));
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("privateField")));
assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("protectedField")));
17 years, 6 months
JBoss Portal SVN: r6667 - in trunk/common/src/main/org/jboss/portal/common: reflect and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 10:32:08 -0400 (Wed, 14 Mar 2007)
New Revision: 6667
Added:
trunk/common/src/main/org/jboss/portal/common/reflect/
trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java
Log:
added support for public bean fields in delegating property resolver
Added: trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/reflect/Modifier.java 2007-03-14 14:32:08 UTC (rev 6667)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.common.reflect;
+
+import java.lang.reflect.Field;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Modifier extends java.lang.reflect.Modifier
+{
+
+ public static boolean isReadableProperty(Field f)
+ {
+ if (f == null)
+ {
+ throw new IllegalArgumentException("No field provided");
+ }
+
+ //
+ int modifiers = f.getModifiers();
+ return (modifiers & STATIC) == 0 && (modifiers & PUBLIC) != 0;
+ }
+
+ public static boolean isWritableProperty(Field f)
+ {
+ if (f == null)
+ {
+ throw new IllegalArgumentException("No field provided");
+ }
+
+ //
+ int modifiers = f.getModifiers();
+ return (modifiers & (STATIC | FINAL)) == 0 && (modifiers & PUBLIC) != 0;
+ }
+}
17 years, 6 months
JBoss Portal SVN: r6666 - in trunk: common/src/main/org/jboss/portal/test/common and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-14 10:31:01 -0400 (Wed, 14 Mar 2007)
New Revision: 6666
Added:
trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java
Modified:
trunk/common/build.xml
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
Log:
added support for public bean fields in delegating property resolver
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-03-14 14:07:51 UTC (rev 6665)
+++ trunk/common/build.xml 2007-03-14 14:31:01 UTC (rev 6666)
@@ -231,6 +231,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.URLToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.ModifierTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Added: trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/ModifierTestCase.java 2007-03-14 14:31:01 UTC (rev 6666)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.test.common;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.reflect.Modifier;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModifierTestCase extends TestCase
+{
+
+ public void testIsReadableProperty() throws Exception
+ {
+ assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("publicField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("privateField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("protectedField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("packageProtectedField")));
+
+ assertTrue(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPublicField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPrivateField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalProtectedField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalPackageProtectedField")));
+
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPublicField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPrivateField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticProtectedField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("staticPackageProtectedField")));
+
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPublicField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPrivateField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticProtectedField")));
+ assertFalse(Modifier.isReadableProperty(Bean.class.getDeclaredField("finalStaticPackageProtectedField")));
+ }
+
+ public void testIsWritableProperty() throws Exception
+ {
+ assertTrue(Modifier.isWritableProperty(Bean.class.getDeclaredField("publicField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("privateField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("protectedField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("packageProtectedField")));
+
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPublicField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPrivateField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalProtectedField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalPackageProtectedField")));
+
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPublicField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPrivateField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticProtectedField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("staticPackageProtectedField")));
+
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPublicField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPrivateField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticProtectedField")));
+ assertFalse(Modifier.isWritableProperty(Bean.class.getDeclaredField("finalStaticPackageProtectedField")));
+ }
+
+ private static class Bean
+ {
+ public Object publicField;
+ private Object privateField;
+ protected Object protectedField;
+ Object packageProtectedField;
+
+ final public Object finalPublicField = new Object();
+ final private Object finalPrivateField = new Object();
+ final protected Object finalProtectedField = new Object();
+ final Object finalPackageProtectedField = new Object();
+
+ static public Object staticPublicField;
+ static private Object staticPrivateField;
+ static protected Object staticProtectedField;
+ static Object staticPackageProtectedField;
+
+ final static public Object finalStaticPublicField = new Object();
+ final static private Object finalStaticPrivateField = new Object();
+ final static protected Object finalStaticProtectedField = new Object();
+ final static Object finalStaticPackageProtectedField = new Object();
+ }
+}
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-03-14 14:07:51 UTC (rev 6665)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-03-14 14:31:01 UTC (rev 6666)
@@ -25,12 +25,14 @@
import org.apache.log4j.Logger;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
import org.jboss.portal.faces.el.decorator.BeanDecorator;
+import org.jboss.portal.common.reflect.Modifier;
import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;
import javax.faces.el.PropertyResolver;
import java.util.HashMap;
import java.util.Map;
+import java.lang.reflect.Field;
/**
* A property resolver that provide fine grained configuration of the resolution mechanism.
@@ -97,6 +99,22 @@
}
//
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isReadableProperty(f))
+ {
+ return f.getType();
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ }
+
+ //
if (delegate != null)
{
return delegate.getType(base, property);
@@ -139,6 +157,26 @@
}
//
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isReadableProperty(f))
+ {
+ return f.get(base);
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Was not able to read the field " + property + " of object " + base + " with class " + base.getClass().getName());
+ }
+ }
+
+ //
if (delegate != null)
{
return delegate.getValue(base, property);
@@ -168,6 +206,27 @@
}
//
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isWritableProperty(f))
+ {
+ f.set(base, value);
+ return;
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Was not able to write the field " + property + " of object " + base + " with class " + base.getClass().getName());
+ }
+ }
+
+ //
if (delegate != null)
{
delegate.setValue(base, property, value);
17 years, 6 months