示例#1
0
  public void doLayout(
      TLayoutType layoutType,
      boolean isAllElementsLayouted,
      boolean isAnimated,
      int xOffset,
      int yOffset,
      final int xGap,
      final int yGap) {
    if (layoutType.equals(TLayoutType.SPRING_LAYOUT_TYPE)) {
      layouter.start();
    } else if (layoutType.equals(TLayoutType.RANDOM_LAYOUT_TYPE)) {
      layouter.stop();
      layouter.random(0, 600);
    } else {
      layouter.stop();

      graph.doLayout(
          isAllElementsLayouted
              ? graph.getDataBox().getAllElements().iterator()
              : graph.getDataBox().getSelectionModel().getAllSelectedElement().iterator(),
          layoutType.getType(),
          isAnimated,
          null,
          xOffset,
          yOffset,
          new Generator() {
            public Object generate(Object object) {
              Element element = (Element) object;
              if (element instanceof Group) {
                return null;
              }

              return new Dimension(xGap, yGap);
            }
          });
    }
  }
示例#2
0
 public void stop() {
   layouter.stop();
 }