Package org.freeplane.view.swing.map

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


      final ExternalResource activeView = getModel(e);
      NodeModel node = null;
      //get node from mouse click
      for (int i = 0; i < e.getComponent().getParent().getComponentCount(); i++) {
        if (e.getComponent().getParent().getComponent(i) instanceof MainView) {
          final MainView mv = (MainView) e.getComponent().getParent().getComponent(i);
          node = mv.getNodeView().getModel();
          break;
        }
      }
      if (node == null) {
        node = Controller.getCurrentModeController().getMapController().getSelectedNode();
View Full Code Here


  @Override
    public void mouseDragged(final MouseEvent e) {
    if (!isDragActive())
      return;
    if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == (InputEvent.BUTTON1_DOWN_MASK)) {
      final MainView mainView = (MainView) e.getSource();
      final NodeView nodeV = getNodeView(e);
      final MapView mapView = nodeV.getMap();
      final Point point = e.getPoint();
      findGridPoint(point);
      UITools.convertPointToAncestor(nodeV, point, JScrollPane.class);
      ModeController c = Controller.getCurrentController().getModeController();
      final Point dragNextPoint = point;
      if (!Compat.isCtrlEvent(e)) {
        final NodeModel node = nodeV.getModel();
        final LocationModel locationModel = LocationModel.createLocationModel(node);
        final int hGapChange = getHGapChange(dragNextPoint, node);
        if(hGapChange != 0){
          locationModel.setHGap(originalHGap + hGapChange);
        }
        final int shiftYChange = getNodeShiftYChange(dragNextPoint, node);
        if(shiftYChange != 0){
          locationModel.setShiftY(originalShiftY + shiftYChange);
        }
        if(hGapChange != 0 || shiftYChange != 0)
          c.getMapController().nodeRefresh(node);
        else
          return;
      }
      else {
        final NodeModel parentNode = nodeV.getVisibleParentView().getModel();
        final int vGapChange = getVGapChange(dragNextPoint, parentNode);
        if(vGapChange != 0){
          LocationModel.createLocationModel(parentNode).setVGap(Math.max(0, originalParentVGap - vGapChange));
          final MapController mapController = c.getMapController();
          mapController.nodeRefresh(parentNode);
          mapController.nodeRefresh(nodeV.getModel());
        }
        else
          return;
      }
      EventQueue.invokeLater(new Runnable() {
        public void run() {
          final Rectangle r = mainView.getBounds();
          UITools.convertRectangleToAncestor(mainView.getParent(), r, mapView);
          final boolean isEventPointVisible = mapView.getVisibleRect().contains(r);
          if (!isEventPointVisible) {
            mapView.scrollRectToVisible(r);
          }
        }
View Full Code Here

    point.y -= point.y % gridSize;
  }

  @Override
  public void mouseReleased(final MouseEvent e) {
    final MainView v = (MainView) e.getSource();
    if (!v.contains(e.getX(), e.getY())) {
      v.setMouseArea(MouseArea.OUT);
    }
    if (!isDragActive()) {
      super.mouseReleased(e);
      return;
    }
View Full Code Here

        preferredWidth = Math.min(preferredWidth, Integer.parseInt(ResourceController.getResourceController()
          .getProperty("el__max_default_window_width")));
        final Dimension preferredSize = new Dimension(preferredWidth, preferredHeight);
        editNodeWYSIWYG.setPreferredSize(preferredSize);
      }
      final MainView mainView = (MainView) getComponent(node);
          final NodeView nodeView = mainView.getNodeView();
      if(EditedComponent.TEXT.equals(editControl.getEditType())){
              final Font font = getFont(node);
              editNodeWYSIWYG.setTitle("edit_long_node");
              editNodeWYSIWYG.setFont(font);
              final Color nodeTextColor = getTextColor(node);
View Full Code Here

    }
 
  private EditNodeBase createEditor(final NodeModel node, final EditedComponent parent, final String text,
                                                       final IEditControl editControl) {
    final ZoomableLabel parentComponent;
    final MainView mainView = (MainView) getComponent(node);
        final NodeView nodeView = mainView.getNodeView();
    if(EditedComponent.TEXT.equals(parent))
      parentComponent = mainView;
    else if(EditedComponent.DETAIL.equals(parent)) {
      final JComponent component = nodeView.getContent(NodeView.DETAIL_VIEWER_POSITION);
          if(component instanceof ZoomableLabel)
View Full Code Here

  private Integer width;
    private ConnectorLocation startConnectorLocation;
    private ConnectorLocation endConnectorLocation;

  protected void createStart() {
        final MainView mainView = source.getMainView();
        final MainView targetMainView = target.getMainView();
       
        final Point relativeLocation = source.getRelativeLocation(target);
        relativeLocation.x += targetMainView.getWidth()/2;
        relativeLocation.y += targetMainView.getHeight()/2;
        start = mainView.getConnectorPoint(relativeLocation);
        startConnectorLocation = mainView.getConnectorLocation(relativeLocation);
               
        relativeLocation.x -= targetMainView.getWidth()/2;
        relativeLocation.y -= targetMainView.getHeight()/2;
        relativeLocation.x = - relativeLocation.x + mainView.getWidth()/2;
        relativeLocation.y = - relativeLocation.y + mainView.getHeight()/2;
    end = target.getMainView().getConnectorPoint(relativeLocation);
    endConnectorLocation = targetMainView.getConnectorLocation(relativeLocation);
  }
View Full Code Here

      }
        final Component component = findMapComponent(e);
        if(! (component instanceof MainView)){
          return;
        }
        MainView mainView = (MainView) component;
        final NodeModel model = mainView.getNodeView().getModel();
        switch(e.getClickCount()){
          case 1:
            final MapController mapController = Controller.getCurrentModeController().getMapController();
        mapController.setFolded(model, ! model.isFolded());
            break;
View Full Code Here

/**
* 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();
View Full Code Here

      add(getResetZoom());
    }
  }

  protected void maybeShowPopup(final MouseEvent e) {
    MainView mv = null;
    if (e.isPopupTrigger()) {
      for (final Component cmp : e.getComponent().getParent().getComponents()) {
        if (cmp instanceof MainView) {
          mv = (MainView) cmp;
          node = mv.getNodeView().getModel();
          viewer = (Controller.getCurrentController().getModeController().getExtension(
              ViewerController.class));
          break;
        }
      }
View Full Code Here

        final NodeModel node = Controller.getCurrentModeController().getMapController().getSelectedNode();
        final NodeView nodeView = mapView.getNodeView(node);
        final JPopupMenu popupmenu = modeController.getUserInputListenerFactory().getNodePopupMenu();
        if (popupmenu != null) {
          popupmenu.addHierarchyListener(new ControllerPopupMenuListener());
          final MainView mainView = nodeView.getMainView();
          popupmenu.show(mainView, mainView.getX(), mainView.getY());
        }
    }
  }
View Full Code Here

TOP

Related Classes of org.freeplane.view.swing.map.MainView

Copyright © 2018 www.massapicom. 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.