// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java
// public enum CrucibleFilter {
//   // Inbox
//   ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer.
//   ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user to summarize.
//   InDraft("drafts", "In Draft"), //Draft reviews created by the current user.
//   RequireApprovalReview("requireMyApproval", "Review Required My Approval"), //Reviews waiting to be approved by the current user.
// 
//   // Outbox
//   OutForReview("outForReview", "Out For Review"), //Reviews with uncompleted reviewers, on which the current reviewer is the moderator.
//   Completed("completed", "Completed"), //Open reviews where the current user is a completed reviewer.
// 
//   // Archive
//   Closed("closed", "Closed"), //Closed reviews created by the current user.
//   Abandoned("trash", "Abandoned"); //Abandoned reviews created by the current user.
// 
//   private final String myFilterUrl;
//   private final String myFilterName;
// 
//   CrucibleFilter(@NotNull final String filterUrl, @NotNull final String filterName) {
//     myFilterUrl = filterUrl;
//     myFilterName = filterName;
//   }
// 
//   @NotNull
//   public String getFilterUrl() {
//     return myFilterUrl;
//   }
// 
//   @NotNull
//   public String getFilterName() {
//     return myFilterName;
//   }
// }
// 
// Path: src/com/jetbrains/crucible/ui/toolWindow/CrucibleReviewModel.java
// public class CrucibleReviewModel extends DefaultTableModel {
//   private final Project myProject;
// 
//   public CrucibleReviewModel(Project project) {
//     myProject = project;
//   }
// 
//   @Override
//   public Class<?> getColumnClass(int columnIndex) {
//     if (columnIndex == 4) return Date.class;
//     return String.class;
//   }
// 
//   @Override
//   public int getColumnCount() {
//     return 5;
//   }
// 
//   @Override
//   public String getColumnName(int column) {
//     switch (column) {
//       case 0:
//         return CrucibleBundle.message("crucible.id");
//       case 1:
//         return CrucibleBundle.message("crucible.description");
//       case 2:
//         return CrucibleBundle.message("crucible.state");
//       case 3:
//         return CrucibleBundle.message("crucible.author");
//       case 4:
//         return CrucibleBundle.message("crucible.date");
//     }
//     return super.getColumnName(column);
//   }
// 
//   @Override
//   public boolean isCellEditable(int row, int column) {
//     return false;
//   }
// 
//   public void updateModel(@NotNull final CrucibleFilter filter) {
//     setRowCount(0);
//     final CrucibleManager manager = CrucibleManager.getInstance(myProject);
//     final List<BasicReview> reviews;
//     reviews = manager.getReviewsForFilter(filter);
//     if (reviews != null) {
//       for (BasicReview review : reviews) {
//         addRow(new Object[]{review.getPermaId(), review.getDescription(), review.getState(),
//           review.getAuthor().getUserName(), review.getCreateDate()});
// 
//       }
//     }
//   }
// }


import com.intellij.ui.treeStructure.SimpleNode;
import com.jetbrains.crucible.model.CrucibleFilter;
import com.jetbrains.crucible.ui.toolWindow.CrucibleReviewModel;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;

package com.jetbrains.crucible.ui.toolWindow.tree;



/**
 * User : ktisha
 */
public class CrucibleRootNode extends SimpleNode {
  private static final String NAME = "All My Reviews";
  private final CrucibleReviewModel myReviewModel;
  private final List<SimpleNode> myChildren = new ArrayList<SimpleNode>();

  public CrucibleRootNode(@NotNull final CrucibleReviewModel reviewModel) {
    myReviewModel = reviewModel;
    addChildren();
  }

  @NotNull
  public String toString() {
    return NAME;
  }

  @Override
  public SimpleNode[] getChildren() {
    if (myChildren.isEmpty()) {
      addChildren();
    }
    return myChildren.toArray(new SimpleNode[myChildren.size()]);
  }

