Make tables 100% wide. Move comments menu bar to title.

Instead of using 95/98% wide tables, use all space (100%) with
correct padding/margins/flows.

Make comments a little bit prettier by moving menubar to title.

Change-Id: I974fe63a4e1c532a3cdb1fb6a53240fab2008b70
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Anatol Pomazau
2010-09-15 11:29:55 -07:00
committed by Shawn O. Pearce
parent 3a00bc458b
commit 6a64c951d4
5 changed files with 22 additions and 21 deletions

View File

@@ -67,6 +67,7 @@ public interface GerritCss extends CssResource {
String commentPanelHeader(); String commentPanelHeader();
String commentPanelLast(); String commentPanelLast();
String commentPanelMessage(); String commentPanelMessage();
String commentPanelMenuBar();
String commentPanelSummary(); String commentPanelSummary();
String commentPanelSummaryCell(); String commentPanelSummaryCell();
String complexHeader(); String complexHeader();

View File

@@ -23,7 +23,6 @@
} }
.logo { .logo {
width: 98%;
text-align: right; text-align: right;
} }

View File

@@ -29,9 +29,9 @@ import com.google.gerrit.common.data.ChangeInfo;
import com.google.gerrit.common.data.ToggleStarRequest; import com.google.gerrit.common.data.ToggleStarRequest;
import com.google.gerrit.reviewdb.Account; import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.reviewdb.Change; import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.Change.Status;
import com.google.gerrit.reviewdb.ChangeMessage; import com.google.gerrit.reviewdb.ChangeMessage;
import com.google.gerrit.reviewdb.PatchSet; import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.Change.Status;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressEvent;
@@ -39,6 +39,7 @@ import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.LocaleInfo; import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.ui.DisclosurePanel; import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.Panel;
@@ -182,7 +183,7 @@ public class ChangeScreen extends Screen {
dependencies = new ChangeTable() { dependencies = new ChangeTable() {
{ {
table.setWidth("98%"); table.setWidth("auto");
} }
}; };
dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn()); dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn());
@@ -192,7 +193,6 @@ public class ChangeScreen extends Screen {
dependenciesPanel = new DisclosurePanel(Util.C.changeScreenDependencies()); dependenciesPanel = new DisclosurePanel(Util.C.changeScreenDependencies());
dependenciesPanel.setContent(dependencies); dependenciesPanel.setContent(dependencies);
dependenciesPanel.setWidth("95%");
add(dependenciesPanel); add(dependenciesPanel);
patchSetsBlock = new PatchSetsBlock(this); patchSetsBlock = new PatchSetsBlock(this);
@@ -272,15 +272,17 @@ public class ChangeScreen extends Screen {
private void addComments(final ChangeDetail detail) { private void addComments(final ChangeDetail detail) {
comments.clear(); comments.clear();
final Label hdr = new Label(Util.C.changeScreenComments());
hdr.setStyleName(Gerrit.RESOURCES.css().blockHeader());
comments.add(hdr);
final AccountInfoCache accts = detail.getAccounts(); final AccountInfoCache accts = detail.getAccounts();
final List<ChangeMessage> msgList = detail.getMessages(); final List<ChangeMessage> msgList = detail.getMessages();
HorizontalPanel title = new HorizontalPanel();
title.setWidth("100%");
title.add(new Label(Util.C.changeScreenComments()));
if (msgList.size() > 1) { if (msgList.size() > 1) {
comments.add(messagesMenuBar()); title.add(messagesMenuBar());
} }
title.setStyleName(Gerrit.RESOURCES.css().blockHeader());
comments.add(title);
final long AGE = 7 * 24 * 60 * 60 * 1000L; final long AGE = 7 * 24 * 60 * 60 * 1000L;
final Timestamp aged = new Timestamp(System.currentTimeMillis() - AGE); final Timestamp aged = new Timestamp(System.currentTimeMillis() - AGE);
@@ -316,24 +318,22 @@ public class ChangeScreen extends Screen {
comments.add(cp); comments.add(cp);
} }
if (msgList.size() > 1) {
comments.add(messagesMenuBar());
}
comments.setVisible(msgList.size() > 0); comments.setVisible(msgList.size() > 0);
} }
private LinkMenuBar messagesMenuBar() { private LinkMenuBar messagesMenuBar() {
final Panel c = comments; final Panel c = comments;
final LinkMenuBar m = new LinkMenuBar(); final LinkMenuBar menuBar = new LinkMenuBar();
m.addItem(Util.C.messageExpandRecent(), new ExpandAllCommand(c, true) { menuBar.addItem(Util.C.messageExpandRecent(), new ExpandAllCommand(c, true) {
@Override @Override
protected void expand(final CommentPanel w) { protected void expand(final CommentPanel w) {
w.setOpen(w.isRecent()); w.setOpen(w.isRecent());
} }
}); });
m.addItem(Util.C.messageExpandAll(), new ExpandAllCommand(c, true)); menuBar.addItem(Util.C.messageExpandAll(), new ExpandAllCommand(c, true));
m.addItem(Util.C.messageCollapseAll(), new ExpandAllCommand(c, false)); menuBar.addItem(Util.C.messageCollapseAll(), new ExpandAllCommand(c, false));
return m; menuBar.addStyleName(Gerrit.RESOURCES.css().commentPanelMenuBar());
return menuBar;
} }
private void toggleStar() { private void toggleStar() {

View File

@@ -69,7 +69,6 @@
font-size: 11pt; font-size: 11pt;
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
width: 98%;
} }
.version, .version,
@@ -199,6 +198,9 @@
padding-left: 0.5em; padding-left: 0.5em;
padding-right: 0.5em; padding-right: 0.5em;
} }
.commentPanelMenuBar {
float: right;
}
.commentPanelMessage p { .commentPanelMessage p {
margin-top: 0px; margin-top: 0px;
margin-bottom: 0px; margin-bottom: 0px;
@@ -767,8 +769,7 @@
} }
.changeComments { .changeComments {
margin-left: 0.5em; padding-top: 1em;
margin-right: 0.5em;
width: 60em; width: 60em;
} }

View File

@@ -38,7 +38,7 @@ class HistoryTable extends FancyFlexTable<Patch> {
HistoryTable(final PatchScreen parent) { HistoryTable(final PatchScreen parent) {
setStyleName(Gerrit.RESOURCES.css().patchHistoryTable()); setStyleName(Gerrit.RESOURCES.css().patchHistoryTable());
screen = parent; screen = parent;
table.setWidth("98%"); table.setWidth("auto");
table.addStyleName(Gerrit.RESOURCES.css().changeTable()); table.addStyleName(Gerrit.RESOURCES.css().changeTable());
} }