Пример #1
0
 protected void exportSelectedRowsAndClose() {
   int[] selectedRows = timeTable.getSelectedRows();
   Vector selectedNodes = new Vector();
   for (int i = 0; i < selectedRows.length; i++) {
     int row = selectedRows[i];
     selectedNodes.add(getMindMapNode(row));
   }
   // create new map:
   MindMap newMap = getMindMapController().newMap();
   MindMapController newMindMapController = (MindMapController) newMap.getModeController();
   // Tools.BooleanHolder booleanHolder = new Tools.BooleanHolder();
   // booleanHolder.setValue(false);
   for (Iterator iter = selectedNodes.iterator(); iter.hasNext(); ) {
     MindMapNode node = (MindMapNode) iter.next();
     // MindMapNode newNode = newMindMapController.addNewNode(
     // newMap.getRootNode(), 0, booleanHolder);
     // // copy style:
     // freemind.controller.actions.generated.instance.Pattern pattern =
     // StylePatternFactory.createPatternFromNode(node);
     // newMindMapController.applyPattern(newNode, pattern);
     // // copy text:
     // newMindMapController.setNodeText(newNode, node.getText());
     MindMapNode copy = node.shallowCopy();
     if (copy != null) {
       newMindMapController.insertNodeInto(copy, newMap.getRootNode());
     }
   }
   disposeDialog();
 }
Пример #2
0
 private void updateModel(DefaultTableModel model, MindMapNode node) {
   ReminderHookBase hook = TimeManagementOrganizer.getHook(node);
   // show all nodes or only those with reminder:
   if (showAllNodes || hook != null) {
     Date date = null;
     if (hook != null) {
       date = new Date(hook.getRemindUserAt());
     }
     model.addRow(
         new Object[] {
           date,
           new NodeHolder(node),
           new IconsHolder(node),
           node.getHistoryInformation().getCreatedAt(),
           node.getHistoryInformation().getLastModifiedAt(),
           new NotesHolder(node)
         });
   }
   if ((!mViewFoldedNodes) && node.isFolded()) {
     // no recursion, if folded nodes should be hidden.
     return;
   }
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     MindMapNode child = (MindMapNode) i.next();
     updateModel(model, child);
   }
 }
Пример #3
0
 protected int getMaxDepth(MindMapNode node) {
   if (node.isFolded() || !node.hasChildren()) return depth(node);
   int k = 0;
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     int l = getMaxDepth((MindMapNode) i.next());
     if (l > k) k = l;
   }
   return k;
 }
Пример #4
0
 public int getMinDepth(MindMapNode node) {
   if (node.isFolded()) return depth(node);
   if (!node.hasChildren()) return Integer.MAX_VALUE;
   int k = Integer.MAX_VALUE;
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     int l = getMinDepth((MindMapNode) i.next());
     if (l < k) k = l;
   }
   return k;
 }
Пример #5
0
 public void act(XmlAction action) {
   if (action instanceof freemind.controller.actions.generated.instance.RemoveIconXmlAction) {
     freemind.controller.actions.generated.instance.RemoveIconXmlAction removeAction =
         (freemind.controller.actions.generated.instance.RemoveIconXmlAction) action;
     MindMapNode node = modeController.getNodeFromID(removeAction.getNode());
     int position = removeAction.getIconPosition();
     node.removeIcon(position);
     modeController.nodeChanged(node);
   }
 }
Пример #6
0
 public void act(XmlAction action) {
   if (action instanceof AddIconAction) {
     AddIconAction iconAction = (AddIconAction) action;
     MindMapNode node = modeController.getNodeFromID(iconAction.getNode());
     String iconName = iconAction.getIconName();
     int position = iconAction.getIconPosition();
     MindIcon icon = MindIcon.factory(iconName);
     node.addIcon(icon, position);
     modeController.nodeChanged(node);
   }
 }
Пример #7
0
 /**
  * Unfolds every node that has only children which themselves have children. As this function is a
  * bit difficult to describe and perhaps not so useful, it is currently not introduced into the
  * menus.
  *
  * @param node node to start from.
  */
 public void foldLastBranches(MindMapNode node) {
   boolean nodeHasChildWhichIsLeave = false;
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     MindMapNode child = (MindMapNode) i.next();
     if (child.getChildCount() == 0) {
       nodeHasChildWhichIsLeave = true;
     }
   }
   setFolded(node, nodeHasChildWhichIsLeave);
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     foldLastBranches((MindMapNode) i.next());
   }
 }
