SideBySide2: Add preferences button in header

Replace the unicode arrows for previous/up/next with arrows from the
Tango Icon Library[1].  These are green arrows 16x16 and are installed
into the DOM using CSS sprites managed by GWT.

Add to the right of the navigation cluster a new gear icon that opens
the panel.  This icon lets mouse driven users adjust values quickly.

[1] http://tango.freedesktop.org/Tango_Icon_Library

Bug: issue 2225
Change-Id: Iaaea288990ed80431a4e44374530facffac4b842
This commit is contained in:
Shawn Pearce
2013-12-12 19:55:29 -08:00
parent cb4b96e315
commit 5257208045
10 changed files with 63 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.uibinder.client.UiBinder;
@@ -43,6 +44,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwtexpui.globalkey.client.KeyCommand;
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
@@ -52,6 +54,9 @@ import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
class Header extends Composite {
interface Binder extends UiBinder<HTMLPanel, Header> {}
private static final Binder uiBinder = GWT.create(Binder.class);
static {
Resources.I.style().ensureInjected();
}
@UiField CheckBox reviewed;
@UiField Element project;
@@ -62,6 +67,7 @@ class Header extends Composite {
@UiField InlineHyperlink prev;
@UiField InlineHyperlink up;
@UiField InlineHyperlink next;
@UiField Image preferences;
private final KeyCommandSet keys;
private final PatchSet.Id base;
@@ -70,6 +76,7 @@ class Header extends Composite {
private boolean hasPrev;
private boolean hasNext;
private String nextPath;
private PreferencesAction prefsAction;
Header(KeyCommandSet keys, PatchSet.Id base, PatchSet.Id patchSetId,
String path) {
@@ -151,10 +158,15 @@ class Header extends Composite {
}
}
void set(ChangeInfo info) {
void setChangeInfo(ChangeInfo info) {
project.setInnerText(info.project());
}
void init(PreferencesAction pa) {
prefsAction = pa;
prefsAction.setPartner(preferences);
}
void setReviewed(boolean r) {
reviewed.setValue(r, true);
}
@@ -176,6 +188,11 @@ class Header extends Composite {
}
}
@UiHandler("preferences")
void onPreferences(ClickEvent e) {
prefsAction.show();
}
private String url(FileInfo info) {
return info.binary()
? Dispatcher.toUnified(base, patchSetId, info.path())