Example #1
0
File: Z.java Project: adamldavis/z
 @Override
 public void mouseReleased(MouseEvent e) {
   log.info("released: " + e);
   if (point1 != null && point2 != null) {
     if (draggedNode == null) {
       ZNode z = findZNodeAt(e.getPoint());
       if (z == null) {
         createSubNode(e.getPoint());
       } else dragged(z);
     } else if (e.getPoint().y >= display.getHeight() - 40) {
       final ZTask task = taskList.getTaskAt(e.getPoint().x, 20);
       if (task == null) {
         // TODO: show confirmation?
         synchronized (zNodes) {
           zNodes.remove(draggedNode);
         }
       } else task.add(draggedNode);
       draggedNode = null;
     } else {
       draggedNode.getLocation().setLocation(translateToZNodePoint(point2));
       updateSubLocations(draggedNode, true, draggedNode.getLocation());
       draggedNode = null;
     }
     point1 = point2 = null;
   }
 }
Example #2
0
File: Z.java Project: adamldavis/z
 @Override
 public void keyPressed(KeyEvent e) {
   if (!links.isEmpty()) return;
   switch (e.getKeyChar()) {
     case 's':
       // TODO: Search!!!!
       String name = display.showInputDialog("Search", "Z");
       ZTask activeTask = taskList.getActiveTask();
       for (ZNode node : getZNodes()) {
         if (node.getName().startsWith(name)) {
           log.info("found {}", node.getName());
           if (activeTask != null) {
             activeTask.add(node);
           }
         }
       }
       break;
     case 'm':
       if (selectedNode.getNodeType() == ZNodeType.CLASS) {
         addMethodLinks();
       }
       break;
     case 'p':
       // TODO: add polymorphic links
     case 'i':
     case 'r':
       // TODO: add import/require links
     case 'h':
     case 'f':
       addFieldLinks();
   }
 }
Example #3
0
File: Z.java Project: adamldavis/z
 private void selectTask(final ZTask task) {
   if (task == taskList.getActiveTask()) {
     taskList.setActiveTask(null);
     clicked(selectedNode);
     return;
   } else {
     taskList.setActiveTask(task);
   }
   if (task.getNodes().isEmpty()) {
     clicked(selectedNode);
   } else {
     synchronized (zNodes) {
       zNodes.clear();
       zNodes.addAll(task.getNodes());
     }
   }
 }