diff options
author | Edwin Kempin <edwin.kempin@sap.com> | 2010-10-15 08:22:22 +0200 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-10-16 11:53:48 -0700 |
commit | 2b19055303ec8c3e29b79662aeb832e14b69f74d (patch) | |
tree | 1bc75fc87f6aa1d05f7fbf9e59db1f1b2d8ac213 | |
parent | 7b6ed691a3746530b07bed4904c83fa65f897523 (diff) |
Make ENTER work for 'Create Group' button
The 'Create Group' button in the 'GroupListScreen'
is now triggered when it has the focus and ENTER
is pressed.
Before this change pressing ENTER when the
'Create Group' button was focused was not creating
a new group but opened the existing group which
was selected in the groups table.
Bug: issue 741
Change-Id: I75b9f4f129fe9bd1c180017ba299879b44d53d13
Signed-off-by: Edwin Kempin <edwin.kempin@gmail.com>
-rw-r--r-- | gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java index a6b026dfef..9c51b77375 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java @@ -23,8 +23,12 @@ import com.google.gerrit.client.ui.OnEditEnabler; import com.google.gerrit.client.ui.SmallHeading; import com.google.gerrit.common.PageLinks; import com.google.gerrit.reviewdb.AccountGroup; +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; @@ -86,6 +90,25 @@ public class GroupListScreen extends AccountScreen { doCreateGroup(); } }); + addNew.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + // unregister the keys for the 'groups' table so that pressing ENTER + // when the 'addNew' button has the focus triggers the button (if the + // keys for the 'groups' table would not be unregistered the 'addNew' + // button would not be triggered on ENTER but the group which is + // selected in the 'groups' table would be opened) + groups.setRegisterKeys(false); + } + }); + addNew.addBlurHandler(new BlurHandler() { + @Override + public void onBlur(BlurEvent event) { + // re-register the keys for the 'groups' table when the 'addNew' button + // gets blurred + groups.setRegisterKeys(true); + } + }); fp.add(addNew); add(fp); |