Package org.freeplane.features.map

Examples of org.freeplane.features.map.NodeModel


      return;
    final MapView map = (MapView) source;
    final Controller controller = map.getModeController().getController();
    final IMapSelection selection = controller.getSelection();
    if(selection != null){
      final NodeModel selected = selection.getSelected();
      if(selected != null)
        controller.getMapViewManager().getComponent(selected).requestFocusInWindow();
    }
  }
View Full Code Here


    }
    if (lastNodeHolder.equals(currentNodeHolder)) {
      go(back);
      return;
    }
    final NodeModel toBeSelected = currentNodeHolder.getNode();
    if (removed(toBeSelected)) {
      currentNodeHolder = lastNodeHolder;
      go(back);
      return;
    }
    boolean changeModule = false;
    MapView newModule = null;
    if (lastNodeHolder.getHoldMapView() != currentNodeHolder.getHoldMapView()) {
      changeModule = true;
      newModule = currentNodeHolder.getMapView();
      if (newModule == null) {
        nodeIterator.remove();
        go(back);
        return;
      }
    }
    final boolean fChangeModule = changeModule;
    final MapView newView;
    if (fChangeModule) {
      newView = newModule;
      final Controller controller = newView.getModeController().getController();
      final IMapViewManager mapViewManager = controller.getMapViewManager();
      final boolean res = mapViewManager.changeToMapView(newView);
      if (!res) {
        LogUtils.warn("Can't change to map mapView " + newView);
        return;
      }
    }
    else {
      newView = currentNodeHolder.getHoldMapView();
    }
    if (!toBeSelected.isRoot()) {
      newView.getModeController().getMapController().setFolded(toBeSelected.getParentNode(), false);
    }
    newView.getModeController().getMapController().select(toBeSelected);
  }
View Full Code Here

  private void startUnfoldTimer(final MainView mainView) {
    if(timer == null){
      timer = new Timer(UNFOLD_DELAY_MILLISECONDS, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          if(mainView.isDisplayable()){
            final NodeModel node = mainView.getNodeView().getModel();
            Controller.getCurrentModeController().getMapController().setFolded(node, !node.isFolded());
          }
        }
      });
      timer.setRepeats(false);
      timer.start();
