Package org.freeplane.features.mode

Examples of org.freeplane.features.mode.Controller


    node.requestFocus();
    edit(nodeModel);
  }

  void edit(final NodeModel nodeModel) {
    final Controller controller = Controller.getCurrentController();
      stopEditing();
    Controller.getCurrentModeController().setBlocked(true);
    String text = NoteModel.getNoteText(nodeModel);
    if(text ==  null){
      text = "";
    }
    final EditNodeBase.IEditControl editControl = new EditNodeBase.IEditControl() {
      public void cancel() {
        Controller.getCurrentModeController().setBlocked(false);
        mCurrentEditDialog = null;
      }

      public void ok(final String newText) {
        setHtmlText(nodeModel, newText);
        cancel();
      }

      public void split(final String newText, final int position) {
      }
      public boolean canSplit() {
                return false;
            }

      public EditedComponent getEditType() {
                return EditedComponent.NOTE;
            }
    };
    final IEditBaseCreator textFieldCreator = (IEditBaseCreator) Controller.getCurrentController().getMapViewManager();
    mCurrentEditDialog = textFieldCreator.createEditor(nodeModel, editControl, text, true);
    final RootPaneContainer frame = (RootPaneContainer) SwingUtilities.getWindowAncestor(controller.getMapViewManager().getMapViewComponent());
    mCurrentEditDialog.show(frame);

    }
View Full Code Here


  public ManageNodeConditionalStylesAction() {
      super(NAME);
    }

  public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
    Component pane = createConditionalStylePane(map, conditionalStyleModel);
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.startTransaction();
    try{
      final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageNodeConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
      if(JOptionPane.OK_OPTION == confirmed){
        modeController.commit();
        modeController.getMapController().nodeChanged(controller.getSelection().getSelected(),NodeModel.UNKNOWN_PROPERTY,null,null);
      }
      else{
        modeController.rollback();

      }
View Full Code Here

    }
  }

  @Override
  public ConditionalStyleModel getConditionalStyleModel() {
    final Controller controller = Controller.getCurrentController();
    final NodeModel node = controller.getSelection().getSelected();
    ConditionalStyleModel conditionalStyleModel = (ConditionalStyleModel) node.getExtension(ConditionalStyleModel.class);
    if(conditionalStyleModel == null){
      conditionalStyleModel = new ConditionalStyleModel();
      node.addExtension(conditionalStyleModel);
    }
View Full Code Here

    final Component c = viewController.getComponent(node);
    UITools.setDialogLocationRelativeTo(dialog, c);
  }

  public static void setDialogLocationUnder(final JDialog dialog, final NodeModel node) {
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    final JComponent c = (JComponent) viewController.getComponent(node);
    final int x = 0;
    final int y = c.getHeight();
    final Point location = new Point(x, y);
    SwingUtilities.convertPointToScreen(location, c);
View Full Code Here

    scrollPane.setPreferredSize(new Dimension(400, 200));
    JOptionPane.showMessageDialog(getFrame(), scrollPane, "Freeplane", messageType);
  }
  public static int showConfirmDialog(final NodeModel node, final Object message, final String title,
                                      final int optionType, final int messageType) {
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component parentComponent;
    if (node == null) {
      parentComponent = getFrame();
    }
    else {
View Full Code Here

  public static String showInputDialog( final NodeModel node, final String message,
                                       final String initialValue) {
    if (node == null) {
      return null;
    }
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    viewController.scrollNodeToVisible(node);
    final Component parentComponent = viewController.getComponent(node);
    return JOptionPane.showInputDialog(parentComponent, message, initialValue);
  }
View Full Code Here

  public static String showInputDialog( final NodeModel node, final String text,
                                       final String title, final int type) {
    if (node == null) {
      return null;
    }
    final Controller controller = Controller.getCurrentController();
    final IMapViewManager viewController = controller.getMapViewManager();
    viewController.scrollNodeToVisible(node);
    final Component parentComponent = viewController.getComponent(node);
    return JOptionPane.showInputDialog(parentComponent, text, title, type);
  }
View Full Code Here

  CopyMapStylesAction() {
    super("CopyMapStylesAction");
  }

  public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    final MFileManager fileManager = MFileManager.getController(modeController);
    final JFileChooser fileChooser = fileManager.getFileChooser(true);
    fileChooser.setMultiSelectionEnabled(false);
    final int returnVal = fileChooser.showOpenDialog(controller.getMapViewManager().getMapViewComponent());
    if (returnVal != JFileChooser.APPROVE_OPTION) {
      return;
    }
    File file = fileChooser.getSelectedFile();
    if(! file.exists()){
      return;
    }
    try {
          final URL url = Compat.fileToUrl(file);
      final MapModel map = controller.getMap();
      MapStyle mapStyleController = MapStyle.getController(modeController);
      mapStyleController.copyStyle(url, map, true);
        }
        catch (MalformedURLException e1) {
          e1.printStackTrace();
View Full Code Here

  }

  @Override
  protected void onWrite(final MapModel map) {
    final ModeController modeController = Controller.getCurrentModeController();
    final Controller controller = modeController.getController();
    final IMapSelection selection = controller.getSelection();
    if (selection == null) {
      return;
    }
    final NodeModel selected = selection.getSelected();
    noteManager.saveNote(selected);
View Full Code Here

    final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
        return focusOwner != null && noteViewerComponent != null && SwingUtilities.isDescendingFrom(focusOwner, noteViewerComponent);
  }

  void setFocusToMap() {
    final Controller controller = Controller.getCurrentModeController().getController();
    final NodeModel node = controller.getSelection().getSelected();
    controller.getMapViewManager().getComponent(node).requestFocusInWindow();
  }
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.