Author: wesleyhales
Date: 2010-01-10 13:02:26 -0500 (Sun, 10 Jan 2010)
New Revision: 1211
Added:
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/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerPropertyEditor.gtmpl
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
Log:
Fixed issues with grid and other errors. Had to utilize ProducerOverview to do so. Still
working on getting tab to stick when change is made.
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-09
22:38:27 UTC (rev 1210)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-10
18:02:26 UTC (rev 1211)
@@ -26,10 +26,12 @@
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;
@@ -55,23 +57,18 @@
import java.util.Map;
/** @author Wesley Hales */
-@ComponentConfigs({
- @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class,
template = "system:/groovy/webui/core/UIGrid.gtmpl"),
- @ComponentConfig(
- lifecycle = UIFormLifecycle.class,
- template =
"app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
- events = {
- @EventConfig(listeners = UIWsrpProducerEditor.AddPropertyActionListener.class),
- @EventConfig(listeners =
UIWsrpProducerEditor.EditPropertyActionListener.class),
- @EventConfig(listeners =
UIWsrpProducerEditor.DeletePropertyActionListener.class),
- @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
- }
- )})
+
+@ComponentConfig(
+ lifecycle = UIFormLifecycle.class,
+ template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
+ events = {
+ @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
+})
+
public class UIWsrpProducerEditor extends UIForm
{
- private static String[] FIELDS = {"name", "description",
"label", "hint"};
- private static String[] SELECT_ACTIONS = {"AddProperty",
"EditProperty", "DeleteProperty"};
+
private static final String REG_REQUIRED_FOR_DESCRIPTION =
"registrationrequiredforfulldescription";
private static final String STRICT_MODE = "strictmode";
private static final String REQUIRES_REGISTRATION = "requiresregistration";
@@ -80,16 +77,15 @@
private static final String REGISTRATION_DETAILS = "registrationdetails";
private ProducerConfigurationService configService;
- private static final String REGISTRATION_PROPERTIES =
"RegistrationPropertySelector";
- private static final String REGISTRATION_PROPERTIES_ITERATOR =
"ProducerPropPageIterator";
+
private UIFormInputSet registrationDetails;
private UIFormInputBase<String> policy;
private UIFormInputBase<String> validator;
private UIFormCheckBoxInput regReqForDesc;
private UIFormCheckBoxInput strictMode;
private UIFormCheckBoxInput<Boolean> regRequired;
- private UIGrid registrationProperties;
+
public UIWsrpProducerEditor() throws Exception
{
configService =
Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
@@ -120,22 +116,9 @@
validator = new UIFormStringInput(VALIDATOR_CLASS, VALIDATOR_CLASS, null);
registrationDetails.addUIFormInput(validator);
- // registration properties
- registrationProperties = registrationDetails.addChild(UIGrid.class,
REGISTRATION_PROPERTIES, null);
- //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("name", FIELDS, SELECT_ACTIONS);
-
registrationProperties.getUIPageIterator().setId(REGISTRATION_PROPERTIES_ITERATOR);
- registrationDetails.addChild(registrationProperties.getUIPageIterator());
- registrationProperties.getUIPageIterator().setRendered(false);
+
init();
-
- //add the popup for property edit and adding new properties
- UIPopupWindow popup = addChild(UIPopupWindow.class, null, null);
- popup.setWindowSize(400, 300);
- UIWsrpProducerPropertyEditor propertyForm =
createUIComponent(UIWsrpProducerPropertyEditor.class, null, "Producer Property
Editor");
- popup.setUIComponent(propertyForm);
- popup.setRendered(false);
}
ProducerConfigurationService getService()
@@ -159,7 +142,7 @@
{
registrationDetails.setRendered(true);
- RegistrationPolicy policy = registrationRequirements.getPolicy();
+ RegistrationPolicy policy = registrationRequirements.getPolicy();
String policyClassName = policy.getClass().getName();
this.policy.setValue(policyClassName);
@@ -176,72 +159,20 @@
}
// registration properties
- Map<QName, RegistrationPropertyDescription> regProps =
configuration.getRegistrationRequirements().getRegistrationProperties();
-
registrationProperties.getUIPageIterator().setPageList(createPageList(getPropertyList(regProps)));
+
}
else
{
registrationDetails.setRendered(false);
+
//getParent().findComponentById(UIWsrpProducerOverview.REGISTRATION_PROPERTIES).setRendered(false);
}
}
- private List<RegistrationPropertyDescription> getPropertyList(Map<QName,
RegistrationPropertyDescription> descriptions) throws Exception
- {
- Comparator<RegistrationPropertyDescription> descComparator = new
Comparator<RegistrationPropertyDescription>()
- {
- public int compare(RegistrationPropertyDescription o1,
RegistrationPropertyDescription o2)
- {
- return o1.getName().toString().compareTo(o2.getName().toString());
- }
- };
- List<RegistrationPropertyDescription> result = new
ArrayList<RegistrationPropertyDescription>(descriptions.values());
- Collections.sort(result, descComparator);
- return result;
- }
- private LazyPageList<RegistrationPropertyDescription> createPageList(final
List<RegistrationPropertyDescription> pageList)
- {
- return new LazyPageList<RegistrationPropertyDescription>(new
ListAccess<RegistrationPropertyDescription>()
- {
- public int getSize() throws Exception
- {
- return pageList.size();
- }
- public RegistrationPropertyDescription[] load(int index, int length) throws
Exception, IllegalArgumentException
- {
- RegistrationPropertyDescription[] pcs = new
RegistrationPropertyDescription[pageList.size()];
- if (index < 0)
- {
- throw new IllegalArgumentException("Illegal index: index must be a
positive number");
- }
-
- if (length < 0)
- {
- throw new IllegalArgumentException("Illegal length: length must be a
positive number");
- }
-
- if (index + length > pageList.size())
- {
- throw new IllegalArgumentException(
- "Illegal index or length: sum of the index and the length cannot
be greater than the list size");
- }
-
- for (int i = 0; i < length; i++)
- {
- pcs[i] = pageList.get(i + index);
- }
-
- return pcs;
- }
-
- }, 10);
- }
-
-
static public class SaveActionListener extends
EventListener<UIWsrpProducerEditor>
{
public void execute(Event<UIWsrpProducerEditor> event) throws Exception
@@ -275,70 +206,7 @@
}
}
- static public class EditPropertyActionListener extends
EventListener<UIWsrpProducerEditor>
- {
- public void execute(Event<UIWsrpProducerEditor> event) throws Exception
- {
- UIWsrpProducerEditor source = event.getSource();
- UIPopupWindow popup = source.getChild(UIPopupWindow.class);
- UIWsrpProducerPropertyEditor editor =
(UIWsrpProducerPropertyEditor)popup.getUIComponent();
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- try
- {
-
editor.setRegistrationPropertyDescription(source.getService().getConfiguration().getRegistrationRequirements().getRegistrationPropertyWith(id));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- popup.setUIComponent(editor);
- popup.setRendered(true);
- popup.setShow(true);
- }
- }
-
- static public class DeletePropertyActionListener extends
EventListener<UIWsrpProducerEditor>
- {
- public void execute(Event<UIWsrpProducerEditor> event)
- {
- UIWsrpProducerEditor source = event.getSource();
- UIApplication uiApp = event.getRequestContext().getUIApplication();
- UIPopupWindow popup = source.getChild(UIPopupWindow.class);
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- try
- {
- ProducerConfigurationService service = source.getService();
-
service.getConfiguration().getRegistrationRequirements().removeRegistrationProperty(id);
- service.saveConfiguration();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- uiApp.addMessage(new ApplicationMessage("Failed to delete Producer
Property. Cause: " + e.getCause(), null, ApplicationMessage.ERROR));
- }
-
- }
- }
-
- static public class AddPropertyActionListener extends
EventListener<UIWsrpProducerEditor>
- {
- public void execute(Event<UIWsrpProducerEditor> event) throws Exception
- {
- UIWsrpProducerEditor source = event.getSource();
- UIPopupWindow popup = source.getChild(UIPopupWindow.class);
- UIWsrpProducerPropertyEditor editor =
(UIWsrpProducerPropertyEditor)popup.getUIComponent();
-
- //reset the form
- editor.setRegistrationPropertyDescription(null);
- popup.setRendered(true);
- popup.setShow(true);
- popup.setShowCloseButton(true);
- //popup.setShowMask(true);
-
- }
- }
-
public static class RegistrationOnChangeActionListener extends
EventListener<UIFormCheckBoxInput>
{
public void execute(Event<UIFormCheckBoxInput> event) throws Exception
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-09
22:38:27 UTC (rev 1210)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java 2010-01-10
18:02:26 UTC (rev 1211)
@@ -22,28 +22,214 @@
*/
package org.exoplatform.wsrp.webui.component;
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.web.application.ApplicationMessage;
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.UIContainer;
+import org.exoplatform.webui.core.UIGrid;
+import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+import org.gatein.wsrp.producer.config.ProducerConfiguration;
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
+import org.gatein.wsrp.registration.LocalizedString;
+import org.gatein.wsrp.registration.RegistrationPropertyDescription;
+import javax.xml.namespace.QName;
+import java.util.*;
+
/** @author Wesley Hales */
+@ComponentConfigs({
+@ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class,
template = "app:/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl"),
@ComponentConfig(
lifecycle = UIApplicationLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl"
-)
+ template = "app:/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl",
+ events = {
+ @EventConfig(listeners = UIWsrpProducerOverview.AddPropertyActionListener.class),
+ @EventConfig(listeners = UIWsrpProducerOverview.EditActionListener.class),
+ @EventConfig(listeners = UIWsrpProducerOverview.DeleteActionListener.class)
+ }
+)})
+
public class UIWsrpProducerOverview extends UIContainer
{
+ private static String[] FIELDS = {"key","name",
"description", "label", "hint"};
+ private static String[] SELECT_ACTIONS = {"Add", "Edit",
"Delete"};
+
+ public static final String REGISTRATION_PROPERTIES =
"RegistrationPropertySelector";
+ private static final String REGISTRATION_PROPERTIES_ITERATOR =
"ProducerPropPageIterator";
+ private UIGrid registrationProperties;
+ private ProducerConfigurationService configService;
private UIWsrpProducerEditor producerForm;
public UIWsrpProducerOverview() throws Exception
{
- producerForm = createUIComponent(UIWsrpProducerEditor.class, null, "Producer
Editor");
- addChild(producerForm);
+ configService =
Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
+ ProducerConfiguration configuration = configService.getConfiguration();
+ //producerForm = createUIComponent();
+ addChild(UIWsrpProducerEditor.class, null, null);
+ // registration properties
+ registrationProperties = addChild(UIGrid.class, REGISTRATION_PROPERTIES,
REGISTRATION_PROPERTIES);
+ //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);
+ //registrationDetails.addChild(registrationProperties.getUIPageIterator());
+ registrationProperties.getUIPageIterator().setRendered(false);
+
+ Map<QName, RegistrationPropertyDescription> regProps =
configuration.getRegistrationRequirements().getRegistrationProperties();
+
registrationProperties.getUIPageIterator().setPageList(createPageList(getPropertyList(regProps)));
+
+ //add the popup for property edit and adding new properties
+ UIPopupWindow popup = addChild(UIPopupWindow.class, null, null);
+ popup.setWindowSize(400, 300);
+ UIWsrpProducerPropertyEditor propertyForm =
createUIComponent(UIWsrpProducerPropertyEditor.class, null, "Producer Property
Editor");
+ popup.setUIComponent(propertyForm);
+ popup.setRendered(false);
+
}
+ private List<RegistrationPropertyDescription> getPropertyList(Map<QName,
RegistrationPropertyDescription> descriptions) throws Exception
+ {
+ Comparator<RegistrationPropertyDescription> descComparator = new
Comparator<RegistrationPropertyDescription>()
+ {
+ public int compare(RegistrationPropertyDescription o1,
RegistrationPropertyDescription o2)
+ {
+ return o1.getName().toString().compareTo(o2.getName().toString());
+ }
+ };
+ List<RegistrationPropertyDescription> result = new
ArrayList<RegistrationPropertyDescription>();
+ for (Object o : descriptions.entrySet()){
+ Map.Entry entry = (Map.Entry)o;
+ RegistrationPropertyDescription rpd =
(RegistrationPropertyDescription)entry.getValue();
+ result.add(rpd);
+
+ }
+
+
+ //List<RegistrationPropertyDescription> result = new
ArrayList<RegistrationPropertyDescription>(descriptions.values());
+ //Collections.sort(result, descComparator);
+ return result;
+ }
+
+ private LazyPageList<RegistrationPropertyDescription> createPageList(final
List<RegistrationPropertyDescription> pageList)
+ {
+ return new LazyPageList<RegistrationPropertyDescription>(new
ListAccess<RegistrationPropertyDescription>()
+ {
+
+ public int getSize() throws Exception
+ {
+ return pageList.size();
+ }
+
+ public RegistrationPropertyDescription[] load(int index, int length) throws
Exception, IllegalArgumentException
+ {
+ RegistrationPropertyDescription[] pcs = new
RegistrationPropertyDescription[pageList.size()];
+
+ if (index < 0)
+ {
+ throw new IllegalArgumentException("Illegal index: index must be a
positive number");
+ }
+
+ if (length < 0)
+ {
+ throw new IllegalArgumentException("Illegal length: length must be a
positive number");
+ }
+
+ if (index + length > pageList.size())
+ {
+ throw new IllegalArgumentException(
+ "Illegal index or length: sum of the index and the length cannot
be greater than the list size");
+ }
+
+ for (int i = 0; i < length; i++)
+ {
+ pcs[i] = pageList.get(i + index);
+ }
+
+ return pcs;
+ }
+
+ }, 10);
+ }
+
+static public class EditActionListener extends
EventListener<UIWsrpProducerOverview>
+ {
+ public void execute(Event<UIWsrpProducerOverview> event) throws Exception
+ {
+ UIWsrpProducerOverview source = event.getSource();
+ UIPopupWindow popup = source.getChild(UIPopupWindow.class);
+ UIWsrpProducerPropertyEditor editor =
(UIWsrpProducerPropertyEditor)popup.getUIComponent();
+ String id = event.getRequestContext().getRequestParameter(OBJECTID);
+ try
+ {
+
editor.setRegistrationPropertyDescription(source.getService().getConfiguration().getRegistrationRequirements().getRegistrationPropertyWith(id));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ popup.setUIComponent(editor);
+ popup.setRendered(true);
+ popup.setShow(true);
+
+ }
+ }
+
+ static public class DeleteActionListener extends
EventListener<UIWsrpProducerOverview>
+ {
+ public void execute(Event<UIWsrpProducerOverview> event)
+ {
+ UIWsrpProducerOverview source = event.getSource();
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+ UIPopupWindow popup = source.getChild(UIPopupWindow.class);
+ String id = event.getRequestContext().getRequestParameter(OBJECTID);
+ try
+ {
+ ProducerConfigurationService service = source.getService();
+
service.getConfiguration().getRegistrationRequirements().removeRegistrationProperty(id);
+ service.saveConfiguration();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ uiApp.addMessage(new ApplicationMessage("Failed to delete Producer
Property. Cause: " + e.getCause(), null, ApplicationMessage.ERROR));
+ }
+
+ }
+ }
+
+ static public class AddPropertyActionListener extends
EventListener<UIWsrpProducerOverview>
+ {
+ public void execute(Event<UIWsrpProducerOverview> event) throws Exception
+ {
+ UIWsrpProducerOverview source = event.getSource();
+ UIPopupWindow popup = source.getChild(UIPopupWindow.class);
+ UIWsrpProducerPropertyEditor editor =
(UIWsrpProducerPropertyEditor)popup.getUIComponent();
+
+ //reset the form
+ editor.setRegistrationPropertyDescription(null);
+ popup.setRendered(true);
+ popup.setShow(true);
+ popup.setShowCloseButton(true);
+ //popup.setShowMask(true);
+
+ }
+ }
+
+ ProducerConfigurationService getService()
+ {
+ return configService;
+ }
+
+
public ProducerConfigurationService getProducerConfigurationService() throws
Exception
{
ExoContainer manager = ExoContainerContext.getCurrentContainer();
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl 2010-01-09
22:38:27 UTC (rev 1210)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl 2010-01-10
18:02:26 UTC (rev 1211)
@@ -1,67 +1,54 @@
-<%
- import org.exoplatform.webui.form.UIFormStringInput;
-%>
-
<div class="UILoginForm" id="ChildTest">
<% uiform.begin() %>
- <%
- UIFormStringInput name = uicomponent.getChild(UIFormStringInput.class);
- %>
- <div class="UserName">
- <div>
- <% //uiform.renderChild(0); %>
- <%
- for (field in uiform.getChildren())
- {
- if (field.isRendered())
- {
- %>
- <div class="form-row">
+
+ <div class="UserName">
+ <div>
+ <% //uiform.renderChild(0); %>
+ <%
+ for (field in uiform.getChildren()) {
+ if (field.isRendered()) {
+ %>
+ <div class="form-row">
<label>
<% fieldName = uicomponent.getLabel(field.getName()); %>
- <% if (!fieldName.equals(uicomponent.getId()))
- { %>
+ <% if (!fieldName.equals(uicomponent.getId())) { %>
<span class="FieldLabel">
- <% if (fieldName != null && fieldName.length() > 0)
- { %>
+ <% if (fieldName != null && fieldName.length() > 0) { %>
<%=uicomponent.getLabel(field.getName())%>
<% } %>
</span>
<% uiform.renderField(field) %>
<% }
- else
- { %>
+ else { %>
<% uiform.renderField(field) %>
<% } %>
</label>
- </div>
- <%
- }
- } %>
-
-
-
</div>
+ <%
+ }
+ } %>
</div>
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
- </div>
+
+ </div>
+ <div class="UIAction">
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
</div>
</div>
</div>
- </td>
- </tr>
- </table>
- </div>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
Added:
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
(rev 0)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpGrid.gtmpl 2010-01-10
18:02:26 UTC (rev 1211)
@@ -0,0 +1,112 @@
+<%
+ 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
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl 2010-01-09
22:38:27 UTC (rev 1210)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl 2010-01-10
18:02:26 UTC (rev 1211)
@@ -1,69 +1,32 @@
<div class="WSRPProducerConfiguration">
<%
uiform.begin()
- for (field in uiform.getChildren())
- {
- if (field.isRendered())
- {
%>
- <div class="row">
- <%
- label = uicomponent.getLabel(field.getName());
- if (!label.equals(uicomponent.getId()))
- {
- %>
- <label>
- <%
- if (label != null && label.length() > 0)
- {
- %>
- <%=label%>
- <%
- }
- %>
- </label>
- <% uiform.renderField(field) %>
- </div>
<%
- }
- }
- }
- %>
-
- <div class="FloatRight">
-
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div
onclick="<%=uicomponent.event("AddProperty")%>"
class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.AddProperty")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- <td>
- <div
onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
+ for (field in uiform.getChildren()) {
+ if (field.isRendered()) {
+ %>
+ <div class="form-row">
+ <label>
+ <% fieldName = uicomponent.getLabel(field.getName()); %>
+ <% if (!fieldName.equals(uicomponent.getId())) { %>
+ <span class="FieldLabel">
+ <% if (fieldName != null && fieldName.length() > 0) { %>
+ <%=uicomponent.getLabel(field.getName())%>
+ <% } %>
+ </span>
+ <% uiform.renderField(field) %>
+ <% }
+ else { %>
+ <% uiform.renderField(field) %>
+ <% } %>
+ </label>
</div>
+ <%
+ }
+ } %>
-
-
- <div class="ClearRight"><span></span></div>
+
<% uiform.end() %>
- </div>
+
</div>
\ No newline at end of file
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-09
22:38:27 UTC (rev 1210)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-10
18:02:26 UTC (rev 1211)
@@ -1,4 +1,40 @@
+<%
+ import org.exoplatform.wsrp.webui.component.UIWsrpProducerEditor;
+%>
+
<div class="<%=uicomponent.getId()%>"
id="<%=uicomponent.getId()%>">
<% uicomponent.renderChildren(); %>
+
+ <div class="FloatRight">
+
+ <div class="UIAction">
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div
onclick="<%=uicomponent.event("AddProperty")%>"
class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.AddProperty")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </td>
+ <td>
+ <div
onclick="<%=uicomponent.getChild(UIWsrpProducerEditor.class).event("Save")%>"
class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getChild(UIWsrpProducerEditor.class).getId()
+ ".action.Save")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
</div>
\ No newline at end of file
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerPropertyEditor.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerPropertyEditor.gtmpl 2010-01-09
22:38:27 UTC (rev 1210)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerPropertyEditor.gtmpl 2010-01-10
18:02:26 UTC (rev 1211)
@@ -3,63 +3,59 @@
<%
%>
- <div class="SignIn">Add New Registration Property</div>
- <div class="FloatRight">
- <div class="FloatLeft">
- <div class="UserName">
+ <div class="form-title">Add New Registration Property</div>
+ <div>
+
+
<div>
- <!--label>Consumer Name</label-->
- <% //uiform.renderChild(0); %>
- <%
- for (field in uiform.getChildren())
- {
- if (field.isRendered())
- {
- %>
- <div>
- <% fieldName = uicomponent.getLabel(field.getName()); %>
- <% if (!fieldName.equals(uicomponent.getId()))
- { %>
- <div class="FieldLabel">
- <% if (fieldName != null && fieldName.length() > 0)
- { %>
- <%=uicomponent.getLabel(field.getName())%>
- <% } %>
+ <% //uiform.renderChild(0); %>
+ <%
+ for (field in uiform.getChildren()) {
+ if (field.isRendered()) {
+ %>
+ <div class="form-row">
+ <label>
+ <% fieldName = uicomponent.getLabel(field.getName()); %>
+ <% if (!fieldName.equals(uicomponent.getId())) { %>
+ <span class="FieldLabel">
+ <% if (fieldName != null && fieldName.length() > 0) {
%>
+ <%=uicomponent.getLabel(field.getName())%>
+ <% } %>
+ </span>
+ <% uiform.renderField(field) %>
+ <% }
+ else { %>
+ <% uiform.renderField(field) %>
+ <% } %>
+ </label>
</div>
- <div class="FieldComponent"><% uiform.renderField(field)
%></div>
- <% }
- else
- { %>
- <div class="FieldComponent"><% uiform.renderField(field)
%></div>
- <% } %>
+ <%
+ }
+ } %>
+
</div>
- <%
- }
- } %>
+
</div>
- </div>
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
+ <div class="UIAction">
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
+ </div>
</div>
</div>
</div>
- </div>
- </td>
- </tr>
- </table>
- </div>
+ </td>
+ </tr>
+ </table>
+ </div>
- <div class="ClearLeft"><span></span></div>
- </div>
- <div class="ClearRight"><span></span></div>
- <% uiform.end() %>
-</div>
+
+ <% uiform.end() %>
+
</div>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-01-09
22:38:27 UTC (rev 1210)
+++ portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-01-10
18:02:26 UTC (rev 1211)
@@ -3,6 +3,7 @@
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();
@@ -11,6 +12,7 @@
UIForm uiForm = uicomponent.getAncestorOfType(UIForm.class);
DateFormat dateFormat = null;
+ LocalizedString localizedString = null;
%>
<div id="$uicomponent.id">
<table class="UIGrid" cellspacing="0">
@@ -61,7 +63,9 @@
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 = "";