Example #1
0
 public Object getData(final WModelIndex index, int role) {
   if (role != ItemDataRole.DisplayRole) {
     return super.getData(index, role);
   }
   double delta_y = (this.yEnd_ - this.yStart_) / (this.getColumnCount() - 2);
   if (index.getRow() == 0) {
     if (index.getColumn() == 0) {
       return 0.0;
     }
     return this.yStart_ + (index.getColumn() - 1) * delta_y;
   }
   double delta_x = (this.xEnd_ - this.xStart_) / (this.getRowCount() - 2);
   if (index.getColumn() == 0) {
     if (index.getRow() == 0) {
       return 0.0;
     }
     return this.xStart_ + (index.getRow() - 1) * delta_x;
   }
   double x;
   double y;
   y = this.yStart_ + (index.getColumn() - 1) * delta_y;
   x = this.xStart_ + (index.getRow() - 1) * delta_x;
   return 4
       * Math.sin(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)))
       / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
 }
Example #2
0
 public int getRowCount(final WModelIndex parent) {
   int treeId;
   if ((parent != null)) {
     if (parent.getColumn() != 0) {
       return 0;
     }
     Git.Object o = this.getObject(parent);
     if (o.type == Git.ObjectType.Tree) {
       treeId = this.getTreeId(parent.getInternalId(), parent.getRow());
     } else {
       return 0;
     }
   } else {
     treeId = 0;
   }
   return this.treeData_.get(treeId).getRowCount();
 }
Example #3
0
 public Object getData(final WModelIndex index, int role) {
   if (!(index != null)) {
     return null;
   }
   Git.Object object = this.getObject(index);
   switch (index.getColumn()) {
     case 0:
       if (role == ItemDataRole.DisplayRole) {
         if (object.type == Git.ObjectType.Tree) {
           return object.name + '/';
         } else {
           return object.name;
         }
       } else {
         if (role == ItemDataRole.DecorationRole) {
           if (object.type == Git.ObjectType.Blob) {
             return "icons/git-blob.png";
           } else {
             if (object.type == Git.ObjectType.Tree) {
               return "icons/git-tree.png";
             }
           }
         } else {
           if (role == ContentsRole) {
             if (object.type == Git.ObjectType.Blob) {
               return this.git_.catFile(object.id);
             }
           }
         }
       }
       break;
     case 1:
       if (role == ItemDataRole.DisplayRole) {
         if (object.type == Git.ObjectType.Tree) {
           return "Folder";
         } else {
           String suffix = getSuffix(object.name);
           if (suffix.equals("C") || suffix.equals("cpp")) {
             return "C++ Source";
           } else {
             if (suffix.equals("h") || suffix.equals("") && !this.topLevel(index)) {
               return "C++ Header";
             } else {
               if (suffix.equals("css")) {
                 return "CSS Stylesheet";
               } else {
                 if (suffix.equals("js")) {
                   return "JavaScript Source";
                 } else {
                   if (suffix.equals("md")) {
                     return "Markdown";
                   } else {
                     if (suffix.equals("png") || suffix.equals("gif")) {
                       return "Image";
                     } else {
                       if (suffix.equals("txt")) {
                         return "Text";
                       } else {
                         return null;
                       }
                     }
                   }
                 }
               }
             }
           }
         }
       }
   }
   return null;
 }