You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/09/10 17:49:14 UTC

svn commit: r813480 - in /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk: Window.java content/ListViewItemEditor.java content/TableViewCellEditor.java content/TableViewRowEditor.java content/TreeViewNodeEditor.java

Author: tvolkert
Date: Thu Sep 10 15:49:14 2009
New Revision: 813480

URL: http://svn.apache.org/viewvc?rev=813480&view=rev
Log:
Added Window.clearFocusDescendant(), fixed minor issues in editors

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemEditor.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellEditor.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewRowEditor.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java?rev=813480&r1=813479&r2=813480&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java Thu Sep 10 15:49:14 2009
@@ -908,6 +908,15 @@
         return focusDescendant;
     }
 
+    /**
+     * Clears the window descendant to which focus will be restored when this
+     * window is moved to the front, meaning that when this window is moved to
+     * front, focus will not be restored to the window.
+     */
+    public void clearFocusDescendant() {
+        focusDescendant = null;
+    }
+
     @Override
     protected void descendantGainedFocus(Component descendant, Component previousFocusedComponent) {
         this.focusDescendant = descendant;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemEditor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemEditor.java?rev=813480&r1=813479&r2=813480&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemEditor.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemEditor.java Thu Sep 10 15:49:14 2009
@@ -33,7 +33,6 @@
 import org.apache.pivot.wtk.Window;
 import org.apache.pivot.wtk.WindowStateListener;
 
-
 /**
  * Default list view item editor.
  */
@@ -108,7 +107,7 @@
             listView.getListViewListeners().remove(listViewListener);
             listView.getListViewItemListeners().remove(listViewItemListener);
 
-            listView.requestFocus();
+            window.getOwner().moveToFront();
 
             listView = null;
             index = -1;
@@ -122,6 +121,7 @@
         public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
             Display display = (Display)container;
             Window window = (Window)display.getComponentAt(x, y);
+
             if (popup != window) {
                 save();
             }

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellEditor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellEditor.java?rev=813480&r1=813479&r2=813480&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellEditor.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellEditor.java Thu Sep 10 15:49:14 2009
@@ -34,7 +34,6 @@
 import org.apache.pivot.wtk.Window;
 import org.apache.pivot.wtk.WindowStateListener;
 
-
 /**
  * Default table view cell editor.
  */
@@ -120,8 +119,8 @@
             tableView.getTableViewListeners().remove(tableViewListener);
             tableView.getTableViewRowListeners().remove(tableViewRowListener);
 
-            // Restore focus to the table view
-            tableView.requestFocus();
+            // Move the owner to front
+            window.getOwner().moveToFront();
 
             // Free memory
             tableView = null;

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewRowEditor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewRowEditor.java?rev=813480&r1=813479&r2=813480&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewRowEditor.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewRowEditor.java Thu Sep 10 15:49:14 2009
@@ -172,8 +172,8 @@
                 if (!closing) {
                     closing = true;
 
-                    // Restore focus to the table view
-                    tableView.requestFocus();
+                    // Disable the table pane to prevent user input
+                    editorTablePane.setEnabled(false);
 
                     // Flip to the image card
                     editorCardPane.setSelectedIndex(IMAGE_CARD_INDEX);
@@ -201,8 +201,12 @@
             tableView.getTableViewListeners().remove(tableViewHandler);
             tableView.getTableViewRowListeners().remove(tableViewRowHandler);
 
-            // Reset flags
+            // Reset state
             closing = false;
+            editorTablePane.setEnabled(true);
+
+            // Move the owner to front
+            window.getOwner().moveToFront();
 
             // Free memory
             tableView = null;
@@ -239,8 +243,6 @@
     private ContainerMouseListener displayMouseHandler = new ContainerMouseListener.Adapter() {
         @Override
         public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
-            boolean consumed = false;
-
             // If the event occurred outside the popup, close the popup
             Display display = (Display)container;
             Window window = (Window)display.getComponentAt(x, y);
@@ -248,10 +250,9 @@
             if (popup != window &&
                 (window == null || !popup.isOwner(window))) {
                 save();
-                consumed = true;
             }
 
-            return consumed;
+            return false;
         }
 
         @Override

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java?rev=813480&r1=813479&r2=813480&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java Thu Sep 10 15:49:14 2009
@@ -66,8 +66,8 @@
             treeView.getTreeViewListeners().remove(treeViewHandler);
             treeView.getTreeViewNodeListeners().remove(treeViewNodeHandler);
 
-            // Restore focus to the tree view
-            treeView.requestFocus();
+            // Move the owner to front
+            window.getOwner().moveToFront();
 
             // Free memory
             treeView = null;