Examples of NodeView


Examples of org.freeplane.view.swing.map.NodeView

  }

  public void showNodePopupMenu(final MouseEvent e) {
    if (e.isPopupTrigger()) {
      ModeController mc = Controller.getCurrentController().getModeController();
      final NodeView nodeView = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, e.getComponent());
      if (nodeView == null)
        return;
      if (!nodeView.isSelected()) {
        Controller.getCurrentController().getSelection().selectAsTheOnlyOneSelected(nodeView.getModel());
      }
      final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
      new NodePopupMenuDisplayer().showMenuAndConsumeEvent(popupmenu, e);
    }
  }
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

      final int deltaX = (int) ((e.getX() - originX) / mapView.getZoom());
      final int deltaY = (int) ((e.getY() - originY) / mapView.getZoom());
      double distSqToTarget = 0;
      double distSqToSource = 0;
      final NodeModel target = draggedLink.getTarget();
      final NodeView targetView = mapView.getNodeView(target);
      final NodeView sourceView = mapView.getNodeView(draggedLink.getSource());
      if (targetView != null && sourceView != null) {
        final Point targetLinkPoint = targetView.getLinkPoint(draggedLink.getEndInclination());
        final Point sourceLinkPoint = sourceView.getLinkPoint(draggedLink.getStartInclination());
        distSqToTarget = targetLinkPoint.distanceSq(originX, originY);
        distSqToSource = sourceLinkPoint.distanceSq(originX, originY);
      }
      if ((targetView == null || sourceView != null) && distSqToSource <= distSqToTarget * 2.25) {
        final Point changedInclination = draggedLink.getStartInclination();
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

* The NodeDragListener which belongs to every NodeView
*/
public class MNodeDragListener implements DragGestureListener {
  public void dragGestureRecognized(final DragGestureEvent e) {
    final MainView mainView = (MainView) e.getComponent();
    final NodeView nodeView = mainView.getNodeView();
    final MapView mapView = nodeView.getMap();
    mapView.select();
    if(! nodeView.isSelected()){
      nodeView.getMap().getModeController().getController().getSelection().selectAsTheOnlyOneSelected(nodeView.getModel());
    }
    Rectangle bounds = new Rectangle(0, 0, mainView.getWidth(), mainView.getHeight());
    if(!bounds.contains(e.getDragOrigin()))
      return;
    final int dragActionType = e.getDragAction();
    if (dragActionType == DnDConstants.ACTION_MOVE) {
      final NodeModel node = nodeView.getModel();
      if (node.isRoot()) {
        if(! isLinkDragEvent(e))
          return;
      }
    }
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

    }
  }

  @Override
  protected Stroke getStroke() {
    final NodeView target = getTarget();
    int edgeWidth = target.getEdgeWidth();
    final EdgeStyle style = target.getEdgeStyle();
    final int nodeLineWidth = style.getNodeLineWidth(edgeWidth);
    final int zoomedWidth;
    if(edgeWidth != 0)
          zoomedWidth = getTarget().getZoomed(nodeLineWidth);
        else
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

    return new Rectangle((int) (p.getX() - side / 2), (int) (p.getY() - side / 2), side, side);
  }

  public boolean shouldSelectOnClick(MouseEvent e) {
    if (isInside(e)) {
      final NodeView nodeView = getRelatedNodeView(e);
      return !nodeView.isSelected() || Controller.getCurrentController().getSelection().size() != 1;
    }
    return false;
  }
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

    return false;
  }

  public void extendSelection(final MouseEvent e) {
    final Controller controller = Controller.getCurrentController();
    final NodeView nodeView = getRelatedNodeView(e);
    final NodeModel newlySelectedNode = nodeView.getModel();
    final boolean extend = Compat.isMacOsX() ? e.isMetaDown() : e.isControlDown();
    final boolean range = e.isShiftDown();
    final IMapSelection selection = controller.getSelection();
    if (range && !extend) {
      selection.selectContinuous(newlySelectedNode);
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

      e.consume();
    }
  }

  public void selectSingleNode(MouseEvent e) {
    final NodeView nodeV = getRelatedNodeView(e);
    final Controller controller = Controller.getCurrentController();
    if (!((MapView) controller.getMapViewManager().getMapViewComponent()).isSelected(nodeV)) {
      controller.getSelection().selectAsTheOnlyOneSelected(nodeV.getModel());
    }
  }
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

                @SuppressWarnings("unchecked")
                    final List<File> transferData = (List<File>) ev.getTransferable().getTransferData(MindMapNodesSelection.fileListFlavor);
                if(transferData.size() != 1)
                  return;
                final Component target = ev.getDropTargetContext().getComponent();
                NodeView nodeView = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, target);
                final File file = transferData.get(0);
            final ViewerController vc = (Controller.getCurrentController().getModeController()
                  .getExtension(ViewerController.class));
            final NodeModel node = nodeView.getModel();
          vc.paste(file.toURI(), node, node.isLeft());
              }
              catch (Exception e) {
                LogUtils.warn(e);
              }
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

            return;
          }
          try {
            Controller controller = Controller.getCurrentController();
            if (!controller.getModeController().isBlocked() && controller.getSelection().size() <= 1) {
              final NodeView nodeV = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class,
                  e.getComponent());
              if (nodeV.isDisplayable() && nodeV.getModel().isVisible()) {
                nodeV.getMap().select();
                controller.getSelection().selectAsTheOnlyOneSelected(nodeV.getModel());
              }
            }
          }
          catch (NullPointerException e) {
          }
View Full Code Here

Examples of org.freeplane.view.swing.map.NodeView

    }
    textfield.setSize(preferredSize);
    if(layoutMapOnTextChange)
      parent.setPreferredSize(new Dimension(preferredSize.width + horizontalSpace , preferredSize.height + verticalSpace));
    textfield.revalidate();
    final NodeView nodeView = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, parent);
    final MapView mapView = (MapView) SwingUtilities.getAncestorOfClass(MapView.class, nodeView);
    if(mapView == null)
      return;
    if(layoutMapOnTextChange)
      mapView.scrollNodeToVisible(nodeView);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.