cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomek...@apache.org
Subject svn commit: r1053069 - in /cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser: NavigationSidebarViewImpl.java SelectableTable.java ViewerViewImpl.java
Date Mon, 27 Dec 2010 13:59:57 GMT
Author: tomekopo
Date: Mon Dec 27 13:59:57 2010
New Revision: 1053069

URL: http://svn.apache.org/viewvc?rev=1053069&view=rev
Log:
Fix UI bug: at one moment there should be only single selection of endpoint (e.g. when user
select endpoint in filter sidebar, the selection from explore sidebar should be removed)

Modified:
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarViewImpl.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/SelectableTable.java
    cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarViewImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarViewImpl.java?rev=1053069&r1=1053068&r2=1053069&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarViewImpl.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/NavigationSidebarViewImpl.java
Mon Dec 27 13:59:57 2010
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
 
-import java.util.ArrayList;
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -56,8 +55,27 @@ public class NavigationSidebarViewImpl e
     public NavigationSidebarViewImpl() {
         initWidget(UI_BINDER.createAndBindUi(this));
 
-        initSubscriptionTable(exploreSubscriptionTable);
-        initSubscriptionTable(filterSubscriptionTable);
+        addColumnDefinitions(exploreSubscriptionTable);
+        exploreSubscriptionTable.addSelectRowHandler(new SelectableTable.SelectRowHandler()
{
+
+            public void onSelectRow(int row) {
+
+                // Remove selection from subscription list in filter section
+                filterSubscriptionTable.deselect();
+                presenter.onSubcriptionItemClicked(row);
+            }
+        });
+
+        addColumnDefinitions(filterSubscriptionTable);
+        filterSubscriptionTable.addSelectRowHandler(new SelectableTable.SelectRowHandler()
{
+
+            public void onSelectRow(int row) {
+
+                // Remove selection from subscription list in explore section
+                exploreSubscriptionTable.deselect();
+                presenter.onSubcriptionItemClicked(row);
+            }
+        });
     }
 
     public void setSubscriptions(@Nonnull final List<Subscription> subscriptions) {
@@ -77,11 +95,8 @@ public class NavigationSidebarViewImpl e
         presenter.onManageSubscriptionsButtonClicked();
     }
 
-    private void initSubscriptionTable(@Nonnull final SubscriptionTable table) {
-        List<SelectableTable.ColumnDefinition<Subscription>> columnDefinitions
=
-            new ArrayList<SelectableTable.ColumnDefinition<Subscription>>();
-
-        columnDefinitions.add(new SelectableTable.ColumnDefinition<Subscription>()
{
+    private void addColumnDefinitions(@Nonnull SubscriptionTable table) {
+        table.setColumnDefinitions(new SelectableTable.ColumnDefinition<Subscription>()
{
 
             public String getContent(Subscription subscription) {
                 return subscription.getName();
@@ -91,17 +106,7 @@ public class NavigationSidebarViewImpl e
                 return null;
             }
         });
-
-        table.setColumnDefinitions(columnDefinitions);
-
-        table.addSelectRowHandler(new SelectableTable.SelectRowHandler() {
-
-            public void onSelectRow(int row) {
-                assert presenter != null;
-                presenter.onSubcriptionItemClicked(row);
-            }
-        });
-    }    
+    }
 
     public void setPresenter(Presenter presenter) {
         this.presenter = presenter;

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/SelectableTable.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/SelectableTable.java?rev=1053069&r1=1053068&r2=1053069&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/SelectableTable.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/SelectableTable.java
Mon Dec 27 13:59:57 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -38,7 +39,6 @@ import com.google.gwt.user.client.ui.HTM
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.ScrollPanel;
 import com.google.gwt.user.client.ui.UIObject;
-
 import org.apache.cxf.management.web.logging.logbrowser.client.ui.resources.LogBrowserResources;
 
 public class SelectableTable<T> extends Composite {
@@ -143,10 +143,23 @@ public class SelectableTable<T> extends 
         setColumnsWidth();
     }
 
+    public void setColumnDefinitions(ColumnDefinition<T>... columnDefinitions) {
+        this.columnDefinitions = Arrays.asList(columnDefinitions);
+        setColumnsWidth();
+    }
+
     public void addSelectRowHandler(@Nonnull final SelectRowHandler selectRowHandler) {
         selectRowHandlers.add(selectRowHandler);
     }
 
+    public void deselect() {
+        if (table.getRowCount() > 0) {
+            styleRow(selectedRowIndex, false);
+            selectedRowIndex = 0;
+            isRowSelected = false;
+        }
+    }
+
     private void addEventHandlers() {
         table.addClickHandler(new ClickHandler() {
 
@@ -218,7 +231,7 @@ public class SelectableTable<T> extends 
             selectRowHandler.onSelectRow(selectedRowIndex);
         }
     }
-
+    
     private void restoreRowSelection() {
         if (isRowSelected && selectedRowIndex < table.getRowCount()) {
             selectRow(selectedRowIndex);

Modified: cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java?rev=1053069&r1=1053068&r2=1053069&view=diff
==============================================================================
--- cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
(original)
+++ cxf/sandbox/logbrowser/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/logbrowser/client/ui/browser/ViewerViewImpl.java
Mon Dec 27 13:59:57 2010
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.management.web.logging.logbrowser.client.ui.browser;
 
-import java.util.ArrayList;
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -154,41 +153,38 @@ public class ViewerViewImpl extends Comp
     }
 
     private void initEntryTable() {
-        List<SelectableTable.ColumnDefinition<Entry>> columnDefinitions =
-            new ArrayList<SelectableTable.ColumnDefinition<Entry>>();
-
-        columnDefinitions.add(new SelectableTable.ColumnDefinition<Entry>() {
-
-            public String getContent(Entry entry) {
-                return DT_FORMATTER.format(entry.getEventTimestamp());
-            }
-
-            public String getWidth() {
-                return constans.browseTabDatatimeColumnWidth();
-            }
-        });
-        columnDefinitions.add(new SelectableTable.ColumnDefinition<Entry>() {
-
-            public String getContent(Entry entry) {
-                return entry.getLevel();
-            }
-
-            public String getWidth() {
-                return constans.browseTabLevelColumnWidth();
-            }
-        });
-        columnDefinitions.add(new SelectableTable.ColumnDefinition<Entry>() {
-
-            public String getContent(Entry entry) {
-                return entry.getTitle();
+        entryTable.setColumnDefinitions(
+            new SelectableTable.ColumnDefinition<Entry>() {
+    
+                public String getContent(Entry entry) {
+                    return DT_FORMATTER.format(entry.getEventTimestamp());
+                }
+
+                public String getWidth() {
+                    return constans.browseTabDatatimeColumnWidth();
+                }
+            },
+            new SelectableTable.ColumnDefinition<Entry>() {
+
+                public String getContent(Entry entry) {
+                    return entry.getLevel();
+                }
+
+                public String getWidth() {
+                    return constans.browseTabLevelColumnWidth();
+                }
+            },
+            new SelectableTable.ColumnDefinition<Entry>() {
+
+                public String getContent(Entry entry) {
+                    return entry.getTitle();
+                }
+
+                public String getWidth() {
+                    return null;
+                }
             }
-
-            public String getWidth() {
-                return null;
-            }
-        });
-
-        entryTable.setColumnDefinitions(columnDefinitions);
+        );
 
         entryTable.addSelectRowHandler(new SelectableTable.SelectRowHandler() {
 



Mime
View raw message