summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2008-12-19 17:46:21 -0800
committerShawn O. Pearce <sop@google.com>2008-12-19 17:46:21 -0800
commit79096efea044ebc7860d96916a9a3fc095945ffc (patch)
tree8b698b55ebe2ec051c93db8299622f5a11b9f12a /webapp
parentd54c86556fbc95a3020ff4afee4ef47b44d2e812 (diff)
Open/collapse comments in patches when enter or 'o' is presed on the line
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/com/google/gerrit/client/patches/AbstractPatchContentTable.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/webapp/src/com/google/gerrit/client/patches/AbstractPatchContentTable.java b/webapp/src/com/google/gerrit/client/patches/AbstractPatchContentTable.java
index d064f2a287..86d3d836f0 100644
--- a/webapp/src/com/google/gerrit/client/patches/AbstractPatchContentTable.java
+++ b/webapp/src/com/google/gerrit/client/patches/AbstractPatchContentTable.java
@@ -24,6 +24,8 @@ import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
public abstract class AbstractPatchContentTable extends FancyFlexTable<Object> {
private static final long AGE = 7 * 24 * 60 * 60 * 1000L;
@@ -42,10 +44,10 @@ public abstract class AbstractPatchContentTable extends FancyFlexTable<Object> {
@Override
protected void onOpenItem(final Object item) {
- if (item instanceof PatchLineComment) {
- final ComplexDisclosurePanel p =
- (ComplexDisclosurePanel) table.getWidget(getCurrentRow(), 1);
- p.setOpen(!p.isOpen());
+ if (item instanceof CommentList) {
+ for (final ComplexDisclosurePanel p : ((CommentList) item).panels) {
+ p.setOpen(!p.isOpen());
+ }
}
}
@@ -87,6 +89,19 @@ public abstract class AbstractPatchContentTable extends FancyFlexTable<Object> {
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.setStyleName(row, col, "Comment");
- setRowItem(row, line);
+
+ CommentList l = (CommentList) getRowItem(row);
+ if (l == null) {
+ l = new CommentList();
+ setRowItem(row, l);
+ }
+ l.comments.add(line);
+ l.panels.add(panel);
+ }
+
+ protected static class CommentList {
+ final List<PatchLineComment> comments = new ArrayList<PatchLineComment>();
+ final List<ComplexDisclosurePanel> panels =
+ new ArrayList<ComplexDisclosurePanel>();
}
}