Examples of ModeController


Examples of org.freeplane.features.mode.ModeController

    if(e.getClickCount() == 2 && Compat.isCtrlEvent(e)){
      final MapView mapView = (MapView) e.getComponent();
      final Object object = mapView.detectCollision(new Point(originX, originY));
      if(object != null)
        return;
      final ModeController modeController = Controller.getCurrentModeController();
      final IExtension freeNode = modeController.getExtension(FreeNode.class);
      if(freeNode != null && modeController instanceof MModeController){
        final JComponent rootContent = mapView.getRoot().getMainView();
        final Point contentPt = new Point();
        UITools.convertPointToAncestor(rootContent, contentPt, mapView);
        final float zoom = mapView.getZoom();
        final Point eventPoint = e.getPoint();
        int x =(int) ((eventPoint.x - contentPt.x)/zoom);
        final int y =(int) ((eventPoint.y - contentPt.y)/zoom);
        final int rootContentNormalWidth = (int)(rootContent.getWidth()/zoom);
        final boolean newNodeIsLeft = x < rootContentNormalWidth/2;
        if(newNodeIsLeft){
          x = rootContentNormalWidth - x;
        }
        final Point pt = new Point(x, y);
        ((MMapController)modeController.getMapController()).addFreeNode(pt, newNodeIsLeft);
      }
    }
    else
      super.mouseClicked(e);
    }
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

    removeFormattingAction = new ExtendedEditorKit.RemoveStyleAttributeAction(null, TextUtils.getText("simplyhtml.clearFormatLabel"));
    removeFormattingAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control T"));
   
    inputMethodInUseListener = new InputMethodInUseListener();
    if(editControl != null ){
      final ModeController modeController = Controller.getCurrentModeController();
      final MTextController textController = (MTextController) TextController.getController(modeController);
      textfield = textController.createEditorPane(MTextController.NODE_TEXT);
      textfield.setNavigationFilter(new MyNavigationFilter(textfield));
      textfield.addInputMethodListener(inputMethodInUseListener);
    }
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

   * @see org.freeplane.view.swing.map.INodeTextField#show()
   */
  @SuppressWarnings("serial")
    @Override
  public void show(final RootPaneContainer frame) {
    final ModeController modeController = Controller.getCurrentModeController();
    final IMapViewManager viewController = modeController.getController().getMapViewManager();
    final MTextController textController = (MTextController) TextController.getController(modeController);
    nodeView = (NodeView) SwingUtilities.getAncestorOfClass(NodeView.class, parent);
    font = parent.getFont();
    zoom = viewController.getZoom();
    if (zoom != 1F) {
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

    nodeSelector = new NodeSelector();
  }

  @Override
    public void mouseClicked(MouseEvent e) {
    final ModeController mc = Controller.getCurrentController().getModeController();
    if (Compat.isMacOsX()) {
      final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
      if (popupmenu.isShowing()) {
        return;
      }
    }
    final NodeView nodeView = nodeSelector.getRelatedNodeView(e);
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

        if (editHandler != null) {
          editHandler.edit(e, FirstAction.EDIT_CURRENT, false);
        }
        return;
      case KeyEvent.VK_CONTEXT_MENU:
        final ModeController modeController = Controller.getCurrentModeController();
        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

Examples of org.freeplane.features.mode.ModeController

      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;
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

      super.mouseReleased(e);
      return;
    }
    final NodeView nodeV = getNodeView(e);
    final NodeModel node = nodeV.getModel();
    final ModeController modeController = nodeV.getMap().getModeController();
    final NodeModel parentNode = nodeV.getModel().getParentNode();
    final int parentVGap = LocationModel.getModel(parentNode).getVGap();
    int hgap = LocationModel.getModel(node).getHGap();
    final int shiftY = LocationModel.getModel(node).getShiftY();
    adjustNodeIndices(nodeV);
    resetPositions(node);
    final Controller controller = modeController.getController();
    MLocationController locationController = (MLocationController) LocationController.getController(controller
        .getModeController());
    locationController.moveNodePosition(node, parentVGap, hgap, shiftY);
    stopDrag();
  }
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

          selectedsBackup = adjustNodeIndexBackupSelection(siblingV, selectedsBackup);
        }
      }
    }
    if (selectedsBackup != null) {
      final ModeController modeController = nodeV.getMap().getModeController();
      final Controller controller = modeController.getController();
      controller.getSelection().replaceSelection(selectedsBackup);
    }
  }
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

  private NodeModel[] adjustNodeIndexBackupSelection(final NodeView nodeV, NodeModel[] selectedsBackup) {
    final NodeModel node = nodeV.getModel();
    boolean isLeft = nodeV.isLeft();
    final int newIndex = calculateNewNodeIndex(nodeV, isLeft, 0, node.getParentNode().getChildCount());
    if (newIndex != -1) {
      final ModeController modeController = nodeV.getMap().getModeController();
      MMapController mapController = (MMapController) modeController.getMapController();
      if (selectedsBackup == null) {
        final Collection<NodeModel> selecteds = mapController.getSelectedNodes();
        selectedsBackup = selecteds.toArray(new NodeModel[selecteds.size()]);
      }
      mapController.moveNode(node, node.getParentNode(), newIndex, isLeft, false);
View Full Code Here

Examples of org.freeplane.features.mode.ModeController

  private void addUpdateButton(final FreeplaneVersion lastVersion) {
    Controller controller = Controller.getCurrentController();
    final Set<String> modes = controller.getModes();
    for (final String mode : modes) {
      ModeController modeController = controller.getModeController(mode);
      if(!modeController.getUserInputListenerFactory().useRibbonMenu()) { 
        final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory()
            .getMenuBuilder(MenuBuilder.class);
        if (lastVersion == null || lastVersion.compareTo(FreeplaneVersion.getVersion()) <= 0) {
          ResourceController.getResourceController().setProperty(LAST_UPDATE_VERSION, "");
          if (menuBuilder.get(UPDATE_BUTTON_PATH) != null) {
            menuBuilder.removeElement(UPDATE_BUTTON_PATH);
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.