Merge "Initialize common KeyCodes in NavigationTable"

This commit is contained in:
Edwin Kempin
2012-11-13 18:49:45 -08:00
committed by Gerrit Code Review
14 changed files with 49 additions and 45 deletions

View File

@@ -94,9 +94,7 @@ public interface AdminConstants extends Constants {
String buttonDeleteBranch();
String branchDeletionOpenChanges();
String groupListPrev();
String groupListNext();
String groupListOpen();
String groupItemHelp();
String groupListTitle();
String createGroupTitle();

View File

@@ -74,9 +74,7 @@ buttonDeleteBranch = Delete
branchDeletionOpenChanges = The following branches were not deleted \
because they have open changes:
groupListPrev = Previous group
groupListNext = Next group
groupListOpen = Open group
groupItemHelp = group
groupListTitle = Groups
createGroupTitle = Create Group

View File

@@ -21,7 +21,6 @@ import com.google.gerrit.client.ui.NavigationTable;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.gwt.user.client.ui.HTMLTable.Cell;
@@ -40,14 +39,9 @@ public class GroupTable extends NavigationTable<AccountGroup> {
}
public GroupTable(final boolean enableLink, final String pointerId) {
super(Util.C.groupItemHelp());
this.enableLink = enableLink;
setSavePointerId(pointerId);
keysNavigation.add(new PrevKeyCommand(0, 'k', Util.C.groupListPrev()));
keysNavigation.add(new NextKeyCommand(0, 'j', Util.C.groupListNext()));
keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.groupListOpen()));
keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.C
.groupListOpen()));
table.setText(0, 1, Util.C.columnGroupName());
table.setText(0, 2, Util.C.columnGroupDescription());

View File

@@ -45,9 +45,7 @@ public interface ChangeConstants extends Constants {
String changeTableColumnLastUpdate();
String changeTableNone();
String changeTablePrev();
String changeTableNext();
String changeTableOpen();
String changeItemHelp();
String changeTableStar();
String changeTablePagePrev();
String changeTablePageNext();

View File

@@ -25,9 +25,7 @@ changeTableColumnBranch = Branch
changeTableColumnLastUpdate = Updated
changeTableNone = (None)
changeTablePrev = Previous change
changeTableNext = Next change
changeTableOpen = Open change
changeItemHelp = change
changeTableStar = Star (or unstar) change
changeTablePagePrev = Previous page of changes
changeTablePageNext = Next page of changes

View File

@@ -42,7 +42,6 @@ import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
@@ -79,6 +78,7 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
}
public ChangeTable(boolean showApprovals) {
super(Util.C.changeItemHelp());
approvalTypes = Gerrit.getConfig().getApprovalTypes().getApprovalTypes();
if (showApprovals) {
columns = BASE_COLUMNS + approvalTypes.size();
@@ -86,12 +86,6 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
columns = BASE_COLUMNS;
}
keysNavigation.add(new PrevKeyCommand(0, 'k', Util.C.changeTablePrev()));
keysNavigation.add(new NextKeyCommand(0, 'j', Util.C.changeTableNext()));
keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.changeTableOpen()));
keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.C
.changeTableOpen()));
if (Gerrit.isSignedIn()) {
keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar()));
}

View File

@@ -29,7 +29,6 @@ import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
@@ -59,15 +58,10 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
private List<String> labelNames;
public ChangeTable2() {
super(Util.C.changeItemHelp());
columns = BASE_COLUMNS;
labelNames = Collections.emptyList();
keysNavigation.add(new PrevKeyCommand(0, 'k', Util.C.changeTablePrev()));
keysNavigation.add(new NextKeyCommand(0, 'j', Util.C.changeTableNext()));
keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.changeTableOpen()));
keysNavigation.add(
new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.C.changeTableOpen()));
if (Gerrit.isSignedIn()) {
keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar()));
}

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.client.ui;
import com.google.gerrit.client.Gerrit;
import com.google.gwt.dom.client.Document;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
@@ -90,6 +91,15 @@ public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
private boolean computedScrollType;
private ScrollPanel parentScrollPanel;
protected NavigationTable(String itemHelpName) {
this();
keysNavigation.add(new PrevKeyCommand(0, 'k', Util.M.helpListPrev(itemHelpName)));
keysNavigation.add(new NextKeyCommand(0, 'j', Util.M.helpListNext(itemHelpName)));
keysNavigation.add(new OpenKeyCommand(0, 'o', Util.M.helpListOpen(itemHelpName)));
keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER,
Util.M.helpListOpen(itemHelpName)));
}
protected NavigationTable() {
pointer = new Image(Gerrit.RESOURCES.arrowRight());
keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.client.ui;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.projects.ProjectInfo;
import com.google.gerrit.client.projects.ProjectMap;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import java.util.Collections;
@@ -27,11 +26,7 @@ import java.util.List;
public class ProjectsTable extends NavigationTable<ProjectInfo> {
public ProjectsTable() {
keysNavigation.add(new PrevKeyCommand(0, 'k', Util.C.projectListPrev()));
keysNavigation.add(new NextKeyCommand(0, 'j', Util.C.projectListNext()));
keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.projectListOpen()));
keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER,
Util.C.projectListOpen()));
super(Util.C.projectItemHelp());
initColumnHeaders();
}

View File

@@ -22,7 +22,5 @@ public interface UIConstants extends Constants {
String projectName();
String projectDescription();
String projectListOpen();
String projectListPrev();
String projectListNext();
String projectItemHelp();
}

View File

@@ -3,6 +3,4 @@ commentedActionButtonCancel = Cancel
projectName = Project Name
projectDescription = Project Description
projectListOpen = Select project
projectListPrev = Previous project
projectListNext = Next project
projectItemHelp = project

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.client.ui;
import com.google.gwt.i18n.client.Messages;
import java.util.Date;
public interface UIMessages extends Messages {
String helpListOpen(String item);
String helpListPrev(String item);
String helpListNext(String item);
}

View File

@@ -0,0 +1,3 @@
helpListOpen = Select {0}
helpListPrev = Previous {0}
helpListNext = Next {0}

View File

@@ -18,4 +18,5 @@ import com.google.gwt.core.client.GWT;
public class Util {
public static final UIConstants C = GWT.create(UIConstants.class);
public static final UIMessages M = GWT.create(UIMessages.class);
}