Author: chris.laprun(a)jboss.com
Date: 2007-08-30 20:46:04 -0400 (Thu, 30 Aug 2007)
New Revision: 8118
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
Log:
- JBPORTAL-1665: Fixed highlighting of selected range.
- JBPORTAL-1588: Now properly shows the newly created instance when re-directing to
instance list.
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-08-30
22:30:20 UTC (rev 8117)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-08-31
00:46:04 UTC (rev 8118)
@@ -22,23 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-import javax.faces.model.SelectItem;
-import javax.portlet.PortletMode;
-
import org.jboss.portal.Mode;
import org.jboss.portal.common.value.Value;
import org.jboss.portal.core.model.instance.Instance;
@@ -56,6 +39,21 @@
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
@@ -63,7 +61,7 @@
*/
public class InstanceManagerBean
{
-
+
/** . */
private final Mode INTERNAL_EDIT_CONTENT = Mode.create("edit_content");
@@ -181,6 +179,12 @@
public void setSelectedId(String selectedId)
{
this.selectedId = selectedId;
+ int index = getInstances().indexOf(getSelectedInstance());
+ if (index != -1)
+ {
+ selectedRow = new Integer(index);
+ selectedFrom = (index / paginationSize) * paginationSize;
+ }
}
public String getSelectedPlugin()
@@ -219,7 +223,7 @@
PreferencesInfo prefsInfo =
selectedInstance.getPortlet().getInfo().getPreferences();
Set keys = prefsInfo.getKeys();
PropertyMap props = selectedInstance.getProperties();
- for (Iterator i = keys.iterator();i.hasNext();)
+ for (Iterator i = keys.iterator(); i.hasNext();)
{
String key = (String)i.next();
PreferenceInfo prefInfo = prefsInfo.getPreference(key);
@@ -249,7 +253,7 @@
// Remove content editors
List tmpInstances = new ArrayList();
nextInstance:
- for (Iterator i = instanceContainer.getDefinitions().iterator();i.hasNext();)
+ for (Iterator i = instanceContainer.getDefinitions().iterator(); i.hasNext();)
{
Instance instance = (Instance)i.next();
@@ -259,7 +263,7 @@
// Filter portlets that are editors
Portlet portlet = instance.getPortlet();
PortletInfo info = portlet.getInfo();
- for (Iterator j =
info.getCapabilities().getAllModes().iterator();j.hasNext();)
+ for (Iterator j = info.getCapabilities().getAllModes().iterator();
j.hasNext();)
{
ModeInfo modeInfo = (ModeInfo)j.next();
if (modeInfo.getMode().equals(INTERNAL_EDIT_CONTENT))
@@ -281,7 +285,6 @@
return instances;
}
- /** Return an array of all instances known in this container. */
public Collection getSelectedInstances()
{
List list = getInstances();
@@ -293,24 +296,26 @@
return list.subList(selectedFrom, to);
}
- /** Return an array of all instances known in this container. */
public Map getSelectedInstancesPrefs()
{
Map map = new HashMap();
Collection instances = getSelectedInstances();
Iterator it = instances.iterator();
-
+
while (it.hasNext())
{
InstanceDefinition instanceDef = (InstanceDefinition)it.next();
- try {
+ try
+ {
map.put(instanceDef.getId(), instanceDef.getProperties());
- } catch (PortletInvokerException e) {
+ }
+ catch (PortletInvokerException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
return map;
}
@@ -357,7 +362,7 @@
selectInstance();
}
-
+
public void deleteInstance(ActionEvent ae)
{
try
@@ -389,7 +394,7 @@
{
List tmp = new ArrayList();
List entries = selectedPrefs.getEntries();
- for (int i = 0;i < entries.size();i++)
+ for (int i = 0; i < entries.size(); i++)
{
PreferenceBean entry = (PreferenceBean)entries.get(i);
if (entry.isStale())
@@ -478,7 +483,7 @@
public SelectItem[] getAvailableActions()
{
- return new SelectItem[]{ new SelectItem("view", "View"), new
SelectItem("admin", "Admin")};
+ return new SelectItem[]{new SelectItem("view", "View"), new
SelectItem("admin", "Admin")};
}
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2007-08-30
22:30:20 UTC (rev 8117)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2007-08-31
00:46:04 UTC (rev 8118)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui.actions;
+import org.jboss.portal.core.admin.ui.InstanceManagerBean;
+import org.jboss.portal.core.admin.ui.PortletManagerBean;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.admin.ui.InstanceManagerBean;
-import org.jboss.portal.core.admin.ui.PortletManagerBean;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
@@ -143,6 +143,7 @@
configurator.setSecurityBindings(instance.getId(), constraints);
// Configure the instance manager with the instance already looked up
+ instanceMgr.refresh();
instanceMgr.setSelectedId(instanceId);
instanceMgr.setSelectedPlugin("info");
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-08-30
22:30:20 UTC (rev 8117)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2007-08-31
00:46:04 UTC (rev 8118)
@@ -8,105 +8,106 @@
<ui:composition template="instancesTemplate.xhtml">
- <ui:define name="content">
+<ui:define name="content">
- <h:form>
+ <h:form>
- <table id="instancesTable2" width="100%">
- <thead class="portlet-section-header">
- <tr>
- <th>Id</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{instancemgr.selectedInstances}"
var="instance" varStatus="status">
- <tr
- class="#{instance.id == instancemgr.selectedId ?
'portlet-section-selected' : (status.index % 2 == 0 ?
'portlet-section-body' : 'portlet-section-alternate')}">
- <td>
- <h:commandLink
action="#{instancemgr.selectInstance}">
- <h:outputText value="#{instance.id}"/>
- <f:param name="id"
value="#{instance.id}"/>
- <f:param name="plugin"
value="info"/>
- </h:commandLink>
- </td>
- <td><h:commandLink
action="#{instancemgr.selectInstance}">
- <h:outputText value="Security"/>
+ <table id="instancesTable2" width="100%">
+ <thead class="portlet-section-header">
+ <tr>
+ <th>Id</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="#{instancemgr.selectedInstances}"
var="instance" varStatus="status">
+ <tr
+ class="#{instance.id == instancemgr.selectedId ?
'portlet-section-selected' : (status.index % 2 == 0 ?
'portlet-section-body' : 'portlet-section-alternate')}">
+ <td>
+ <h:commandLink
action="#{instancemgr.selectInstance}">
+ <h:outputText value="#{instance.id}"/>
<f:param name="id"
value="#{instance.id}"/>
- <f:param name="plugin"
value="security"/>
- </h:commandLink> | <h:panelGroup
- rendered="#{!
empty(instancemgr.selectedInstancesPrefs[instance.id])}"><h:commandLink
- action="#{instancemgr.selectInstance}">
- <h:outputText value="Preferences"/>
- <f:param name="id"
value="#{instance.id}"/>
- <f:param name="plugin"
value="preferences"/>
- </h:commandLink> | </h:panelGroup><h:commandLink
action="confirmDeleteInstance"
-
actionListener="#{instancemgr.selectInstance}">
- <h:outputText value="Delete"/>
- <f:param name="id"
value="#{instance.id}"/>
+ <f:param name="plugin" value="info"/>
</h:commandLink>
- </td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <ul class="pagination">
- <c:if test="#{instancemgr.instanceCount >
instancemgr.paginationSize}">
- <c:forEach begin="0" end="#{(instancemgr.instanceCount -
1)/ instancemgr.paginationSize}" step="1"
- var="index">
- <li class="#{index == instancemgr.selectedFrom ?
'selected' : ''}">
- <h:commandLink
action="#{instancemgr.selectFrom}"><f:param name="from"
-
value="#{index * instancemgr.paginationSize}"/><h:outputText
- value="#{index *
instancemgr.paginationSize}"/></h:commandLink>
- </li>
- </c:forEach>
- </c:if>
- </ul>
+ </td>
+ <td><h:commandLink
action="#{instancemgr.selectInstance}">
+ <h:outputText value="Security"/>
+ <f:param name="id"
value="#{instance.id}"/>
+ <f:param name="plugin" value="security"/>
+ </h:commandLink> | <h:panelGroup
+ rendered="#{!
empty(instancemgr.selectedInstancesPrefs[instance.id])}"><h:commandLink
+ action="#{instancemgr.selectInstance}">
+ <h:outputText value="Preferences"/>
+ <f:param name="id"
value="#{instance.id}"/>
+ <f:param name="plugin"
value="preferences"/>
+ </h:commandLink> | </h:panelGroup><h:commandLink
action="confirmDeleteInstance"
+
actionListener="#{instancemgr.selectInstance}">
+ <h:outputText value="Delete"/>
+ <f:param name="id"
value="#{instance.id}"/>
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <ul class="pagination">
+ <c:if test="#{instancemgr.instanceCount >
instancemgr.paginationSize}">
+ <c:forEach begin="0" end="#{(instancemgr.instanceCount -
1)/ instancemgr.paginationSize}" step="1"
+ var="index">
+ <li class="#{index == (instancemgr.selectedFrom /
instancemgr.paginationSize)? 'selected' : ''}">
+ <h:commandLink action="#{instancemgr.selectFrom}">
+ <f:param name="from" value="#{index *
instancemgr.paginationSize}"/>
+ <h:outputText value="#{index *
instancemgr.paginationSize}"/>
+ </h:commandLink>
+ </li>
+ </c:forEach>
+ </c:if>
+ </ul>
- </h:form>
+ </h:form>
- <c:if test="#{instancemgr.selectedPlugin != null}">
+ <c:if test="#{instancemgr.selectedPlugin != null}">
- <hr/>
+ <hr/>
- <c:if test="#{instancemgr.selectedPlugin == 'info'}">
- <c:choose>
- <c:when test="#{instancemgr.selectedInstance.portlet !=
null}">
- <h3>Portlet details
- </h3>
- <ui:include src="common/showPortletDetails.xhtml">
- <ui:param name="portlet"
value="#{instancemgr.selectedInstance.portlet}"/>
- <ui:param name="portletmgr"
value="#{portletmgr}"/>
- </ui:include>
- </c:when>
- <c:otherwise>
- <h3>Portlet details</h3>
- The associated portlet is not available
- </c:otherwise>
- </c:choose>
- </c:if>
+ <c:if test="#{instancemgr.selectedPlugin == 'info'}">
+ <c:choose>
+ <c:when test="#{instancemgr.selectedInstance.portlet !=
null}">
+ <h3>Portlet details
+ </h3>
+ <ui:include src="common/showPortletDetails.xhtml">
+ <ui:param name="portlet"
value="#{instancemgr.selectedInstance.portlet}"/>
+ <ui:param name="portletmgr"
value="#{portletmgr}"/>
+ </ui:include>
+ </c:when>
+ <c:otherwise>
+ <h3>Portlet details</h3>
+ The associated portlet is not available
+ </c:otherwise>
+ </c:choose>
+ </c:if>
- <c:if test="#{instancemgr.selectedPlugin ==
'preferences'}">
- <h3>Editing preferences of #{instancemgr.selectedInstance.id}:
</h3>
- <ui:include src="common/editPreferences.xhtml">
- <ui:param name="prefs"
value="#{instancemgr.selectedPrefs}"/>
- </ui:include>
- <h:form style="text-align:center;padding: 1em 0 1em 0">
- <h:commandButton value="Save"
action="#{instancemgr.updatePrefs}"
styleClass="portlet-form-button"/>
- <h:commandButton value="Cancel"
action="#{instancemgr.cancelPrefs}"
styleClass="portlet-form-button"/>
- </h:form>
- </c:if>
+ <c:if test="#{instancemgr.selectedPlugin ==
'preferences'}">
+ <h3>Editing preferences of #{instancemgr.selectedInstance.id}:
</h3>
+ <ui:include src="common/editPreferences.xhtml">
+ <ui:param name="prefs"
value="#{instancemgr.selectedPrefs}"/>
+ </ui:include>
+ <h:form style="text-align:center;padding: 1em 0 1em 0">
+ <h:commandButton value="Save"
action="#{instancemgr.updatePrefs}"
styleClass="portlet-form-button"/>
+ <h:commandButton value="Cancel"
action="#{instancemgr.cancelPrefs}"
styleClass="portlet-form-button"/>
+ </h:form>
+ </c:if>
- <c:if test="#{instancemgr.selectedPlugin ==
'security'}">
- <h3>Editing security of #{instancemgr.selectedInstance.id}:
</h3>
+ <c:if test="#{instancemgr.selectedPlugin == 'security'}">
+ <h3>Editing security of #{instancemgr.selectedInstance.id}: </h3>
- <ui:decorate
template="/WEB-INF/jsf/common/editSecurity.xhtml">
- <ui:param name="auth"
value="#{instancemgr.auth}"/>
- </ui:decorate>
- </c:if>
-
+ <ui:decorate template="/WEB-INF/jsf/common/editSecurity.xhtml">
+ <ui:param name="auth"
value="#{instancemgr.auth}"/>
+ </ui:decorate>
</c:if>
- </ui:define>
+ </c:if>
+
+</ui:define>
</ui:composition>
</div>
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-08-30
22:30:20 UTC (rev 8117)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/portlets.xhtml 2007-08-31
00:46:04 UTC (rev 8118)
@@ -42,7 +42,8 @@
title="#{portlet.context.id}">
<f:param name="id"
value="#{portlet.context.id}"/>
<f:param name="plugin"
value="manager"/>
- <h:outputText rendered="#{not empty
portlet.name.value}">#{portlet.name.value}</h:outputText>
+ <h:outputText
+ rendered="#{not empty
portlet.name.value}">#{portlet.name.value}</h:outputText>
<h:outputText title="#{portlet.context.id}"
rendered="#{empty
portlet.name.value}">#{portlet.context.id}</h:outputText>
</h:commandLink>
</td>
@@ -68,9 +69,9 @@
<c:if test="#{portletmgr.portletCount >
portletmgr.paginationSize}">
<c:forEach begin="0" end="#{(portletmgr.portletCount
- 1) / portletmgr.paginationSize}" step="1"
var="index">
- <li class="#{index == portletmgr.selectedFrom ?
'selected' : ''}">
+ <li class="#{index == (portletmgr.selectedFrom /
portletmgr.paginationSize)? 'selected' : ''}">
<h:commandLink
action="#{portletmgr.selectFrom}"><f:param name="from"
- value="#{index *
portletmgr.paginationSize}"/><h:outputText
+
value="#{index * portletmgr.paginationSize}"/><h:outputText
value="#{index *
portletmgr.paginationSize}"/></h:commandLink>
</li>
</c:forEach>
Show replies by date