Merge "Add ExpandAllComments checkbox in PatchScreen"

This commit is contained in:
Shawn Pearce
2011-06-07 08:04:45 -07:00
committed by Android Code Review
10 changed files with 77 additions and 21 deletions

View File

@@ -155,6 +155,10 @@ public class PatchScript {
return intralineFailure; return intralineFailure;
} }
public boolean isExpandAllComments() {
return diffPrefs.isExpandAllComments();
}
public SparseFileContent getA() { public SparseFileContent getA() {
return a; return a;
} }

View File

@@ -175,7 +175,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
protected abstract void onInsertComment(PatchLine pl); protected abstract void onInsertComment(PatchLine pl);
public abstract void display(CommentDetail comments); public abstract void display(CommentDetail comments, boolean expandComments);
@Override @Override
protected MyFlexTable createFlexTable() { protected MyFlexTable createFlexTable() {
@@ -529,7 +529,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
} }
protected void bindComment(final int row, final int col, protected void bindComment(final int row, final int col,
final PatchLineComment line, final boolean isLast) { final PatchLineComment line, final boolean isLast, boolean expandComment) {
if (line.getStatus() == PatchLineComment.Status.DRAFT) { if (line.getStatus() == PatchLineComment.Status.DRAFT) {
final CommentEditorPanel plc = new CommentEditorPanel(line); final CommentEditorPanel plc = new CommentEditorPanel(line);
plc.addFocusHandler(this); plc.addFocusHandler(this);
@@ -541,6 +541,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
final AccountInfo author = accountCache.get(line.getAuthor()); final AccountInfo author = accountCache.get(line.getAuthor());
final PublishedCommentPanel panel = final PublishedCommentPanel panel =
new PublishedCommentPanel(author, line); new PublishedCommentPanel(author, line);
panel.setOpen(expandComment);
panel.addFocusHandler(this); panel.addFocusHandler(this);
panel.addBlurHandler(this); panel.addBlurHandler(this);
table.setWidget(row, col, panel); table.setWidget(row, col, panel);

View File

@@ -438,7 +438,7 @@ public abstract class PatchScreen extends Screen implements
if (hasDifferences) { if (hasDifferences) {
contentTable.display(patchKey, idSideA, idSideB, script); contentTable.display(patchKey, idSideA, idSideB, script);
contentTable.display(script.getCommentDetail()); contentTable.display(script.getCommentDetail(), script.isExpandAllComments());
contentTable.finishDisplay(); contentTable.finishDisplay();
} }
showPatch(hasDifferences); showPatch(hasDifferences);

View File

@@ -87,6 +87,9 @@ public class PatchScriptSettingsPanel extends Composite implements
@UiField @UiField
CheckBox skipUncommented; CheckBox skipUncommented;
@UiField
CheckBox expandAllComments;
@UiField @UiField
Button update; Button update;
@@ -209,6 +212,7 @@ public class PatchScriptSettingsPanel extends Composite implements
showTabs.setValue(dp.isShowTabs()); showTabs.setValue(dp.isShowTabs());
skipDeleted.setValue(dp.isSkipDeleted()); skipDeleted.setValue(dp.isSkipDeleted());
skipUncommented.setValue(dp.isSkipUncommented()); skipUncommented.setValue(dp.isSkipUncommented());
expandAllComments.setValue(dp.isExpandAllComments());
} }
@UiHandler("update") @UiHandler("update")
@@ -233,6 +237,7 @@ public class PatchScriptSettingsPanel extends Composite implements
dp.setShowTabs(showTabs.getValue()); dp.setShowTabs(showTabs.getValue());
dp.setSkipDeleted(skipDeleted.getValue()); dp.setSkipDeleted(skipDeleted.getValue());
dp.setSkipUncommented(skipUncommented.getValue()); dp.setSkipUncommented(skipUncommented.getValue());
dp.setExpandAllComments(expandAllComments.getValue());
listenablePrefs.set(dp); listenablePrefs.set(dp);

View File

@@ -115,18 +115,27 @@ limitations under the License.
</g:CheckBox> </g:CheckBox>
</td> </td>
<td>
<g:CheckBox
ui:field='expandAllComments'
text='Expand All Comments'
tabIndex='9'>
<ui:attribute name='text'/>
</g:CheckBox>
</td>
<td rowspan='2'> <td rowspan='2'>
<g:CheckBox <g:CheckBox
ui:field='skipUncommented' ui:field='skipUncommented'
text='Skip Uncommented Files' text='Skip Uncommented Files'
tabIndex='9'> tabIndex='10'>
<ui:attribute name='text'/> <ui:attribute name='text'/>
</g:CheckBox> </g:CheckBox>
<br/> <br/>
<g:CheckBox <g:CheckBox
ui:field='skipDeleted' ui:field='skipDeleted'
text='Skip Deleted Files' text='Skip Deleted Files'
tabIndex='10'> tabIndex='11'>
<ui:attribute name='text'/> <ui:attribute name='text'/>
</g:CheckBox> </g:CheckBox>
</td> </td>
@@ -136,7 +145,7 @@ limitations under the License.
ui:field='update' ui:field='update'
text='Update' text='Update'
styleName='{style.updateButton}' styleName='{style.updateButton}'
tabIndex='11'> tabIndex='12'>
<ui:attribute name='text'/> <ui:attribute name='text'/>
</g:Button> </g:Button>
</td> </td>
@@ -145,7 +154,7 @@ limitations under the License.
<g:CheckBox <g:CheckBox
ui:field='reviewed' ui:field='reviewed'
text='Reviewed' text='Reviewed'
tabIndex='12'> tabIndex='13'>
<ui:attribute name='text'/> <ui:attribute name='text'/>
</g:CheckBox> </g:CheckBox>
</td> </td>

View File

@@ -186,7 +186,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
} }
@Override @Override
public void display(final CommentDetail cd) { public void display(final CommentDetail cd, boolean expandComments) {
if (cd.isEmpty()) { if (cd.isEmpty()) {
return; return;
} }
@@ -205,13 +205,13 @@ public class SideBySideTable extends AbstractPatchContentTable {
final PatchLineComment ac = ai.next(); final PatchLineComment ac = ai.next();
final PatchLineComment bc = bi.next(); final PatchLineComment bc = bi.next();
insertRow(row); insertRow(row);
bindComment(row, COL_A, ac, !ai.hasNext()); bindComment(row, COL_A, ac, !ai.hasNext(), expandComments);
bindComment(row, COL_B, bc, !bi.hasNext()); bindComment(row, COL_B, bc, !bi.hasNext(), expandComments);
row++; row++;
} }
row = finish(ai, row, COL_A); row = finish(ai, row, COL_A, expandComments);
row = finish(bi, row, COL_B); row = finish(bi, row, COL_B, expandComments);
} else { } else {
row++; row++;
} }
@@ -228,11 +228,11 @@ public class SideBySideTable extends AbstractPatchContentTable {
fmt.addStyleName(row, COL_B, Gerrit.RESOURCES.css().diffText()); fmt.addStyleName(row, COL_B, Gerrit.RESOURCES.css().diffText());
} }
private int finish(final Iterator<PatchLineComment> i, int row, final int col) { private int finish(final Iterator<PatchLineComment> i, int row, final int col, boolean expandComment) {
while (i.hasNext()) { while (i.hasNext()) {
final PatchLineComment c = i.next(); final PatchLineComment c = i.next();
insertRow(row); insertRow(row);
bindComment(row, col, c, !i.hasNext()); bindComment(row, col, c, !i.hasNext(), expandComment);
row++; row++;
} }
return row; return row;

View File

@@ -205,7 +205,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
} }
@Override @Override
public void display(final CommentDetail cd) { public void display(final CommentDetail cd, boolean expandComments) {
if (cd.isEmpty()) { if (cd.isEmpty()) {
return; return;
} }
@@ -224,13 +224,13 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
all.addAll(fora); all.addAll(fora);
all.addAll(forb); all.addAll(forb);
Collections.sort(all, BY_DATE); Collections.sort(all, BY_DATE);
row = insert(all, row); row = insert(all, row, expandComments);
} else if (!fora.isEmpty()) { } else if (!fora.isEmpty()) {
row = insert(fora, row); row = insert(fora, row, expandComments);
} else if (!forb.isEmpty()) { } else if (!forb.isEmpty()) {
row = insert(forb, row); row = insert(forb, row, expandComments);
} }
} else { } else {
row++; row++;
@@ -248,11 +248,11 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
fmt.addStyleName(row, PC, Gerrit.RESOURCES.css().diffText()); fmt.addStyleName(row, PC, Gerrit.RESOURCES.css().diffText());
} }
private int insert(final List<PatchLineComment> in, int row) { private int insert(final List<PatchLineComment> in, int row, boolean expandComment) {
for (Iterator<PatchLineComment> ci = in.iterator(); ci.hasNext();) { for (Iterator<PatchLineComment> ci = in.iterator(); ci.hasNext();) {
final PatchLineComment c = ci.next(); final PatchLineComment c = ci.next();
insertRow(row); insertRow(row);
bindComment(row, PC, c, !ci.hasNext()); bindComment(row, PC, c, !ci.hasNext(), expandComment);
row++; row++;
} }
return row; return row;

View File

@@ -102,6 +102,9 @@ public class AccountDiffPreference {
@Column(id = 11) @Column(id = 11)
protected boolean skipUncommented; protected boolean skipUncommented;
@Column(id = 12)
protected boolean expandAllComments;
protected AccountDiffPreference() { protected AccountDiffPreference() {
} }
@@ -120,6 +123,7 @@ public class AccountDiffPreference {
this.showTabs = p.showTabs; this.showTabs = p.showTabs;
this.skipDeleted = p.skipDeleted; this.skipDeleted = p.skipDeleted;
this.skipUncommented = p.skipUncommented; this.skipUncommented = p.skipUncommented;
this.expandAllComments = p.expandAllComments;
this.context = p.context; this.context = p.context;
} }
@@ -209,4 +213,12 @@ public class AccountDiffPreference {
public void setSkipUncommented(boolean skip) { public void setSkipUncommented(boolean skip) {
skipUncommented = skip; skipUncommented = skip;
} }
public boolean isExpandAllComments() {
return expandAllComments;
}
public void setExpandAllComments(boolean expand) {
expandAllComments = expand;
}
} }

View File

@@ -32,7 +32,7 @@ import java.util.List;
/** A version of the database schema. */ /** A version of the database schema. */
public abstract class SchemaVersion { public abstract class SchemaVersion {
/** The current schema version. */ /** The current schema version. */
private static final Class<? extends SchemaVersion> C = Schema_53.class; private static final Class<? extends SchemaVersion> C = Schema_54.class;
public static class Module extends AbstractModule { public static class Module extends AbstractModule {
@Override @Override

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2011 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.schema;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class Schema_54 extends SchemaVersion {
@Inject
Schema_54(Provider<Schema_53> prior) {
super(prior);
}
}