Пример #1
0
  /** getCellsBinary */
  private void createCells() {
    ConstraintDefinition constraint = model.createConstraintDefinition(template);
    // int count = template.parameterCount();
    ActivityDefinitonCell[] cells = new ActivityDefinitonCell[constraint.parameterCount()];
    // ActivityDefinition [] params = new ActivityDefinition [count];
    double total = 0;
    int c = 0;
    for (Parameter parameter : constraint.getParameters()) {

      ActivityDefinition activityDefinition = model.addActivityDefinition();
      activityDefinition.setName(parameter.getName());
      // params[i] = activityDefinition;
      constraint.addBranch(parameter, activityDefinition);

      ActivityDefinitonCell activityDefinitionCell =
          view.getActivityDefinitionCell(activityDefinition);
      total = activityDefinitionCell.getWidth() + 10;
      cells[c++] = activityDefinitionCell;
    }

    double radius = total / 2 + 100;
    Point[] points = Circle.getPoints(radius, cells.length);

    for (int i = 0; i < cells.length; i++) {
      ActivityDefinitonCell cell = cells[i];
      int x = points[i].x + (new Double(cell.getWidth() / 2)).intValue();
      int y = points[i].y + (new Double(cell.getHeight() / 2)).intValue();
      cell.setPosition(new Point(x, y));
    }
    model.addConstraintDefiniton(constraint);
  }
Пример #2
0
 /**
  * createGraph
  *
  * @return DGraph
  */
 public DGraph createGraph() {
   view.getGraph().getSelectionModel().clearSelection();
   return view.getGraph();
 }