Exemplo n.º 1
0
Arquivo: Z.java Projeto: adamldavis/z
 private ZNode createNewZNode(Point point, ZNodeType type, String name) {
   if (name == null) {
     return null;
   }
   final Point2D.Float zp = translateToZNodePoint(point);
   final ZNode zNode = new ZNode(zp.x, zp.y, name.trim());
   zNode.setNodeType(type);
   zNode.setParentFile(selectedNode.getParentFile());
   if (type == ZNodeType.DEPENDENCY) {
     zNode.setCode(asList("artifactId=" + name, "groupId=" + name));
   }
   synchronized (zNodes) {
     zNodes.add(zNode);
   }
   if (type == ZNodeType.METHOD) {
     zNode.setParentFile(
         new File(
             selectedNode.getParentFile(),
             selectedNode.getName() + "." + selectedNode.getExtension()));
     int end = selectedNode.getEndLineNumber(apiFactory.getLanguageParser());
     for (ZNode method : selectedNode.getSubmodules()) {
       end += method.getCodeLineSize();
     }
     zNode.setExtension(String.valueOf(end));
     System.err.println("ext=" + zNode.getExtension());
   } else if (type == ZNodeType.CALLEE) {
     selectedNode.addCodeLine(zNode.getName());
   }
   new ZCodeSaver(apiFactory).save(zNode);
   return zNode;
 }
Exemplo n.º 2
0
Arquivo: Z.java Projeto: adamldavis/z
  protected void clicked(ZNode node) {
    log.info("selected: " + node);
    selectedNode = new ZCodeLoader(apiFactory).load(node);
    synchronized (zNodes) {
      zNodes.clear();
      zNodes.add(selectedNode);
      zNodes.addAll(selectedNode.getDependencies());
      zNodes.addAll(selectedNode.getSubmodules());
    }
    count.set(0);

    state = State.ANIMATING;
    aniCount.set(0);
    final Dimension dim = display.getDimension();
    sortNodes();
    float selSize = (float) Math.min(dim.getWidth(), dim.getHeight()) / 2.2f;
    sizeMap.put(selectedNode, selSize);
    float shrinkFactor = 0.2f;
    float size = (float) (selSize * shrinkFactor);

    for (ZNode dep : selectedNode.getDependencies()) {
      sizeMap.put(dep, size);
    }
    for (ZNode sub : selectedNode.getSubmodules()) {
      sub = new ZCodeLoader(apiFactory).load(sub);
      sizeMap.put(sub, size + logSize(sub.getSubmodules().size()));
      synchronized (zNodes) {
        zNodes.addAll(sub.getSubmodules());
      }
      for (ZNode sub2 : sub.getSubmodules()) {
        sizeMap.put(sub2, size * shrinkFactor + logSize(sub2.getCodeLineSize()));
      }
    }
    Point2D.Float center = new Point2D.Float(selSize * 1.25f, selSize);
    pointMap.put(node, center);
    updateSubLocations(selectedNode, false, center);
  }
Exemplo n.º 3
0
Arquivo: Z.java Projeto: adamldavis/z
 private void updateEditorSize(Editor editor) {
   ZNode editorNode = edit.getNode(editor);
   int width = display.getWidth() - 50;
   int height = 50 + editorNode.getCodeLineSize() * 14;
   editor.getEditorPanel().setPreferredSize(new Dimension(width, height));
 }