Author: chris.laprun(a)jboss.com
Date: 2010-01-12 10:14:16 -0500 (Tue, 12 Jan 2010)
New Revision: 1239
Removed:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java
Log:
- Cleaned-up UIWsrpConsole and make it use the default SelectTabActionListener. Tabs
should now be stateful.
- UIGrid for registration properties is now using the default template which we can reuse
thanks to the new renderer framework.
- Removed now useless UIWsrpGrid.gtmpl.
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java 2010-01-12
15:09:42 UTC (rev 1238)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java 2010-01-12
15:14:16 UTC (rev 1239)
@@ -1,146 +1,55 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.exoplatform.wsrp.webui.component;
-import org.exoplatform.portal.webui.application.UIApplicationList;
-import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.container.UIContainerList;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UITabPane;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import org.exoplatform.webui.event.Event;
/** @author Wesley Hales */
@ComponentConfigs({
-@ComponentConfig(
- lifecycle = UIApplicationLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpConsole.gtmpl"),
-@ComponentConfig(
- id = "UIWsrpConsoleTab",
- type = UITabPane.class,
- //template = "system:/groovy/webui/core/UITabPane.gtmpl",
- template = "app:/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl",
- events = {@EventConfig(listeners = UIWsrpConsole.SelectTabActionListener.class)})})
+ @ComponentConfig(
+ lifecycle = UIApplicationLifecycle.class,
+ template = "app:/groovy/wsrp/webui/component/UIWsrpConsole.gtmpl"),
+ @ComponentConfig(
+ id = "UIWsrpConsoleTab",
+ type = UITabPane.class,
+ template =
"app:/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl",
+ events = {@EventConfig(listeners = UITabPane.SelectTabActionListener.class)})})
public class UIWsrpConsole extends UIContainer
{
-
- private UITabPane uiTabPane;
-
public UIWsrpConsole() throws Exception
{
- uiTabPane = addChild(UITabPane.class, "UIWsrpConsoleTab", null);
+ UITabPane uiTabPane = addChild(UITabPane.class, "UIWsrpConsoleTab",
null);
uiTabPane.addChild(UIWsrpConsumerOverview.class, null, "Manage
Consumers").setRendered(true);
uiTabPane.addChild(UIWsrpProducerOverview.class, null, "Producer
Configuration").setRendered(false);
- if (uiTabPane.getSelectedTabId().equals("")){
+ if (uiTabPane.getSelectedTabId().equals(""))
+ {
uiTabPane.setSelectedTab(1);
}
-
}
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
-// UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
-// int portalMode = uiPortalApp.getModeState();
-// if (portalMode != UIPortalApplication.NORMAL_MODE)
-// {
-// UITabPane uiTabPane = this.getChild(UITabPane.class);
-// UIComponent uiComponent =
uiTabPane.getChildById(uiTabPane.getSelectedTabId());
-// if (uiComponent instanceof UIWsrpConsumerOverview)
-// {
-// if (portalMode == UIPortalApplication.APP_VIEW_EDIT_MODE)
-// {
-//
Util.showComponentEditInViewMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// else
-// {
-// uiPortalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
-//
Util.showComponentLayoutMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// }
-// else if (uiComponent instanceof UIWsrpProducerOverview)
-// {
-// if (portalMode == UIPortalApplication.CONTAINER_VIEW_EDIT_MODE)
-// {
-//
Util.showComponentEditInViewMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// else
-// {
-//
uiPortalApp.setModeState(UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE);
-//
Util.showComponentLayoutMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// }
-// }
- super.processRender(context);
- }
-
- static public class SelectTabActionListener extends UITabPane.SelectTabActionListener
- {
- public void execute(Event<UITabPane> event) throws Exception
- {
-// super.execute(event);
-// UITabPane uiTabPane = event.getSource();
-// UIComponent uiComponent =
uiTabPane.getChildById(uiTabPane.getSelectedTabId());
-// UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
-// int portalMode = uiPortalApp.getModeState();
-//
-// if (uiComponent instanceof UIWsrpConsumerOverview)
-// { // Swicth to Porlets Tab
-// if (portalMode % 2 == 0)
-// {
-// uiPortalApp.setModeState(UIPortalApplication.APP_VIEW_EDIT_MODE);
-//
Util.showComponentEditInViewMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// else
-// {
-// uiPortalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
-//
Util.showComponentLayoutMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// }
-// else if (uiComponent instanceof UIWsrpProducerOverview)
-// { // Swicth to
-// // Containers Tab
-// if (portalMode % 2 == 0)
-// {
-// uiPortalApp.setModeState(UIPortalApplication.CONTAINER_VIEW_EDIT_MODE);
-//
Util.showComponentEditInViewMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// else
-// {
-//
uiPortalApp.setModeState(UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE);
-//
Util.showComponentLayoutMode(org.exoplatform.portal.webui.container.UIContainer.class);
-// }
-// }
-// event.getRequestContext().addUIComponentToUpdateByAjax(
-//
Util.getUIPortalApplication().getChildById(UIPortalApplication.UI_WORKING_WS_ID));
- }
- }
-
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-12
15:09:42 UTC (rev 1238)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-12
15:14:16 UTC (rev 1239)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, 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.
@@ -22,18 +22,12 @@
*/
package org.exoplatform.wsrp.webui.component;
-import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UIGrid;
-import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -47,15 +41,7 @@
import org.gatein.wsrp.producer.config.ProducerConfiguration;
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
-import org.gatein.wsrp.registration.RegistrationPropertyDescription;
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-
/** @author Wesley Hales */
@ComponentConfig(
@@ -67,8 +53,6 @@
public class UIWsrpProducerEditor extends UIForm
{
-
-
private static final String REG_REQUIRED_FOR_DESCRIPTION =
"registrationrequiredforfulldescription";
private static final String STRICT_MODE = "strictmode";
private static final String REQUIRES_REGISTRATION = "requiresregistration";
@@ -132,8 +116,6 @@
regRequired.setValue(registrationRequired);
-
-
// if registration is required then we display more information
if (registrationRequired)
{
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java 2010-01-12
15:09:42 UTC (rev 1238)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java 2010-01-12
15:14:16 UTC (rev 1239)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, 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.
@@ -26,7 +26,6 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.portal.webui.container.UIContainerForm;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -37,8 +36,8 @@
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.UIPopupWindow;
-import org.exoplatform.webui.core.UITabPane;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
+import org.exoplatform.webui.core.renderers.ValueRenderer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.gatein.wsrp.producer.config.ProducerConfiguration;
@@ -47,11 +46,14 @@
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
/** @author Wesley Hales */
@ComponentConfigs({
- @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class,
template = "app:/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl"),
+ @ComponentConfig(id = UIWsrpProducerOverview.REGISTRATION_PROPERTIES, type =
UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
@ComponentConfig(
lifecycle = UIApplicationLifecycle.class,
template =
"app:/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl",
@@ -82,6 +84,18 @@
addChild(UIWsrpProducerEditor.class, null, null);
// registration properties
registrationProperties = addChild(UIGrid.class, REGISTRATION_PROPERTIES,
REGISTRATION_PROPERTIES);
+
+ // add renderer for LocalizedString
+ ValueRenderer<LocalizedString> renderer = new
ValueRenderer<LocalizedString>()
+ {
+ @Override
+ public String render(LocalizedString value)
+ {
+ return value.getValue();
+ }
+ };
+ registrationProperties.registerRendererFor(renderer, LocalizedString.class);
+
//configure the edit and delete buttons based on an id from the data list - this
will also be passed as param to listener
registrationProperties.configure("key", FIELDS, SELECT_ACTIONS);
registrationProperties.getUIPageIterator().setId(REGISTRATION_PROPERTIES_ITERATOR);
Deleted:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl 2010-01-12
15:09:42 UTC (rev 1238)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl 2010-01-12
15:14:16 UTC (rev 1239)
@@ -1,112 +0,0 @@
-<%
- import org.exoplatform.webui.core.UIComponent;
- import org.exoplatform.webui.form.UIForm;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import org.gatein.wsrp.registration.LocalizedString;
-
- String[] beanFields = uicomponent.getBeanFields();
- String[] beanActions = uicomponent.getBeanActions();
- UIComponent uiParent = uicomponent.getParent();
- String name = uicomponent.getLabel();
- UIForm uiForm = uicomponent.getAncestorOfType(UIForm.class);
-
- DateFormat dateFormat = null;
- LocalizedString localizedString = null;
-%>
-<div id="$uicomponent.id">
- <table class="UIGrid" cellspacing="0">
- <thead>
- <tr>
- <%if(name != null) {%>
- <%for(field in beanFields) { %>
- <th><%=_ctx.appRes(name+".header."+field)%></th>
- <%}%>
- <%if(beanActions != null) { %>
- <th><%=_ctx.appRes(name+".header.action")%></th>
- <%}%>
- <%}%>
- <%if(name == null) {%>
- <%for(field in beanFields) { %>
- <th><%=_ctx.appRes(uiParent.getName()+".header."+field)%></th>
- <%}%>
- <%if(beanActions != null && beanActions.length > 0) { %>
- <th><%=_ctx.appRes(uiParent.getName()+".header.action")%></th>
- <%}%>
- <%}%>
- </tr>
- </thead>
- <tbody>
- <%if(uicomponent.getUIPageIterator().getAvailable() < 1) {%>
- <tr>
- <td style="font-style:italic; color: #FF5604; text-align: center;"
colspan="<%=beanFields.length+1%>">
- <%=_ctx.appRes("UIGrid.msg.empty")%>
- </td>
- </tr>
- <%} else {
- def rowClass = null;
- boolean even = true;
- for (bean in uicomponent.getBeans()) {
- if(even) rowClass = "EvenRow";
- else rowClass = "OddRow";
- even = !even;
- %>
- <tr class="$rowClass">
- <%
- for(field in beanFields) {
- def fieldValue = uicomponent.getFieldValue(bean, field);
- def cssClass = "";
- if(fieldValue != null) {
- def fieldClass = fieldValue.getClass();
- if(fieldClass == Integer.class) cssClass = "number";
- else if(java.util.Date.class.isAssignableFrom(fieldClass)) {
- if(dateFormat == null) dateFormat = new SimpleDateFormat("HH:mm:ss
yyyy-MM-dd");
- cssClass = "Datetime";
- fieldValue = dateFormat.format(fieldValue);
- }else
if(org.gatein.wsrp.registration.LocalizedString.class.isAssignableFrom(fieldClass)) {
- fieldValue = fieldValue.value
- }
- else cssClass = "Text";
- } else {
- fieldValue = "";
- }
- String value = fieldValue.toString();
- println "<td><div class=\""+cssClass+"\"
title='$fieldValue'>"+fieldValue+"</div></td>";
- }
- if(beanActions != null && beanActions.length > 0) {
- %>
- <td>
- <div class="ActionContainer">
- <%
- def beanIdField = uicomponent.getBeanIdField();
- for(action in beanActions) {
- def beanId = uicomponent.getFieldValue(bean, beanIdField) ;
- if(action == null) continue;
- String title = _ctx.appRes(uicomponent.getParent().getName() +
".action.title." + action);
- String actionLink = "";
- if(uiForm != null){
- actionLink = uiForm.event(action, uicomponent.getParent().getId(), beanId);
- } else {
- actionLink = uiParent.event(action, beanId);
- }
- %>
- <img onclick="$actionLink" alt=""
title="$title" src="/eXoResources/skin/sharedImages/Blank.gif"
class="${action}Icon" />
- <%}%>
- </div>
- </td>
- <%
- }
- %>
- </tr>
- <%
- }
- }
- %>
- </tbody>
- </table> <!--End UIGrid-->
- <%
- if(uicomponent.getUIPageIterator().getAvailablePage() > 1) {
- _ctx.renderUIComponent(uicomponent.getUIPageIterator());
- }
- %>
-</div>
\ No newline at end of file