JBoss Portal SVN: r6685 - in trunk: wsrp and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-15 09:15:51 -0400 (Thu, 15 Mar 2007)
New Revision: 6685
Modified:
trunk/faces/.classpath
trunk/wsrp/.classpath
Log:
Update Eclipse classpath
Modified: trunk/faces/.classpath
===================================================================
--- trunk/faces/.classpath 2007-03-15 13:13:40 UTC (rev 6684)
+++ trunk/faces/.classpath 2007-03-15 13:15:51 UTC (rev 6685)
@@ -10,5 +10,10 @@
<classpathentry kind="lib" path="/thirdparty/el/lib/el-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/junit/lib/junit.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/portlet"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/api"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/server"/>
+ <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/bridge"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/wsrp/.classpath
===================================================================
--- trunk/wsrp/.classpath 2007-03-15 13:13:40 UTC (rev 6684)
+++ trunk/wsrp/.classpath 2007-03-15 13:15:51 UTC (rev 6685)
@@ -29,5 +29,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/registration"/>
<classpathentry combineaccessrules="false" kind="src" path="/portlet-federation"/>
<classpathentry kind="lib" path="/thirdparty/hibernate/lib/hibernate3.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-myfaces/lib/myfaces-api.jar"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
17 years, 6 months
JBoss Portal SVN: r6684 - trunk/common.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-15 09:13:40 -0400 (Thu, 15 Mar 2007)
New Revision: 6684
Modified:
trunk/common/.classpath
Log:
Update eclipse classpath
Modified: trunk/common/.classpath
===================================================================
--- trunk/common/.classpath 2007-03-15 13:11:00 UTC (rev 6683)
+++ trunk/common/.classpath 2007-03-15 13:13:40 UTC (rev 6684)
@@ -15,5 +15,6 @@
<classpathentry kind="lib" path="/tools/lib/cargo-core-uberjar-0.8.jar"/>
<classpathentry kind="lib" path="/tools/lib/ant-junit.jar"/>
<classpathentry kind="lib" path="/thirdparty/apache-httpclient/lib/commons-httpclient.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/backport-concurrent/lib/jboss-backport-concurrent.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 years, 6 months
JBoss Portal SVN: r6683 - in trunk/core-admin/src: main/org/jboss/portal/core/admin/ui/actions and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 09:11:00 -0400 (Thu, 15 Mar 2007)
New Revision: 6683
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.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/faces-config.xml
Log:
moved security configuration when a page is added to the listener of the page action since the dashboard page creation does not require the same security config than a shared page
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-15 13:10:28 UTC (rev 6682)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-15 13:11:00 UTC (rev 6683)
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Map;
import java.util.LinkedList;
+import java.util.Set;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
@@ -45,14 +46,18 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.admin.ui.portlet.PortletDefinitionInvoker;
import org.jboss.portal.core.admin.ui.common.PageManagerBean;
+import org.jboss.portal.core.admin.ui.actions.AddPageAction;
import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
import org.jboss.portal.faces.component.portlet.PortletActionEvent;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
import org.jboss.portal.theme.LayoutService;
@@ -66,7 +71,7 @@
import org.jboss.portal.portlet.PortletInvoker;
/** The portal object manager bean. */
-public class PortalObjectManagerBean implements Serializable
+public class PortalObjectManagerBean implements Serializable, AddPageAction.Listener
{
/** The serialVersionUID */
@@ -583,6 +588,15 @@
}
}
+ /**
+ * The implication configure properly the page security for default access.
+ */
+ public void pageCreated(Page page)
+ {
+ Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
+ getDomainConfigurator().setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+ }
+
public class PortalObjectAuthorizationBean extends AbstractAuthorizationBean
{
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 13:10:28 UTC (rev 6682)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 13:11:00 UTC (rev 6683)
@@ -24,17 +24,10 @@
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 org.apache.log4j.Logger;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
-import java.util.Set;
-import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -61,9 +54,6 @@
/** The page container that will create the child. */
public PageContainer pageContainer;
- /** The domain configurator for security. */
- public DomainConfigurator domainConfigurator;
-
/** The page name to create. */
public String pageName;
@@ -105,10 +95,6 @@
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);
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 13:10:28 UTC (rev 6682)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-03-15 13:11:00 UTC (rev 6683)
@@ -94,6 +94,7 @@
public void pageCreated(Page page)
{
+ // Select page to show
selectedPageName = page.getName();
}
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-15 13:10:28 UTC (rev 6682)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15 13:11:00 UTC (rev 6683)
@@ -94,13 +94,13 @@
<value>#{portalobjectmgr.selectedObject}</value>
</managed-property>
<managed-property>
- <property-name>domainConfigurator</property-name>
- <value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
- </managed-property>
- <managed-property>
<property-name>messageTarget</property-name>
<value>addPageForm:pageName</value>
</managed-property>
+ <managed-property>
+ <property-name>listener</property-name>
+ <value>#{sessionScope.dashboard}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>themePropertyAction</managed-bean-name>
@@ -250,10 +250,6 @@
<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>messageTarget</property-name>
<value>error</value>
</managed-property>
17 years, 6 months
JBoss Portal SVN: r6682 - trunk/widget.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-15 09:10:28 -0400 (Thu, 15 Mar 2007)
New Revision: 6682
Modified:
trunk/widget/
Log:
Add bin and output to svnignore
Property changes on: trunk/widget
___________________________________________________________________
Name: svn:ignore
+ output
bin
17 years, 6 months
JBoss Portal SVN: r6681 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 09:05:28 -0400 (Thu, 15 Mar 2007)
New Revision: 6681
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
Log:
added proper page name validation logic
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 12:51:47 UTC (rev 6680)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 13:05:28 UTC (rev 6681)
@@ -29,7 +29,10 @@
import org.jboss.portal.security.spi.provider.DomainConfigurator;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
+import org.apache.log4j.Logger;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
import java.util.Set;
import java.util.Collections;
@@ -41,65 +44,87 @@
{
/** . */
- public PageContainer pageContainer;
+ private static final Logger log = Logger.getLogger(AddPageAction.class);
/** . */
- public DomainConfigurator domainConfigurator;
+ private static final String ERROR_DUPE_NAME = "Duplicate Page name found on this portal!";
/** . */
- public String pageName;
+ private static final String ERROR_EMPTY_NAME = "Page name cannot be blank!";
/** . */
- public Listener listener;
+ private static final String ERROR_NO_NAME = "Page name not specified!";
/** . */
-// private static final String ERROR_DUPE_NAME = "Duplicate Page name found on this portal!";
+ private static final String ERROR_INTERNAL_ERROR = "An internal error happened!";
- /** . */
-// private static final String ERROR_EMPTY_NAME = "Page name cannot be blank!";
+ /** The page container that will create the child. */
+ public PageContainer pageContainer;
- /*
- * 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);
-// }
-// }
+ /** The domain configurator for security. */
+ public DomainConfigurator domainConfigurator;
+ /** The page name to create. */
+ public String pageName;
+
+ /** An optional listener. */
+ public Listener listener;
+
+ /** The message id when an error happens. */
+ public String messageTarget;
+
public void execute()
{
- try
+ FacesMessage message = null;
+
+ //
+ if (pageName == null)
{
- Page page = pageContainer.createPage(pageName);
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_NO_NAME, ERROR_NO_NAME);
+ }
+ else
+ {
+ pageName = pageName.trim();
//
- Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
- domainConfigurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
+ if (pageName.length() == 0)
+ {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_EMPTY_NAME, ERROR_EMPTY_NAME);
+ }
+ else if (pageContainer.getChild(pageName) != null)
+ {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_DUPE_NAME, ERROR_DUPE_NAME);
+ }
+ }
- //
- if (listener != null)
+ //
+ if (message == null)
+ {
+ try
{
- listener.pageCreated(page);
+ 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)
+ {
+ log.error("An error happened during page creation", e);
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_INTERNAL_ERROR, ERROR_INTERNAL_ERROR);
+ }
}
- catch (Exception e)
+
+ //
+ if (message != null && messageTarget != null)
{
- e.printStackTrace();
+ FacesContext.getCurrentInstance().addMessage(messageTarget, message);
}
}
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-15 12:51:47 UTC (rev 6680)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15 13:05:28 UTC (rev 6681)
@@ -97,6 +97,10 @@
<property-name>domainConfigurator</property-name>
<value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
</managed-property>
+ <managed-property>
+ <property-name>messageTarget</property-name>
+ <value>addPageForm:pageName</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>themePropertyAction</managed-bean-name>
@@ -250,6 +254,10 @@
<value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
</managed-property>
<managed-property>
+ <property-name>messageTarget</property-name>
+ <value>error</value>
+ </managed-property>
+ <managed-property>
<property-name>listener</property-name>
<value>#{sessionScope.dashboard}</value>
</managed-property>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-03-15 12:51:47 UTC (rev 6680)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-03-15 13:05:28 UTC (rev 6681)
@@ -12,10 +12,10 @@
<div style="padding:1em 0 0 0">
<div class="portlet-font">Create a nested page:</div>
<div style="padding:1em 0 1em 0">
- <h:form>
- <h:inputText id="name" value="#{addPageAction.pageName}" styleClass="portlet-form-input-field" required="true"/>
+ <h:form id="addPageForm">
+ <h:inputText id="pageName" value="#{addPageAction.pageName}" styleClass="portlet-form-input-field" required="true"/>
<h:commandButton action="#{addPageAction.execute}" value="Add" styleClass="portlet-form-button"/>
- <h:message for="name" errorClass="portlet-msg-error"/>
+ <h:message for="pageName" errorClass="portlet-msg-error"/>
</h:form>
</div>
</div>
17 years, 6 months
JBoss Portal SVN: r6680 - 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-15 08:51:47 -0400 (Thu, 15 Mar 2007)
New Revision: 6680
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
Removed:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
Log:
- renamed AddPageAction2 bean to AddDashboardPageAction
Copied: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java (from rev 6671, 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/AddPageAction.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 12:51:47 UTC (rev 6680)
@@ -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 AddPageAction
+{
+
+ /** . */
+ 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);
+ }
+}
Deleted: 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 2007-03-15 12:48:16 UTC (rev 6679)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java 2007-03-15 12:51:47 UTC (rev 6680)
@@ -1,110 +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.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);
- }
-}
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 12:48:16 UTC (rev 6679)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-03-15 12:51:47 UTC (rev 6680)
@@ -31,7 +31,7 @@
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.core.admin.ui.actions.AddPageAction;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.ThemeService;
import org.jboss.portal.theme.ThemeConstants;
@@ -45,7 +45,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class DashboardBean implements AddPageAction2.Listener
+public class DashboardBean implements AddPageAction.Listener
{
/** . */
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-15 12:48:16 UTC (rev 6679)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15 12:51:47 UTC (rev 6680)
@@ -87,7 +87,7 @@
</managed-bean>
<managed-bean>
<managed-bean-name>addPageAction</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AddPageAction2</managed-bean-class>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AddPageAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>pageContainer</property-name>
@@ -238,8 +238,8 @@
</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-name>addDashboardPageAction</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AddPageAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>pageContainer</property-name>
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 12:48:16 UTC (rev 6679)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml 2007-03-15 12:51:47 UTC (rev 6680)
@@ -23,10 +23,10 @@
<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}"
+ <h:inputText id="pageName" value="#{addDashboardPageAction.pageName}"
styleClass="portlet-form-input-field"/>
<h:commandButton value="Save"
- action="#{addPageAction2.execute}"
+ action="#{addDashboardPageAction.execute}"
styleClass="portlet-form-button"/>
</h:form>
</td>
17 years, 6 months
JBoss Portal SVN: r6679 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 08:48:16 -0400 (Thu, 15 Mar 2007)
New Revision: 6679
Removed:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
Log:
use the new page action bean which is more reusable
Deleted: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 12:33:20 UTC (rev 6678)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2007-03-15 12:48:16 UTC (rev 6679)
@@ -1,122 +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.admin.ui.actions;
-
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.PageContainer;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
-import org.jboss.portal.security.RoleSecurityBinding;
-import org.jboss.portal.security.SecurityConstants;
-import org.jboss.portal.security.spi.provider.DomainConfigurator;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.ValidatorException;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5763 $
- */
-public class AddPageAction
-{
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- /** . */
- private String pageName;
-
- /** . */
- 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!";
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
- }
-
- public String getPageName()
- {
- return pageName;
- }
-
- public void setPageName(String pageName)
- {
- this.pageName = pageName;
- }
-
- /**
- * 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.
- *
- * @param context
- * @param toValidate
- * @param value
- */
- 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 (pomgr.getSelectedObject().getChild(pageName) != null)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ERROR_DUPE_NAME, ERROR_DUPE_NAME);
- throw new ValidatorException(message);
- }
- }
-
- public void execute()
- {
- try
- {
- PageContainer pageContainer = (PageContainer)pomgr.getSelectedObject();
- Page page = pageContainer.createPage(pageName);
- DomainConfigurator configurator = pomgr.getDomainConfigurator();
- Set constraints = Collections.singleton(new RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION, SecurityConstants.UNCHECKED_ROLE_NAME));
- configurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT), constraints);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-}
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-15 12:33:20 UTC (rev 6678)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15 12:48:16 UTC (rev 6679)
@@ -87,12 +87,16 @@
</managed-bean>
<managed-bean>
<managed-bean-name>addPageAction</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AddPageAction</managed-bean-class>
+ <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>portalObjectManager</property-name>
- <value>#{sessionScope.portalobjectmgr}</value>
+ <property-name>pageContainer</property-name>
+ <value>#{portalobjectmgr.selectedObject}</value>
</managed-property>
+ <managed-property>
+ <property-name>domainConfigurator</property-name>
+ <value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>themePropertyAction</managed-bean-name>
17 years, 6 months
JBoss Portal SVN: r6678 - trunk/widget.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-15 08:33:20 -0400 (Thu, 15 Mar 2007)
New Revision: 6678
Added:
trunk/widget/.classpath
trunk/widget/.project
Log:
Eclipse files
Added: trunk/widget/.classpath
===================================================================
--- trunk/widget/.classpath (rev 0)
+++ trunk/widget/.classpath 2007-03-15 12:33:20 UTC (rev 6678)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/common"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/api"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/backport-concurrent/lib/jboss-backport-concurrent.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/widget/.project
===================================================================
--- trunk/widget/.project (rev 0)
+++ trunk/widget/.project 2007-03-15 12:33:20 UTC (rev 6678)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>widget</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
17 years, 6 months
JBoss Portal SVN: r6677 - in trunk/core-admin/src: main/org/jboss/portal/core/admin/ui/actions and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 07:44:04 -0400 (Thu, 15 Mar 2007)
New Revision: 6677
Removed:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignWindowsAction.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
Log:
made the page layout editor of the admin portlet uses the same bean+facelet than the dashboard editor
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-15 11:06:18 UTC (rev 6676)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-15 11:44:04 UTC (rev 6677)
@@ -28,33 +28,27 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
import java.util.LinkedList;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
-import javax.faces.event.AbortProcessingException;
import javax.faces.model.SelectItem;
-import org.jboss.logging.Logger;
import org.jboss.portal.common.MediaType;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
+import org.jboss.portal.core.model.portal.Page;
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.admin.ui.portlet.PortletDefinitionInvoker;
+import org.jboss.portal.core.admin.ui.common.PageManagerBean;
import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
import org.jboss.portal.faces.component.portlet.PortletActionEvent;
import org.jboss.portal.identity.RoleModule;
@@ -78,9 +72,6 @@
/** The serialVersionUID */
private static final long serialVersionUID = -8923517554726982622L;
- /** . */
- private Logger log = Logger.getLogger(getClass());
-
// Wired services
/** . */
@@ -150,6 +141,9 @@
/** . */
private PortletInvoker portletDefinitionInvoker;
+ /** . */
+ public PageManagerBean pageManager;
+
// Wired services
public List getAvailableContentTypes()
@@ -330,95 +324,28 @@
return authorizationDomainRegistry.getDomain("portalobject").getConfigurator();
}
- public PortalObject getObjectFromId(String id)
- {
- PortalObjectId objectId = PortalObjectId.parse(id, PortalObjectId.LEGACY_BASE64_FORMAT);
- return getObjectFromId(objectId);
- }
-
- public PortalObject getObjectFromId(PortalObjectId id)
- {
- return portalObjectContainer.getObject(id);
- }
-
public SelectItem[] getInstanceItems()
{
- if (instanceItems == null)
- {
- List tmp = new ArrayList(instanceContainer.getDefinitions());
- Collections.sort(tmp, InstanceManagerBean.INSTANCE_COMPARATOR);
- for (int i = 0;i < tmp.size();i++)
- {
- Instance instance = (Instance)tmp.get(i);
- SelectItem item = new SelectItem(instance.getId());
- tmp.set(i, item);
- }
- instanceItems = (SelectItem[])tmp.toArray(new SelectItem[tmp.size()]);
- }
return instanceItems;
}
public SelectItem[] getPortalPageItems()
{
- if (portalPageItems == null)
- {
- Collection pages = getSelectedObject().getChildren(PortalObject.PAGE_MASK);
- ArrayList list = new ArrayList(pages.size() + 1);
- for (Iterator iterator = pages.iterator(); iterator.hasNext();)
- {
- PortalObject o = (PortalObject)iterator.next();
- SelectItem item = new SelectItem(o.getName());
- list.add(item);
- }
- list.add(new SelectItem("", "no selection"));
- portalPageItems = (SelectItem[])list.toArray(new SelectItem[list.size()]);
- }
return portalPageItems;
}
public List getSelectedObjectPath()
{
- if (selectedObjectPath == null)
- {
- PortalObject o = getSelectedObject();
- ArrayList path = new ArrayList();
- while (o != null)
- {
- path.add(o);
- o = o.getParent();
- }
- Collections.reverse(path);
- selectedObjectPath = path;
- }
return selectedObjectPath;
}
public PortalObject getSelectedObject()
{
- if (selectedObject == null)
- {
- if (selectedId == null)
- {
- selectedId = new PortalObjectId();
- }
- selectedObject = getObjectFromId(selectedId);
- }
return selectedObject;
}
public List getSelectedProperties()
{
- if (selectedProperties == null)
- {
- PortalObject object = getSelectedObject();
- List properties = new ArrayList();
- for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
- }
- selectedProperties = properties;
- }
return selectedProperties;
}
@@ -558,123 +485,77 @@
}
}
- /** Returns a <Region,<Window>SortedSet>Map. */
- private Map getWindows(Page page) throws Exception
+ public void refresh()
{
- // Get the layout
- String layoutId = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
- PortalLayout layout = layoutService.getLayout(layoutId, false);
+ instanceItems = null;
+ portalPageItems = null;
+ selectedObjectPath = null;
+ selectedObject = null;
+ selectedProperties = null;
//
- LinkedHashMap windows = new LinkedHashMap();
- for (Iterator i = layout.getLayoutInfo().getRegionNames().iterator(); i.hasNext();)
+ if (selectedId == null)
{
- String region = (String)i.next();
- windows.put(region, new TreeSet(new WindowComparator()));
+ selectedId = new PortalObjectId();
}
- windows.put("unknown", new TreeSet(new WindowComparator()));
-
- //
- for (Iterator j = getSelectedObject().getChildren().iterator(); j.hasNext();)
+ selectedObject = portalObjectContainer.getObject(selectedId);
+ if (selectedObject.getType() == PortalObject.TYPE_PAGE)
{
- PortalObject object = (PortalObject)j.next();
- if (object.getType() == PortalObject.TYPE_WINDOW)
+ if (pageManager == null)
{
- String region = object.getProperty(ThemeConstants.PORTAL_PROP_REGION);
- if (!windows.containsKey(region))
- {
- region = "unknown";
- }
- SortedSet set = (SortedSet)windows.get(region);
- set.add(object);
+ pageManager = new PageManagerBean(layoutService, portletDefinitionInvoker);
}
+ pageManager.page = (Page)selectedObject;
}
- return windows;
- }
- /** Return the <Region>List on the selected object which must be a page. */
- public List getRegionNames()
- {
- try
+ //
+ Collection pages = getSelectedObject().getChildren(PortalObject.PAGE_MASK);
+ ArrayList list = new ArrayList(pages.size() + 1);
+ for (Iterator iterator = pages.iterator(); iterator.hasNext();)
{
- Map windows = getWindows((Page)getSelectedObject());
-
- //
- List regions = new ArrayList(windows.keySet());
- regions.remove("unknown");
- Collections.sort(regions);
-
- //
- return regions;
+ PortalObject o = (PortalObject)iterator.next();
+ SelectItem item = new SelectItem(o.getName());
+ list.add(item);
}
- catch (Exception e)
- {
- e.printStackTrace();
+ list.add(new SelectItem("", "no selection"));
+ portalPageItems = (SelectItem[])list.toArray(new SelectItem[list.size()]);
- //
- return Collections.EMPTY_LIST;
- }
- }
-
- public List getRegionItems()
- {
- try
+ //
+ if (selectedProperties == null)
{
- Map windows = getWindows((Page)getSelectedObject());
- windows.remove("unknown");
-
- //
- ArrayList regions = new ArrayList(windows.keySet());
- Collections.sort(regions);
- for (int i = 0; i < regions.size();i++)
+ PortalObject object = getSelectedObject();
+ List properties = new ArrayList();
+ for (Iterator i = object.getDeclaredProperties().entrySet().iterator(); i.hasNext();)
{
- String regionName = (String)regions.get(i);
- SelectItem regionItem = new SelectItem(regionName, regionName);
- regions.set(i, regionItem);
+ Map.Entry entry = (Map.Entry)i.next();
+ properties.add(new String[]{(String)entry.getKey(), (String)entry.getValue()});
}
-
- //
- return regions;
+ selectedProperties = properties;
}
- catch (Exception e)
- {
- e.printStackTrace();
- //
- return Collections.EMPTY_LIST;
+ //
+ PortalObject o = getSelectedObject();
+ ArrayList path = new ArrayList();
+ while (o != null)
+ {
+ path.add(o);
+ o = o.getParent();
}
- }
+ Collections.reverse(path);
+ selectedObjectPath = path;
- public Map getWindowItemsMap() throws Exception
- {
- Map windowMap = getWindows((Page)getSelectedObject());
- for (Iterator i = windowMap.entrySet().iterator();i.hasNext();)
+ //
+ List tmp = new ArrayList(instanceContainer.getDefinitions());
+ Collections.sort(tmp, InstanceManagerBean.INSTANCE_COMPARATOR);
+ for (int i = 0;i < tmp.size();i++)
{
- 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);
+ Instance instance = (Instance)tmp.get(i);
+ SelectItem item = new SelectItem(instance.getId());
+ tmp.set(i, item);
}
- return windowMap;
+ instanceItems = (SelectItem[])tmp.toArray(new SelectItem[tmp.size()]);
}
- public void refresh()
- {
- instanceItems = null;
- portalPageItems = null;
- selectedObjectPath = null;
- selectedObject = null;
- selectedProperties = null;
- }
-
public void processEvent(ActionEvent event)
{
if (event instanceof PortletActionEvent)
@@ -696,92 +577,6 @@
window.getContent().setURI(uri);
break;
}
- case PortalObject.TYPE_PAGE:
- {
- // Validate window name
- String windowName = ((String[])actionParams.get("windowName"))[0];
- if (windowName.trim().length() == 0)
- {
- FacesContext faces = FacesContext.getCurrentInstance();
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No window name!", null);
- faces.addMessage("windowName", message);
- throw new AbortProcessingException();
- }
-
- // Check for duplicate window name
- Page page = (Page)getSelectedObject();
- 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];
-
- //
- selectedContentURI = uri;
- selectedContentParameters.clear();
- 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];
- selectedContentParameters.put(paramName, paramValue);
- }
- }
-
- try
- {
- Window window = page.createWindow(windowName, selectedContentType, uri);
- Content content = window.getContent();
- for (Iterator i = selectedContentParameters.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();
- }
- break;
- }
}
}
}
Deleted: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignWindowsAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignWindowsAction.java 2007-03-15 11:06:18 UTC (rev 6676)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignWindowsAction.java 2007-03-15 11:44:04 UTC (rev 6677)
@@ -1,301 +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.admin.ui.actions;
-
-import org.jboss.portal.faces.el.dynamic.DynamicBean;
-import org.jboss.portal.faces.el.PropertyValue;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.core.model.content.Content;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.NoSuchPortalObjectException;
-import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
-import org.jboss.portal.theme.ThemeConstants;
-
-import javax.faces.event.ActionEvent;
-import javax.faces.context.FacesContext;
-import javax.faces.application.FacesMessage;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class AssignWindowsAction
-{
-
- /** . */
- private static final int MOVE_UP = 'u';
-
- /** . */
- private static final int MOVE_DOWN = 'd';
-
- /** . */
- private static final int MOVE_LEFT = 'l';
-
- /** . */
- private static final int MOVE_RIGHT = 'r';
-
- /** . */
- private DynamicMap assignedWindows = new DynamicMap();
-
- /** . */
- private String windowName;
-
- /** . */
- private PortalObjectManagerBean pomgr;
-
- /** . */
- private ContentType contentType;
-
- /** . */
- private String contentURI;
-
- public DynamicMap getAssignedWindows()
- {
- return assignedWindows;
- }
-
- public PortalObjectManagerBean getPortalObjectManager()
- {
- return pomgr;
- }
-
- public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
- {
- this.pomgr = portalObjectManager;
- }
-
- public String getWindowName()
- {
- return windowName;
- }
-
- public void setWindowName(String windowName)
- {
- this.windowName = windowName;
- }
-
- public void execute(ActionEvent event)
- {
- String id = event.getComponent().getId();
- char direction = id.charAt(0);
- String regionName = id.substring(2);
-
- // Contains the names selected window in the UI
- List selectedWindows = (List)assignedWindows.values.get(regionName);
-
- //
- Page page = (Page)pomgr.getSelectedObject();
-
- // 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 window = (Window)i.next();
- if (regionName.equals(window.getProperty(ThemeConstants.PORTAL_PROP_REGION)))
- {
- windows.add(window);
- }
- }
- Collections.sort(windows, new WindowComparator());
-
- //
- if (direction == MOVE_UP || direction == MOVE_DOWN)
- {
- //
- int index = direction == MOVE_UP ? 1 : windows.size() - 2;
- int length = windows.size() - 1;
- int step = direction == MOVE_UP ? 1 : -1;
-
- // Perform swaps
- while (length-- > 0)
- {
- Window window = (Window)windows.get(index);
- if (selectedWindows.contains(window.getName()))
- {
- Collections.swap(windows, index - step, index);
- }
- index += step;
- }
- }
- else if (direction == MOVE_LEFT)
- {
- for (Iterator i = windows.iterator();i.hasNext();)
- {
- Window window = (Window)i.next();
- if (selectedWindows.contains(window.getName()))
- {
- i.remove();
- try
- {
- page.destroyChild(window.getName());
- }
- catch (NoSuchPortalObjectException ignore)
- {
- ignore.printStackTrace();
- }
- }
- }
- }
- else if (direction == MOVE_RIGHT)
- {
- //
- if (validateAddWindow())
- {
- try
- {
- ContentType contentType = pomgr.getSelectedContentType();
- String contentURI = pomgr.getSelectedContentURI();
- Map contentParameters = pomgr.getSelectedContentParameters();
-
- //
- Window window = page.createWindow(windowName, contentType, contentURI);
-
- //
- Content content = window.getContent();
- for (Iterator i = contentParameters.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, regionName);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
-
- //
- windows.add(window);
- }
- catch (DuplicatePortalObjectException unexpected)
- {
- unexpected.printStackTrace();
- }
- }
- }
-
-
- // Update the order states
- for (int i = 0;i < windows.size();i++)
- {
- Window window = (Window)windows.get(i);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
- }
- }
-
- /**
- * Checks for duplicate window names on the page. Blank window names are not allowed and are
- * controlled by the required attribute in the presentation page.
- */
- public boolean validateAddWindow()
- {
- FacesContext faces = FacesContext.getCurrentInstance();
-
- // Validate window name
- if (windowName == null)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No window name!", null);
- faces.addMessage("layoutForm:windowName", message);
- }
- else
- {
- // Trim name
- windowName = windowName.trim();
-
- // Check for empty string
- if (windowName.length() == 0)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Window name cannot be blank!", null);
- faces.addMessage("layoutForm:windowName", message);
- }
- else
- {
- // Check for duplicate window name
- Page page = (Page)pomgr.getSelectedObject();
- if (page.getWindow(windowName) != null)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Duplicate window name found on this page!", null);
- faces.addMessage("layoutForm:windowName", message);
- }
- }
- }
-
- // Validate instance selection
- contentType = pomgr.getSelectedContentType();
- if (contentType == null)
- {
- FacesMessage message = new FacesMessage("No content type provided!", null);
- faces.addMessage("layoutForm:instanceId", message);
- }
- else
- {
- contentURI = pomgr.getSelectedContentURI();
- if (contentURI == null)
- {
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No portlet selected!", null);
- faces.addMessage("layoutForm:instanceId", message);
- }
- }
-
- //
- return faces.getMessages().hasNext() == false;
- }
-
- public static class DynamicMap implements DynamicBean
- {
-
- /** . */
- private Map values = new HashMap();
-
- public Class getType(Object propertyName) throws IllegalArgumentException
- {
- return List.class;
- }
-
- public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
- {
- List list = (List)values.get(propertyName);
- if (list == null)
- {
- list = new ArrayList();
- values.put(propertyName, list);
- }
- return new PropertyValue(list);
- }
-
- public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
- {
- values.put(propertyName, value);
- return true;
- }
- }
-}
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-15 11:06:18 UTC (rev 6676)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15 11:44:04 UTC (rev 6677)
@@ -95,15 +95,6 @@
</managed-property>
</managed-bean>
<managed-bean>
- <managed-bean-name>assignWindowsAction</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.admin.ui.actions.AssignWindowsAction</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- <managed-property>
- <property-name>portalObjectManager</property-name>
- <value>#{sessionScope.portalobjectmgr}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
<managed-bean-name>themePropertyAction</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.admin.ui.actions.ThemePropertyAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
@@ -217,7 +208,10 @@
</managed-property>
</managed-bean>
- <!-- The dashboard bean -->
+ <!--
+ | Dashboard beans
+ -->
+
<managed-bean>
<managed-bean-name>dashboard</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.admin.ui.dashboard.DashboardBean</managed-bean-class>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-15 11:06:18 UTC (rev 6676)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-15 11:44:04 UTC (rev 6677)
@@ -13,131 +13,9 @@
<h3>You are editing the page layout</h3>
- <div style="float:left; padding:0 2em 0 2em">
- <h:form id="layoutForm">
- <table>
- <c:forEach items="#{portalobjectmgr.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="#{portalobjectmgr.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="#{portalobjectmgr.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="#{portalobjectmgr.selectedContentType}"
- styleClass="portlet-form-field contentType">
- <f:selectItems value="#{portalobjectmgr.availableContentTypes}"/>
- </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="#{portalobjectmgr.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="#{portalobjectmgr.selectedContentEditorInstance}"
- portletInvoker="#{portalobjectmgr.portletDefinitionInvoker}"
- actionListener="#{portalobjectmgr.processEvent}"
- 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>
- <br />
+ <ui:include src="common/editPageLayout.xhtml">
+ <ui:param name="pageManager" value="#{portalobjectmgr.pageManager}"/>
+ </ui:include>
</ui:define>
17 years, 6 months
JBoss Portal SVN: r6676 - in trunk/core-admin/src: resources/portal-admin-war/WEB-INF/jsf/common and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 07:06:18 -0400 (Thu, 15 Mar 2007)
New Revision: 6676
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
Log:
finished to implement the layout capabilities for the dashboard editor
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 05:19:32 UTC (rev 6675)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2007-03-15 11:06:18 UTC (rev 6676)
@@ -26,6 +26,7 @@
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.portal.NoSuchPortalObjectException;
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;
@@ -34,6 +35,8 @@
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.faces.component.portlet.PortletActionEvent;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.portlet.PortletInvoker;
import javax.faces.model.SelectItem;
@@ -59,6 +62,15 @@
public class PageManagerBean
{
+ /** . */
+ private static final int MOVE_UP = 'u';
+
+ /** . */
+ private static final int MOVE_DOWN = 'd';
+
+ /** . */
+ private static final int MOVE_LEFT = 'l';
+
public PageManagerBean(LayoutService layoutService, PortletInvoker portletInvoker)
{
this.layoutService = layoutService;
@@ -78,6 +90,9 @@
/** . */
public ContentType selectedContentType;
+ /** . */
+ public DynamicMap assignedWindows = new DynamicMap();
+
public List getContentTypeItems()
{
LinkedList types = new LinkedList();
@@ -116,6 +131,80 @@
return "" + (int)(100 * Math.random());
}
+ public void assignWindows(ActionEvent event)
+ {
+ String id = event.getComponent().getId();
+ char direction = id.charAt(0);
+ String regionName = id.substring(2);
+
+ // Contains the names selected window in the UI
+ List selectedWindows = (List)assignedWindows.values.get(regionName);
+
+ // 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 window = (Window)i.next();
+ if (regionName.equals(window.getProperty(ThemeConstants.PORTAL_PROP_REGION)))
+ {
+ windows.add(window);
+ }
+ }
+ Collections.sort(windows, new WindowComparator());
+
+ //
+ if (direction == MOVE_UP || direction == MOVE_DOWN)
+ {
+ //
+ int index = direction == MOVE_UP ? 1 : windows.size() - 2;
+ int length = windows.size() - 1;
+ int step = direction == MOVE_UP ? 1 : -1;
+
+ // Perform swaps
+ while (length-- > 0)
+ {
+ Window window = (Window)windows.get(index);
+ if (selectedWindows.contains(window.getName()))
+ {
+ Collections.swap(windows, index - step, index);
+ }
+ index += step;
+ }
+ }
+ else if (direction == MOVE_LEFT)
+ {
+ for (Iterator i = windows.iterator();i.hasNext();)
+ {
+ Window window = (Window)i.next();
+ if (selectedWindows.contains(window.getName()))
+ {
+ i.remove();
+ try
+ {
+ page.destroyChild(window.getName());
+ }
+ catch (NoSuchPortalObjectException ignore)
+ {
+ ignore.printStackTrace();
+ }
+ }
+ }
+ }
+
+ // Update the order states
+ for (int i = 0;i < windows.size();i++)
+ {
+ Window window = (Window)windows.get(i);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + i);
+ }
+
+ //
+ assignedWindows.values.clear();
+ }
+
+ /**
+ * Portlet event
+ */
public void assignWindow(ActionEvent event)
{
if (event instanceof PortletActionEvent)
@@ -321,4 +410,33 @@
}
return windows;
}
+
+ public static class DynamicMap implements DynamicBean
+ {
+
+ /** . */
+ private Map values = new HashMap();
+
+ public Class getType(Object propertyName) throws IllegalArgumentException
+ {
+ return List.class;
+ }
+
+ public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
+ {
+ List list = (List)values.get(propertyName);
+ if (list == null)
+ {
+ list = new ArrayList();
+ values.put(propertyName, list);
+ }
+ return new PropertyValue(list);
+ }
+
+ public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
+ {
+ values.put(propertyName, value);
+ return true;
+ }
+ }
}
Modified: 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 2007-03-15 05:19:32 UTC (rev 6675)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-03-15 11:06:18 UTC (rev 6676)
@@ -33,24 +33,24 @@
<td>
<div>
<h:commandButton value="Up" id="u_#{regionName}"
- actionListener="#{assignWindowsAction.execute}"
+ actionListener="#{pageManager.assignWindows}"
styleClass="portlet-form-button"/>
</div>
<div>
<h:commandButton value="Down" id="d_#{regionName}"
- actionListener="#{assignWindowsAction.execute}"
+ actionListener="#{pageManager.assignWindows}"
styleClass="portlet-form-button"/>
</div>
<div style="margin-top: 1em">
<h:commandButton
value="Delete" id="l_#{regionName}"
- actionListener="#{assignWindowsAction.execute}"
+ actionListener="#{pageManager.assignWindows}"
styleClass="portlet-form-button"/>
</div>
</td>
<td>
<h:selectManyListbox
- value="#{assignWindowsAction.assignedWindows[regionName]}"
+ value="#{pageManager.assignedWindows[regionName]}"
size="7" styleClass="windowList portlet-form-field">
<f:selectItems
value="#{pageManager.windowItemsMap[regionName]}"/>
@@ -70,13 +70,13 @@
<td>
<div style="margin-top: 1em">
<h:commandButton value="Delete"
- id="l_unknown" actionListener="#{assignWindowsAction.execute}"
+ id="l_unknown" actionListener="#{pageManager.assignWindows}"
styleClass="portlet-form-button"/>
</div>
</td>
<td>
<h:selectManyListbox
- value="#{assignWindowsAction.assignedWindows['unknown']}"
+ value="#{pageManager.assignedWindows['unknown']}"
size="7" styleClass="windowList portlet-form-field">
<f:selectItems
value="#{pageManager.windowItemsMap['unknown']}"/>
17 years, 6 months