anmolbabu has uploaded a new change for review.

Change subject: webadmin : Fix Menu Cell click event
......................................................................

webadmin : Fix Menu Cell click event

A cell registers to events that it wants to listen
with its table. The table notifies the cell by invoking
onBrowserEvent when a registered event occurs.

In case of ActivityColumn of Volumes main tab, it is a
column of a CompositeCell - VolumeActivityCompositeCell
which is in-turn a combination of :

1.VolumeActivityStatusColumn - Column of AbstractCell
                               VolumeActivityStatusCell
2.Column of AbstractCell - VolumeActivitySeperatorCell
3.Column of AbstractCell - MenuCell - for rebalance
4.Column of AbstractCell - MenuCell - for remove-brick

So, this being the situation, the Composite of the Composites
which is the VolumeActivityCompositeCell receieves the events
to which it subscribes from the table and then only constituent
cells can get them but in our case, the VolumeActivityCompositeCell
was not subscribing for the click event and hence the constituent
MenuCell was not notified of the click.
Hence this patch modifies VolumeActivityCompositeCell to
subscribe to a superset of all events that its constituent cells
need.

Change-Id: I32a223494d23848c530ee083dc14e1d072a86967
Signed-off-by: Anmol Babu <anb...@redhat.com>
---
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityCompositeCell.java
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/41528/1

diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityCompositeCell.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityCompositeCell.java
index c4efc01..6e9c94c 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityCompositeCell.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/cell/VolumeActivityCompositeCell.java
@@ -1,15 +1,19 @@
 package org.ovirt.engine.ui.webadmin.widget.table.cell;
 
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport;
 import org.ovirt.engine.ui.common.widget.table.cell.CompositeCell;
 
+import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.cell.client.Cell;
 import com.google.gwt.cell.client.HasCell;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.user.cellview.client.Column;
 
 public class VolumeActivityCompositeCell<T extends GlusterTaskSupport> extends 
CompositeCell<T> {
 
@@ -21,6 +25,26 @@
     }
 
     @Override
+    public Set<String> getConsumedEvents() {
+        Set<String> set = new HashSet<>(super.getConsumedEvents());
+        if (hasCells == null) {
+            return set;
+        }
+        for(HasCell<T, ?> currentHasCell : hasCells) {
+            if(currentHasCell instanceof Column) {
+                Set<String> consumedEvents = 
((Column)(currentHasCell)).getCell().getConsumedEvents();
+                if(consumedEvents != null) {
+                    set.addAll(consumedEvents);
+                }
+            }
+            if(currentHasCell instanceof AbstractCell) {
+                set.addAll(((AbstractCell)currentHasCell).getConsumedEvents());
+            }
+        }
+        return set;
+    }
+
+    @Override
     public void render(Context context, T value, SafeHtmlBuilder sb, String 
id) {
         if (!isVisible(value)) {
             return;


-- 
To view, visit https://gerrit.ovirt.org/41528
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32a223494d23848c530ee083dc14e1d072a86967
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: anmolbabu <anb...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to