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:
Martin Fick
2012-01-15 16:07:01 -08:00
committed by gerrit code review
5 changed files with 54 additions and 31 deletions

View File

@@ -204,7 +204,7 @@ public class ChangeScreen extends Screen {
toggleStar(); toggleStar();
} }
}); });
insertTitleWidget(starChange); setTitleWest(starChange);
} }
descriptionBlock = new ChangeDescriptionBlock(); descriptionBlock = new ChangeDescriptionBlock();

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

View File

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

View File

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

View File

@@ -18,12 +18,24 @@ import com.google.gerrit.client.Gerrit;
import com.google.gerrit.common.PageLinks; import com.google.gerrit.common.PageLinks;
import com.google.gwt.user.client.History; import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.FlowPanel; 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.InlineLabel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
import com.google.gwtexpui.user.client.View; 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 { public abstract class Screen extends View {
private FlowPanel header; private Grid header;
private InlineLabel headerText; private InlineLabel headerText;
private FlowPanel body; private FlowPanel body;
private String token; private String token;
@@ -46,13 +58,25 @@ public abstract class Screen extends View {
public void registerKeys() { public void registerKeys() {
} }
private static enum Cols {
West, Title, East, FarEast;
}
protected void onInitUI() { protected void onInitUI() {
final FlowPanel me = (FlowPanel) getWidget(); final FlowPanel me = (FlowPanel) getWidget();
me.add(header = new FlowPanel()); me.add(header = new Grid(1, Cols.values().length));
me.add(body = new FlowPanel()); 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.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) { protected void setWindowTitle(final String text) {
@@ -73,8 +97,16 @@ public abstract class Screen extends View {
} }
} }
protected void insertTitleWidget(final Widget w) { protected void setTitleEast(final Widget w) {
header.insert(w, 0); 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) { protected void add(final Widget w) {