  private void addChildren() {
// Path: src/com/jetbrains/crucible/model/CrucibleFilter.java
// public enum CrucibleFilter {
//   // Inbox
//   ToReview("toReview", "To Review"), //Reviews on which the current user is an uncompleted reviewer.
//   ReadyToClose("toSummarize", "Ready To Close"), //Completed reviews which are ready for the current user to summarize.
//   InDraft("drafts", "In Draft"), //Draft reviews created by the current user.
//   RequireApprovalReview("requireMyApproval", "Review Required My Approval"), //Reviews waiting to be approved by the current user.
// 
//   // Outbox
//   OutForReview("outForReview", "Out For Review"), //Reviews with uncompleted reviewers, on which the current reviewer is the moderator.
//   Completed("completed", "Completed"), //Open reviews where the current user is a completed reviewer.
// 
//   // Archive
//   Closed("closed", "Closed"), //Closed reviews created by the current user.
//   Abandoned("trash", "Abandoned"); //Abandoned reviews created by the current user.
// 
//   private final String myFilterUrl;
//   private final String myFilterName;
// 
//   CrucibleFilter(@NotNull final String filterUrl, @NotNull final String filterName) {
//     myFilterUrl = filterUrl;
//     myFilterName = filterName;
//   }
// 
//   @NotNull
//   public String getFilterUrl() {
//     return myFilterUrl;
//   }
// 
//   @NotNull
//   public String getFilterName() {
//     return myFilterName;
//   }
// }
// 
// Path: src/com/jetbrains/crucible/ui/toolWindow/CrucibleReviewModel.java
// public class CrucibleReviewModel extends DefaultTableModel {
//   private final Project myProject;
// 
//   public CrucibleReviewModel(Project project) {
//     myProject = project;
//   }
// 
//   @Override
//   public Class<?> getColumnClass(int columnIndex) {
//     if (columnIndex == 4) return Date.class;
//     return String.class;
//   }
// 
//   @Override
//   public int getColumnCount() {
//     return 5;
//   }
// 
//   @Override
//   public String getColumnName(int column) {
//     switch (column) {
//       case 0:
//         return CrucibleBundle.message("crucible.id");
//       case 1:
//         return CrucibleBundle.message("crucible.description");
//       case 2:
//         return CrucibleBundle.message("crucible.state");
//       case 3:
//         return CrucibleBundle.message("crucible.author");
//       case 4:
//         return CrucibleBundle.message("crucible.date");
//     }
//     return super.getColumnName(column);
//   }
// 
//   @Override
//   public boolean isCellEditable(int row, int column) {
//     return false;
//   }
// 
//   public void updateModel(@NotNull final CrucibleFilter filter) {
//     setRowCount(0);
//     final CrucibleManager manager = CrucibleManager.getInstance(myProject);
//     final List<BasicReview> reviews;
//     reviews = manager.getReviewsForFilter(filter);
//     if (reviews != null) {
//       for (BasicReview review : reviews) {
//         addRow(new Object[]{review.getPermaId(), review.getDescription(), review.getState(),
//           review.getAuthor().getUserName(), review.getCreateDate()});
// 
//       }
//     }
//   }
// }


// Path: src/com/jetbrains/crucible/ui/toolWindow/tree/CrucibleRootNode.java
import com.intellij.ui.treeStructure.SimpleNode;
import com.jetbrains.crucible.model.CrucibleFilter;
import com.jetbrains.crucible.ui.toolWindow.CrucibleReviewModel;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;


package com.jetbrains.crucible.ui.toolWindow.tree;



/**
 * User : ktisha
 */
public class CrucibleRootNode extends SimpleNode {
  private static final String NAME = "All My Reviews";
  private final CrucibleReviewModel myReviewModel;
  private final List<SimpleNode> myChildren = new ArrayList<SimpleNode>();

  public CrucibleRootNode(@NotNull final CrucibleReviewModel reviewModel) {
    myReviewModel = reviewModel;
    addChildren();
  }

  @NotNull
  public String toString() {
    return NAME;
  }

  @Override
  public SimpleNode[] getChildren() {
    if (myChildren.isEmpty()) {
      addChildren();
    }
    return myChildren.toArray(new SimpleNode[myChildren.size()]);
  }

  private void addChildren() {
    for (CrucibleFilter filter : CrucibleFilter.values()) {