Package org.freeplane.features.mode

Examples of org.freeplane.features.mode.Controller


    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


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

    createAddIns();
    return modeController;
  }

  private void createStandardControllers() {
    final Controller controller = Controller.getCurrentController();
    modeController = new MModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, UITools.useRibbonsMenu());

        final IMouseListener nodeMouseMotionListener = new MNodeMotionListener();
        userInputListenerFactory.setNodeMouseMotionListener(nodeMouseMotionListener);
    final JPopupMenu popupmenu = new JPopupMenu();
    userInputListenerFactory.setNodePopupMenu(popupmenu);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MMapController(modeController);
    if(userInputListenerFactory.useRibbonMenu()) {
      RibbonBuilder builder = userInputListenerFactory.getMenuBuilder(RibbonBuilder.class);
      final RibbonMapChangeAdapter mapChangeAdapter = builder.getMapChangeAdapter();
      modeController.getMapController().addNodeSelectionListener(mapChangeAdapter);
      modeController.getMapController().addNodeChangeListener(mapChangeAdapter);
      modeController.getMapController().addMapChangeListener(mapChangeAdapter);
      controller.getMapViewManager().addMapSelectionListener(mapChangeAdapter);
    }
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    IconController.install(new MIconController(modeController));
    new ProgressFactory().installActions(modeController);
    final MapController mapController = modeController.getMapController();
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
    final MTextController textController = new MTextController(modeController);
    TextController.install(textController);
    LinkController.install(new MLinkController());
    NodeStyleController.install(new MNodeStyleController(modeController));
    ClipboardController.install(new MClipboardController());
    userInputListenerFactory.setNodeDragListener(new MNodeDragListener());
    userInputListenerFactory.setNodeDropTargetListener(new MNodeDropListener());
    LocationController.install(new MLocationController());
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    LogicalStyleController.install(logicalStyleController);
    logicalStyleController.initM();
    AttributeController.install(new MAttributeController(modeController));
    userInputListenerFactory.setNodeKeyListener(new DefaultNodeKeyListener(new IEditHandler() {
      public void edit(final KeyEvent e, final FirstAction action, final boolean editLong) {
        ((MTextController) MTextController.getController(modeController)).getEventQueue().activate(e);
        textController.edit(action, editLong);
      }
    }));
    userInputListenerFactory.setNodeMotionListener(new MNodeMotionListener());
    modeController.addAction(new EditAttributesAction());
    SpellCheckerController.install(modeController);
    ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
    MapStyle.install(true);
    final FreeplaneToolBar toolbar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    final FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolbar, "toolbarVisible");
    if(!userInputListenerFactory.useRibbonMenu()) {
      userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolbar);
    }
    userInputListenerFactory.addToolBar("/filter_toolbar", ViewController.BOTTOM, FilterController.getController(controller).getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, frameController
        .getStatusBar());
    final JTabbedPane formattingPanel = new JTabbedPane();
    Box resisableTabs = new CollapseableBoxBuilder(frameController).setPropertyNameBase("styleScrollPaneVisible").createBox(formattingPanel, Direction.RIGHT);
    modeController.getUserInputListenerFactory().addToolBar("/format", ViewController.RIGHT, resisableTabs);
    KeyBindingProcessor keyProcessor = new KeyBindingProcessor();
    modeController.addExtension(KeyBindingProcessor.class, keyProcessor);
    keyProcessor.addKeyStrokeProcessor(userInputListenerFactory.getAcceleratorManager());
    final FButtonBar fButtonToolBar = new FButtonBar(frameController.getRootPaneContainer().getRootPane(), keyProcessor);
    UIComponentVisibilityDispatcher.install(frameController, fButtonToolBar, "fbarVisible");
    fButtonToolBar.setVisible(ResourceController.getResourceController().getBooleanProperty("fbarVisible"));
    userInputListenerFactory.addToolBar("/fbuttons", ViewController.TOP, fButtonToolBar);
    controller.addAction(new ToggleToolbarAction("ToggleFBarAction", "/fbuttons"));
    SModeControllerFactory.install();
    modeController.addAction(new SetAcceleratorOnNextClickAction());
    modeController.addAction(new ShowNotesInMapAction());
    //userInputListenerFactory.getMenuBuilder().setAcceleratorChangeListener(fButtonToolBar);
    userInputListenerFactory.getAcceleratorManager().addAcceleratorChangeListener(fButtonToolBar);
    userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController
        .getController()).getIconToolBarScrollPane());
    modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
    new RevisionPlugin();
    FoldingController.install(new FoldingController());

    uiFactory = new MUIFactory();
    mapController.addNodeChangeListener(uiFactory);
    mapController.addNodeSelectionListener(uiFactory);
    mapController.addMapChangeListener(uiFactory);
    controller.getMapViewManager().addMapSelectionListener(uiFactory);
    final MToolbarContributor menuContributor = new MToolbarContributor(uiFactory);
    modeController.addExtension(MUIFactory.class, uiFactory);
    modeController.addMenuContributor(menuContributor);
    new CloneStateIconSupplier().registerStateIconProvider();
