You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/06/24 00:20:48 UTC
svn commit: r787853 - in /incubator/pivot/trunk:
demos/src/org/apache/pivot/demos/million/LargeData.java
wtk/src/org/apache/pivot/wtk/Dialog.java
wtk/src/org/apache/pivot/wtk/Window.java
wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java
Author: gbrown
Date: Tue Jun 23 22:20:48 2009
New Revision: 787853
URL: http://svn.apache.org/viewvc?rev=787853&view=rev
Log:
Resolve issues with MenuBar and MenuButton.
Modified:
incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dialog.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java
Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java?rev=787853&r1=787852&r2=787853&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java (original)
+++ incubator/pivot/trunk/demos/src/org/apache/pivot/demos/million/LargeData.java Tue Jun 23 22:20:48 2009
@@ -162,7 +162,7 @@
throws Exception {
basePath = properties.get(BASE_PATH_KEY);
if (basePath == null) {
- throw new IllegalArgumentException("basePath is required.");
+ throw new IllegalArgumentException(BASE_PATH_KEY + " is required.");
}
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dialog.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dialog.java?rev=787853&r1=787852&r2=787853&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dialog.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Dialog.java Tue Jun 23 22:20:48 2009
@@ -177,8 +177,8 @@
// Disabling the owner tree also disabled this dialog; re-enable it
// and make it the active window
setEnabled(true);
- requestActive();
- requestFocus(true);
+ setActiveWindow(this);
+ restoreFocus();
}
}
}
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=787853&r1=787852&r2=787853&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 Tue Jun 23 22:20:48 2009
@@ -240,7 +240,7 @@
if (parent == null
&& isActive()) {
- clearActive();
+ setActiveWindow(null);
}
super.setParent(parent);
@@ -293,7 +293,7 @@
if (isEnabled() == enabled) {
if (!enabled
&& isActive()) {
- clearActive();
+ setActiveWindow(null);
}
// Enable/disable owned windows
@@ -656,25 +656,6 @@
}
/**
- * Requests that this window become active.
- */
- public void requestActive() {
- if (isAuxilliary()) {
- throw new IllegalArgumentException("Window is auxilliary.");
- }
-
- if (!isOpen()) {
- throw new IllegalArgumentException("Window is not open.");
- }
-
- if (!isEnabled()) {
- throw new IllegalArgumentException("Window is not enabled.");
- }
-
- setActiveWindow(this);
- }
-
- /**
* Returns the currently active window.
*
* @return
@@ -693,7 +674,21 @@
* @param activeWindow
* The window to activate, or <tt>null</tt> to clear the active window.
*/
- private static void setActiveWindow(Window activeWindow) {
+ public static void setActiveWindow(Window activeWindow) {
+ if (activeWindow != null) {
+ if (activeWindow.isAuxilliary()) {
+ throw new IllegalArgumentException("activeWindow is auxilliary.");
+ }
+
+ if (!activeWindow.isOpen()) {
+ throw new IllegalArgumentException("activeWindow is not open.");
+ }
+
+ if (!activeWindow.isEnabled()) {
+ throw new IllegalArgumentException("activeWindow is not enabled.");
+ }
+ }
+
Window previousActiveWindow = Window.activeWindow;
if (previousActiveWindow != activeWindow) {
@@ -715,15 +710,8 @@
}
/**
- * Clears the active window.
- */
- public static void clearActive() {
- setActiveWindow(null);
- }
-
- /**
* Returns the window descendant to which focus will be restored by a call
- * to {@link #requestFocus()}.
+ * to {@link #restoreFocus()}.
*/
public Component getFocusDescendant() {
return focusDescendant;
@@ -731,7 +719,7 @@
/**
* Sets the window descendant to which focus will be restored by a call to
- * {@link #requestFocus()}.
+ * {@link #restoreFocus()}.
*
* @param focusDescendant
*/
@@ -742,8 +730,11 @@
this.focusDescendant = focusDescendant;
}
- @Override
- protected boolean requestFocus(boolean temporary) {
+ /**
+ * Restores the focus to the focus descendant. If the window does not
+ * have a focus descendant, the focus is cleared.
+ */
+ public void restoreFocus() {
// If this window is still an ancestor of the focus descendant
// and the focus descendant can be focused, restore focus to it;
// otherwise, clear the focus descendant
@@ -751,13 +742,11 @@
&& isAncestor(focusDescendant)
&& !focusDescendant.isBlocked()
&& focusDescendant.isShowing()) {
- focusDescendant.requestFocus(temporary);
+ focusDescendant.requestFocus(true);
} else {
focusDescendant = null;
Component.clearFocus(true);
}
-
- return containsFocus();
}
/**
@@ -823,8 +812,8 @@
if (window.isShowing()
&& !window.isBlocked()) {
if (!window.isAuxilliary()) {
- window.requestActive();
- window.requestFocus(true);
+ setActiveWindow(window);
+ window.restoreFocus();
}
}
@@ -859,10 +848,11 @@
}
if (isActive()) {
- clearActive();
- clearFocus(true);
+ setActiveWindow(null);
}
+ clearFocus(true);
+
Display display = getDisplay();
// Ensure that the window and all of its owning ancestors are moved
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java?rev=787853&r1=787852&r2=787853&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/DisplaySkin.java Tue Jun 23 22:20:48 2009
@@ -92,7 +92,7 @@
if (window != null
&& window.isEnabled()
&& !window.isAuxilliary()) {
- window.requestActive();
+ Window.setActiveWindow(window);
}
}