Пример #8
0
 MainView newMainView(MindMapNode model) {
   if (model.isRoot()) {
     return new RootMainView();
   }
   if (model.getStyle().equals(MindMapNode.STYLE_FORK)) {
     return new ForkMainView();
   } else if (model.getStyle().equals(MindMapNode.STYLE_BUBBLE)) {
     return new BubbleMainView();
   } else {
     System.err.println("Tried to create a NodeView of unknown Style.");
     return new ForkMainView();
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * freemind.controller.filter.condition.Condition#checkNode(freemind.modes
  * .MindMapNode)
  */
 public boolean checkNode(Controller c, MindMapNode node) {
   AttributeTableModel attributes = node.getAttributes();
   for (int i = 0; i < attributes.getRowCount(); i++) {
     if (attributes.getValueAt(i, 0).equals(attribute)) return false;
   }
   return true;
 }
Пример #10
0
 public void act(XmlAction action) {
   if (action instanceof FontNodeAction) {
     FontNodeAction fontFamilyAction = (FontNodeAction) action;
     MindMapNode node = getNodeFromID(fontFamilyAction.getNode());
     String fontFamily = fontFamilyAction.getFont();
     if (!Tools.safeEquals(node.getFontFamilyName(), fontFamily)) {
       ((NodeAdapter) node).establishOwnFont();
       node.setFont(
           modeController
               .getController()
               .getFontThroughMap(
                   new Font(fontFamily, node.getFont().getStyle(), node.getFont().getSize())));
       modeController.nodeChanged(node);
     }
   }
 }
Пример #11
0
 public AddIconAction createAddIconAction(MindMapNode node, MindIcon icon, int iconPosition) {
   AddIconAction action = new AddIconAction();
   action.setNode(node.getObjectId(modeController));
   action.setIconName(icon.getName());
   action.setIconPosition(iconPosition);
   return action;
 }
 /**
  * @param child the child node the hook should be propagated to.
  * @return returns the new hook or null if there is already such a hook.
  */
 protected PermanentNodeHook propagate(MindMapNode child) {
   PermanentNodeHook hook =
       (PermanentNodeHook) getMindMapController().createNodeHook(getName(), child, getMap());
   // invocation:
   child.invokeHook(hook);
   return hook;
 }
Пример #13
0
 public void displayState(int stateAdded, MindMapNode pNode, boolean recurse) {
   ImageIcon icon = null;
   if (stateAdded == CLOCK_VISIBLE) {
     icon = getClockIcon();
   } else if (stateAdded == CLOCK_INVISIBLE) {
     if (pNode == getNode()) {
       icon = getBellIcon();
     } else {
       icon = getFlagIcon();
     }
   }
   pNode.setStateIcon(getStateKey(), icon);
   nodeRefresh(pNode);
   if (recurse && !pNode.isRoot()) {
     displayState(stateAdded, pNode.getParentNode(), recurse);
   }
 }
Пример #14
0
 public ActionPair apply(MindMap model, MindMapNode selected) {
   List icons = selected.getIcons();
   if (icons.size() == 0) return null;
   AddIconAction undoAction =
       iconAction.createAddIconAction(
           selected, (MindIcon) icons.get(icons.size() - 1), MindIcon.LAST);
   return new ActionPair(createRemoveIconXmlAction(selected, MindIcon.LAST), undoAction);
 }
Пример #15
0
 public IconsHolder(MindMapNode node) {
   icons.addAll(node.getIcons());
   // sorting the output.
   iconNames = new Vector();
   for (Iterator i = icons.iterator(); i.hasNext(); ) {
     MindIcon icon = (MindIcon) i.next();
     iconNames.add(icon.getName());
   }
   Collections.sort(iconNames);
 }
Пример #16
0
 public void invoke(MindMapNode node) {
   super.invoke(node);
   if (remindUserAt == 0) {
     return;
   }
   if (timer == null) {
     scheduleTimer(node);
   }
   logger.info("Invoke for node: " + node.getObjectId(getController()));
 }
Пример #17
0
 public void foldStageN(MindMapNode node, int stage) {
   int k = depth(node);
   if (k < stage) {
     setFolded(node, false);
     for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
       foldStageN((MindMapNode) i.next(), stage);
     }
   } else {
     foldAll(node);
   }
 }
