Move checkbox to mark file as reviewed into title bar

The reviewed checkbox did not fit well on the preferences
panel.  It was not a preference and it operated
immediately without having to hit Update or Save.

To encourage its usage more, move it to the title
bar on the far right of the screen above the link
to the next file.  This makes it much more accessible
since it will now always be on the screen and it is
positioned nicely near the action a user will most
likely take next after checking the reviewed box.
This last piece should make reviewing on smaller
screens such as tablets much more convenient.

Change-Id: Ia6d47cc8b976805297231916dc28f7d8002fbaf4
This commit is contained in:
Martin Fick
2011-11-30 12:26:47 -07:00
parent 49cd82b0e1
commit be7d961f7a
3 changed files with 16 additions and 25 deletions

View File

@@ -39,6 +39,7 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwtexpui.globalkey.client.GlobalKey;
@@ -105,6 +106,7 @@ public abstract class PatchScreen extends Screen implements
protected PatchScriptSettingsPanel settingsPanel;
protected TopView topView;
private CheckBox reviewed;
private HistoryTable historyTable;
private FlowPanel topPanel;
private FlowPanel contentPanel;
@@ -151,6 +153,15 @@ public abstract class PatchScreen extends Screen implements
idSideB = diffSideB != null ? diffSideB : id.getParentKey();
this.patchIndex = patchIndex;
reviewed = new CheckBox(Util.C.reviewed());
reviewed.addValueChangeHandler(
new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
setReviewedByCurrentUser(event.getValue());
}
});
prefs = fileList != null ? fileList.getPreferences() :
new ListenableAccountDiffPreference();
if (Gerrit.isSignedIn()) {
@@ -165,13 +176,6 @@ public abstract class PatchScreen extends Screen implements
});
settingsPanel = new PatchScriptSettingsPanel(prefs);
settingsPanel.getReviewedCheckBox().addValueChangeHandler(
new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
setReviewedByCurrentUser(event.getValue());
}
});
}
@Override
@@ -234,6 +238,10 @@ public abstract class PatchScreen extends Screen implements
protected void onInitUI() {
super.onInitUI();
if (Gerrit.isSignedIn()) {
setTitleFarEast(reviewed);
}
keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());
keysNavigation.add(new UpToChangeCommand(patchKey.getParentKey(), 0, 'u'));
keysNavigation.add(new FileListCmd(0, 'f', PatchUtil.C.fileList()));
@@ -444,7 +452,7 @@ public abstract class PatchScreen extends Screen implements
// Mark this file reviewed as soon we display the diff screen
if (Gerrit.isSignedIn() && isFirst) {
settingsPanel.getReviewedCheckBox().setValue(true);
reviewed.setValue(true);
setReviewedByCurrentUser(true /* reviewed */);
}

View File

@@ -78,9 +78,6 @@ public class PatchScriptSettingsPanel extends Composite implements
@UiField
CheckBox showTabs;
@UiField
CheckBox reviewed;
@UiField
CheckBox skipDeleted;
@@ -119,7 +116,6 @@ public class PatchScriptSettingsPanel extends Composite implements
initIgnoreWhitespace(ignoreWhitespace);
initContext(context);
if (!Gerrit.isSignedIn()) {
reviewed.setVisible(false);
save.setVisible(false);
}
@@ -188,10 +184,6 @@ public class PatchScriptSettingsPanel extends Composite implements
syntaxHighlighting.setTitle(title);
}
public CheckBox getReviewedCheckBox() {
return reviewed;
}
public AccountDiffPreference getValue() {
return listenablePrefs.get();
}

View File

@@ -164,15 +164,6 @@ limitations under the License.
<ui:attribute name='text'/>
</g:Button>
</td>
<td>
<g:CheckBox
ui:field='reviewed'
text='Reviewed'
tabIndex='15'>
<ui:attribute name='text'/>
</g:CheckBox>
</td>
</tr>
<tr valign='top'>