Exemplo n.º 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));
 }
Exemplo n.º 2
0
 public WModelIndex getIndex(int row, int column, final WModelIndex parent) {
   int parentId;
   if (!(parent != null)) {
     parentId = 0;
   } else {
     int grandParentId = parent.getInternalId();
     parentId = this.getTreeId(grandParentId, parent.getRow());
   }
   return this.createIndex(row, column, parentId);
 }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
0
 private Git.Object getObject(final WModelIndex index) {
   int parentId = index.getInternalId();
   final GitModel.Tree parentItem = this.treeData_.get(parentId);
   return this.git_.treeGetObject(parentItem.getTreeObject(), index.getRow());
 }