View Full Code Here

      final Transferable t = dtde.getTransferable();
      final MainView mainView = (MainView) dtde.getDropTargetContext().getComponent();
      final NodeView targetNodeView = mainView.getNodeView();
      final MapView mapView = targetNodeView.getMap();
      mapView.select();
      final NodeModel targetNode = targetNodeView.getModel();
      final Controller controller = Controller.getCurrentController();
      if (dtde.isLocalTransfer() && t.isDataFlavorSupported(MindMapNodesSelection.dropActionFlavor)) {
        final String sourceAction = (String) t.getTransferData(MindMapNodesSelection.dropActionFlavor);
        if (sourceAction.equals("LINK")) {
          dropAction = DnDConstants.ACTION_LINK;
        }
        if (sourceAction.equals("COPY")) {
          dropAction = DnDConstants.ACTION_COPY;
        }
      }
      mainView.setDraggedOver(NodeView.DRAGGED_OVER_NO);
      mainView.repaint();
      if (dtde.isLocalTransfer() && (dropAction == DnDConstants.ACTION_MOVE) && !isDropAcceptable(dtde)) {
        dtde.rejectDrop();
        return;
      }
      final boolean dropAsSibling = mainView.dropAsSibling(dtde.getLocation().getX());
      ModeController modeController = controller.getModeController();
      final MMapController mapController = (MMapController) modeController.getMapController();
      if ((dropAction == DnDConstants.ACTION_MOVE || dropAction == DnDConstants.ACTION_COPY)) {
        final NodeModel parent = dropAsSibling ? targetNode.getParentNode() : targetNode;
        if (!mapController.isWriteable(parent)) {
          dtde.rejectDrop();
          final String message = TextUtils.getText("node_is_write_protected");
          UITools.errorMessage(message);
          return;
        }
      }
      final boolean isLeft = mainView.dropLeft(dtde.getLocation().getX());
      if (!dtde.isLocalTransfer()) {
        dtde.acceptDrop(DnDConstants.ACTION_COPY);
        ((MClipboardController) ClipboardController.getController()).paste(t, targetNode, dropAsSibling, isLeft, dropAction);
        dtde.dropComplete(true);
        return;
      }
      dtde.acceptDrop(dropAction);
      if (dropAction == DnDConstants.ACTION_LINK) {
        int yesorno = JOptionPane.YES_OPTION;
        if (controller.getSelection().size() >= 5) {
          yesorno = JOptionPane.showConfirmDialog(controller.getViewController().getContentPane(), TextUtils
              .getText("lots_of_links_warning"), Integer.toString(controller.getSelection().size())
                  + " links to the same node", JOptionPane.YES_NO_OPTION);
        }
        if (yesorno == JOptionPane.YES_OPTION) {
          for (final Iterator<NodeModel> it = controller.getSelection().getSelection().iterator(); it
              .hasNext();) {
            final NodeModel selectedNodeModel = (it.next());
            ((MLinkController) LinkController.getController(modeController)).addConnector(
                selectedNodeModel, targetNode);
          }
        }
      }
      else {
        Transferable trans = null;
        final Collection<NodeModel> selecteds = mapController.getSelectedNodes();
        if (DnDConstants.ACTION_MOVE == dropAction) {
          NodeModel actualNode = targetNode;
          do {
            if (selecteds.contains(actualNode)) {
              final String message = TextUtils.getText("cannot_move_to_child");
              JOptionPane.showMessageDialog(controller.getViewController().getContentPane(), message,
                  "Freeplane", JOptionPane.WARNING_MESSAGE);
              dtde.dropComplete(true);
              return;
            }
            actualNode = (actualNode.isRoot()) ? null : actualNode.getParentNode();
          } while (actualNode != null);
                  final NodeModel[] array = selecteds.toArray(new NodeModel[selecteds.size()]);
          final List<NodeModel> sortedSelection = controller.getSelection().getSortedSelection(true);
          for (final NodeModel node : sortedSelection) {
            boolean changeSide = isLeft != node.isLeft();
View Full Code Here

    }
    return false;
  }

  private boolean isDropAcceptable(final DropTargetDropEvent event) {
    final NodeModel node = ((MainView) event.getDropTargetContext().getComponent()).getNodeView().getModel();
    final ModeController modeController = Controller.getCurrentController().getModeController();
    final NodeModel selected = modeController.getMapController().getSelectedNode();
    return ((node != selected) && !node.isDescendantOf(selected));
  }
View Full Code Here

    final MainView component = (MainView) e.getComponent();
    NodeView nodeView = component.getNodeView();
    if (nodeView == null)
      return;

    final NodeModel node = nodeView.getModel();
    final boolean plainEvent = Compat.isPlainEvent(e);
    final boolean inside = nodeSelector.isInside(e);
    final MapController mapController = mc.getMapController();
    if(e.getButton() == 1){
      if(plainEvent){
View Full Code Here

    final String link = uri.toString();
    if (!link.startsWith("#")) {
      LogUtils.warn(link + " is no node id link");
      return null;
    }
    final NodeModel targetNode = getDelegate().getMap().getNodeForID(link.substring(1));
    if (targetNode == null) {
      LogUtils.warn(link + ": node does not exist (anymore?)");
      return null;
    }
    return new NodeProxy(targetNode, getScriptContext());
View Full Code Here

  public NodeWidthAction() {
    super("NodeWidthAction");
  }

  public void actionPerformed(final ActionEvent e) {
    final NodeModel selected = Controller.getCurrentController().getSelection().getSelected();
    nsc = (MNodeStyleController) NodeStyleController.getController();
    minNodeWidth = nsc.getMinWidth(selected);
    maxNodeWidth = nsc.getMaxWidth(selected);
    final NodeSizeDialog nodeSizeDialog = new NodeSizeDialog();
    nodeSizeDialog.setTitle(TextUtils.getText("NodeWidthAction.text"));
View Full Code Here

  }

  private Color getStyleBackgroundColor(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for(IStyle styleKey : styleKeys){
      final NodeModel styleNode = model.getStyleNode(styleKey);
      if (styleNode == null) {
        continue;
      }
      final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
      if (styleModel == null) {
View Full Code Here

  }

  private int getStyleMaxNodeWidth(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for(IStyle styleKey : styleKeys){
      final NodeModel styleNode = model.getStyleNode(styleKey);
      if (styleNode == null) {
        continue;
      }
      final NodeSizeModel sizeModel = NodeSizeModel.getModel(styleNode);
      if (sizeModel == null) {
View Full Code Here

TOP

Related Classes of org.freeplane.features.map.NodeModel

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.