Author: julien(a)jboss.com
Date: 2007-03-01 13:03:53 -0500 (Thu, 01 Mar 2007)
New Revision: 6487
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java
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/content/ContentEditorTagHandler.java
trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
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
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java
Log:
improving the page layout editor
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-03-01
16:57:55 UTC (rev 6486)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/content/portlet/PortletContent.java 2007-03-01
18:03:53 UTC (rev 6487)
@@ -56,6 +56,21 @@
return new LocalizedString(state.getURI() + " portlet", Locale.ENGLISH);
}
+ public ContentState getState()
+ {
+ return state;
+ }
+
+ public String getURI()
+ {
+ return getInstanceRef();
+ }
+
+ public void setURI(String uri)
+ {
+ setInstanceRef(uri);
+ }
+
/**
*
* @return
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/Content.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-03-01
16:57:55 UTC (rev 6486)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/Content.java 2007-03-01
18:03:53 UTC (rev 6487)
@@ -38,4 +38,18 @@
* @return the content display name
*/
LocalizedString getDisplayName();
+
+ /**
+ * Returns the content URI.
+ *
+ * @return the content URI
+ */
+ String getURI();
+
+ /**
+ * Updates the content URI.
+ *
+ * @param uri the new content URI value
+ */
+ void setURI(String uri);
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java 2007-03-01
16:57:55 UTC (rev 6486)
+++
trunk/core/src/main/org/jboss/portal/test/core/model/content/NullContent.java 2007-03-01
18:03:53 UTC (rev 6487)
@@ -61,4 +61,14 @@
{
return new LocalizedString("Null content", Locale.ENGLISH);
}
+
+ public String getURI()
+ {
+ return state.getURI();
+ }
+
+ public void setURI(String uri)
+ {
+ state.setURI(uri);
+ }
}
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-01
16:57:55 UTC (rev 6486)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-01
18:03:53 UTC (rev 6487)
@@ -468,7 +468,10 @@
next = "pages";
break;
case PortalObject.TYPE_WINDOW:
+ Window window = (Window)object;
next = "windows";
+ selectedContentType = window.getContentType();
+ selectedContentURI = window.getURI();
break;
}
}
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AssignContentToWindowAction.java 2007-03-01
18:03:53 UTC (rev 6487)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.admin.ui.PortalObjectManagerBean;
+import org.jboss.portal.core.model.portal.Window;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AssignContentToWindowAction
+{
+
+ /** . */
+ private PortalObjectManagerBean portalObjectManager;
+
+ public PortalObjectManagerBean getPortalObjectManager()
+ {
+ return portalObjectManager;
+ }
+
+ public void setPortalObjectManager(PortalObjectManagerBean portalObjectManager)
+ {
+ this.portalObjectManager = portalObjectManager;
+ }
+
+ public void execute()
+ {
+ Window window = (Window)portalObjectManager.getSelectedObject();
+ String contentURI = portalObjectManager.getSelectedContentURI();
+ window.getContent().setURI(contentURI);
+ }
+}
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java 2007-03-01
16:57:55 UTC (rev 6486)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/content/ContentEditorTagHandler.java 2007-03-01
18:03:53 UTC (rev 6487)
@@ -55,6 +55,9 @@
/** . */
private final TagAttribute contentURI;
+ /** . */
+ private final TagAttribute submitFunction;
+
public ContentEditorTagHandler(TagConfig tagConfig)
{
super(tagConfig);
@@ -62,6 +65,7 @@
//
this.contentURI = this.getRequiredAttribute("contentURI");
this.contentType = this.getRequiredAttribute("contentType");
+ this.submitFunction = this.getRequiredAttribute("submitFunction");
}
public static String getContentURI()
@@ -113,10 +117,14 @@
nextHandler.apply(ctx, null);
//
- ValueExpression valueVE = contentURI.getValueExpression(ctx, Object.class);
- variableMapper.setVariable(contentURI.getLocalName(), valueVE);
+ ValueExpression contentURIVE = contentURI.getValueExpression(ctx,
Object.class);
+ variableMapper.setVariable(contentURI.getLocalName(), contentURIVE);
//
+ ValueExpression submitFunctionVE = submitFunction.getValueExpression(ctx,
Object.class);
+ variableMapper.setVariable(submitFunction.getLocalName(), submitFunctionVE);
+
+ //
ctx.includeFacelet(parent, url);
}
finally
Modified: trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-03-01
16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-sar/content/editor.xhtml 2007-03-01
18:03:53 UTC (rev 6487)
@@ -10,10 +10,12 @@
<h:selectOneListbox
value="#{contentURI}"
styleClass="instanceList portlet-form-field"
- size="13">
+ onclick="#{submitFunction}"
+ size="13"
+ style="">
<f:selectItems value="#{registry.editors.portlet.instanceItems}"/>
</h:selectOneListbox>
- <h:commandButton value="Show details"
styleClass="portlet-form-button"/>
+
<pfc:context>
<ui:param name="instance"
value="#{registry.editors.portlet.instanceMap[contentURI]}"/>
<ui:param name="portlet" value="#{instance.portlet}"/>
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-01
16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-01
18:03:53 UTC (rev 6487)
@@ -107,6 +107,15 @@
<value>#{sessionScope.portalobjectmgr}</value>
</managed-property>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>assignContentToWindowAction</managed-bean-name>
+
<managed-bean-class>org.jboss.portal.core.admin.ui.actions.AssignContentToWindowAction</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>
<!-- The instance manager managed bean -->
<managed-bean>
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-01
16:57:55 UTC (rev 6486)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageLayout.xhtml 2007-03-01
18:03:53 UTC (rev 6487)
@@ -72,13 +72,16 @@
</tr>
<tr>
<td>
+ <h:outputLabel for="instanceId">
+ <h:outputText value="Content type: "
styleClass="portlet-form-field-label"/>
+ </h:outputLabel>
<h:selectOneMenu
id="instanceId"
value="#{portalobjectmgr.selectedContentType}"
styleClass="portlet-form-field contentType">
<f:selectItems
value="#{registry.availableTypes}"/>
</h:selectOneMenu>
- <h:commandButton value="Change content type"
styleClass="portlet-form-button"/>
+ <h:commandButton value="Update"
styleClass="portlet-form-button"/>
<br/><h:message for="instanceId"
errorClass="portlet-msg-error"/>
</td>
</tr>
@@ -86,7 +89,8 @@
<td>
<ct:content
contentType="#{portalobjectmgr.selectedContentType}"
- contentURI="#{portalobjectmgr.selectedContentURI}"/>
+ contentURI="#{portalobjectmgr.selectedContentURI}"
+ submitFunction="document.layoutForm.submit()"/>
</td>
</tr>
</table>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml 2007-03-01
16:57:55 UTC (rev 6486)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/windows.xhtml 2007-03-01
18:03:53 UTC (rev 6487)
@@ -9,9 +9,10 @@
<h:form id="window_form">
<ct:content
- contentType="#{portalobjectmgr.selectedObject.contentType}"
- contentURI="#{portalobjectmgr.selectedObject.instanceRef}"/>
- <h:commandButton value="Change instance"
styleClass="portlet-form-button"/>
+ contentType="#{portalobjectmgr.selectedContentType}"
+ contentURI="#{portalobjectmgr.selectedContentURI}"
+ submitFunction="document.window_form.submit()"/>
+ <h:commandButton value="Update"
action="#{assignContentToWindowAction.execute}"
styleClass="portlet-form-button"/>
</h:form>
</ui:define>