Author: wesleyhales
Date: 2010-01-10 19:15:37 -0500 (Sun, 10 Jan 2010)
New Revision: 1217
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/UIWsrpConsumerOverview.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
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpPopup.gtmpl
Log:
Fixed dynamic display of property grid, and a little cleanup... tried a few things to get
statefull tabs, but nothing worked
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-11
00:14:03 UTC (rev 1216)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java 2010-01-11
00:15:37 UTC (rev 1217)
@@ -50,12 +50,18 @@
events = {@EventConfig(listeners = UIWsrpConsole.SelectTabActionListener.class)})})
public class UIWsrpConsole extends UIContainer
{
+
+ private UITabPane uiTabPane;
+
public UIWsrpConsole() throws Exception
{
- UITabPane uiTabPane = addChild(UITabPane.class, "UIWsrpConsoleTab",
null);
+ uiTabPane = addChild(UITabPane.class, "UIWsrpConsoleTab", null);
uiTabPane.addChild(UIWsrpConsumerOverview.class, null, "Manage
Consumers").setRendered(true);
- uiTabPane.addChild(UIWsrpProducerOverview.class, null, "Producer
Configuration");
- uiTabPane.setSelectedTab(1);
+ uiTabPane.addChild(UIWsrpProducerOverview.class, null, "Producer
Configuration").setRendered(false);
+
+ if (uiTabPane.getSelectedTabId().equals("")){
+ uiTabPane.setSelectedTab(1);
+ }
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2010-01-11
00:14:03 UTC (rev 1216)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2010-01-11
00:15:37 UTC (rev 1217)
@@ -26,6 +26,7 @@
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.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -35,6 +36,7 @@
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.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -122,6 +124,7 @@
public UIWsrpConsumerOverview() throws Exception
{
+ //setSelectedTab(1);
UIPopupWindow popup = addChild(UIPopupWindow.class, null, null);
popup.setWindowSize(450, 0);
UIWsrpConsumerEditor consumerForm = createUIComponent(UIWsrpConsumerEditor.class,
null, "Consumer Editor");
@@ -321,7 +324,14 @@
}
}
+ public void processRender(WebuiRequestContext context) throws Exception
+ {
+// UITabPane uiTabPane =
context.getUIApplication().findComponentById("UIWsrpConsoleTab");
+// uiTabPane.setSelectedTab(1);
+ super.processRender(context);
+ }
+
public WSRPConsumer getConsumerFromEvent(Event<?> event) throws Exception
{
ConsumerRegistry consumerRegistry = getConsumerRegistry();
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-11
00:14:03 UTC (rev 1216)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-11
00:15:37 UTC (rev 1217)
@@ -59,11 +59,11 @@
/** @author Wesley Hales */
@ComponentConfig(
- lifecycle = UIFormLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
- events = {
- @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
-})
+ lifecycle = UIFormLifecycle.class,
+ template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
+ events = {
+ @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
+ })
public class UIWsrpProducerEditor extends UIForm
{
@@ -116,18 +116,12 @@
validator = new UIFormStringInput(VALIDATOR_CLASS, VALIDATOR_CLASS, null);
registrationDetails.addUIFormInput(validator);
-
- init();
+ //init();
}
- ProducerConfigurationService getService()
+ public void processRender(WebuiRequestContext context) throws Exception
{
- return configService;
- }
-
- private void init() throws Exception
- {
ProducerConfiguration configuration = configService.getConfiguration();
ProducerRegistrationRequirements registrationRequirements =
configuration.getRegistrationRequirements();
@@ -137,12 +131,17 @@
boolean registrationRequired = registrationRequirements.isRegistrationRequired();
regRequired.setValue(registrationRequired);
+
+
+
// if registration is required then we display more information
if (registrationRequired)
{
+
registrationDetails.setRendered(true);
+
context.getUIApplication().findComponentById(UIWsrpProducerOverview.REGISTRATION_PROPERTIES).setRendered(true);
- RegistrationPolicy policy = registrationRequirements.getPolicy();
+ RegistrationPolicy policy = registrationRequirements.getPolicy();
String policyClassName = policy.getClass().getName();
this.policy.setValue(policyClassName);
@@ -164,15 +163,23 @@
else
{
registrationDetails.setRendered(false);
-
//getParent().findComponentById(UIWsrpProducerOverview.REGISTRATION_PROPERTIES).setRendered(false);
+
context.getUIApplication().findComponentById(UIWsrpProducerOverview.REGISTRATION_PROPERTIES).setRendered(false);
}
+
+ super.processRender(context);
}
+ ProducerConfigurationService getService()
+ {
+ return configService;
+ }
+ private void init() throws Exception
+ {
+ }
-
static public class SaveActionListener extends
EventListener<UIWsrpProducerEditor>
{
public void execute(Event<UIWsrpProducerEditor> event) throws Exception
@@ -213,7 +220,7 @@
{
UIFormCheckBoxInput source = event.getSource();
UIWsrpProducerEditor parent =
source.getAncestorOfType(UIWsrpProducerEditor.class);
- parent.init();
+ //parent.init();
//update only the parent, avoid updating the full portlet
event.getRequestContext().addUIComponentToUpdateByAjax(parent);
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-11
00:14:03 UTC (rev 1216)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerOverview.java 2010-01-11
00:15:37 UTC (rev 1217)
@@ -26,8 +26,10 @@
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;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
@@ -35,6 +37,7 @@
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.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -48,35 +51,36 @@
/** @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",
- events = {
- @EventConfig(listeners = UIWsrpProducerOverview.AddPropertyActionListener.class),
- @EventConfig(listeners = UIWsrpProducerOverview.EditActionListener.class),
- @EventConfig(listeners = UIWsrpProducerOverview.DeleteActionListener.class)
- }
-)})
+ @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",
+ 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[] FIELDS = {"key", "name",
"description", "label", "hint"};
private static String[] SELECT_ACTIONS = {"Add", "Edit",
"Delete"};
- public static final String REGISTRATION_PROPERTIES =
"RegistrationPropertySelector";
+ public static final String REGISTRATION_PROPERTIES =
"RegistrationPropertySelector";
private static final String REGISTRATION_PROPERTIES_ITERATOR =
"ProducerPropPageIterator";
- private UIGrid registrationProperties;
- private ProducerConfigurationService configService;
+ private UIGrid registrationProperties;
+ private ProducerConfigurationService configService;
private UIWsrpProducerEditor producerForm;
public UIWsrpProducerOverview() throws Exception
{
- configService =
Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
- ProducerConfiguration configuration = configService.getConfiguration();
+ //setSelectedTab(2);
+ configService =
Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
+ ProducerConfiguration configuration = configService.getConfiguration();
//producerForm = createUIComponent();
addChild(UIWsrpProducerEditor.class, null, null);
- // registration properties
+ // 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);
@@ -87,16 +91,16 @@
Map<QName, RegistrationPropertyDescription> regProps =
configuration.getRegistrationRequirements().getRegistrationProperties();
registrationProperties.getUIPageIterator().setPageList(createPageList(getPropertyList(regProps)));
- //add the popup for property edit and adding new properties
+ //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
+ private List<RegistrationPropertyDescription> getPropertyList(Map<QName,
RegistrationPropertyDescription> descriptions) throws Exception
{
Comparator<RegistrationPropertyDescription> descComparator = new
Comparator<RegistrationPropertyDescription>()
{
@@ -105,13 +109,14 @@
return o1.getName().toString().compareTo(o2.getName().toString());
}
};
- List<RegistrationPropertyDescription> result = new
ArrayList<RegistrationPropertyDescription>();
- for (Object o : descriptions.entrySet()){
+ 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);
+ RegistrationPropertyDescription rpd =
(RegistrationPropertyDescription)entry.getValue();
+ result.add(rpd);
- }
+ }
//List<RegistrationPropertyDescription> result = new
ArrayList<RegistrationPropertyDescription>(descriptions.values());
@@ -119,7 +124,7 @@
return result;
}
- private LazyPageList<RegistrationPropertyDescription> createPageList(final
List<RegistrationPropertyDescription> pageList)
+ private LazyPageList<RegistrationPropertyDescription> createPageList(final
List<RegistrationPropertyDescription> pageList)
{
return new LazyPageList<RegistrationPropertyDescription>(new
ListAccess<RegistrationPropertyDescription>()
{
@@ -160,7 +165,7 @@
}, 10);
}
-static public class EditActionListener extends
EventListener<UIWsrpProducerOverview>
+ static public class EditActionListener extends
EventListener<UIWsrpProducerOverview>
{
public void execute(Event<UIWsrpProducerOverview> event) throws Exception
{
@@ -224,15 +229,24 @@
}
}
- ProducerConfigurationService getService()
+ ProducerConfigurationService getService()
{
return configService;
}
+ public void processRender(WebuiRequestContext context) throws Exception
+ {
+// UITabPane uiTabPane =
context.getUIApplication().findComponentById("UIWsrpConsoleTab");
+// uiTabPane.setSelectedTab(2);
+ super.processRender(context);
+ }
+
public ProducerConfigurationService getProducerConfigurationService() throws
Exception
{
ExoContainer manager = ExoContainerContext.getCurrentContainer();
return
(ProducerConfigurationService)manager.getComponentInstanceOfType(ProducerConfigurationService.class);
}
+
+
}
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl 2010-01-11
00:14:03 UTC (rev 1216)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl 2010-01-11
00:15:37 UTC (rev 1217)
@@ -22,7 +22,7 @@
<div class="LeftTab">
<div class="RightTab">
<% String consumerLink = "ajaxAsyncGetRequest('" +
uicomponent.url("SelectTab",consumerOverview.getId()) + "', true)"
%>
- <div class="MiddleTab"
onclick="eXo.webui.UIHorizontalTabs.changeTabForUITabPane(this,
'${consumerOverview.getId()}',
'$url');$consumerLink;if(eXo.portal.portalMode) eXo.portal.portalMode -=
2;">
+ <div class="MiddleTab"
onclick="eXo.webui.UIHorizontalTabs.changeTabForUITabPane(this,
'${consumerOverview.getId()}', '$url');$consumerLink;">
<%=_ctx.appRes("UITabPane.title." +
consumerOverview.getId());%>
</div>
</div>
@@ -34,7 +34,7 @@
<div class="LeftTab">
<div class="RightTab">
<% String producerLink = "ajaxAsyncGetRequest('" +
uicomponent.url("SelectTab",producerOverview.getId()) + "', true)"
%>
- <div class="MiddleTab"
onclick="eXo.webui.UIHorizontalTabs.changeTabForUITabPane(this,
'${producerOverview.getId()}',
'$url');$producerLink;if(eXo.portal.portalMode) eXo.portal.portalMode -=
2;">
+ <div class="MiddleTab"
onclick="eXo.webui.UIHorizontalTabs.changeTabForUITabPane(this,
'${producerOverview.getId()}', '$url');$producerLink;">
<%=_ctx.appRes("UITabPane.title." +
producerOverview.getId());%>
</div>
</div>
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpPopup.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpPopup.gtmpl 2010-01-11
00:14:03 UTC (rev 1216)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpPopup.gtmpl 2010-01-11
00:15:37 UTC (rev 1217)
@@ -1,3 +1,3 @@
<div class="<%=uicomponent.getId()%>">
- this is a popup?
+
</div>
\ No newline at end of file