Пример #18
0
 public String getUntaggedNodeText() {
   String nodeText = node.getText();
   // cache empty or dirty?:
   if (untaggedNodeText == null
       || (originalNodeText != null && !originalNodeText.equals(nodeText))) {
     originalNodeText = nodeText;
     // remove tags:
     untaggedNodeText = HtmlTools.htmlToPlain(nodeText).replaceAll("\\s+", " ");
   }
   return untaggedNodeText;
 }
Пример #19
0
 public String getUntaggedNotesText() {
   String notesText = node.getNoteText();
   if (notesText == null) return "";
   if (untaggedNotesText == null
       || (originalNotesText != null && !originalNotesText.equals(notesText))) {
     originalNotesText = notesText;
     // remove tags:
     untaggedNotesText = HtmlTools.removeHtmlTagsFromString(notesText).replaceAll("\\s+", " ");
   }
   return untaggedNotesText;
 }
Пример #20
0
  /** Factory method which creates the right NodeView for the model. */
  NodeView newNodeView(MindMapNode model, int position, MapView map, Container parent) {
    NodeView newView = new NodeView(model, position, map, parent);

    if (model.isRoot()) {
      final MainView mainView = new RootMainView();
      newView.setMainView(mainView);
      newView.setLayout(VerticalRootNodeViewLayout.getInstance());

    } else {
      newView.setMainView(newMainView(model));
      if (newView.isLeft()) {
        newView.setLayout(LeftNodeViewLayout.getInstance());
      } else {
        newView.setLayout(RightNodeViewLayout.getInstance());
      }
    }

    model.addViewer(newView);
    newView.update();
    fireNodeViewCreated(newView);
    return newView;
  }
Пример #21
0
  private void encrypt(MindMapNode node) {
    final StringBuffer password = getUsersPassword();
    if (password == null) {
      return;
    }
    MindMapController mindmapcontroller = (MindMapController) getMindMapController();
    // FIXME: not multithreading safe
    mindmapcontroller.setNewNodeCreator(
        new NewNodeCreator() {

          public MindMapNode createNode(Object userObject, MindMap map) {
            EncryptedMindMapNode encryptedMindMapNode =
                new EncryptedMindMapNode(userObject, getMindMapController().getFrame(), map);
            encryptedMindMapNode.setPassword(password);
            return encryptedMindMapNode;
          }
        });
    try {
      MindMapNode newNode = getMindMapController().addNewNode(node, 0, node.isLeft());
    } catch (Exception e) {
    }
    // normal value:
    mindmapcontroller.setNewNodeCreator(null);
  }
Пример #22
0
 protected void foldAll(MindMapNode node) {
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     foldAll((MindMapNode) i.next());
   }
   setFolded(node, true);
 }
Пример #23
0
 protected int depth(MindMapNode node) {
   if (node.isRoot()) return 0;
   return depth((MindMapNode) node.getParent()) + 1;
 }
Пример #24
0
 protected void setFolded(MindMapNode node, boolean state) {
   if (node.hasChildren() && (node.isFolded() != state)) {
     getMindMapController().setFolded(node, state);
   }
 }
Пример #25
0
 public RemoveIconXmlAction createRemoveIconXmlAction(MindMapNode node, int iconPosition) {
   RemoveIconXmlAction action = new RemoveIconXmlAction();
   action.setNode(node.getObjectId(modeController));
   action.setIconPosition(iconPosition);
   return action;
 }
Пример #26
0
 public int removeLastIcon(MindMapNode node) {
   modeController.getActionFactory().startTransaction((String) getValue(NAME));
   modeController.getActionFactory().executeAction(apply(modeController.getMap(), node));
   modeController.getActionFactory().endTransaction((String) getValue(NAME));
   return node.getIcons().size();
 }
Пример #27
0
 public void unfoldAll(MindMapNode node) {
   setFolded(node, false);
   for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) {
     unfoldAll((MindMapNode) i.next());
   }
 }
Пример #28
0
 private ActionPair getActionPair(MindMapNode node, String fontFamilyValue) {
   FontNodeAction fontFamilyAction = createFontNodeAction(node, fontFamilyValue);
   FontNodeAction undoFontFamilyAction = createFontNodeAction(node, node.getFontFamilyName());
   return new ActionPair(fontFamilyAction, undoFontFamilyAction);
 }