JBoss Portal SVN: r11752 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/impl/coordination and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-08-27 16:26:54 -0400 (Wed, 27 Aug 2008)
New Revision: 11752
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
Log:
- Renamed ParameterBindingInfo.getId to getName for better consistency.
- Started adding support for deleting and renaming bindings.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-08-27 19:26:24 UTC (rev 11751)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-08-27 20:26:54 UTC (rev 11752)
@@ -29,5 +29,5 @@
*/
public interface ParameterBindingInfo
{
- String getId();
+ String getName();
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-08-27 19:26:24 UTC (rev 11751)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-08-27 20:26:54 UTC (rev 11752)
@@ -22,33 +22,33 @@
package org.jboss.portal.core.impl.coordination;
+import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
+import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
import org.jboss.portal.core.controller.coordination.CoordinationManager;
+import org.jboss.portal.core.controller.coordination.EventConverter;
+import org.jboss.portal.core.controller.coordination.EventWiringInfo;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
-import org.jboss.portal.core.controller.coordination.EventWiringInfo;
-import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
-import org.jboss.portal.core.controller.coordination.EventConverter;
import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
-import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
-import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PageContainer;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
+import org.jboss.portal.portlet.info.EventInfo;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.EventInfo;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import javax.xml.namespace.QName;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.Collections;
-import java.util.Iterator;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -159,7 +159,7 @@
{
if (entry.getKey().getName().equals(window.getName()) && entry.getValue().equals(name))
{
- names.add(info.getId());
+ names.add(info.getName());
}
}
}
@@ -171,7 +171,7 @@
{
if (info.getNames().contains(name))
{
- names.add(info.getId());
+ names.add(info.getName());
}
}
}
@@ -562,7 +562,7 @@
}
// Remove all entries
- String prop_wiring = PREFIX_PARAMETER_BINDING + "." + info.getId();
+ String prop_wiring = PREFIX_PARAMETER_BINDING + "." + info.getName();
//
for (Window window : info.getWindows().keySet())
@@ -670,7 +670,7 @@
AliasInfoPOJO alias = (AliasInfoPOJO)aliasInfo;
//
- String propName = PREFIX_PARAMETER_ALIAS_NAME + "." + aliasInfo.getId();
+ String propName = PREFIX_PARAMETER_ALIAS_NAME + "." + aliasInfo.getName();
if (alias.page.getProperties().keySet().contains(propName))
{
alias.page.setDeclaredProperty(propName,null);
@@ -978,7 +978,7 @@
this.immutableWindows = Collections.unmodifiableMap(windows);
}
- public String getId()
+ public String getName()
{
return name;
}
@@ -1012,7 +1012,7 @@
this.immutableNames = Collections.unmodifiableSet(names);
}
- public String getId()
+ public String getName()
{
return name;
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java 2008-08-27 19:26:24 UTC (rev 11751)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/CustomizationManagerService.java 2008-08-27 20:26:54 UTC (rev 11752)
@@ -236,7 +236,7 @@
// }
//
// //
-// PortalObjectId objectId = object.getId();
+// PortalObjectId objectId = object.getName();
//
// //
// if (user != null && "dashboard".equals(objectId.getNamespace()))
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-08-27 19:26:24 UTC (rev 11751)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-08-27 20:26:54 UTC (rev 11752)
@@ -355,7 +355,7 @@
assertTrue(bindings1.size() == 1);
AliasBindingInfo info = bindings1.iterator().next();
- assertTrue(info.getId().equals("alias1"));
+ assertTrue(info.getName().equals("alias1"));
assertTrue(info.getNames().size() == 3);
assertTrue(info.getNames().contains(qname1));
assertTrue(info.getNames().contains(qname2));
@@ -373,11 +373,11 @@
for (AliasBindingInfo aliasBindingInfo : bindings2)
{
- if (aliasBindingInfo.getId().equals("alias2"))
+ if (aliasBindingInfo.getName().equals("alias2"))
{
info2 = aliasBindingInfo;
}
- if (aliasBindingInfo.getId().equals("alias3"))
+ if (aliasBindingInfo.getName().equals("alias3"))
{
info3 = aliasBindingInfo;
}
@@ -388,13 +388,13 @@
assertNotNull(info2);
assertNotNull(info3);
- assertTrue(info2.getId().equals("alias2"));
+ assertTrue(info2.getName().equals("alias2"));
assertTrue(info2.getNames().size() == 3);
assertTrue(info2.getNames().contains(qname4));
assertTrue(info2.getNames().contains(qname5));
assertTrue(info2.getNames().contains(qname6));
- assertTrue(info3.getId().equals("alias3"));
+ assertTrue(info3.getName().equals("alias3"));
assertTrue(info3.getNames().size() == 3);
assertTrue(info3.getNames().contains(qname7));
assertTrue(info3.getNames().contains(qname8));
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java 2008-08-27 19:26:24 UTC (rev 11751)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java 2008-08-27 20:26:54 UTC (rev 11752)
@@ -22,6 +22,7 @@
package org.jboss.portal.core.admin.ui.coordination;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
@@ -33,12 +34,14 @@
import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.PortletInfo;
+import javax.faces.event.ActionEvent;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -56,7 +59,11 @@
private String selectedRenderParameter;
private Map<String, String> availableRenderParameters;
private String windowBindingName;
+ private String selectedForDeletionName;
+ private String selectedForDeletionType;
+ private Map<String, DisplayParameterBinding> displayParameterBindings;
+
public Map<String, String> getWindows()
{
return windows;
@@ -139,7 +146,7 @@
{
availableRenderParameters.put(pInfo.getName().toString(), pInfo.getName().toString());
}
-
+
// record window information
this.windows.put(window.getName(), window.getId().toString(PortalObjectPath.LEGACY_BASE64_FORMAT));
}
@@ -155,7 +162,13 @@
private String id;
private QName name;
private List<Window> windows;
+ private WindowBindingInfo bindingInfo;
+ public DisplayParameterBinding(WindowBindingInfo bindingInfo)
+ {
+ this.bindingInfo = bindingInfo;
+ }
+
public String getId()
{
return id;
@@ -190,6 +203,11 @@
this.windows = windows;
}
+ public WindowBindingInfo getBindingInfo()
+ {
+ return bindingInfo;
+ }
+
public int compareTo(Object o)
{
DisplayParameterBinding other = (DisplayParameterBinding)o;
@@ -197,16 +215,17 @@
}
}
- private List<DisplayParameterBinding> displayParameterBindings;
-
- public List<DisplayParameterBinding> getDisplayParameterBindings()
+ public Collection<DisplayParameterBinding> getDisplayParameterBindings()
{
- return displayParameterBindings;
- }
+ if (displayParameterBindings == null)
+ {
+ return Collections.emptyList();
+ }
- public void setDisplayParameterBindings(List<DisplayParameterBinding> displayParameterBindings)
- {
- this.displayParameterBindings = displayParameterBindings;
+ List<DisplayParameterBinding> result = new LinkedList<DisplayParameterBinding>(displayParameterBindings.values());
+ Collections.sort(result);
+
+ return result;
}
public void initKnowing(Collection<PortalObject> children)
@@ -229,10 +248,10 @@
Collection<? extends WindowBindingInfo> windowBindingInfos = managerBean.getCoordinationService().getWindowBindings(page);
if (windowBindingInfos != null && !windowBindingInfos.isEmpty())
{
- displayParameterBindings = new ArrayList<DisplayParameterBinding>(windowBindingInfos.size());
+ displayParameterBindings = new HashMap<String, DisplayParameterBinding>(windowBindingInfos.size());
for (WindowBindingInfo wbInfo : windowBindingInfos)
{
- DisplayParameterBinding dpb = new DisplayParameterBinding();
+ DisplayParameterBinding dpb = new DisplayParameterBinding(wbInfo);
for (Map.Entry<Window, QName> entry : wbInfo.getWindows().entrySet())
{
Window paramName = entry.getKey();
@@ -241,16 +260,16 @@
dpb.getWindows().add(paramName);
if (dpb.getWindows().size() < 2)
{
- dpb.setId(wbInfo.getId());
+ dpb.setId(wbInfo.getName());
dpb.setName(paramValue);
}
}
- displayParameterBindings.add(dpb);
+ displayParameterBindings.put(dpb.getId(), dpb);
}
}
else
{
- displayParameterBindings = Collections.emptyList();
+ displayParameterBindings = Collections.emptyMap();
}
}
@@ -281,4 +300,46 @@
return null;
}
+
+ public void selectBindingForDeletion(ActionEvent event)
+ {
+ selectedForDeletionName = managerBean.getFacesParam("binding");
+ selectedForDeletionType = managerBean.getFacesParam("type");
+ }
+
+ public String deleteBinding(ActionEvent actionEvent)
+ {
+ DisplayParameterBinding displayParam = displayParameterBindings.get(selectedForDeletionName);
+
+ if (displayParam != null)
+ {
+ WindowBindingInfo bindingInfo = displayParam.getBindingInfo();
+ try
+ {
+ managerBean.getCoordinationService().removeWindowBinding(bindingInfo);
+ displayParameterBindings.remove(selectedForDeletionName);
+ }
+ catch (IllegalCoordinationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+ // reset selected values
+ selectedForDeletionName = null;
+ selectedForDeletionType = null;
+ }
+ return null;
+ }
+
+ public String renameWiring()
+ {
+ String wiring = managerBean.getFacesParam("binding");
+ DisplayParameterBinding displayParam = displayParameterBindings.get(wiring);
+ if (displayParam != null)
+ {
+ //todo: implement, rename operation should be on CoordinationConfigurator
+ }
+
+ throw new NotYetImplemented("renameWiring not yet implemented!");
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 19:26:24 UTC (rev 11751)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 20:26:54 UTC (rev 11752)
@@ -79,7 +79,15 @@
</h:column>
<h:column>
<f:facet name="header">Actions</f:facet>
- Delete | Rename
+ <h:commandLink action="#{windowCoordination.renameWiring}">
+ <h:outputText styleClass="actionRename" value="#{bundle.RENAME}"/>
+ <f:param name="binding" value="#{binding.name}"/>
+ </h:commandLink> |
+ <h:commandLink action="confirmCoordinationDeletion" actionListener="#{windowCoordination.selectBindingForDeletion}">
+ <h:outputText styleClass="actionDelete" value="#{bundle.COMMON_DELETE}"/>
+ <f:param name="binding" value="#{binding.name}"/>
+ <f:param name="type" value="parameter"/>
+ </h:commandLink>
</h:column>
</h:dataTable>
</h:form>
15 years, 8 months
JBoss Portal SVN: r11751 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/data.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-08-27 15:26:24 -0400 (Wed, 27 Aug 2008)
New Revision: 11751
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/data/default-object.xml
Log:
Fix wrong XML comment
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/data/default-object.xml 2008-08-27 17:10:13 UTC (rev 11750)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/data/default-object.xml 2008-08-27 19:26:24 UTC (rev 11751)
@@ -53,7 +53,7 @@
<value>divRenderer</value>
</property>
<!--
- | The default page name, if the property is not explicited then the default page name is "default"
+ | The default portal name, if the property is not explicited then the default portal name is "default"
-->
<property>
<name>portal.defaultObjectName</name>
15 years, 8 months
JBoss Portal SVN: r11750 - in branches/JBoss_Portal_Branch_2_7/core-admin/src: resources/portal-admin-war/WEB-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-08-27 13:10:13 -0400 (Wed, 27 Aug 2008)
New Revision: 11750
Removed:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/confirmDeleteCoordination.xhtml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editPage.xhtml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/objectNavigation.xhtml
Log:
- Erased CoordinationAction and renamed bean to coordinationManager.
Deleted: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java 2008-08-27 17:05:50 UTC (rev 11749)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CoordinationAction.java 2008-08-27 17:10:13 UTC (rev 11750)
@@ -1,984 +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.common.NotYetImplemented;
-import org.jboss.portal.common.util.ConversionException;
-import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
-import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
-import org.jboss.portal.core.controller.coordination.EventWiringInfo;
-import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
-import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
-import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectPath;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.portlet.info.EventInfo;
-import org.jboss.portal.portlet.info.EventingInfo;
-import org.jboss.portal.portlet.info.NavigationInfo;
-import org.jboss.portal.portlet.info.ParameterInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
-
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.ValueChangeEvent;
-import javax.faces.model.SelectItem;
-import javax.xml.namespace.QName;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/**
- * @author <a href="mailto:whales@redhat.com">Wesley Hales</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 777 $
- */
-public class CoordinationAction
-{
- private PortalObjectManagerBean pomb;
-
- private Map<String, String> windows;
-
- private List<String> selectedWindows;
-
- private Map<String, String> aliasBindings;
-
- private Map<String, Map<String, String>> windowBindings;
-
- private String selectedRenderParameter;
-
- private Map<String, String> availableRenderParameters;
-
- private String stringStub;
-
- private Page selectedPage;
-
- private PortalObjectId selectedObjectId;
-
- private String windowBindingName;
-
- private Map<String, DisplayEventWiring> displayEventWirings;
- private Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindowSources;
- private Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindowDestinations;
-
- private String selectedSourceEvent;
- private List<String> selectedSourceWindows;
- private String selectedDestinationEvent;
- private List<String> selectedDestinationWindows;
- private EventWiringInfoCreator currentWiring;
-
- private String selectedForDeletionName;
- private String selectedForDeletionType;
- private static final String RESOURCE_NAME = "Resource";
- private static final String COORDINATION_UNKNOWN = "COORDINATION_UNKNOWN";
- private static final String COORDINATION_WIRING = "COORDINATION_WIRING";
- private static final String COORDINATION_PARAMETER = "COORDINATION_PARAMETER";
-
- public PortalObjectId getSelectedObjectId()
- {
- //since this backing bean is in session, always check for new object request
- String id = getFacesParam("id");
- if (id != null)
- {
- selectedObjectId = parsePortalObjectId(id);
- }
- else
- {
- selectedObjectId = pomb.getSelectedObject().getId();
- }
- return selectedObjectId;
- }
-
- public void setSelectedObjectId(PortalObjectId selectedObjectId)
- {
- this.selectedObjectId = selectedObjectId;
- }
-
- public Page getSelectedPage()
- {
- PortalObject portalObject = pomb.getPortalObjectContainer().getObject(getSelectedObjectId());
- if (portalObject.getType() != PortalObject.TYPE_PAGE)
- {
- throw new IllegalArgumentException("Coordination can only be dealt with at the page level!");
- }
-
- selectedPage = (Page) portalObject;
-
- //perform surgery on portalobjectmanager
- pomb.selectObject(pomb.getPortalObjectContainer().getObject(selectedPage.getId()));
- return selectedPage;
- }
-
- public Map<String, String> getWindows()
- {
- return windows;
- }
-
- public void setWindows(Map<String, String> windows)
- {
- this.windows = windows;
- }
-
- public List<String> getSelectedWindows()
- {
- return selectedWindows;
- }
-
- public void setSelectedWindows(List<String> selectedWindows)
- {
- this.selectedWindows = selectedWindows;
- }
-
- public PortalObjectManagerBean getPomb()
- {
- return pomb;
- }
-
- public void setPomb(PortalObjectManagerBean pomb)
- {
- this.pomb = pomb;
- }
-
- public Map<String, String> getAliasBindings()
- {
- if (aliasBindings == null)
- {
- aliasBindings = new HashMap<String, String>();
- }
- return aliasBindings;
- }
-
- public void setAliasBindings(Map<String, String> aliasBindings)
- {
- this.aliasBindings = aliasBindings;
- }
-
- public Map<String, String> getAvailableRenderParameters()
- {
- return availableRenderParameters;
- }
-
- public void setAvailableRenderParameters(Map<String, String> availableRenderParameters)
- {
- this.availableRenderParameters = availableRenderParameters;
- }
-
- public Map<String, Map<String, String>> getWindowBindings()
- {
- return windowBindings;
- }
-
- public void setWindowBindings(Map<String, Map<String, String>> windowBindings)
- {
- this.windowBindings = windowBindings;
- }
-
- public String getSelectedRenderParameter()
- {
- return selectedRenderParameter;
- }
-
- public void setSelectedRenderParameter(String selectedRenderParameter)
- {
- this.selectedRenderParameter = selectedRenderParameter;
- }
-
- public String getWindowBindingName()
- {
- return windowBindingName;
- }
-
- public void setWindowBindingName(String windowBindingName)
- {
- this.windowBindingName = windowBindingName;
- }
-
- public String getStringStub()
- {
- return stringStub;
- }
-
- public void setStringStub(String stringStub)
- {
- this.stringStub = stringStub;
- }
-
- public String editCoordination() throws ConversionException
- {
- Page page = getSelectedPage();
- try
- {
- loadEventWirings(page);
- loadWindowBindings(page);
-
- //aliasbindings prep for ui
- for (AliasBindingInfo abInfo : pomb.getCoordinationService().getAliasBindings(page))
- {
- for (QName name : abInfo.getNames())
- {
- getAliasBindings().put(name.getNamespaceURI(), name.getNamespaceURI());
- }
- }
-
- // Extract metadata only on window children
- Collection<PortalObject> children = page.getChildren(PortalObject.WINDOW_MASK);
- if (!children.isEmpty())
- {
- availableRenderParameters = new LinkedHashMap<String, String>();
- this.windows = new LinkedHashMap<String, String>(children.size());
-
- for (PortalObject po : children)
- {
- Window window = (Window)po;
- this.windows.put(window.getName(), window.getId().toString(PortalObjectPath.LEGACY_BASE64_FORMAT));
- if (ContentType.PORTLET.equals(window.getContentType()))
- {
- PortletContent pc = (PortletContent)window.getContent();
- Instance instance = pomb.getInstanceContainer().getDefinition(pc.getInstanceRef());
- PortletInfo info = instance.getPortlet().getInfo();
-
- // retrieve metadata on public render parameters
- NavigationInfo navInfo = info.getNavigation();
- for (ParameterInfo pInfo : navInfo.getPublicParameters())
- {
- availableRenderParameters.put(pInfo.getName().toString(), pInfo.getName().toString());
- }
-
- // retrieve metadata on events
- EventingInfo eventingInfo = info.getEventing();
- eventNameToWindowSources = addEventInfoFor(window, eventingInfo.getProducedEvents(), eventNameToWindowSources);
- eventNameToWindowDestinations = addEventInfoFor(window, eventingInfo.getConsumedEvents(), eventNameToWindowDestinations);
- }
- }
- }
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- return "editCoordination";
- }
-
- private Map<QNameSelectItem, SortedSet<WindowSelectItem>> addEventInfoFor(Window window, Map<QName, ? extends EventInfo> windowEvents, Map<QNameSelectItem, SortedSet<WindowSelectItem>> existing)
- {
- if (windowEvents != null && !windowEvents.isEmpty())
- {
- if (existing == null)
- {
- existing = new HashMap<QNameSelectItem, SortedSet<WindowSelectItem>>();
- }
- for (QName qName : windowEvents.keySet())
- {
- QNameSelectItem item = new QNameSelectItem(qName);
- SortedSet<WindowSelectItem> windows = existing.get(item);
- if (windows == null)
- {
- windows = new TreeSet<WindowSelectItem>();
- existing.put(item, windows);
- }
- windows.add(new WindowSelectItem(window));
- }
- }
-
- return existing;
- }
-
- // JSF helper methods
-
- /**
- * Retrieves the value of the parameter which name is given.
- *
- * @param name
- * @return
- */
- public String getFacesParam(String name)
- {
- return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(name);
- }
-
- /**
- * Util: Parse PortalObjectId for given portlet object.
- *
- * @param id
- * @return
- */
- private PortalObjectId parsePortalObjectId(String id)
- {
- return PortalObjectId.parse(id, PortalObjectPath.LEGACY_BASE64_FORMAT);
- }
-
- /** Bypass the rest of the life cycle and re-display page */
- public void renderResponse()
- {
- FacesContext.getCurrentInstance().renderResponse();
- }
-
-
- // Event Wirings methods
- private void loadEventWirings(Page page)
- {
- Collection<EventWiringInfo> wiringInfos = pomb.getCoordinationService().getEventWirings(page);
- if (!wiringInfos.isEmpty())
- {
- displayEventWirings = new HashMap<String, DisplayEventWiring>(wiringInfos.size());
- for (EventWiringInfo ewInfo : wiringInfos)
- {
- displayEventWirings.put(ewInfo.getName(), new DisplayEventWiring(ewInfo));
- }
- }
- else
- {
- displayEventWirings = Collections.emptyMap();
- }
- }
-
- public boolean isExplicitEventsUsed()
- {
- boolean enabled = false;
- Page page = getSelectedPage();
- if (pomb.getCoordinationService().isEventWiringImplicitModeEnabled(page) != null)
- {
- enabled = !pomb.getCoordinationService().isEventWiringImplicitModeEnabled(page);
- }
- return enabled;
- }
-
- public void setExplicitEventsUsed(boolean usingExplicitEvents)
- {
- try
- {
- pomb.getCoordinationService().setEventWiringImplicitMode(getSelectedPage(), usingExplicitEvents);
- }
- catch (IllegalCoordinationException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-
- public void selectSourceEvent(ValueChangeEvent event)
- {
- System.out.println("selectSourceEvent");
- System.out.println("old value = " + event.getOldValue());
- System.out.println("new value = " + event.getNewValue());
- }
-
- public void selectSourceWindows(ValueChangeEvent event)
- {
- System.out.println("selectSourceWindows");
- System.out.println("old value = " + event.getOldValue());
- System.out.println("new value = " + event.getNewValue());
- }
-
- public void selectDestinationEvent(ValueChangeEvent event)
- {
- System.out.println("selectDestinationEvent");
- System.out.println("old value = " + event.getOldValue());
- System.out.println("new value = " + event.getNewValue());
- }
-
- public void selectDestinationWindows(ValueChangeEvent event)
- {
- System.out.println("selectDestinationWindows");
- System.out.println("old value = " + event.getOldValue());
- System.out.println("new value = " + event.getNewValue());
- }
-
- public Collection<DisplayEventWiring> getDisplayEventWirings()
- {
- if (displayEventWirings == null)
- {
- return Collections.emptyList();
- }
-
- List<DisplayEventWiring> result = new LinkedList<DisplayEventWiring>(displayEventWirings.values());
- Collections.sort(result);
-
- return result;
- }
-
- public List<QNameSelectItem> getSourceEvents()
- {
- // create new wiring
- currentWiring = new EventWiringInfoCreator();
-
- // return list of produced events
- return getPossibleEvents(eventNameToWindowSources);
- }
-
- public List<QNameSelectItem> getDestinationEvents()
- {
- // at this point, we have the sources selected, populate new wiring
- Map<Window, QName> sources = getMappingForWiring(selectedSourceWindows, selectedSourceEvent);
- currentWiring.setSources(sources);
-
- return getPossibleEvents(eventNameToWindowDestinations);
- }
-
- private List<QNameSelectItem> getPossibleEvents(Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindows)
- {
- if (eventNameToWindows == null)
- {
- return Collections.emptyList();
- }
-
- List<QNameSelectItem> result = new LinkedList<QNameSelectItem>();
- result.addAll(eventNameToWindows.keySet());
- Collections.sort(result);
- return result;
- }
-
- /**
- * Format selected information into something that can be used to construct a new event wiring.
- *
- * @param selectedWindows
- * @param selectedEvent
- * @return
- */
- private Map<Window, QName> getMappingForWiring(List<String> selectedWindows, String selectedEvent)
- {
- if (selectedWindows != null)
- {
- if (selectedPage == null)
- {
- throw new IllegalStateException("A page should have been selected!");
- }
-
- Map<Window, QName> windowQNameMap = new HashMap<Window, QName>(selectedWindows.size());
- for (String windowName : selectedWindows)
- {
- Window window = (Window)selectedPage.getChild(windowName);
- windowQNameMap.put(window, QName.valueOf(selectedEvent));
- }
-
- return windowQNameMap;
- }
-
- return Collections.emptyMap();
- }
-
- public List<WindowSelectItem> getSourceWindows()
- {
- return getPossibleWindows(eventNameToWindowSources, selectedSourceEvent);
- }
-
- public List<WindowSelectItem> getDestinationWindows()
- {
- return getPossibleWindows(eventNameToWindowDestinations, selectedDestinationEvent);
- }
-
- private List<WindowSelectItem> getPossibleWindows(Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindows, String selectedEventName)
- {
- if (eventNameToWindows == null)
- {
- return Collections.emptyList();
- }
-
- if (selectedEventName != null)
- {
- List<WindowSelectItem> result = new LinkedList<WindowSelectItem>();
- result.addAll(eventNameToWindows.get(new QNameSelectItem(QName.valueOf(selectedEventName))));
- Collections.sort(result);
- return result;
- }
-
- return Collections.emptyList();
- }
-
- public String getSelectedSourceEvent()
- {
- return selectedSourceEvent;
- }
-
- public void setSelectedSourceEvent(String selectedSourceEvent)
- {
- this.selectedSourceEvent = selectedSourceEvent;
- }
-
- public List<String> getSelectedSourceWindows()
- {
- return selectedSourceWindows;
- }
-
- public void setSelectedSourceWindows(List<String> selectedSourceWindows)
- {
- this.selectedSourceWindows = selectedSourceWindows;
- }
-
- public String getSelectedDestinationEvent()
- {
- return selectedDestinationEvent;
- }
-
- public void setSelectedDestinationEvent(String selectedDestinationEvent)
- {
- this.selectedDestinationEvent = selectedDestinationEvent;
- }
-
- public List<String> getSelectedDestinationWindows()
- {
- return selectedDestinationWindows;
- }
-
- public void setSelectedDestinationWindows(List<String> selectedDestinationWindows)
- {
- this.selectedDestinationWindows = selectedDestinationWindows;
- }
-
- public String getWiringName()
- {
- if (currentWiring == null)
- {
- return null;
- }
-
- return currentWiring.getName();
- }
-
- public void setWiringName(String eventWiringName)
- {
- if (currentWiring != null)
- {
- currentWiring.setName(eventWiringName);
-
- // we also now have the information to build the destinations
- Map<Window, QName> destinations = getMappingForWiring(selectedDestinationWindows, selectedDestinationEvent);
- currentWiring.setDestinations(destinations);
- }
- }
-
- public String createWiring()
- {
- if (currentWiring != null)
- {
- try
- {
- pomb.getCoordinationService().setEventWiring(currentWiring.getSources(), currentWiring.getDestinations(), currentWiring.getName());
- }
- catch (IllegalCoordinationException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- return null;
- }
-
- public String cancelWiring()
- {
- currentWiring = null;
- selectedSourceEvent = null;
- selectedSourceWindows = null;
- selectedDestinationEvent = null;
- selectedDestinationWindows = null;
-
- return null;
- }
-
- public String getSelectedForDeletionName()
- {
- return selectedForDeletionName;
- }
-
- public String getSelectedForDeletionType()
- {
- Locale locale = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
- ResourceBundle rb = ResourceBundle.getBundle(RESOURCE_NAME, locale);
- String localizationKey = COORDINATION_UNKNOWN;
- if ("wiring".equals(selectedForDeletionType))
- {
- localizationKey = COORDINATION_WIRING;
- }
- else if ("parameter".equals(selectedForDeletionType))
- {
- localizationKey = COORDINATION_PARAMETER;
- }
-
- return MessageFormat.format(rb.getString(localizationKey), null);
- }
-
- public void selectWiringForDeletion(ActionEvent event)
- {
- selectedForDeletionName = getFacesParam("wiring");
- selectedForDeletionType = getFacesParam("type");
- }
-
- public String deleteWiring(ActionEvent actionEvent)
- {
- DisplayEventWiring displayEvent = displayEventWirings.get(selectedForDeletionName);
-
- if (displayEvent != null)
- {
- EventWiringInfo event = displayEvent.getEventInfo();
- try
- {
- pomb.getCoordinationService().removeEventWiring(event);
- displayEventWirings.remove(selectedForDeletionName);
- }
- catch (IllegalCoordinationException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
-
- // reset selected values
- selectedForDeletionName = null;
- selectedForDeletionType = null;
- }
- return null;
- }
-
- public String renameWiring()
- {
- String wiring = getFacesParam("wiring");
- DisplayEventWiring displayEvent = displayEventWirings.get(wiring);
- if (displayEvent != null)
- {
- //todo: implement, rename operation should be on CoordinationConfigurator
- }
-
- throw new NotYetImplemented("renameWiring not yet implemented!");
- }
-
- public static class DisplayEventWiring implements Comparable
- {
- private Set<Window> sourceWindows;
- private Set<QName> sourceEvents;
- private Set<Window> destinationWindows;
- private Set<QName> destinationEvents;
- private EventWiringInfo eventInfo;
-
- DisplayEventWiring(EventWiringInfo eventInfo)
- {
- this.eventInfo = eventInfo;
-
- Map<Window, QName> sources = eventInfo.getSources();
- sourceWindows = new HashSet<Window>(sources.keySet());
- sourceEvents = new HashSet<QName>(sources.values());
-
- Map<Window, QName> destinations = eventInfo.getDestinations();
- destinationWindows = new HashSet<Window>(destinations.keySet());
- destinationEvents = new HashSet<QName>(destinations.values());
- }
-
- public EventWiringInfo getEventInfo()
- {
- return eventInfo;
- }
-
- public String getName()
- {
- return eventInfo.getName();
- }
-
- public Set<Window> getSourceWindows()
- {
- return sourceWindows;
- }
-
- public Set<QName> getSourceEvents()
- {
- return sourceEvents;
- }
-
- public Set<Window> getDestinationWindows()
- {
- return destinationWindows;
- }
-
- public Set<QName> getDestinationEvents()
- {
- return destinationEvents;
- }
-
- public int compareTo(Object o)
- {
- DisplayEventWiring other = (DisplayEventWiring)o;
- return getName().compareTo(other.getName());
- }
- }
-
- public static class WindowSelectItem extends SelectItem implements Comparable
- {
- public WindowSelectItem(Window window)
- {
- super(window.getName(), window.getName());
- }
-
- public int compareTo(Object o)
- {
- WindowSelectItem other = (WindowSelectItem)o;
- return getLabel().compareTo(other.getLabel());
- }
-
- @Override
- public int hashCode()
- {
- return getLabel().hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof WindowSelectItem)
- {
- return false;
- }
- WindowSelectItem item = (WindowSelectItem)obj;
- return getLabel().equals(item.getLabel());
- }
- }
-
- public static class QNameSelectItem extends SelectItem implements Comparable
- {
- public QNameSelectItem(QName qName)
- {
- super(qName, qName.toString());
- }
-
- public QName getQName()
- {
- return (QName)getValue();
- }
-
- public int compareTo(Object o)
- {
- QNameSelectItem other = (QNameSelectItem)o;
- return getQName().toString().compareTo(other.getQName().toString());
- }
-
- @Override
- public int hashCode()
- {
- return getQName().hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (!(obj instanceof QNameSelectItem))
- {
- return false;
- }
- QNameSelectItem item = (QNameSelectItem)obj;
- return getQName().equals(item.getQName());
- }
- }
-
- private static class EventWiringInfoCreator implements EventWiringInfo
- {
- private String name;
- private Map<Window, QName> sources;
- private Map<Window, QName> destinations;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public Map<Window, QName> getSources()
- {
- return sources;
- }
-
- public void setSources(Map<Window, QName> sources)
- {
- this.sources = sources;
- }
-
- public Map<Window, QName> getDestinations()
- {
- return destinations;
- }
-
- public void setDestinations(Map<Window, QName> destinations)
- {
- this.destinations = destinations;
- }
- }
-
- public static class QNameComparator implements Comparator<QName>
- {
- public int compare(QName o1, QName o2)
- {
- return o1.toString().compareTo(o2.toString());
- }
- }
-
- // Parameter Binding
- public boolean isParameterImplicitEnabled()
- {
- boolean enabled = false;
- Page page = getSelectedPage();
- if (pomb.getCoordinationService().isParameterBindingImplicitModeEnabled(page) != null)
- {
- enabled = pomb.getCoordinationService().isParameterBindingImplicitModeEnabled(page);
- }
- return enabled;
- }
-
- /**
- * Listener for implicit parameter binding checkbox
- *
- * @param event
- * @throws org.jboss.portal.core.controller.coordination.IllegalCoordinationException
- *
- */
- public void implicitParameterListener(ValueChangeEvent event) throws IllegalCoordinationException
- {
- String newValue = event.getNewValue().toString();
- pomb.getCoordinationService().setParameterBindingImplicitMode(getSelectedPage(), Boolean.parseBoolean(newValue));
- }
-
-
- public static class DisplayParameterBinding implements Comparable
- {
-
- private String id;
-
- private QName name;
-
- private List<Window> windows;
-
- public String getId()
- {
- return id;
- }
-
- public void setId(String id)
- {
- this.id = id;
- }
-
- public QName getName()
- {
- return name;
- }
-
- public void setName(QName name)
- {
- this.name = name;
- }
-
- public List<Window> getWindows()
- {
- if (windows == null)
- {
- windows = new ArrayList<Window>();
- }
- return windows;
- }
-
- public void setWindows(List<Window> windows)
- {
- this.windows = windows;
- }
-
- public int compareTo(Object o)
- {
- DisplayParameterBinding other = (DisplayParameterBinding)o;
- return id.compareTo(other.getId());
- }
- }
-
- private List<DisplayParameterBinding> displayParameterBindings;
-
- public List<DisplayParameterBinding> getDisplayParameterBindings()
- {
- return displayParameterBindings;
- }
-
- public void setDisplayParameterBindings(List<DisplayParameterBinding> displayParameterBindings)
- {
- this.displayParameterBindings = displayParameterBindings;
- }
-
- private void loadWindowBindings(Page page)
- {
- Collection<? extends WindowBindingInfo> windowBindingInfos = pomb.getCoordinationService().getWindowBindings(page);
- if (windowBindingInfos != null && !windowBindingInfos.isEmpty())
- {
- displayParameterBindings = new ArrayList<DisplayParameterBinding>(windowBindingInfos.size());
- for (WindowBindingInfo wbInfo : windowBindingInfos)
- {
- DisplayParameterBinding dpb = new DisplayParameterBinding();
- for (Map.Entry<Window,QName> entry : wbInfo.getWindows().entrySet())
- {
- Window paramName = entry.getKey();
- QName paramValue = entry.getValue();
- //quick filter for duplicate binding ids
- dpb.getWindows().add(paramName);
- if (dpb.getWindows().size() < 2)
- {
- dpb.setId(wbInfo.getId());
- dpb.setName(paramValue);
- }
- }
- displayParameterBindings.add(dpb);
- }
- }
- else
- {
- displayParameterBindings = Collections.emptyList();
- }
- }
-
- public void createWindowBinding(ActionEvent event) throws IllegalCoordinationException
- {
- Map<Window, QName> windowBinding;
- for (String window : selectedWindows)
- {
- windowBinding = new HashMap<Window, QName>();
- PortalObject portalObject = pomb.getPortalObjectContainer().getObject(parsePortalObjectId(window));
-
- if (portalObject.getType() == PortalObject.TYPE_WINDOW)
- {
- windowBinding.put((Window)portalObject, QName.valueOf(selectedRenderParameter));
- pomb.getCoordinationService().setWindowBinding(windowBindingName, windowBinding);
- }
- }
- //refresh data
- loadWindowBindings(getSelectedPage());
- }
-}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-08-27 17:05:50 UTC (rev 11749)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-08-27 17:10:13 UTC (rev 11750)
@@ -344,7 +344,7 @@
</managed-bean>
<managed-bean>
- <managed-bean-name>coordinationAction</managed-bean-name>
+ <managed-bean-name>coordinationManager</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.admin.ui.coordination.CoordinationManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/confirmDeleteCoordination.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/confirmDeleteCoordination.xhtml 2008-08-27 17:05:50 UTC (rev 11749)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/confirmDeleteCoordination.xhtml 2008-08-27 17:10:13 UTC (rev 11750)
@@ -12,31 +12,31 @@
<ui:param name="portalObjectScreen" value="#{bundle.COMMON_DELETE}"/>
<ui:define name="content">
- <f:subview rendered="#{empty coordinationAction.selectedForDeletionName}">
+ <f:subview rendered="#{empty coordinationManager.selectedForDeletionName}">
<p class="portlet-msg-error">#{bundle.COMMON_INCONSISTENT_STATE}</p>
</f:subview>
- <f:subview rendered="#{not empty coordinationAction.selectedForDeletionName}">
+ <f:subview rendered="#{not empty coordinationManager.selectedForDeletionName}">
<div class="portlet-msg">
<div class="portlet-msg-icon"><h:graphicImage url="/img/msgIcon_Warning.gif" alt="/!\"/></div>
<div class="portlet-msg-body">
- <h3>#{bundle.COMMON_DELETE}  <h:outputText value="#{coordinationAction.selectedForDeletionType}"/></h3>
+ <h3>#{bundle.COMMON_DELETE}  <h:outputText value="#{coordinationManager.selectedForDeletionType}"/></h3>
<p class="portlet-msg-alert">
#{bundle.COMMON_DELETING}
- <span class="objectName">#{coordinationAction.selectedForDeletionName}</span>
- #{coordinationAction.selectedForDeletionType} #{bundle.COMMON_FROM}
+ <span class="objectName">#{coordinationManager.selectedForDeletionName}</span>
+ #{coordinationManager.selectedForDeletionType} #{bundle.COMMON_FROM}
<c:if test="#{not empty portalobjectmgr.selectedObjectParent.name}">
<span class="objectName">#{portalobjectmgr.selectedObject.name}</span>
</c:if>
#{portalobjectmgr.selectedObject.typeName}!
</p>
- <p class="portlet-class">#{bundle.COMMON_SURE_DELETE} #{coordinationAction.selectedForDeletionType}?</p>
+ <p class="portlet-class">#{bundle.COMMON_SURE_DELETE} #{coordinationManager.selectedForDeletionType}?</p>
<h:form>
<h:commandButton value="#{bundle.COMMON_DELETE}" action="editCoordination"
- actionListener="#{coordinationAction.deleteWiring}"
+ actionListener="#{coordinationManager.deleteWiring}"
styleClass="portlet-form-button portlet-section-buttonrow">
</h:commandButton>
<h:commandButton value="#{bundle.COMMON_CANCEL}" action="editCoordination"
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 17:05:50 UTC (rev 11749)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 17:10:13 UTC (rev 11750)
@@ -10,15 +10,15 @@
<ui:define name="content">
<div class="tenpx-top-bottom">
- <h2 class="portlet-area-header">#{coordinationAction.selectedPage.name} #{bundle.COORDINATION_PARAMETER_BINDINGS}</h2>
+ <h2 class="portlet-area-header">#{coordinationManager.selectedPage.name} #{bundle.COORDINATION_PARAMETER_BINDINGS}</h2>
<h:form>
- <h:selectBooleanCheckbox id="useImplicitBinding" value="#{coordinationAction.explicitParametersUsed}"
+ <h:selectBooleanCheckbox id="useImplicitBinding" value="#{coordinationManager.explicitParametersUsed}"
onchange="this.form.submit()" immediate="true"/>
#{bundle.COORDINATION_PARAMETER_EXPLICIT_MODE}
</h:form>
- <h:panelGroup rendered="#{coordinationAction.explicitParametersUsed}">
+ <h:panelGroup rendered="#{coordinationManager.explicitParametersUsed}">
<hr/>
<!-- Create parameter binding -->
@@ -89,14 +89,14 @@
</div>
<!-- Event wirings -->
- <h2 class="portlet-area-header">#{coordinationAction.selectedPage.name} #{bundle.COORDINATION_EVENT_WIRINGS}</h2>
+ <h2 class="portlet-area-header">#{coordinationManager.selectedPage.name} #{bundle.COORDINATION_EVENT_WIRINGS}</h2>
<h:form>
- <h:selectBooleanCheckbox id="useExplicitEvents" value="#{coordinationAction.explicitEventsUsed}"
+ <h:selectBooleanCheckbox id="useExplicitEvents" value="#{coordinationManager.explicitEventsUsed}"
onchange="this.form.submit()" immediate="true"/>#{bundle.COORDINATION_EVENT_EXPLICIT_MODE}
</h:form>
- <h:panelGroup rendered="#{coordinationAction.explicitEventsUsed}">
+ <h:panelGroup rendered="#{coordinationManager.explicitEventsUsed}">
<hr/>
<!-- Create new event wiring -->
<h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_CREATE}</h3>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editPage.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editPage.xhtml 2008-08-27 17:05:50 UTC (rev 11749)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editPage.xhtml 2008-08-27 17:10:13 UTC (rev 11750)
@@ -41,7 +41,7 @@
#{bundle.DISPLAY_NAMES}
</h:commandLink>
<h:panelGroup rendered="#{'page' eq portalobjectmgr.selectedObjectType}">
- | <h:commandLink action="#{coordinationAction.editCoordination}"
+ | <h:commandLink action="#{coordinationManager.editCoordination}"
actionListener="#{portalobjectmgr.selectObject}"
styleClass="actionCoordination">
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}" />
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/objectNavigation.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/objectNavigation.xhtml 2008-08-27 17:05:50 UTC (rev 11749)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/objectNavigation.xhtml 2008-08-27 17:10:13 UTC (rev 11750)
@@ -108,7 +108,7 @@
actionListener="#{portalobjectmgr.selectObject}">
<f:param name="id" value="#{object.id}"/>
#{bundle.DISPLAY_NAMES}
- </h:commandLink> | <h:commandLink action="#{coordinationAction.editCoordination}" styleClass="actionCoordination"
+ </h:commandLink> | <h:commandLink action="#{coordinationManager.editCoordination}" styleClass="actionCoordination"
actionListener="#{portalobjectmgr.selectObject}">
<f:param name="id" value="#{object.id}"/>
#{bundle.COORDINATION_COORDINATION}
15 years, 9 months
JBoss Portal SVN: r11748 - in branches/JBoss_Portal_Branch_2_7/core-admin/src: resources/portal-admin-war/WEB-INF/classes and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-08-27 13:02:38 -0400 (Wed, 27 Aug 2008)
New Revision: 11748
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
Log:
- Implemented progressive disclosure...
- More localization.
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2008-08-27 14:21:54 UTC (rev 11747)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2008-08-27 17:02:38 UTC (rev 11748)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
+import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.instance.Instance;
@@ -137,32 +138,81 @@
this.windowManager.setManagerBean(this);
}
- public String editCoordination() throws ConversionException
+ public boolean isExplicitEventsUsed()
{
+ boolean enabled = false;
Page page = getSelectedPage();
+ Boolean implicitEvents = getCoordinationService().isEventWiringImplicitModeEnabled(page);
+ if (implicitEvents != null)
+ {
+ enabled = !implicitEvents;
+ }
+ return enabled;
+ }
+
+ public void setExplicitEventsUsed(boolean usingExplicitEvents)
+ {
try
{
- eventManager.loadEventWirings(page);
- windowManager.loadWindowBindings(page);
+ getCoordinationService().setEventWiringImplicitMode(getSelectedPage(), !usingExplicitEvents);
+ }
+ catch (IllegalCoordinationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
- // Extract metadata only on window children
- Collection<PortalObject> children = page.getChildren(PortalObject.WINDOW_MASK);
- if (!children.isEmpty())
+ public boolean isExplicitParametersUsed()
+ {
+ boolean enabled = false;
+ Page page = getSelectedPage();
+ Boolean implicitParameter = getCoordinationService().isParameterBindingImplicitModeEnabled(page);
+ if (implicitParameter != null)
+ {
+ enabled = !implicitParameter;
+ }
+ return enabled;
+ }
+
+ public void setExplicitParametersUsed(boolean usingExplicitParameters)
+ {
+ try
+ {
+ getCoordinationService().setParameterBindingImplicitMode(getSelectedPage(), !usingExplicitParameters);
+ }
+ catch (IllegalCoordinationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public String editCoordination() throws ConversionException
+ {
+ try
+ {
+ // Extract metadata only on window children and only if needed
+ if (isExplicitEventsUsed() || isExplicitParametersUsed())
{
- windowManager.initKnowing(children);
+ eventManager.loadEventWirings(selectedPage);
+ windowManager.loadWindowBindings(selectedPage);
- for (PortalObject po : children)
+ Collection<PortalObject> children = selectedPage.getChildren(PortalObject.WINDOW_MASK);
+ if (!children.isEmpty())
{
- Window window = (Window)po;
- if (ContentType.PORTLET.equals(window.getContentType()))
+ windowManager.initKnowing(children);
+
+ for (PortalObject po : children)
{
- PortletContent pc = (PortletContent)window.getContent();
- Instance instance = pomb.getInstanceContainer().getDefinition(pc.getInstanceRef());
- PortletInfo info = instance.getPortlet().getInfo();
+ Window window = (Window)po;
+ if (ContentType.PORTLET.equals(window.getContentType()))
+ {
+ PortletContent pc = (PortletContent)window.getContent();
+ Instance instance = pomb.getInstanceContainer().getDefinition(pc.getInstanceRef());
+ PortletInfo info = instance.getPortlet().getInfo();
- windowManager.extractInfoFrom(window, info);
-
- eventManager.extractInfoFrom(window, info);
+ windowManager.extractInfoFrom(window, info);
+ eventManager.extractInfoFrom(window, info);
+ }
}
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java 2008-08-27 14:21:54 UTC (rev 11747)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java 2008-08-27 17:02:38 UTC (rev 11748)
@@ -126,30 +126,6 @@
return existing;
}
- public boolean isExplicitEventsUsed()
- {
- boolean enabled = false;
- Page page = managerBean.getSelectedPage();
- Boolean implicitEvents = managerBean.getCoordinationService().isEventWiringImplicitModeEnabled(page);
- if (implicitEvents != null)
- {
- enabled = !implicitEvents;
- }
- return enabled;
- }
-
- public void setExplicitEventsUsed(boolean usingExplicitEvents)
- {
- try
- {
- managerBean.getCoordinationService().setEventWiringImplicitMode(managerBean.getSelectedPage(), usingExplicitEvents);
- }
- catch (IllegalCoordinationException e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-
public void selectSourceEvent(ValueChangeEvent event)
{
System.out.println("selectSourceEvent");
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java 2008-08-27 14:21:54 UTC (rev 11747)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java 2008-08-27 17:02:38 UTC (rev 11748)
@@ -33,8 +33,6 @@
import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.PortletInfo;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.ValueChangeEvent;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;
@@ -51,19 +49,12 @@
public class WindowBindingManagerBean
{
private CoordinationManagerBean managerBean;
-
private Map<String, String> windows;
-
private List<String> selectedWindows;
-
private Map<String, String> aliasBindings;
-
private Map<String, Map<String, String>> windowBindings;
-
private String selectedRenderParameter;
-
private Map<String, String> availableRenderParameters;
-
private String windowBindingName;
public Map<String, String> getWindows()
@@ -140,32 +131,6 @@
this.windowBindingName = windowBindingName;
}
- // Parameter Binding
- public boolean isParameterImplicitEnabled()
- {
- boolean enabled = false;
- Page page = managerBean.getSelectedPage();
- Boolean implicitParameter = managerBean.getCoordinationService().isParameterBindingImplicitModeEnabled(page);
- if (implicitParameter != null)
- {
- enabled = implicitParameter;
- }
- return enabled;
- }
-
- /**
- * Listener for implicit parameter binding checkbox
- *
- * @param event
- * @throws org.jboss.portal.core.controller.coordination.IllegalCoordinationException
- *
- */
- public void implicitParameterListener(ValueChangeEvent event) throws IllegalCoordinationException
- {
- String newValue = event.getNewValue().toString();
- managerBean.getCoordinationService().setParameterBindingImplicitMode(managerBean.getSelectedPage(), Boolean.parseBoolean(newValue));
- }
-
public void extractInfoFrom(Window window, PortletInfo info)
{
// retrieve metadata on public render parameters
@@ -174,6 +139,7 @@
{
availableRenderParameters.put(pInfo.getName().toString(), pInfo.getName().toString());
}
+
// record window information
this.windows.put(window.getName(), window.getId().toString(PortalObjectPath.LEGACY_BASE64_FORMAT));
}
@@ -186,11 +152,8 @@
public static class DisplayParameterBinding implements Comparable
{
-
private String id;
-
private QName name;
-
private List<Window> windows;
public String getId()
@@ -291,21 +254,31 @@
}
}
- public void createWindowBinding(ActionEvent event) throws IllegalCoordinationException
+ public String createBinding() throws IllegalCoordinationException
{
- Map<Window, QName> windowBinding;
- for (String window : selectedWindows)
+ if (windowBindingName != null)
{
- windowBinding = new HashMap<Window, QName>();
- PortalObject portalObject = managerBean.getPortalObjectContainer().getObject(managerBean.parsePortalObjectId(window));
-
- if (portalObject.getType() == PortalObject.TYPE_WINDOW)
+ Map<Window, QName> windowBinding = new HashMap<Window, QName>();
+ for (String window : selectedWindows)
{
- windowBinding.put((Window)portalObject, QName.valueOf(selectedRenderParameter));
- managerBean.getCoordinationService().setWindowBinding(windowBindingName, windowBinding);
+ PortalObject portalObject = managerBean.getPortalObjectContainer().getObject(managerBean.parsePortalObjectId(window));
+
+ if (portalObject.getType() == PortalObject.TYPE_WINDOW)
+ {
+ windowBinding.put((Window)portalObject, QName.valueOf(selectedRenderParameter));
+ managerBean.getCoordinationService().setWindowBinding(windowBindingName, windowBinding);
+ }
}
}
- //refresh data
- loadWindowBindings(managerBean.getSelectedPage());
+ return null;
}
+
+ public String cancelBinding()
+ {
+ selectedWindows = null;
+ windowBindingName = null;
+ selectedRenderParameter = null;
+
+ return null;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2008-08-27 14:21:54 UTC (rev 11747)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2008-08-27 17:02:38 UTC (rev 11748)
@@ -270,8 +270,13 @@
COORDINATION_COORDINATION=Coordination
COORDINATION_PARAMETER_BINDINGS=Parameter bindings
-COORDINATION_CREATE_PARAMETER_BINDING=Create new parameter binding
-COORDINATION_PARAMETER_IMPLICIT_MODE=Parameter implicit mode
+COORDINATION_PARAMETER_EXPLICIT_MODE=Use explicit parameter binding
+COORDINATION_PARAMETER_MANAGE_EXISTING=Manage existing parameter bindings:
+COORDINATION_PARAMETER_CREATE=Create new parameter binding:
+COORDINATION_PARAMETER_CREATE_STEP1=1. Select public render parameter:
+COORDINATION_PARAMETER_CREATE_STEP2=2. Select windows for parameter ''{0}'':
+COORDINATION_PARAMETER_CREATE_STEP3=3. Name binding:
+COORDINATION_PARAMETER_CREATE_CREATE=Create binding
COORDINATION_WINDOWS=Windows
COORDINATION_ALIAS_BINDINGS=Alias bindings
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 14:21:54 UTC (rev 11747)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 17:02:38 UTC (rev 11748)
@@ -12,89 +12,79 @@
<div class="tenpx-top-bottom">
<h2 class="portlet-area-header">#{coordinationAction.selectedPage.name} #{bundle.COORDINATION_PARAMETER_BINDINGS}</h2>
- <!-- Create parameter binding -->
- <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_CREATE_PARAMETER_BINDING}</h3>
-
<h:form>
- <h:selectBooleanCheckbox id="useImplicitBinding" value="#{windowCoordination.parameterImplicitEnabled}"
- onchange="this.form.submit()"
- valueChangeListener="#{windowCoordination.implicitParameterListener}"/>
- Enable #{bundle.COORDINATION_PARAMETER_IMPLICIT_MODE}
+ <h:selectBooleanCheckbox id="useImplicitBinding" value="#{coordinationAction.explicitParametersUsed}"
+ onchange="this.form.submit()" immediate="true"/>
+ #{bundle.COORDINATION_PARAMETER_EXPLICIT_MODE}
</h:form>
- <hr/>
- <h:form>
- <h:messages/>
+ <h:panelGroup rendered="#{coordinationAction.explicitParametersUsed}">
+ <hr/>
- <div class="float-left quarter-width">
- Available Render Parameter Names
- <h:selectOneListbox size="5" value="#{windowCoordination.selectedRenderParameter}">
- <f:selectItems value="#{windowCoordination.availableRenderParameters}"/>
- </h:selectOneListbox>
- </div>
-
-
- <div class="float-left quarter-width">
- #{bundle.COORDINATION_WINDOWS}
- <h:selectManyListbox size="5" value="#{windowCoordination.selectedWindows}">
- <f:selectItems value="#{windowCoordination.windows}"/>
- </h:selectManyListbox>
-
-
- </div>
-
- <div class="float-left quarter-width">
- <h:inputText value="#{windowCoordination.windowBindingName}"/>
- </div>
-
- <h:commandButton actionListener="#{windowCoordination.createWindowBinding}" value="Create Binding"/>
- <br class="clear"/>
-
- </h:form>
- <!-- Manage existing parameter bindings -->
- <h3 class="sectionTitle tenpx-top-bottom">Manage Existing Parameter Bindings</h3>
-
- <div class="float-left full-width">
+ <!-- Create parameter binding -->
+ <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_PARAMETER_CREATE}</h3>
<h:form>
- <h:dataTable var="binding" value="#{windowCoordination.displayParameterBindings}"
- rendered="true"
- styleClass="objectList datatable"
- rowClasses="portlet-section-body,portlet-section-alternate-blue"
- columnClasses="objectNameColumn"
- headerClass="portlet-section-header">
- <h:column>
- <f:facet name="header">
- Binding Name
- </f:facet>
- #{binding.id}
- </h:column>
- <h:column>
- <f:facet name="header">
- Original QName
- </f:facet>
- #{binding.name}
- </h:column>
- <h:column>
- <f:facet name="header">
- Target Windows
- </f:facet>
- <ui:repeat var="window" value="#{binding.windows}">
- #{window.name},
- </ui:repeat>
+ <div class="float-left quarter-width">
+ #{bundle.COORDINATION_PARAMETER_CREATE_STEP1}
+ <h:selectOneListbox id="parameter" size="5" value="#{windowCoordination.selectedRenderParameter}"
+ immediate="true" onchange="this.form.submit()">
+ <f:selectItems value="#{windowCoordination.availableRenderParameters}"/>
+ </h:selectOneListbox>
+ </div>
- </h:column>
+ <h:panelGroup rendered="#{!empty windowCoordination.selectedRenderParameter}">
+ <div class="float-left quarter-width">
+ #{bundle.COORDINATION_PARAMETER_CREATE_STEP2}
+ <h:selectManyListbox id="windows" size="5" value="#{windowCoordination.selectedWindows}"
+ immediate="true" onchange="this.form.submit()">
+ <f:selectItems value="#{windowCoordination.windows}"/>
+ </h:selectManyListbox>
+ </div>
+ </h:panelGroup>
- <h:column>
- <f:facet name="header">
- Actions
- </f:facet>
- Delete | Rename
+ <h:panelGroup rendered="#{!empty windowCoordination.selectedWindows}">
+ <div class="float-left quarter-width">
+ #{bundle.COORDINATION_PARAMETER_CREATE_STEP3}
+ <h:inputText id="bindingName" value="#{windowCoordination.windowBindingName}"/>
+ <h:commandButton value="#{bundle.COORDINATION_PARAMETER_CREATE_CREATE}"
+ action="#{eventCoordination.createBinding}" styleClass="portlet-form-button"/>
+ <h:commandButton value="#{bundle.COMMON_CANCEL}" action="#{eventCoordination.cancelBinding}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </h:panelGroup>
- </h:column>
- </h:dataTable>
+ <br class="clear"/>
</h:form>
- </div>
+ <!-- Manage existing parameter bindings -->
+ <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_PARAMETER_MANAGE_EXISTING}</h3>
+ <div class="float-left full-width">
+ <h:form>
+ <h:dataTable var="binding" value="#{windowCoordination.displayParameterBindings}"
+ rendered="true" styleClass="objectList datatable"
+ rowClasses="portlet-section-body,portlet-section-alternate-blue"
+ columnClasses="objectNameColumn"
+ headerClass="portlet-section-header">
+ <h:column>
+ <f:facet name="header">Binding Name</f:facet>
+ #{binding.id}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Original QName</f:facet>
+ #{binding.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Target Windows</f:facet>
+ <ui:repeat var="window" value="#{binding.windows}">#{window.name},</ui:repeat>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Actions</f:facet>
+ Delete | Rename
+ </h:column>
+ </h:dataTable>
+ </h:form>
+ </div>
+ </h:panelGroup>
<br class="clear"/>
</div>
@@ -102,115 +92,114 @@
<h2 class="portlet-area-header">#{coordinationAction.selectedPage.name} #{bundle.COORDINATION_EVENT_WIRINGS}</h2>
<h:form>
-
- <h:selectBooleanCheckbox id="useExplicitEvents" value="#{eventCoordination.explicitEventsUsed}"
+ <h:selectBooleanCheckbox id="useExplicitEvents" value="#{coordinationAction.explicitEventsUsed}"
onchange="this.form.submit()" immediate="true"/>#{bundle.COORDINATION_EVENT_EXPLICIT_MODE}
-
</h:form>
- <!-- Create new event wiring -->
- <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_CREATE}</h3>
- <h:form>
- <h:panelGroup>
- #{bundle.COORDINATION_EVENT_CREATE_STEP1}
- <h:selectOneListbox id="sourceEvent" size="5" value="#{eventCoordination.selectedSourceEvent}" immediate="true"
- valueChangeListener="#{eventCoordination.selectSourceEvent}" onchange="this.form.submit()">
- <f:selectItems value="#{eventCoordination.sourceEvents}"/>
- </h:selectOneListbox>
- </h:panelGroup>
+ <h:panelGroup rendered="#{coordinationAction.explicitEventsUsed}">
+ <hr/>
+ <!-- Create new event wiring -->
+ <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_CREATE}</h3>
+ <h:form>
+ <h:panelGroup>
+ #{bundle.COORDINATION_EVENT_CREATE_STEP1}
+ <h:selectOneListbox id="sourceEvent" size="5" value="#{eventCoordination.selectedSourceEvent}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectSourceEvent}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.sourceEvents}"/>
+ </h:selectOneListbox>
+ </h:panelGroup>
- <h:panelGroup rendered="#{!empty eventCoordination.selectedSourceEvent}">
- #{bundle.COORDINATION_EVENT_CREATE_STEP2}
- <h:selectManyListbox id="sourceWindows" size="5" value="#{eventCoordination.selectedSourceWindows}" immediate="true"
- valueChangeListener="#{eventCoordination.selectSourceWindows}" onchange="this.form.submit()">
- <f:selectItems value="#{eventCoordination.sourceWindows}"/>
- </h:selectManyListbox>
- </h:panelGroup>
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedSourceEvent}">
+ #{bundle.COORDINATION_EVENT_CREATE_STEP2}
+ <h:selectManyListbox id="sourceWindows" size="5" value="#{eventCoordination.selectedSourceWindows}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectSourceWindows}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.sourceWindows}"/>
+ </h:selectManyListbox>
+ </h:panelGroup>
- <h:panelGroup rendered="#{!empty eventCoordination.selectedSourceWindows}">
- #{bundle.COORDINATION_EVENT_CREATE_STEP3}
- <h:selectOneListbox id="destEvent" size="5" value="#{eventCoordination.selectedDestinationEvent}" immediate="true"
- valueChangeListener="#{eventCoordination.selectDestinationEvent}" onchange="this.form.submit()">
- <f:selectItems value="#{eventCoordination.destinationEvents}"/>
- </h:selectOneListbox>
- </h:panelGroup>
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedSourceWindows}">
+ #{bundle.COORDINATION_EVENT_CREATE_STEP3}
+ <h:selectOneListbox id="destEvent" size="5" value="#{eventCoordination.selectedDestinationEvent}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectDestinationEvent}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.destinationEvents}"/>
+ </h:selectOneListbox>
+ </h:panelGroup>
- <h:panelGroup rendered="#{!empty eventCoordination.selectedDestinationEvent}">
- #{bundle.COORDINATION_EVENT_CREATE_STEP4}
- <h:selectManyListbox id="destWindows" size="5" value="#{eventCoordination.selectedDestinationWindows}" immediate="true"
- valueChangeListener="#{eventCoordination.selectDestinationWindows}" onchange="this.form.submit()">
- <f:selectItems value="#{eventCoordination.destinationWindows}"/>
- </h:selectManyListbox>
- </h:panelGroup>
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedDestinationEvent}">
+ #{bundle.COORDINATION_EVENT_CREATE_STEP4}
+ <h:selectManyListbox id="destWindows" size="5" value="#{eventCoordination.selectedDestinationWindows}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectDestinationWindows}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.destinationWindows}"/>
+ </h:selectManyListbox>
+ </h:panelGroup>
- <h:panelGroup rendered="#{!empty eventCoordination.selectedDestinationWindows}">
- #{bundle.COORDINATION_EVENT_CREATE_STEP5}
- <h:inputText id="wiringName" value="#{eventCoordination.wiringName}"/>
- <h:commandButton value="#{bundle.COORDINATION_EVENT_CREATE_CREATE}" action="#{eventCoordination.createWiring}"
- styleClass="portlet-form-button"/>
- <h:commandButton value="#{bundle.COMMON_CANCEL}" action="#{eventCoordination.cancelWiring}"
- styleClass="portlet-form-button"/>
- </h:panelGroup>
- </h:form>
- <hr/>
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedDestinationWindows}">
+ #{bundle.COORDINATION_EVENT_CREATE_STEP5}
+ <h:inputText id="wiringName" value="#{eventCoordination.wiringName}"/>
+ <h:commandButton value="#{bundle.COORDINATION_EVENT_CREATE_CREATE}" action="#{eventCoordination.createWiring}"
+ styleClass="portlet-form-button"/>
+ <h:commandButton value="#{bundle.COMMON_CANCEL}" action="#{eventCoordination.cancelWiring}"
+ styleClass="portlet-form-button"/>
+ </h:panelGroup>
+ </h:form>
+ <hr/>
- <!-- Manage existing wirings -->
- <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_MANAGE_EXISTING}</h3>
- <h:form>
- <h:dataTable var="wiring" value="#{eventCoordination.displayEventWirings}"
- rendered="true"
- styleClass="objectList datatable"
- rowClasses="portlet-section-body,portlet-section-alternate-blue"
- columnClasses="objectNameColumn, objectActionColumn"
- headerClass="portlet-section-header">
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_NAME}"/>
- </f:facet>
- #{wiring.name}
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_WINDOWS}"/>
- </f:facet>
- #{wiring.sourceWindows}
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_EVENTS}"/>
- </f:facet>
- #{wiring.sourceEvents}
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_EVENTS}"/>
- </f:facet>
- #{wiring.destinationEvents}
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_WINDOWS}"/>
- </f:facet>
- #{wiring.destinationWindows}
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_ACTIONS}"/>
- </f:facet>
+ <!-- Manage existing wirings -->
+ <h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_MANAGE_EXISTING}</h3>
+ <h:form>
+ <h:dataTable var="wiring" value="#{eventCoordination.displayEventWirings}"
+ rendered="true"
+ styleClass="objectList datatable"
+ rowClasses="portlet-section-body,portlet-section-alternate-blue"
+ columnClasses="objectNameColumn, objectActionColumn"
+ headerClass="portlet-section-header">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_NAME}"/>
+ </f:facet>
+ #{wiring.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_WINDOWS}"/>
+ </f:facet>
+ #{wiring.sourceWindows}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_EVENTS}"/>
+ </f:facet>
+ #{wiring.sourceEvents}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_EVENTS}"/>
+ </f:facet>
+ #{wiring.destinationEvents}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_WINDOWS}"/>
+ </f:facet>
+ #{wiring.destinationWindows}
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_ACTIONS}"/>
+ </f:facet>
- <h:commandLink action="#{eventCoordination.renameWiring}">
- <h:outputText styleClass="actionRename" value="#{bundle.RENAME}"/>
- <f:param name="wiring" value="#{wiring.name}"/>
- </h:commandLink> |
- <h:commandLink action="confirmCoordinationDeletion" actionListener="#{eventCoordination.selectWiringForDeletion}">
- <h:outputText styleClass="actionDelete" value="#{bundle.COMMON_DELETE}"/>
- <f:param name="wiring" value="#{wiring.name}"/>
- <f:param name="type" value="wiring"/>
- </h:commandLink>
- </h:column>
- </h:dataTable>
- </h:form>
-
-
+ <h:commandLink action="#{eventCoordination.renameWiring}">
+ <h:outputText styleClass="actionRename" value="#{bundle.RENAME}"/>
+ <f:param name="wiring" value="#{wiring.name}"/>
+ </h:commandLink> |
+ <h:commandLink action="confirmCoordinationDeletion" actionListener="#{eventCoordination.selectWiringForDeletion}">
+ <h:outputText styleClass="actionDelete" value="#{bundle.COMMON_DELETE}"/>
+ <f:param name="wiring" value="#{wiring.name}"/>
+ <f:param name="type" value="wiring"/>
+ </h:commandLink>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+ </h:panelGroup>
</ui:define>
</ui:composition>
15 years, 9 months
JBoss Portal SVN: r11747 - in modules/web/trunk/web/src: main/java/org/jboss/portal/web/impl/tomcat and 1 other directories.
by portal-commits@lists.jboss.org
Author: mwringe
Date: 2008-08-27 10:21:54 -0400 (Wed, 27 Aug 2008)
New Revision: 11747
Removed:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/jboss/
Modified:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java
modules/web/trunk/web/src/test/resources/support/jboss-5.0-container-servlet/server-war/WEB-INF/web.xml
Log:
Update JBoss AS5 support to not require changes to StandardHost.startChildren.
Modified: modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java
===================================================================
--- modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java 2008-08-27 12:34:31 UTC (rev 11746)
+++ modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/tomcat/TC6ServletContainerContext.java 2008-08-27 14:21:54 UTC (rev 11747)
@@ -146,7 +146,7 @@
}
}
- protected void start()
+ void start()
{
DefaultServletContainerFactory.registerContext(this);
@@ -165,7 +165,7 @@
engine.addContainerListener(this);
}
- protected void stop()
+ void stop()
{
engine.removeContainerListener(this);
Modified: modules/web/trunk/web/src/test/resources/support/jboss-5.0-container-servlet/server-war/WEB-INF/web.xml
===================================================================
--- modules/web/trunk/web/src/test/resources/support/jboss-5.0-container-servlet/server-war/WEB-INF/web.xml 2008-08-27 12:34:31 UTC (rev 11746)
+++ modules/web/trunk/web/src/test/resources/support/jboss-5.0-container-servlet/server-war/WEB-INF/web.xml 2008-08-27 14:21:54 UTC (rev 11747)
@@ -39,7 +39,7 @@
</listener>
<servlet>
<servlet-name>ContainerServlet</servlet-name>
- <servlet-class>org.jboss.portal.web.impl.jboss.JB5ContainerServlet</servlet-class>
+ <servlet-class>org.jboss.portal.web.impl.tomcat.TC6ContainerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
15 years, 9 months
JBoss Portal SVN: r11746 - in branches/JBoss_Portal_Branch_2_7/core-admin/src: main/org/jboss/portal/core/admin/ui/coordination and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-08-27 08:34:31 -0400 (Wed, 27 Aug 2008)
New Revision: 11746
Added:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
Log:
- Re-organized coordination beans (will remove CoordinationAction later).
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2008-08-27 12:34:31 UTC (rev 11746)
@@ -0,0 +1,208 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.coordination;
+
+import org.jboss.portal.common.util.ConversionException;
+import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
+import org.jboss.portal.core.controller.coordination.CoordinationConfigurator;
+import org.jboss.portal.core.impl.model.content.portlet.PortletContent;
+import org.jboss.portal.core.model.content.ContentType;
+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.PortalObjectPath;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+import javax.faces.context.FacesContext;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class CoordinationManagerBean
+{
+ private PortalObjectManagerBean pomb;
+
+ private Page selectedPage;
+
+ private PortalObjectId selectedObjectId;
+
+ private EventWiringManagerBean eventManager;
+ private WindowBindingManagerBean windowManager;
+
+ public PortalObjectId getSelectedObjectId()
+ {
+ //since this backing bean is in session, always check for new object request
+ String id = getFacesParam("id");
+ if (id != null)
+ {
+ selectedObjectId = parsePortalObjectId(id);
+ }
+ else
+ {
+ selectedObjectId = pomb.getSelectedObject().getId();
+ }
+ return selectedObjectId;
+ }
+
+ public void setSelectedObjectId(PortalObjectId selectedObjectId)
+ {
+ this.selectedObjectId = selectedObjectId;
+ }
+
+ public Page getSelectedPage()
+ {
+ PortalObject portalObject = pomb.getPortalObjectContainer().getObject(getSelectedObjectId());
+ if (portalObject.getType() != PortalObject.TYPE_PAGE)
+ {
+ throw new IllegalArgumentException("Coordination can only be dealt with at the page level!");
+ }
+
+ selectedPage = (Page)portalObject;
+
+ //perform surgery on portalobjectmanager
+ pomb.selectObject(pomb.getPortalObjectContainer().getObject(selectedPage.getId()));
+ return selectedPage;
+ }
+
+ public PortalObjectManagerBean getPomb()
+ {
+ return pomb;
+ }
+
+ public void setPomb(PortalObjectManagerBean pomb)
+ {
+ this.pomb = pomb;
+ }
+
+ public InstanceContainer getInstanceContainer()
+ {
+ return pomb.getInstanceContainer();
+ }
+
+ public CoordinationConfigurator getCoordinationService()
+ {
+ return pomb.getCoordinationService();
+ }
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return pomb.getPortalObjectContainer();
+ }
+
+ public EventWiringManagerBean getEventManager()
+ {
+ return eventManager;
+ }
+
+ public void setEventManager(EventWiringManagerBean eventManager)
+ {
+ this.eventManager = eventManager;
+ this.eventManager.setManagerBean(this);
+ }
+
+ public WindowBindingManagerBean getWindowManager()
+ {
+ return windowManager;
+ }
+
+ public void setWindowManager(WindowBindingManagerBean windowManager)
+ {
+ this.windowManager = windowManager;
+ this.windowManager.setManagerBean(this);
+ }
+
+ public String editCoordination() throws ConversionException
+ {
+ Page page = getSelectedPage();
+ try
+ {
+ eventManager.loadEventWirings(page);
+ windowManager.loadWindowBindings(page);
+
+ // Extract metadata only on window children
+ Collection<PortalObject> children = page.getChildren(PortalObject.WINDOW_MASK);
+ if (!children.isEmpty())
+ {
+ windowManager.initKnowing(children);
+
+ for (PortalObject po : children)
+ {
+ Window window = (Window)po;
+ if (ContentType.PORTLET.equals(window.getContentType()))
+ {
+ PortletContent pc = (PortletContent)window.getContent();
+ Instance instance = pomb.getInstanceContainer().getDefinition(pc.getInstanceRef());
+ PortletInfo info = instance.getPortlet().getInfo();
+
+ windowManager.extractInfoFrom(window, info);
+
+ eventManager.extractInfoFrom(window, info);
+ }
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return "editCoordination";
+ }
+
+ // JSF helper methods
+
+ /**
+ * Retrieves the value of the parameter which name is given.
+ *
+ * @param name
+ * @return
+ */
+ public String getFacesParam(String name)
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(name);
+ }
+
+ /**
+ * Util: Parse PortalObjectId for given portlet object.
+ *
+ * @param id
+ * @return
+ */
+ PortalObjectId parsePortalObjectId(String id)
+ {
+ return PortalObjectId.parse(id, PortalObjectPath.LEGACY_BASE64_FORMAT);
+ }
+
+ /** Bypass the rest of the life cycle and re-display page */
+ public void renderResponse()
+ {
+ FacesContext.getCurrentInstance().renderResponse();
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/EventWiringManagerBean.java 2008-08-27 12:34:31 UTC (rev 11746)
@@ -0,0 +1,605 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.coordination;
+
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.core.controller.coordination.EventWiringInfo;
+import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.info.EventInfo;
+import org.jboss.portal.portlet.info.EventingInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+import javax.xml.namespace.QName;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class EventWiringManagerBean
+{
+ private CoordinationManagerBean managerBean;
+
+ private Map<String, DisplayEventWiring> displayEventWirings;
+ private Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindowSources;
+ private Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindowDestinations;
+
+ private String selectedSourceEvent;
+ private List<String> selectedSourceWindows;
+ private String selectedDestinationEvent;
+ private List<String> selectedDestinationWindows;
+ private EventWiringInfoCreator currentWiring;
+
+ private String selectedForDeletionName;
+ private String selectedForDeletionType;
+ private static final String RESOURCE_NAME = "Resource";
+ private static final String COORDINATION_UNKNOWN = "COORDINATION_UNKNOWN";
+ private static final String COORDINATION_WIRING = "COORDINATION_WIRING";
+ private static final String COORDINATION_PARAMETER = "COORDINATION_PARAMETER";
+
+ public CoordinationManagerBean getManagerBean()
+ {
+ return managerBean;
+ }
+
+ public void setManagerBean(CoordinationManagerBean managerBean)
+ {
+ this.managerBean = managerBean;
+ }
+
+ public void loadEventWirings(Page page)
+ {
+ Collection<EventWiringInfo> wiringInfos = managerBean.getCoordinationService().getEventWirings(page);
+ if (!wiringInfos.isEmpty())
+ {
+ displayEventWirings = new HashMap<String, DisplayEventWiring>(wiringInfos.size());
+ for (EventWiringInfo ewInfo : wiringInfos)
+ {
+ displayEventWirings.put(ewInfo.getName(), new DisplayEventWiring(ewInfo));
+ }
+ }
+ else
+ {
+ displayEventWirings = Collections.emptyMap();
+ }
+ }
+
+ private Map<QNameSelectItem, SortedSet<WindowSelectItem>> addEventInfoFor(Window window, Map<QName, ? extends EventInfo> windowEvents, Map<QNameSelectItem, SortedSet<WindowSelectItem>> existing)
+ {
+ if (windowEvents != null && !windowEvents.isEmpty())
+ {
+ if (existing == null)
+ {
+ existing = new HashMap<QNameSelectItem, SortedSet<WindowSelectItem>>();
+ }
+ for (QName qName : windowEvents.keySet())
+ {
+ QNameSelectItem item = new QNameSelectItem(qName);
+ SortedSet<WindowSelectItem> windows = existing.get(item);
+ if (windows == null)
+ {
+ windows = new TreeSet<WindowSelectItem>();
+ existing.put(item, windows);
+ }
+ windows.add(new WindowSelectItem(window));
+ }
+ }
+
+ return existing;
+ }
+
+ public boolean isExplicitEventsUsed()
+ {
+ boolean enabled = false;
+ Page page = managerBean.getSelectedPage();
+ Boolean implicitEvents = managerBean.getCoordinationService().isEventWiringImplicitModeEnabled(page);
+ if (implicitEvents != null)
+ {
+ enabled = !implicitEvents;
+ }
+ return enabled;
+ }
+
+ public void setExplicitEventsUsed(boolean usingExplicitEvents)
+ {
+ try
+ {
+ managerBean.getCoordinationService().setEventWiringImplicitMode(managerBean.getSelectedPage(), usingExplicitEvents);
+ }
+ catch (IllegalCoordinationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public void selectSourceEvent(ValueChangeEvent event)
+ {
+ System.out.println("selectSourceEvent");
+ System.out.println("old value = " + event.getOldValue());
+ System.out.println("new value = " + event.getNewValue());
+ }
+
+ public void selectSourceWindows(ValueChangeEvent event)
+ {
+ System.out.println("selectSourceWindows");
+ System.out.println("old value = " + event.getOldValue());
+ System.out.println("new value = " + event.getNewValue());
+ }
+
+ public void selectDestinationEvent(ValueChangeEvent event)
+ {
+ System.out.println("selectDestinationEvent");
+ System.out.println("old value = " + event.getOldValue());
+ System.out.println("new value = " + event.getNewValue());
+ }
+
+ public void selectDestinationWindows(ValueChangeEvent event)
+ {
+ System.out.println("selectDestinationWindows");
+ System.out.println("old value = " + event.getOldValue());
+ System.out.println("new value = " + event.getNewValue());
+ }
+
+ public Collection<DisplayEventWiring> getDisplayEventWirings()
+ {
+ if (displayEventWirings == null)
+ {
+ return Collections.emptyList();
+ }
+
+ List<DisplayEventWiring> result = new LinkedList<DisplayEventWiring>(displayEventWirings.values());
+ Collections.sort(result);
+
+ return result;
+ }
+
+ public List<QNameSelectItem> getSourceEvents()
+ {
+ // create new wiring
+ currentWiring = new EventWiringInfoCreator();
+
+ // return list of produced events
+ return getPossibleEvents(eventNameToWindowSources);
+ }
+
+ public List<QNameSelectItem> getDestinationEvents()
+ {
+ // at this point, we have the sources selected, populate new wiring
+ Map<Window, QName> sources = getMappingForWiring(selectedSourceWindows, selectedSourceEvent);
+ currentWiring.setSources(sources);
+
+ return getPossibleEvents(eventNameToWindowDestinations);
+ }
+
+ private List<QNameSelectItem> getPossibleEvents(Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindows)
+ {
+ if (eventNameToWindows == null)
+ {
+ return Collections.emptyList();
+ }
+
+ List<QNameSelectItem> result = new LinkedList<QNameSelectItem>();
+ result.addAll(eventNameToWindows.keySet());
+ Collections.sort(result);
+ return result;
+ }
+
+ /**
+ * Format selected information into something that can be used to construct a new event wiring.
+ *
+ * @param selectedWindows
+ * @param selectedEvent
+ * @return
+ */
+ private Map<Window, QName> getMappingForWiring(List<String> selectedWindows, String selectedEvent)
+ {
+ if (selectedWindows != null)
+ {
+ Page selectedPage = managerBean.getSelectedPage();
+ if (selectedPage == null)
+ {
+ throw new IllegalStateException("A page should have been selected!");
+ }
+
+ Map<Window, QName> windowQNameMap = new HashMap<Window, QName>(selectedWindows.size());
+ for (String windowName : selectedWindows)
+ {
+ Window window = (Window)selectedPage.getChild(windowName);
+ windowQNameMap.put(window, QName.valueOf(selectedEvent));
+ }
+
+ return windowQNameMap;
+ }
+
+ return Collections.emptyMap();
+ }
+
+ public List<WindowSelectItem> getSourceWindows()
+ {
+ return getPossibleWindows(eventNameToWindowSources, selectedSourceEvent);
+ }
+
+ public List<WindowSelectItem> getDestinationWindows()
+ {
+ return getPossibleWindows(eventNameToWindowDestinations, selectedDestinationEvent);
+ }
+
+ private List<WindowSelectItem> getPossibleWindows(Map<QNameSelectItem, SortedSet<WindowSelectItem>> eventNameToWindows, String selectedEventName)
+ {
+ if (eventNameToWindows == null)
+ {
+ return Collections.emptyList();
+ }
+
+ if (selectedEventName != null)
+ {
+ List<WindowSelectItem> result = new LinkedList<WindowSelectItem>();
+ result.addAll(eventNameToWindows.get(new QNameSelectItem(QName.valueOf(selectedEventName))));
+ Collections.sort(result);
+ return result;
+ }
+
+ return Collections.emptyList();
+ }
+
+ public String getSelectedSourceEvent()
+ {
+ return selectedSourceEvent;
+ }
+
+ public void setSelectedSourceEvent(String selectedSourceEvent)
+ {
+ this.selectedSourceEvent = selectedSourceEvent;
+ }
+
+ public List<String> getSelectedSourceWindows()
+ {
+ return selectedSourceWindows;
+ }
+
+ public void setSelectedSourceWindows(List<String> selectedSourceWindows)
+ {
+ this.selectedSourceWindows = selectedSourceWindows;
+ }
+
+ public String getSelectedDestinationEvent()
+ {
+ return selectedDestinationEvent;
+ }
+
+ public void setSelectedDestinationEvent(String selectedDestinationEvent)
+ {
+ this.selectedDestinationEvent = selectedDestinationEvent;
+ }
+
+ public List<String> getSelectedDestinationWindows()
+ {
+ return selectedDestinationWindows;
+ }
+
+ public void setSelectedDestinationWindows(List<String> selectedDestinationWindows)
+ {
+ this.selectedDestinationWindows = selectedDestinationWindows;
+ }
+
+ public String getWiringName()
+ {
+ if (currentWiring == null)
+ {
+ return null;
+ }
+
+ return currentWiring.getName();
+ }
+
+ public void setWiringName(String eventWiringName)
+ {
+ if (currentWiring != null)
+ {
+ currentWiring.setName(eventWiringName);
+
+ // we also now have the information to build the destinations
+ Map<Window, QName> destinations = getMappingForWiring(selectedDestinationWindows, selectedDestinationEvent);
+ currentWiring.setDestinations(destinations);
+ }
+ }
+
+ public String createWiring()
+ {
+ if (currentWiring != null)
+ {
+ try
+ {
+ managerBean.getCoordinationService().setEventWiring(currentWiring.getSources(), currentWiring.getDestinations(), currentWiring.getName());
+ }
+ catch (IllegalCoordinationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ return null;
+ }
+
+ public String cancelWiring()
+ {
+ currentWiring = null;
+ selectedSourceEvent = null;
+ selectedSourceWindows = null;
+ selectedDestinationEvent = null;
+ selectedDestinationWindows = null;
+
+ return null;
+ }
+
+ public String getSelectedForDeletionName()
+ {
+ return selectedForDeletionName;
+ }
+
+ public String getSelectedForDeletionType()
+ {
+ Locale locale = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ ResourceBundle rb = ResourceBundle.getBundle(RESOURCE_NAME, locale);
+ String localizationKey = COORDINATION_UNKNOWN;
+ if ("wiring".equals(selectedForDeletionType))
+ {
+ localizationKey = COORDINATION_WIRING;
+ }
+ else if ("parameter".equals(selectedForDeletionType))
+ {
+ localizationKey = COORDINATION_PARAMETER;
+ }
+
+ return MessageFormat.format(rb.getString(localizationKey), null);
+ }
+
+ public void selectWiringForDeletion(ActionEvent event)
+ {
+ selectedForDeletionName = managerBean.getFacesParam("wiring");
+ selectedForDeletionType = managerBean.getFacesParam("type");
+ }
+
+ public String deleteWiring(ActionEvent actionEvent)
+ {
+ DisplayEventWiring displayEvent = displayEventWirings.get(selectedForDeletionName);
+
+ if (displayEvent != null)
+ {
+ EventWiringInfo event = displayEvent.getEventInfo();
+ try
+ {
+ managerBean.getCoordinationService().removeEventWiring(event);
+ displayEventWirings.remove(selectedForDeletionName);
+ }
+ catch (IllegalCoordinationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+ // reset selected values
+ selectedForDeletionName = null;
+ selectedForDeletionType = null;
+ }
+ return null;
+ }
+
+ public String renameWiring()
+ {
+ String wiring = managerBean.getFacesParam("wiring");
+ DisplayEventWiring displayEvent = displayEventWirings.get(wiring);
+ if (displayEvent != null)
+ {
+ //todo: implement, rename operation should be on CoordinationConfigurator
+ }
+
+ throw new NotYetImplemented("renameWiring not yet implemented!");
+ }
+
+ public void extractInfoFrom(Window window, PortletInfo info)
+ {
+ // retrieve metadata on events
+ EventingInfo eventingInfo = info.getEventing();
+ eventNameToWindowSources = addEventInfoFor(window, eventingInfo.getProducedEvents(), eventNameToWindowSources);
+ eventNameToWindowDestinations = addEventInfoFor(window, eventingInfo.getConsumedEvents(), eventNameToWindowDestinations);
+ }
+
+ public static class DisplayEventWiring implements Comparable
+ {
+ private Set<Window> sourceWindows;
+ private Set<QName> sourceEvents;
+ private Set<Window> destinationWindows;
+ private Set<QName> destinationEvents;
+ private EventWiringInfo eventInfo;
+
+ DisplayEventWiring(EventWiringInfo eventInfo)
+ {
+ this.eventInfo = eventInfo;
+
+ Map<Window, QName> sources = eventInfo.getSources();
+ sourceWindows = new HashSet<Window>(sources.keySet());
+ sourceEvents = new HashSet<QName>(sources.values());
+
+ Map<Window, QName> destinations = eventInfo.getDestinations();
+ destinationWindows = new HashSet<Window>(destinations.keySet());
+ destinationEvents = new HashSet<QName>(destinations.values());
+ }
+
+ public EventWiringInfo getEventInfo()
+ {
+ return eventInfo;
+ }
+
+ public String getName()
+ {
+ return eventInfo.getName();
+ }
+
+ public Set<Window> getSourceWindows()
+ {
+ return sourceWindows;
+ }
+
+ public Set<QName> getSourceEvents()
+ {
+ return sourceEvents;
+ }
+
+ public Set<Window> getDestinationWindows()
+ {
+ return destinationWindows;
+ }
+
+ public Set<QName> getDestinationEvents()
+ {
+ return destinationEvents;
+ }
+
+ public int compareTo(Object o)
+ {
+ DisplayEventWiring other = (DisplayEventWiring)o;
+ return getName().compareTo(other.getName());
+ }
+ }
+
+ public static class WindowSelectItem extends SelectItem implements Comparable
+ {
+ public WindowSelectItem(Window window)
+ {
+ super(window.getName(), window.getName());
+ }
+
+ public int compareTo(Object o)
+ {
+ WindowSelectItem other = (WindowSelectItem)o;
+ return getLabel().compareTo(other.getLabel());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getLabel().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof WindowSelectItem)
+ {
+ return false;
+ }
+ WindowSelectItem item = (WindowSelectItem)obj;
+ return getLabel().equals(item.getLabel());
+ }
+ }
+
+ public static class QNameSelectItem extends SelectItem implements Comparable
+ {
+ public QNameSelectItem(QName qName)
+ {
+ super(qName, qName.toString());
+ }
+
+ public QName getQName()
+ {
+ return (QName)getValue();
+ }
+
+ public int compareTo(Object o)
+ {
+ QNameSelectItem other = (QNameSelectItem)o;
+ return getQName().toString().compareTo(other.getQName().toString());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getQName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof QNameSelectItem))
+ {
+ return false;
+ }
+ QNameSelectItem item = (QNameSelectItem)obj;
+ return getQName().equals(item.getQName());
+ }
+ }
+
+ private static class EventWiringInfoCreator implements EventWiringInfo
+ {
+ private String name;
+ private Map<Window, QName> sources;
+ private Map<Window, QName> destinations;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Map<Window, QName> getSources()
+ {
+ return sources;
+ }
+
+ public void setSources(Map<Window, QName> sources)
+ {
+ this.sources = sources;
+ }
+
+ public Map<Window, QName> getDestinations()
+ {
+ return destinations;
+ }
+
+ public void setDestinations(Map<Window, QName> destinations)
+ {
+ this.destinations = destinations;
+ }
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/WindowBindingManagerBean.java 2008-08-27 12:34:31 UTC (rev 11746)
@@ -0,0 +1,311 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.coordination;
+
+import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
+import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
+import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.portlet.info.NavigationInfo;
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WindowBindingManagerBean
+{
+ private CoordinationManagerBean managerBean;
+
+ private Map<String, String> windows;
+
+ private List<String> selectedWindows;
+
+ private Map<String, String> aliasBindings;
+
+ private Map<String, Map<String, String>> windowBindings;
+
+ private String selectedRenderParameter;
+
+ private Map<String, String> availableRenderParameters;
+
+ private String windowBindingName;
+
+ public Map<String, String> getWindows()
+ {
+ return windows;
+ }
+
+ public void setWindows(Map<String, String> windows)
+ {
+ this.windows = windows;
+ }
+
+ public List<String> getSelectedWindows()
+ {
+ return selectedWindows;
+ }
+
+ public void setSelectedWindows(List<String> selectedWindows)
+ {
+ this.selectedWindows = selectedWindows;
+ }
+
+ public Map<String, String> getAliasBindings()
+ {
+ if (aliasBindings == null)
+ {
+ aliasBindings = new HashMap<String, String>();
+ }
+ return aliasBindings;
+ }
+
+ public void setAliasBindings(Map<String, String> aliasBindings)
+ {
+ this.aliasBindings = aliasBindings;
+ }
+
+ public Map<String, String> getAvailableRenderParameters()
+ {
+ return availableRenderParameters;
+ }
+
+ public void setAvailableRenderParameters(Map<String, String> availableRenderParameters)
+ {
+ this.availableRenderParameters = availableRenderParameters;
+ }
+
+ public Map<String, Map<String, String>> getWindowBindings()
+ {
+ return windowBindings;
+ }
+
+ public void setWindowBindings(Map<String, Map<String, String>> windowBindings)
+ {
+ this.windowBindings = windowBindings;
+ }
+
+ public String getSelectedRenderParameter()
+ {
+ return selectedRenderParameter;
+ }
+
+ public void setSelectedRenderParameter(String selectedRenderParameter)
+ {
+ this.selectedRenderParameter = selectedRenderParameter;
+ }
+
+ public String getWindowBindingName()
+ {
+ return windowBindingName;
+ }
+
+ public void setWindowBindingName(String windowBindingName)
+ {
+ this.windowBindingName = windowBindingName;
+ }
+
+ // Parameter Binding
+ public boolean isParameterImplicitEnabled()
+ {
+ boolean enabled = false;
+ Page page = managerBean.getSelectedPage();
+ Boolean implicitParameter = managerBean.getCoordinationService().isParameterBindingImplicitModeEnabled(page);
+ if (implicitParameter != null)
+ {
+ enabled = implicitParameter;
+ }
+ return enabled;
+ }
+
+ /**
+ * Listener for implicit parameter binding checkbox
+ *
+ * @param event
+ * @throws org.jboss.portal.core.controller.coordination.IllegalCoordinationException
+ *
+ */
+ public void implicitParameterListener(ValueChangeEvent event) throws IllegalCoordinationException
+ {
+ String newValue = event.getNewValue().toString();
+ managerBean.getCoordinationService().setParameterBindingImplicitMode(managerBean.getSelectedPage(), Boolean.parseBoolean(newValue));
+ }
+
+ public void extractInfoFrom(Window window, PortletInfo info)
+ {
+ // retrieve metadata on public render parameters
+ NavigationInfo navInfo = info.getNavigation();
+ for (ParameterInfo pInfo : navInfo.getPublicParameters())
+ {
+ availableRenderParameters.put(pInfo.getName().toString(), pInfo.getName().toString());
+ }
+ // record window information
+ this.windows.put(window.getName(), window.getId().toString(PortalObjectPath.LEGACY_BASE64_FORMAT));
+ }
+
+ public void setManagerBean(CoordinationManagerBean managerBean)
+ {
+ this.managerBean = managerBean;
+ }
+
+
+ public static class DisplayParameterBinding implements Comparable
+ {
+
+ private String id;
+
+ private QName name;
+
+ private List<Window> windows;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public void setName(QName name)
+ {
+ this.name = name;
+ }
+
+ public List<Window> getWindows()
+ {
+ if (windows == null)
+ {
+ windows = new ArrayList<Window>();
+ }
+ return windows;
+ }
+
+ public void setWindows(List<Window> windows)
+ {
+ this.windows = windows;
+ }
+
+ public int compareTo(Object o)
+ {
+ DisplayParameterBinding other = (DisplayParameterBinding)o;
+ return id.compareTo(other.getId());
+ }
+ }
+
+ private List<DisplayParameterBinding> displayParameterBindings;
+
+ public List<DisplayParameterBinding> getDisplayParameterBindings()
+ {
+ return displayParameterBindings;
+ }
+
+ public void setDisplayParameterBindings(List<DisplayParameterBinding> displayParameterBindings)
+ {
+ this.displayParameterBindings = displayParameterBindings;
+ }
+
+ public void initKnowing(Collection<PortalObject> children)
+ {
+ availableRenderParameters = new LinkedHashMap<String, String>();
+ this.windows = new LinkedHashMap<String, String>(children.size());
+ }
+
+ public void loadWindowBindings(Page page)
+ {
+ //aliasbindings prep for ui
+ for (AliasBindingInfo abInfo : managerBean.getCoordinationService().getAliasBindings(page))
+ {
+ for (QName name : abInfo.getNames())
+ {
+ getAliasBindings().put(name.getNamespaceURI(), name.getNamespaceURI());
+ }
+ }
+
+ Collection<? extends WindowBindingInfo> windowBindingInfos = managerBean.getCoordinationService().getWindowBindings(page);
+ if (windowBindingInfos != null && !windowBindingInfos.isEmpty())
+ {
+ displayParameterBindings = new ArrayList<DisplayParameterBinding>(windowBindingInfos.size());
+ for (WindowBindingInfo wbInfo : windowBindingInfos)
+ {
+ DisplayParameterBinding dpb = new DisplayParameterBinding();
+ for (Map.Entry<Window, QName> entry : wbInfo.getWindows().entrySet())
+ {
+ Window paramName = entry.getKey();
+ QName paramValue = entry.getValue();
+ //quick filter for duplicate binding ids
+ dpb.getWindows().add(paramName);
+ if (dpb.getWindows().size() < 2)
+ {
+ dpb.setId(wbInfo.getId());
+ dpb.setName(paramValue);
+ }
+ }
+ displayParameterBindings.add(dpb);
+ }
+ }
+ else
+ {
+ displayParameterBindings = Collections.emptyList();
+ }
+ }
+
+ public void createWindowBinding(ActionEvent event) throws IllegalCoordinationException
+ {
+ Map<Window, QName> windowBinding;
+ for (String window : selectedWindows)
+ {
+ windowBinding = new HashMap<Window, QName>();
+ PortalObject portalObject = managerBean.getPortalObjectContainer().getObject(managerBean.parsePortalObjectId(window));
+
+ if (portalObject.getType() == PortalObject.TYPE_WINDOW)
+ {
+ windowBinding.put((Window)portalObject, QName.valueOf(selectedRenderParameter));
+ managerBean.getCoordinationService().setWindowBinding(windowBindingName, windowBinding);
+ }
+ }
+ //refresh data
+ loadWindowBindings(managerBean.getSelectedPage());
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-08-27 11:43:39 UTC (rev 11745)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2008-08-27 12:34:31 UTC (rev 11746)
@@ -345,12 +345,20 @@
<managed-bean>
<managed-bean-name>coordinationAction</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.admin.ui.actions.CoordinationAction</managed-bean-class>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.coordination.CoordinationManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>pomb</property-name>
<value>#{portalobjectmgr}</value>
</managed-property>
+ <managed-property>
+ <property-name>eventManager</property-name>
+ <value>#{eventCoordination}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>windowManager</property-name>
+ <value>#{windowCoordination}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
@@ -408,8 +416,18 @@
<value>org.jboss.portal.core.admin.ui.ControlPropertiesBean</value>
</managed-property>
</managed-bean>
-
+ <managed-bean>
+ <managed-bean-name>eventCoordination</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.coordination.EventWiringManagerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>windowCoordination</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.admin.ui.coordination.WindowBindingManagerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>index</from-outcome>
@@ -464,10 +482,6 @@
<to-view-id>/jsf/displayNameObject.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>editCoordination</from-outcome>
- <to-view-id>/jsf/editCoordination.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
<from-outcome>editWindowTheme</from-outcome>
<to-view-id>/jsf/editWindowTheme.xhtml</to-view-id>
</navigation-case>
@@ -518,7 +532,12 @@
<to-view-id>/jsf/confirmDeleteInstance.xhtml</to-view-id>
</navigation-case>
+ <!-- Coordination -->
<navigation-case>
+ <from-outcome>editCoordination</from-outcome>
+ <to-view-id>/jsf/editCoordination.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
<from-outcome>confirmCoordinationDeletion</from-outcome>
<to-view-id>/jsf/confirmDeleteCoordination.xhtml</to-view-id>
</navigation-case>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 11:43:39 UTC (rev 11745)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-08-27 12:34:31 UTC (rev 11746)
@@ -16,9 +16,9 @@
<h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_CREATE_PARAMETER_BINDING}</h3>
<h:form>
- <h:selectBooleanCheckbox id="useImplicitBinding" value="#{coordinationAction.parameterImplicitEnabled}"
+ <h:selectBooleanCheckbox id="useImplicitBinding" value="#{windowCoordination.parameterImplicitEnabled}"
onchange="this.form.submit()"
- valueChangeListener="#{coordinationAction.implicitParameterListener}"/>
+ valueChangeListener="#{windowCoordination.implicitParameterListener}"/>
Enable #{bundle.COORDINATION_PARAMETER_IMPLICIT_MODE}
</h:form>
<hr/>
@@ -28,26 +28,26 @@
<div class="float-left quarter-width">
Available Render Parameter Names
- <h:selectOneListbox size="5" value="#{coordinationAction.selectedRenderParameter}">
- <f:selectItems value="#{coordinationAction.availableRenderParameters}"/>
+ <h:selectOneListbox size="5" value="#{windowCoordination.selectedRenderParameter}">
+ <f:selectItems value="#{windowCoordination.availableRenderParameters}"/>
</h:selectOneListbox>
</div>
<div class="float-left quarter-width">
#{bundle.COORDINATION_WINDOWS}
- <h:selectManyListbox size="5" value="#{coordinationAction.selectedWindows}">
- <f:selectItems value="#{coordinationAction.windows}"/>
+ <h:selectManyListbox size="5" value="#{windowCoordination.selectedWindows}">
+ <f:selectItems value="#{windowCoordination.windows}"/>
</h:selectManyListbox>
</div>
<div class="float-left quarter-width">
- <h:inputText value="#{coordinationAction.windowBindingName}"/>
+ <h:inputText value="#{windowCoordination.windowBindingName}"/>
</div>
- <h:commandButton actionListener="#{coordinationAction.createWindowBinding}" value="Create Binding"/>
+ <h:commandButton actionListener="#{windowCoordination.createWindowBinding}" value="Create Binding"/>
<br class="clear"/>
</h:form>
@@ -56,7 +56,7 @@
<div class="float-left full-width">
<h:form>
- <h:dataTable var="binding" value="#{coordinationAction.displayParameterBindings}"
+ <h:dataTable var="binding" value="#{windowCoordination.displayParameterBindings}"
rendered="true"
styleClass="objectList datatable"
rowClasses="portlet-section-body,portlet-section-alternate-blue"
@@ -103,7 +103,7 @@
<h:form>
- <h:selectBooleanCheckbox id="useExplicitEvents" value="#{coordinationAction.explicitEventsUsed}"
+ <h:selectBooleanCheckbox id="useExplicitEvents" value="#{eventCoordination.explicitEventsUsed}"
onchange="this.form.submit()" immediate="true"/>#{bundle.COORDINATION_EVENT_EXPLICIT_MODE}
</h:form>
@@ -113,42 +113,42 @@
<h:form>
<h:panelGroup>
#{bundle.COORDINATION_EVENT_CREATE_STEP1}
- <h:selectOneListbox id="sourceEvent" size="5" value="#{coordinationAction.selectedSourceEvent}" immediate="true"
- valueChangeListener="#{coordinationAction.selectSourceEvent}" onchange="this.form.submit()">
- <f:selectItems value="#{coordinationAction.sourceEvents}"/>
+ <h:selectOneListbox id="sourceEvent" size="5" value="#{eventCoordination.selectedSourceEvent}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectSourceEvent}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.sourceEvents}"/>
</h:selectOneListbox>
</h:panelGroup>
- <h:panelGroup rendered="#{!empty coordinationAction.selectedSourceEvent}">
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedSourceEvent}">
#{bundle.COORDINATION_EVENT_CREATE_STEP2}
- <h:selectManyListbox id="sourceWindows" size="5" value="#{coordinationAction.selectedSourceWindows}" immediate="true"
- valueChangeListener="#{coordinationAction.selectSourceWindows}" onchange="this.form.submit()">
- <f:selectItems value="#{coordinationAction.sourceWindows}"/>
+ <h:selectManyListbox id="sourceWindows" size="5" value="#{eventCoordination.selectedSourceWindows}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectSourceWindows}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.sourceWindows}"/>
</h:selectManyListbox>
</h:panelGroup>
- <h:panelGroup rendered="#{!empty coordinationAction.selectedSourceWindows}">
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedSourceWindows}">
#{bundle.COORDINATION_EVENT_CREATE_STEP3}
- <h:selectOneListbox id="destEvent" size="5" value="#{coordinationAction.selectedDestinationEvent}" immediate="true"
- valueChangeListener="#{coordinationAction.selectDestinationEvent}" onchange="this.form.submit()">
- <f:selectItems value="#{coordinationAction.destinationEvents}"/>
+ <h:selectOneListbox id="destEvent" size="5" value="#{eventCoordination.selectedDestinationEvent}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectDestinationEvent}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.destinationEvents}"/>
</h:selectOneListbox>
</h:panelGroup>
- <h:panelGroup rendered="#{!empty coordinationAction.selectedDestinationEvent}">
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedDestinationEvent}">
#{bundle.COORDINATION_EVENT_CREATE_STEP4}
- <h:selectManyListbox id="destWindows" size="5" value="#{coordinationAction.selectedDestinationWindows}" immediate="true"
- valueChangeListener="#{coordinationAction.selectDestinationWindows}" onchange="this.form.submit()">
- <f:selectItems value="#{coordinationAction.destinationWindows}"/>
+ <h:selectManyListbox id="destWindows" size="5" value="#{eventCoordination.selectedDestinationWindows}" immediate="true"
+ valueChangeListener="#{eventCoordination.selectDestinationWindows}" onchange="this.form.submit()">
+ <f:selectItems value="#{eventCoordination.destinationWindows}"/>
</h:selectManyListbox>
</h:panelGroup>
- <h:panelGroup rendered="#{!empty coordinationAction.selectedDestinationWindows}">
+ <h:panelGroup rendered="#{!empty eventCoordination.selectedDestinationWindows}">
#{bundle.COORDINATION_EVENT_CREATE_STEP5}
- <h:inputText id="wiringName" value="#{coordinationAction.wiringName}"/>
- <h:commandButton value="#{bundle.COORDINATION_EVENT_CREATE_CREATE}" action="#{coordinationAction.createWiring}"
+ <h:inputText id="wiringName" value="#{eventCoordination.wiringName}"/>
+ <h:commandButton value="#{bundle.COORDINATION_EVENT_CREATE_CREATE}" action="#{eventCoordination.createWiring}"
styleClass="portlet-form-button"/>
- <h:commandButton value="#{bundle.COMMON_CANCEL}" action="#{coordinationAction.cancelWiring}"
+ <h:commandButton value="#{bundle.COMMON_CANCEL}" action="#{eventCoordination.cancelWiring}"
styleClass="portlet-form-button"/>
</h:panelGroup>
</h:form>
@@ -157,7 +157,7 @@
<!-- Manage existing wirings -->
<h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_MANAGE_EXISTING}</h3>
<h:form>
- <h:dataTable var="wiring" value="#{coordinationAction.displayEventWirings}"
+ <h:dataTable var="wiring" value="#{eventCoordination.displayEventWirings}"
rendered="true"
styleClass="objectList datatable"
rowClasses="portlet-section-body,portlet-section-alternate-blue"
@@ -198,11 +198,11 @@
<h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_ACTIONS}"/>
</f:facet>
- <h:commandLink action="#{coordinationAction.renameWiring}">
+ <h:commandLink action="#{eventCoordination.renameWiring}">
<h:outputText styleClass="actionRename" value="#{bundle.RENAME}"/>
<f:param name="wiring" value="#{wiring.name}"/>
</h:commandLink> |
- <h:commandLink action="confirmCoordinationDeletion" actionListener="#{coordinationAction.selectWiringForDeletion}">
+ <h:commandLink action="confirmCoordinationDeletion" actionListener="#{eventCoordination.selectWiringForDeletion}">
<h:outputText styleClass="actionDelete" value="#{bundle.COMMON_DELETE}"/>
<f:param name="wiring" value="#{wiring.name}"/>
<f:param name="type" value="wiring"/>
15 years, 9 months
JBoss Portal SVN: r11745 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss: portal/core/aspects/portlet and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-08-27 07:43:39 -0400 (Wed, 27 Aug 2008)
New Revision: 11745
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/CoreConstants.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
Log:
minor
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/CoreConstants.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/CoreConstants.java 2008-08-27 11:32:22 UTC (rev 11744)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/CoreConstants.java 2008-08-27 11:43:39 UTC (rev 11745)
@@ -54,15 +54,26 @@
}
}
- /** The namespace for JBoss Portal content integration framework. */
- public static final String JBOSS_PORTAL_CONTENT_NAMESPACE = "urn:jboss:portal:content";
+ public final static String JBOSS_PORTAL_NAMESPACE = "urn:jboss:portal";
+
+ /**
+ * SignOut event
+ */
+ public static final QName JBOSS_PORTAL_SIGN_OUT = new QName(JBOSS_PORTAL_NAMESPACE, "signOut");
+ /**
+ * The namespace for JBoss Portal content integration framework.
+ */
+ public static final String JBOSS_PORTAL_CONTENT_NAMESPACE = JBOSS_PORTAL_NAMESPACE + ":content";
+
public static final QName JBOSS_PORTAL_CONTENT_URI = new QName(JBOSS_PORTAL_CONTENT_NAMESPACE, "uri");
public static final QName JBOSS_PORTAL_CONTENT_PARAMETERS = new QName(JBOSS_PORTAL_CONTENT_NAMESPACE, "parameters");
- /** The namespace for the page integration. */
- public static final String JBOSS_PORTAL_PAGE_NAMESPACE = "urn:jboss:portal:page";
+ /**
+ * The namespace for the page integration.
+ */
+ public static final String JBOSS_PORTAL_PAGE_NAMESPACE = JBOSS_PORTAL_NAMESPACE + ":page";
/**
* This name can be used as a page parameter. It denotes a special parameter which is the page title.
@@ -70,4 +81,6 @@
* @todo implement it
*/
public static final QName JBOSS_PORTAL_PAGE_TITLE = new QName(JBOSS_PORTAL_PAGE_NAMESPACE, "title");
+
+
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java 2008-08-27 11:32:22 UTC (rev 11744)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/aspects/portlet/SignOutInterceptor.java 2008-08-27 11:43:39 UTC (rev 11745)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.aspects.portlet;
-import org.jboss.portal.core.controller.portlet.CoreEventControllerContext;
+import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.core.controller.portlet.SignOutResponse;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletInvokerInterceptor;
@@ -30,8 +30,6 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
-import javax.xml.namespace.QName;
-
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
@@ -49,7 +47,7 @@
UpdateNavigationalStateResponse unsr = (UpdateNavigationalStateResponse)response;
for (UpdateNavigationalStateResponse.Event event : unsr.getEvents())
{
- if (event.getName().equals(new QName(CoreEventControllerContext.PORTAL_NAMESPACE, "signOut")))
+ if (event.getName().equals(CoreConstants.JBOSS_PORTAL_SIGN_OUT))
{
String location = (String)event.getPayload();
return new SignOutResponse(location);
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java 2008-08-27 11:32:22 UTC (rev 11744)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/CoreEventControllerContext.java 2008-08-27 11:43:39 UTC (rev 11745)
@@ -29,6 +29,7 @@
import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.core.controller.coordination.CoordinationManager;
import org.jboss.portal.core.model.portal.Window;
import org.apache.log4j.Logger;
@@ -41,8 +42,6 @@
public class CoreEventControllerContext implements EventControllerContext
{
- public final static String PORTAL_NAMESPACE = "urn:jboss:portal";
-
/** . */
private final Logger log = Logger.getLogger(CoreEventControllerContext.class);
@@ -74,7 +73,7 @@
}
// Portal events unused at the moment
- if (PORTAL_NAMESPACE.equals(producedEvent.getName().getNamespaceURI()))
+ if (CoreConstants.JBOSS_PORTAL_NAMESPACE.equals(producedEvent.getName().getNamespaceURI()))
{
toConsumeEvents.addLast(producedEvent);
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-08-27 11:32:22 UTC (rev 11744)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portlet/JBossActionResponse.java 2008-08-27 11:43:39 UTC (rev 11745)
@@ -37,6 +37,7 @@
import org.jboss.portal.api.PortalRuntimeContext;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.core.aspects.controller.node.Navigation;
import org.jboss.portal.core.controller.portlet.CoreEventControllerContext;
@@ -155,7 +156,7 @@
*/
public void signOut() throws IllegalStateException
{
- setEvent(new QName(CoreEventControllerContext.PORTAL_NAMESPACE, "signOut"), null);
+ setEvent(CoreConstants.JBOSS_PORTAL_SIGN_OUT, null);
}
/**
@@ -168,7 +169,7 @@
*/
public void signOut(String location) throws IllegalStateException
{
- setEvent(new QName(CoreEventControllerContext.PORTAL_NAMESPACE, "signOut"), location);
+ setEvent(CoreConstants.JBOSS_PORTAL_SIGN_OUT, location);
}
15 years, 9 months
JBoss Portal SVN: r11744 - branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-08-27 07:32:22 -0400 (Wed, 27 Aug 2008)
New Revision: 11744
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
Log:
Make it validate
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2008-08-26 21:19:01 UTC (rev 11743)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2008-08-27 11:32:22 UTC (rev 11744)
@@ -28,20 +28,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
- <filter>
- <filter-name>JBoss Portlet Filter</filter-name>
- <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
- <lifecycle>ACTION_PHASE</lifecycle>
- <lifecycle>RENDER_PHASE</lifecycle>
- </filter>
- <filter-mapping>
- <filter-name>JBoss Portlet Filter</filter-name>
- <portlet-name>IdentityUserPortlet</portlet-name>
- <portlet-name>IdentityAdminPortlet</portlet-name>
- </filter-mapping>
-
-
<portlet>
<description>Identity user portlet</description>
<portlet-name>IdentityUserPortlet</portlet-name>
@@ -126,4 +113,18 @@
</preference>
</portlet-preferences>
</portlet>
-</portlet-app>
+
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>IdentityUserPortlet</portlet-name>
+ <portlet-name>IdentityAdminPortlet</portlet-name>
+ </filter-mapping>
+
+</portlet-app>
\ No newline at end of file
15 years, 9 months
JBoss Portal SVN: r11743 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-08-26 17:19:01 -0400 (Tue, 26 Aug 2008)
New Revision: 11743
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml
Log:
Put back session timeout to 15 min
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml 2008-08-26 20:52:47 UTC (rev 11742)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml 2008-08-26 21:19:01 UTC (rev 11743)
@@ -146,7 +146,7 @@
</servlet-mapping>
<session-config>
- <session-timeout>1</session-timeout>
+ <session-timeout>15</session-timeout>
</session-config>
<!--
15 years, 9 months
JBoss Portal SVN: r11742 - in branches/JBoss_Portal_Branch_2_7: server/src/main/org/jboss/portal/server and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-08-26 16:52:47 -0400 (Tue, 26 Aug 2008)
New Revision: 11742
Added:
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/listener/
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/listener/SessionListener.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml
Log:
JBPORTAL-2030: Portal session expiration should invalidate portlet webapps sessions
Added a listener to kill application sessions when the portal session expires.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml 2008-08-26 16:59:15 UTC (rev 11741)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/web.xml 2008-08-26 20:52:47 UTC (rev 11742)
@@ -35,6 +35,11 @@
<listener>
<listener-class>org.jboss.portal.core.impl.api.event.ServletEventBridge</listener-class>
</listener>
+
+ <!-- Session listener to kill all sub-sessions -->
+ <listener>
+ <listener-class>org.jboss.portal.server.listener.SessionListener</listener-class>
+ </listener>
<!-- The portal servlet is the main entrance point -->
<servlet>
@@ -141,7 +146,7 @@
</servlet-mapping>
<session-config>
- <session-timeout>15</session-timeout>
+ <session-timeout>1</session-timeout>
</session-config>
<!--
Added: branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/listener/SessionListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/listener/SessionListener.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/listener/SessionListener.java 2008-08-26 20:52:47 UTC (rev 11742)
@@ -0,0 +1,589 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.server.listener;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.portal.server.aspects.server.SignOutInterceptor.Invalidation;
+import org.jboss.portal.web.ServletContainer;
+
+/**
+ * This listener listens to the main portal session events.
+ * When the portal session timesout, all web applications' sessions referenced
+ * by org.jboss.portal.server.aspects.server.SignOutInterceptor are destroyed
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class SessionListener implements HttpSessionListener
+{
+ /** . */
+ private static final Invalidation invalidator = new Invalidation();
+
+ /** . */
+ private Logger log = Logger.getLogger(SessionListener.class);
+
+ /** . */
+ private static final String KEY = "org.jboss.portal.session.contexts";
+
+ public void sessionCreated(HttpSessionEvent arg0)
+ {
+ // Nothing to do
+ }
+
+ public void sessionDestroyed(HttpSessionEvent arg0)
+ {
+ System.out.println("Portal session got destroyed");
+ Set<String> contexts = (Set<String>)arg0.getSession().getAttribute(KEY);
+
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ ObjectName objectName = null;
+ ServletContainer servletContainer = null;
+
+ try
+ {
+ objectName = new ObjectName("portal:service=ServletContainerFactory");
+ servletContainer = (ServletContainer)server.getAttribute(objectName, "ServletContainer");
+ }
+ catch (Exception e1)
+ {
+ log.error("Error while destroying portlet webapp sessions");
+ }
+
+ // Iterate over all the context that have been used
+ for (Iterator<String> i = contexts.iterator(); i.hasNext();)
+ {
+ String dispatchContextName = (String)i.next();
+
+ // Get the context
+ ServletContext dispatchContext = arg0.getSession().getServletContext().getContext(dispatchContextName);
+
+ // The context could be null if the web app has been removed after the web app has been tracked
+ if (dispatchContext != null)
+ {
+ try
+ {
+ // Execute the command that invalidates the session
+ servletContainer.include(dispatchContext, new TestHttpServletRequest(arg0.getSession()), new TestHttpServletResponse(), invalidator, null);
+ }
+ catch (Exception e)
+ {
+ log.error("An error occured when trying to invalidate the sessions");
+ }
+ }
+ }
+ }
+
+ // request
+ private static class TestHttpServletRequest implements HttpServletRequest
+ {
+ private Map attributes;
+
+ private HttpSession session;
+
+ public TestHttpServletRequest(HttpSession session)
+ {
+ attributes = new HashMap();
+ this.session = session;
+ }
+
+ public String getAuthType()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Cookie[] getCookies()
+ {
+ return new Cookie[0]; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public long getDateHeader(String string)
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getHeader(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Enumeration getHeaders(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Enumeration getHeaderNames()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getIntHeader(String string)
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getMethod()
+ {
+ return "GET";
+ }
+
+ public String getPathInfo()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getPathTranslated()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getContextPath()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getQueryString()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRemoteUser()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isUserInRole(String string)
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRequestedSessionId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRequestURI()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public StringBuffer getRequestURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getServletPath()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public HttpSession getSession(boolean b)
+ {
+ return session;
+ }
+
+ public HttpSession getSession()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isRequestedSessionIdValid()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isRequestedSessionIdFromCookie()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isRequestedSessionIdFromURL()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isRequestedSessionIdFromUrl()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Object getAttribute(String key)
+ {
+ return attributes.get(key);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getCharacterEncoding()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setCharacterEncoding(String string) throws UnsupportedEncodingException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getContentLength()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getContentType()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ServletInputStream getInputStream() throws IOException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getParameter(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Enumeration getParameterNames()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String[] getParameterValues(String string)
+ {
+ return new String[0]; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Map getParameterMap()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getProtocol()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getScheme()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getServerName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getServerPort()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public BufferedReader getReader() throws IOException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRemoteAddr()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRemoteHost()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setAttribute(String key, Object value)
+ {
+ attributes.put(key, value);
+ }
+
+ public void removeAttribute(String key)
+ {
+ attributes.remove(key);
+ }
+
+ public Locale getLocale()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Enumeration getLocales()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isSecure()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public RequestDispatcher getRequestDispatcher(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRealPath(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getRemotePort()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getLocalName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getLocalAddr()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getLocalPort()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ }
+
+ // response
+ private static class TestHttpServletResponse implements HttpServletResponse
+ {
+ private StringWriter writer;
+
+ public TestHttpServletResponse()
+ {
+
+ }
+
+ public void addCookie(Cookie cookie)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean containsHeader(String string)
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String encodeURL(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String encodeRedirectURL(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String encodeUrl(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String encodeRedirectUrl(String string)
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void sendError(int i, String string) throws IOException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void sendError(int i) throws IOException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void sendRedirect(String string) throws IOException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setDateHeader(String string, long l)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void addDateHeader(String string, long l)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setHeader(String string, String string1)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void addHeader(String string, String string1)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setIntHeader(String string, int i)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void addIntHeader(String string, int i)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setStatus(int i)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setStatus(int i, String string)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getCharacterEncoding()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getContentType()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ writer = new StringWriter();
+ return new PrintWriter(writer);
+ }
+
+ public String getResult()
+ {
+ return writer.toString();
+ }
+
+ public void setCharacterEncoding(String string)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setContentLength(int i)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setContentType(String string)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setBufferSize(int i)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public int getBufferSize()
+ {
+ return 0; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void resetBuffer()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isCommitted()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void reset()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setLocale(Locale locale)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Locale getLocale()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getResponseMarkup()
+ {
+ return null; //To change body of created methods use File | Settings | File Templates.
+ }
+ }
+
+}
+
15 years, 9 months