Merge changes Ia6d47cc8,Iaa6b7775
* changes: Move checkbox to mark file as reviewed into title bar Add decoration regions to the Screen header title
This commit is contained in:
@@ -204,7 +204,7 @@ public class ChangeScreen extends Screen {
|
||||
toggleStar();
|
||||
}
|
||||
});
|
||||
insertTitleWidget(starChange);
|
||||
setTitleWest(starChange);
|
||||
}
|
||||
|
||||
descriptionBlock = new ChangeDescriptionBlock();
|
||||
|
@@ -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 */);
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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'>
|
||||
|
@@ -18,12 +18,24 @@ import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.InlineLabel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwtexpui.user.client.View;
|
||||
|
||||
/**
|
||||
* A Screen layout with a header and a body.
|
||||
*
|
||||
* The header is mainly a text title, but it can be decorated
|
||||
* in the West, the East, and the FarEast by any Widget. The
|
||||
* West and East decorations will surround the text on the
|
||||
* left and right respectively, and the FarEast will be right
|
||||
* justified to the right edge of the screen. The East
|
||||
* decoration will expand to take up any extra space.
|
||||
*/
|
||||
public abstract class Screen extends View {
|
||||
private FlowPanel header;
|
||||
private Grid header;
|
||||
private InlineLabel headerText;
|
||||
private FlowPanel body;
|
||||
private String token;
|
||||
@@ -46,13 +58,25 @@ public abstract class Screen extends View {
|
||||
public void registerKeys() {
|
||||
}
|
||||
|
||||
private static enum Cols {
|
||||
West, Title, East, FarEast;
|
||||
}
|
||||
|
||||
protected void onInitUI() {
|
||||
final FlowPanel me = (FlowPanel) getWidget();
|
||||
me.add(header = new FlowPanel());
|
||||
me.add(header = new Grid(1, Cols.values().length));
|
||||
me.add(body = new FlowPanel());
|
||||
|
||||
FlowPanel title = new FlowPanel();
|
||||
title.add(headerText = new InlineLabel());
|
||||
title.setStyleName(Gerrit.RESOURCES.css().screenHeader());
|
||||
header.setWidget(0, Cols.Title.ordinal(), title);
|
||||
|
||||
header.setStyleName(Gerrit.RESOURCES.css().screenHeader());
|
||||
header.add(headerText = new InlineLabel());
|
||||
header.getCellFormatter().setHorizontalAlignment(0, Cols.FarEast.ordinal(),
|
||||
HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
// force FarEast all the way to the right
|
||||
header.getCellFormatter().setWidth(0, Cols.FarEast.ordinal(), "100%");
|
||||
}
|
||||
|
||||
protected void setWindowTitle(final String text) {
|
||||
@@ -73,8 +97,16 @@ public abstract class Screen extends View {
|
||||
}
|
||||
}
|
||||
|
||||
protected void insertTitleWidget(final Widget w) {
|
||||
header.insert(w, 0);
|
||||
protected void setTitleEast(final Widget w) {
|
||||
header.setWidget(0, Cols.East.ordinal(), w);
|
||||
}
|
||||
|
||||
protected void setTitleFarEast(final Widget w) {
|
||||
header.setWidget(0, Cols.FarEast.ordinal(), w);
|
||||
}
|
||||
|
||||
protected void setTitleWest(final Widget w) {
|
||||
header.setWidget(0, Cols.West.ordinal(), w);
|
||||
}
|
||||
|
||||
protected void add(final Widget w) {
|
||||
|
Reference in New Issue
Block a user