Author: julien(a)jboss.com
Date: 2007-02-28 08:19:23 -0500 (Wed, 28 Feb 2007)
New Revision: 6454
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AssignWindowsAction.java
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/portlet/manager.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/portlets.xhtml
Log:
started to work on the portlet manager
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AssignWindowsAction.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AssignWindowsAction.java 2007-02-28
12:09:49 UTC (rev 6453)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AssignWindowsAction.java 2007-02-28
13:19:23 UTC (rev 6454)
@@ -208,7 +208,7 @@
if (windowName == null)
{
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No
window name!", null);
- faces.addMessage("windowName", message);
+ faces.addMessage("layoutForm:windowName", message);
}
else
{
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java 2007-02-28
12:09:49 UTC (rev 6453)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/CreateInstanceAction.java 2007-02-28
13:19:23 UTC (rev 6454)
@@ -24,9 +24,11 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.model.instance.DuplicateInstanceException;
import org.jboss.portal.core.portlet.management.InstanceManagerBean;
import org.jboss.portal.core.portlet.management.PortletManagerBean;
import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
@@ -84,10 +86,49 @@
public String execute()
{
+ FacesContext faces = FacesContext.getCurrentInstance();
+
+ // Validate instance id
+ if (instanceId == null)
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No
instance id!", null);
+ faces.addMessage("add_instance_form:instanceId", message);
+ }
+ else
+ {
+ // Trim name
+ instanceId = instanceId.trim();
+
+ // Check for empty string
+ if (instanceId.length() == 0)
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Instance id cannot be blank!", null);
+ faces.addMessage("add_instance_form:instanceId", message);
+ }
+ else
+ {
+ // Check for duplicate instance
+ Instance instance =
instanceMgr.getInstanceContainer().getDefinition(instanceId);
+ if (instance != null)
+ {
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"An instance with the id " + instanceId + " already exist!", null);
+ faces.addMessage("add_instance_form:instanceId", message);
+ }
+ }
+ }
+
+ //
+ if (faces.getMessages().hasNext())
+ {
+ return null;
+ }
+
+ //
Portlet portlet = portletMgr.getSelectedPortlet();
if (portlet == null)
{
- // Todo validate here
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "No
portlet was selected!", null);
+ faces.addMessage("add_instance_form:instanceId", message);
return null;
}
else
@@ -103,17 +144,19 @@
Set constraints = Collections.singleton(new
RoleSecurityBinding("view", SecurityConstants.UNCHECKED_ROLE_NAME));
configurator.setSecurityBindings(instance.getId(), constraints);
+ // Configure the instance manager with the instance already looked up
+ instanceMgr.setSelectedId(instanceId);
+ instanceMgr.setSelectedPlugin("info");
+
//
return "instances";
}
catch (Exception e)
{
- FacesContext ctx = FacesContext.getCurrentInstance();
- FacesMessage msg = new FacesMessage("An instance with this name already
exist");
- ctx.addMessage(null, msg);
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "An
unexpected error happened!", null);
+ faces.addMessage("add_instance_form:instanceId", message);
return null;
}
}
}
-
}
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/portlet/manager.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/portlet/manager.xhtml 2007-02-28
12:09:49 UTC (rev 6453)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/portlet/manager.xhtml 2007-02-28
13:19:23 UTC (rev 6454)
@@ -4,19 +4,24 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<br/>
+
<h:panelGrid
rendered="#{portletmgr.selectedPortlet != null}">
<h:outputText value="Name: #{portletmgr.selectedPortlet.name}"/>
<h:outputText value="Description:
#{portletmgr.selectedPortlet.description}"/>
<br/>
- <h:form>
- <h:inputText value="#{createInstanceAction.instanceId}"
class="portlet-form-input-field"/>
- <br/>
- <h:commandButton
- action="#{createInstanceAction.execute}"
- value="Create instance"
- class="portlet-form-button">
- </h:commandButton>
- </h:form>
+
+
</h:panelGrid>
+
+ <!-- Instance creation -->
+
+ <hr class="admin-ui"/>
+ <h:form id="add_instance_form">
+ <h:inputText id="instanceId"
value="#{createInstanceAction.instanceId}"
styleClass="portlet-form-input-field" required="true"/>
+ <h:commandButton action="#{createInstanceAction.execute}"
value="Create instance" styleClass="portlet-form-button">
+ </h:commandButton>
+ <h:message for="instanceId"
errorClass="portlet-msg-error"/>
+ </h:form>
+
</div>
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/portlets.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/portlets.xhtml 2007-02-28
12:09:49 UTC (rev 6453)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/portlets.xhtml 2007-02-28
13:19:23 UTC (rev 6454)
@@ -20,65 +20,65 @@
</h:form>
</h:panelGrid>
- <h:form>
+ <h:form>
- <table width="100%" border="0" cellspacing="0"
class="portlet-table-body">
- <thead class="portlet-section-header"
style="text-align:left;">
- <tr>
- <th>Id</th>
- <th>Name</th>
- <th>Remote</th>
- <th>Remotable</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{portletmgr.portlets}" var="portlet"
varStatus="status">
- <tr class="#{status.index % 2 == 0 ? 'portlet-section-body'
: 'portlet-section-alternate'}">
- <td>
- <h:commandLink
- action="#{portletmgr.selectPortlet}">
- <f:param name="id"
value="#{portlet.context.id}"/>
- <f:param name="plugin"
value="manager"/>
- #{portlet.context.id}
- </h:commandLink>
- </td>
- <td>#{portlet.name}</td>
- <td><h:selectBooleanCheckbox disabled="true"
value="#{portlet.remote}"/></td>
- <td><h:selectBooleanCheckbox disabled="true"
value="#{portlet.remotable}"/></td>
- <td>
- <h:commandLink action="#{portletmgr.selectPortlet}">
- <f:param name="id"
value="#{portlet.context.id}"/>
- <f:param name="plugin"
value="manager"/>
- Info
- </h:commandLink> | <h:commandLink
action="#{portletmgr.selectPortlet}">
- <f:param name="id"
value="#{portlet.context.id}"/>
- <f:param name="plugin"
value="preferences"/>
- Preferences
- </h:commandLink>
- </td>
+ <table width="100%" border="0" cellspacing="0"
class="portlet-table-body">
+ <thead class="portlet-section-header"
style="text-align:left;">
+ <tr>
+ <th>Id</th>
+ <th>Name</th>
+ <th>Remote</th>
+ <th>Remotable</th>
+ <th>Actions</th>
</tr>
- </c:forEach>
- </tbody>
- </table>
+ </thead>
+ <tbody>
+ <c:forEach items="#{portletmgr.portlets}"
var="portlet" varStatus="status">
+ <tr class="#{status.index % 2 == 0 ?
'portlet-section-body' : 'portlet-section-alternate'}">
+ <td>
+ <h:commandLink
+ action="#{portletmgr.selectPortlet}">
+ <f:param name="id"
value="#{portlet.context.id}"/>
+ <f:param name="plugin"
value="manager"/>
+ #{portlet.context.id}
+ </h:commandLink>
+ </td>
+ <td>#{portlet.name}</td>
+ <td><h:selectBooleanCheckbox disabled="true"
value="#{portlet.remote}"/></td>
+ <td><h:selectBooleanCheckbox disabled="true"
value="#{portlet.remotable}"/></td>
+ <td>
+ <h:commandLink
action="#{portletmgr.selectPortlet}">
+ <f:param name="id"
value="#{portlet.context.id}"/>
+ <f:param name="plugin"
value="manager"/>
+ Info
+ </h:commandLink> | <h:commandLink
action="#{portletmgr.selectPortlet}">
+ <f:param name="id"
value="#{portlet.context.id}"/>
+ <f:param name="plugin"
value="preferences"/>
+ Preferences
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
- </h:form>
+ </h:form>
- <h:panelGroup
- id="pg4"
- rendered="#{portletmgr.selectedPortlet != null}">
- <h:panelGroup
- rendered="#{portletmgr.selectedPlugin == 'manager'}">
- <ui:include
src="/WEB-INF/jsp/management/plugins/portlet/manager.xhtml"/>
- </h:panelGroup>
- <h:panelGroup
- rendered="#{portletmgr.selectedPlugin == 'preferences'}">
- <ui:include
src="/WEB-INF/jsp/management/common/editPreferences.xhtml">
- <ui:param name="preferences"
value="#{portletmgr.selectedPreferences}"/>
- </ui:include>
- </h:panelGroup>
- </h:panelGroup>
+ <c:if test="#{portletmgr.selectedPortlet != null}">
+ <c:if test="#{portletmgr.selectedPlugin == 'manager'}">
+ <hr class="admin-ui"/>
+ <h3>Portlet details</h3>
+ <ui:include
src="/WEB-INF/jsp/management/plugins/portlet/manager.xhtml"/>
+ </c:if>
+ <c:if test="#{portletmgr.selectedPlugin ==
'preferences'}">
+ <hr class="admin-ui"/>
+ <h3>Portlet preferences</h3>
+ <ui:include
src="/WEB-INF/jsp/management/common/editPreferences.xhtml">
+ <ui:param name="preferences"
value="#{portletmgr.selectedPreferences}"/>
+ </ui:include>
+ </c:if>
+ </c:if>
-</ui:define>
+ </ui:define>
</ui:composition>
</div>