public void mouseReleased(MouseEvent e) {
    logger.fine("Event: mouseReleased");
    // handling click in mouseReleased rather than in mouseClicked
    // provides better interaction. If mouse was slightly moved
    // between pressed and released events, the event clicked
    // is not triggered.
    // The behavior is not tested on Linux.

    // first stop the timer and select the node:
    stopTimerForDelayedSelection();
    c.extendSelection(e);
    // Right mouse <i>press</i> is <i>not</i> a popup trigger for Windows.
    // Only Right mouse release is a popup trigger!
    // OK, but Right mouse <i>press</i> <i>is</i> a popup trigger on Linux.
    c.showPopupMenu(e);
    if (e.isConsumed()) {
      return;
    }

    if (e.getModifiers() == MouseEvent.BUTTON1_MASK) {
      // FIXME Dimitry: Double Click comes after Plain Click combining (un)folding with editing
      //            if (e.getClickCount() % 2 == 0) {
      //                c.doubleClick(e);
      //            } else {
      c.plainClick(e);
      //            }
      e.consume();
    }
  }
示例#2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * freemind.controller.MenuItemEnabledListener#isEnabled(javax.swing
  * .JMenuItem, javax.swing.Action)
  */
 public boolean isEnabled(JMenuItem item, Action action) {
   String hookName = ((NodeHookAction) action).getHookName();
   // the following function does not work without a running valid
   // controller, so we comment it out.
   // if(hookName.equals("accessories/plugins/NewEncryptedMap.properties"))
   // {
   // return true;
   // }
   if (!enabled) return false;
   boolean isEncryptedNode = false;
   boolean isOpened = false;
   if (controller.getSelected() != null
       && controller.getSelected() instanceof EncryptedMindMapNode) {
     isEncryptedNode = true;
     EncryptedMindMapNode enode = (EncryptedMindMapNode) controller.getSelected();
     isOpened = enode.isAccessible();
   }
   if (hookName.equals("accessories/plugins/EnterPassword.properties")) {
     return isEncryptedNode;
   } else {
     /*
      * you can insert an encrypted node, if the current selected
      * node is not encrypted, or if it is opened.
      */
     return (!isEncryptedNode || isOpened);
   }
 }
  /** Invoked when a mouse button is pressed on a component and then dragged. */
  public void mouseDragged(MouseEvent e) {
    logger.fine("Event: mouseDragged");
    // first stop the timer and select the node:
    stopTimerForDelayedSelection();
    NodeView nodeV = ((MainView) e.getComponent()).getNodeView();

    // if dragged for the first time, select the node:
    if (!c.getView().isSelected(nodeV)) c.extendSelection(e);
  }
示例#4
0
 public Registration(ModeController controller, MindMap map) {
   this.controller = (MindMapController) controller;
   mMap = map;
   logger = controller.getFrame().getLogger(this.getClass().getName());
   // fc, 12.8.2004: this is a bad hack, but when time lacks...
   hookInstance = new UnfoldAll();
   hookInstance.setController(controller);
   hookInstance.setMap(mMap);
 }
 public void mouseMoved(MouseEvent e) {
   logger.finest("Event: mouseMoved");
   // Invoked when the mouse button has been moved on a component (with no
   // buttons down).
   MainView node = ((MainView) e.getComponent());
   boolean isLink = (node).updateCursor(e.getX());
   // links are displayed in the status bar:
   if (isLink) {
     c.getFrame().out(c.getLinkShortText(node.getNodeView().getModel()));
   }
   // test if still in selection region:
   if (controlRegionForDelayedSelection != null && delayedSelectionEnabled.getValue()) {
     if (!controlRegionForDelayedSelection.contains(e.getPoint())) {
       // point is not in the region. start timer again and adjust
       // region to the current point:
       createTimer(e);
     }
   }
 }
 /**
  * And a static method to reread this holder. This is used when the selection method is changed
  * via the option menu.
  */
 public void updateSelectionMethod() {
   if (timeForDelayedSelection == null) {
     timeForDelayedSelection = new Tools.IntHolder();
   }
   delayedSelectionEnabled = new Tools.BooleanHolder();
   delayedSelectionEnabled.setValue(
       c.getFrame().getProperty("selection_method").equals("selection_method_direct")
           ? false
           : true);
   /*
    * set time for delay to infinity, if selection_method equals
    * selection_method_by_click.
    */
   if (c.getFrame().getProperty("selection_method").equals("selection_method_by_click")) {
     timeForDelayedSelection.setValue(Integer.MAX_VALUE);
   } else {
     timeForDelayedSelection.setValue(
         Integer.parseInt(c.getFrame().getProperty("time_for_delayed_selection")));
   }
 }
 public EncryptedBrowseNode(Object userObject, FreeMindMain frame, ModeController modeController) {
   super(userObject, frame, modeController.getMap());
   this.mModeController = modeController;
   if (logger == null) logger = frame.getLogger(this.getClass().getName());
   if (encryptedIcon == null) {
     encryptedIcon = MindIcon.factory("encrypted").getIcon();
   }
   if (decryptedIcon == null) {
     decryptedIcon = MindIcon.factory("decrypted").getIcon();
   }
   updateIcon();
 }
示例#8
0
 public Registration(ModeController controller, MindMap map) {
   this.controller = controller;
   mMap = map;
   logger = controller.getFrame().getLogger(this.getClass().getName());
 }
示例#9
0
 protected FreeMindMain getFrame() {
   return controller.getFrame();
 }
示例#10
0
 protected String getText(String string) {
   return controller.getText(string);
 }
示例#11
0
 protected Controller getController() {
   return controller.getController();
 }
示例#12
0
 protected MapView getView() {
   return controller.getView();
 }
 public CommonNodeMouseMotionListener(ModeController controller) {
   c = controller;
   if (logger == null) logger = c.getFrame().getLogger(this.getClass().getName());
   if (delayedSelectionEnabled == null) updateSelectionMethod();
 }
 public void mousePressed(MouseEvent e) {
   logger.fine("Event: mousePressed");
   // for Linux
   c.showPopupMenu(e);
 }