Author: wesleyhales
Date: 2009-12-15 14:52:48 -0500 (Tue, 15 Dec 2009)
New Revision: 1014
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsole.gtmpl
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
Log:
wsrp consumer ui - all actions addded
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java 2009-12-15
11:42:57 UTC (rev 1013)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java 2009-12-15
19:52:48 UTC (rev 1014)
@@ -59,7 +59,7 @@
return getUIStringInput(CONSUMER_NAME).getValue();
}
- public void setConsumerName(WSRPConsumer consumer) throws Exception{
+ public void setConsumer(WSRPConsumer consumer) throws Exception{
if (consumer == null)
{
getUIStringInput(CONSUMER_NAME).setEditable(UIFormStringInput.ENABLE);
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2009-12-15
11:42:57 UTC (rev 1013)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2009-12-15
19:52:48 UTC (rev 1014)
@@ -32,10 +32,12 @@
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.services.organization.MembershipType;
import org.exoplatform.services.organization.OrganizationService;
+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.UIContainer;
import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.UIPopupWindow;
@@ -49,7 +51,7 @@
import java.util.ArrayList;
import java.util.List;
-/** @author Wesley Hales */
+/** @author Wesley Hales */
@ComponentConfigs({
@ComponentConfig(id = "ConsumerSelector", type = UIGrid.class, template =
"system:/groovy/webui/core/UIGrid.gtmpl",
events = { //make note in doc not to put grid listeners here
@@ -59,8 +61,12 @@
template =
"app:/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl",
events = {
@EventConfig(listeners = UIWsrpConsumerOverview.OpenPopupActionListener.class),
- @EventConfig(listeners =
UIWsrpConsumerOverview.EditConsumerActionListener.class),
- @EventConfig(listeners =
UIWsrpConsumerOverview.DeleteConsumerActionListener.class)
+ @EventConfig(listeners = UIWsrpConsumerOverview.EditActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerOverview.DeleteActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerOverview.StartActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerOverview.StopActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerOverview.RefreshActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerOverview.DeactivateActionListener.class)
})
})
@@ -68,7 +74,11 @@
{
public static String[] FIELDS = {"producerId", "active",
"refreshNeeded"};
- public static String[] SELECT_ACTIONS =
{"EditConsumer","DeleteConsumer"};
+ //The action names are also your class names on the ui buttons. You should stick with
common names like:
+ //edit
+ //delete
+ //
+ public static String[] SELECT_ACTIONS =
{"Edit","Delete","Refresh","Deactivate","Start","Stop"};
public UIWsrpConsumerOverview() throws Exception
{
@@ -136,28 +146,27 @@
{
UIWsrpConsumerOverview consumerOverview = event.getSource();
UIPopupWindow popup = consumerOverview.getChild(UIPopupWindow.class);
+ UIWsrpConsumerEditor editor = (UIWsrpConsumerEditor)popup.getUIComponent();
+
+ //reset the form
+ editor.setConsumer(null);
popup.setRendered(true);
popup.setShow(true);
}
}
- static public class EditConsumerActionListener extends
EventListener<UIWsrpConsumerOverview>
+ static public class EditActionListener extends
EventListener<UIWsrpConsumerOverview>
{
public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
{
- ExoContainer manager = ExoContainerContext.getCurrentContainer();
- ConsumerRegistry consumerRegistry =
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
-
UIWsrpConsumerOverview consumerOverview = event.getSource();
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- System.out.println("----------------id " + id);
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
- WSRPConsumer consumer = consumerRegistry.getConsumer(id);
-
if(consumer != null){
UIPopupWindow popup = consumerOverview.getChild(UIPopupWindow.class);
UIWsrpConsumerEditor editor = (UIWsrpConsumerEditor)popup.getUIComponent();
- editor.setConsumerName(consumer);
+ editor.setConsumer(consumer);
popup.setRendered(true);
popup.setShow(true);
}
@@ -166,20 +175,91 @@
}
}
- static public class DeleteConsumerActionListener extends
EventListener<UIWsrpConsumerOverview>
+ static public class DeleteActionListener extends
EventListener<UIWsrpConsumerOverview>
{
public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
{
- ExoContainer manager = ExoContainerContext.getCurrentContainer();
- ConsumerRegistry consumerRegistry =
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+ if(consumer != null){
+ consumer.getProducerInfo().deregister();
+ uiApp.addMessage(new ApplicationMessage("Consumer has been
deleted.", null));
+ }
+
+ }
+ }
+
+ static public class StartActionListener extends
EventListener<UIWsrpConsumerOverview>
+ {
+ public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
+ {
UIWsrpConsumerOverview consumerOverview = event.getSource();
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- System.out.println("----------------id " + id);
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+ if(consumer != null){
+ consumer.start();
+ uiApp.addMessage(new ApplicationMessage("todo", null));
+ }
+
}
}
+ static public class StopActionListener extends
EventListener<UIWsrpConsumerOverview>
+ {
+ public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
+ {
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+
+ if(consumer != null){
+ consumer.stop();
+ uiApp.addMessage(new ApplicationMessage("todo", null));
+ }
+ }
+ }
+
+ static public class DeactivateActionListener extends
EventListener<UIWsrpConsumerOverview>
+ {
+ public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
+ {
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+
+ if(consumer != null){
+ consumer.deactivate();
+ uiApp.addMessage(new ApplicationMessage("todo", null));
+ }
+ }
+ }
+
+ static public class RefreshActionListener extends
EventListener<UIWsrpConsumerOverview>
+ {
+ public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
+ {
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+
+ if(consumer != null){
+ consumer.refresh(true);
+ uiApp.addMessage(new ApplicationMessage("todo", null));
+ }
+ }
+ }
+
+
+ public WSRPConsumer getConsumerFromEvent(Event<?> event) throws Exception{
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ ConsumerRegistry consumerRegistry =
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
+ String id = event.getRequestContext().getRequestParameter(OBJECTID);
+ return consumerRegistry.getConsumer(id);
+ }
+
// public void processRender(WebuiRequestContext context) throws Exception
// {
// super.processRender(context);
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsole.gtmpl
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsole.gtmpl 2009-12-15
11:42:57 UTC (rev 1013)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsole.gtmpl 2009-12-15
19:52:48 UTC (rev 1014)
@@ -1,4 +1,4 @@
<% uicomponent.renderChildren(); %>
<div>
- Console Text...
+
</div>
\ No newline at end of file
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl 2009-12-15
11:42:57 UTC (rev 1013)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl 2009-12-15
19:52:48 UTC (rev 1014)
@@ -1,4 +1,4 @@
-<% uicomponent.renderChildren(); %>
+
<%
import org.exoplatform.webui.core.UIComponent ;
import org.exoplatform.webui.form.UIFormPageIterator ;
@@ -10,6 +10,6 @@
<div class="<%=uicomponent.getId()%>">
<a href="<%=uicomponent.event("OpenPopup",
"")%>">Add Consumer</a>
+ <% uicomponent.renderChildren(); %>
-
</div>
\ No newline at end of file
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css 2009-12-15
11:42:57 UTC (rev 1013)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css 2009-12-15
19:52:48 UTC (rev 1014)
@@ -18,6 +18,25 @@
*/
.UIWsrpPortlet {
- padding: 30px 0;
- border:2px dotted brown;
+
+}
+
+img.RefreshIcon {
+ width: 16px; height: 16px;
+ background:
url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/RefreshIcon.gif')
no-repeat;
+}
+
+img.DeactivateIcon {
+ width: 16px; height: 16px;
+ background:
url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/Cancel.gif') no-repeat;
+}
+
+img.StopIcon {
+ width: 16px; height: 16px;
+ background:
url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DustBinClickButton.gif')
no-repeat;
+}
+
+img.StartIcon {
+ width: 16px; height: 16px;
+ background:
url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/SelectIcon.gif')
no-repeat;
}
\ No newline at end of file