View Full Code Here

  /**
   * the client which asks a remote repository for the current version of the program.
   */
  public UpdateCheckAction() {
    super("UpdateCheckAction");
    final Controller controller = Controller.getCurrentController();
    controller.getMapViewManager().addMapViewChangeListener(new IMapViewChangeListener() {
      public void afterViewChange(final Component oldView, final Component newView) {
        if (newView == null) {
          return;
        }
        controller.getViewController().invokeLater(new Runnable() {
          public void run() {
            removeMe();
          }
        });
        setTimer();
      }

      public void afterViewClose(final Component oldView) {
      }

      public void afterViewCreated(final Component mapView) {
      }

      public void beforeViewChange(final Component oldView, final Component newView) {
      }

      private void removeMe() {
        controller.getMapViewManager().removeMapViewChangeListener(this);
      }
    });
  }
View Full Code Here

      }
    }, "checkForUpdates").start();
  }

  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);
          }
          continue;
        }
        ResourceController.getResourceController().setProperty(LAST_UPDATE_VERSION, lastVersion.toString());
        final String updateAvailable = TextUtils.format("new_version_available", lastVersion.toString());
        controller.getViewController().out(updateAvailable);
        putValue(SHORT_DESCRIPTION, updateAvailable);
        putValue(LONG_DESCRIPTION, updateAvailable);
        if (menuBuilder.get(UPDATE_BUTTON_PATH) == null) {
          menuBuilder.addAction(UPDATE_BUTTON_LOCATION, UPDATE_BUTTON_PATH, UpdateCheckAction.this,
              MenuBuilder.AS_CHILD);
View Full Code Here

    final String text = styles.replaceAll("\n", ", ");
    btn.setText(text);
    }

  private void addListeners() {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = Controller.getCurrentModeController();
    final MapController mapController = modeController.getMapController();
    mapController.addNodeSelectionListener(new INodeSelectionListener() {
      public void onSelect(final NodeModel node) {
        final IMapSelection selection = controller.getSelection();
        if (selection == null) {
          return;
        }
        if (selection.size() == 1) {
          setStyle(node);
        }
      }

      public void onDeselect(final NodeModel node) {
      }
    });
    mapController.addNodeChangeListener(new INodeChangeListener() {
      public void nodeChanged(final NodeChangeEvent event) {
        final IMapSelection selection = controller.getSelection();
        if (selection == null) {
          return;
        }
        final NodeModel node = event.getNode();
        if (selection.getSelected().equals(node)) {
          setStyle(node);
        }
      }
    });
    mapController.addMapChangeListener(new AMapChangeListenerAdapter() {

      @Override
            public void mapChanged(MapChangeEvent event) {
        if(! MapStyle.MAP_STYLES.equals(event.getProperty()))
          return;
        final IMapSelection selection = controller.getSelection();
        if (selection == null) {
          return;
        }
        final NodeModel node = selection.getSelected();
        setStyle(node);
            }
     
    });
    final IMapViewManager mapViewManager = controller.getMapViewManager();
    mapViewManager.addMapViewChangeListener(new IMapViewChangeListener() {
      public void beforeViewChange(final Component oldView, final Component newView) {
      }

      public void afterViewCreated(final Component mapView) {
View Full Code Here

    }
    updateMenus();
  }

  private void updateMenus() {
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    if(!modeController.getUserInputListenerFactory().useRibbonMenu()) {
      final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
      menuBuilder.removeChildElements(MENU_CATEGORY);
      List<AFreeplaneAction> openMapActions = createOpenLastMapActionList();
      for(AFreeplaneAction openMapAction:openMapActions)
View Full Code Here

      }
    }
  }

  public List<AFreeplaneAction> createOpenLastMapActionList() {
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
      int i = 0;
      int maxEntries = getMaxMenuEntries();
      List<AFreeplaneAction> openMapActions = new ArrayList<AFreeplaneAction>(maxEntries);
      for (final String key : lastOpenedList) {
        if (i == 0
                && (!modeController.getModeName().equals(MModeController.MODENAME) || controller.getMap() == null || controller
                    .getMap().getURL() == null)) {
          i++;
          maxEntries++;
        }
        if (i == maxEntries) {
View Full Code Here

  }

  private SModeController modeController;

  Controller createController(final JDialog dialog) {
    final Controller controller = new Controller(ResourceController.getResourceController());
    Controller.setCurrentController(controller);
    final MapViewController mapViewController = new MMapViewController(controller);
    final DialogController viewController = new DialogController(controller, mapViewController, dialog);
    controller.setViewController(viewController);
    FilterController.install();
    TextController.install();
    controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
    controller.addAction(new ShowSelectionAsRectangleAction());
    modeController = new SModeController(controller);
    controller.selectModeForBuild(modeController);
    modeController.addAction(new NewUserStyleAction());
    modeController.addAction(new DeleteUserStyleAction());
    modeController.addAction(new NewLevelStyleAction());
    modeController.addAction(new DeleteLevelStyleAction());
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, false);
    userInputListenerFactory.setNodeMouseMotionListener(new DefaultNodeMouseMotionListener());
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addExtension(ModelessAttributeController.class, new ModelessAttributeController());
    new MMapController(modeController);
    userInputListenerFactory.getMenuBuilder(RibbonBuilder.class).setEnabled(false);
    TextController.install(new MTextController(modeController));
    SpellCheckerController.install(modeController);
    IconController.install(new MIconController(modeController));
    NodeStyleController.install(new MNodeStyleController(modeController));
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    LinkController.install(new MLinkController());
    MFileManager.install(new MFileManager());
    MMapIO.install(modeController);
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    logicalStyleController.initS();
    LogicalStyleController.install(logicalStyleController);
    AttributeController.install(new MAttributeController(modeController));
    FormatController.install(new FormatController());
    final ScannerController scannerController = new ScannerController();
        ScannerController.install(scannerController);
        scannerController.addParsersForStandardFormats();
    modeController.addAction(new EditAttributesAction());
    userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
    final JPopupMenu popupmenu = new JPopupMenu();
    userInputListenerFactory.setNodePopupMenu(popupmenu);
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    UIComponentVisibilityDispatcher.install(viewController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController
        .getController()).getIconToolBarScrollPane());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController()
        .getStatusBar());
    modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
    MapStyle.install(false);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    final SModeController modeController = this.modeController;
    final StyleEditorPanel styleEditorPanel = new StyleEditorPanel(modeController, null, false);
    final MapController mapController = modeController.getMapController();
    mapController.addNodeSelectionListener(new INodeSelectionListener() {
      public void onSelect(final NodeModel node) {
        final IMapSelection selection = controller.getSelection();
        if (selection == null) {
          return;
        }
        if (selection.size() == 1 && node.depth() >= 2) {
          return;
View Full Code Here

    final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
    undoHandler.startTransaction();
    init();
    SModeController modeController = getModeController();
    modeController.getMapController().newMapView(styleMap);
    Controller controller = modeController.getController();
    Component mapViewComponent = controller.getMapViewManager().getMapViewComponent();
    ((DialogController) controller.getViewController()).setMapView(mapViewComponent);
    dialog.setLocationRelativeTo(Controller.getCurrentController().getViewController().getJFrame());
    dialog.setVisible(true);
  }
View Full Code Here

TOP

Related Classes of org.freeplane.features.mode.Controller

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.