Package org.freeplane.features.icon.mindmapmode

Examples of org.freeplane.features.icon.mindmapmode.MIconController


   * @param up : true if the progress is increased (0% -> 25% -> 50%...)
   *         if false the progress is decreased
   */
  public static void updateProgressIcons(final NodeModel node, final boolean up) {
    final ProgressUtilities progUtil = new ProgressUtilities();
    final MIconController iconController = (MIconController) IconController.getController();
    String activeIcon = null;
    final List<MindIcon> icons = node.getIcons();
    //get active progress icon and remove it
    if (progUtil.hasProgressIcons(node)) {
      for (int i = 0; i < icons.size(); i++) {
        for (int j = 0; j < iconNames.length; j++) {
          if (icons.get(i).getName().equals(iconNames[j])) {
            activeIcon = iconNames[j];
            break;
          }
        }
      }
      ProgressIcons.removeProgressIcons(node);
    }
    // set initial progress icon always 0%
    if (activeIcon == null) {
      ProgressIcons.removeProgressIcons(node);
      iconController.addIcon(node, progressIcons[0], 0);
    }
    else {
      final int iActiveIcon = Integer.parseInt(activeIcon.substring(0, activeIcon.length() - 1));
      //progress is increased
      if (up) {
        switch (iActiveIcon) {
          case 0:
            iconController.addIcon(node, progressIcons[1], 0);
            break;
          case 25:
            iconController.addIcon(node, progressIcons[2], 0);
            break;
          case 50:
            iconController.addIcon(node, progressIcons[3], 0);
            break;
          case 75:
            iconController.addIcon(node, progressIcons[4], 0);
            if (!progUtil.hasOKIcon(node)) {
              iconController.addIcon(node, OKIcon, 0);
            }
            break;
          //at 100% draw an extra OK-icon
          case 100:
            iconController.addIcon(node, progressIcons[4], 0);
            iconController.addIcon(node, OKIcon, 0);
            break;
          default:
            break;
        }
      }
      //progress is decreased
      else {
        switch (iActiveIcon) {
          case 25:
            iconController.addIcon(node, progressIcons[0], 0);
            break;
          case 50:
            iconController.addIcon(node, progressIcons[1], 0);
            break;
          case 75:
            iconController.addIcon(node, progressIcons[2], 0);
            break;
          case 100:
            iconController.addIcon(node, progressIcons[3], 0);
            break;
          case 0:
          default:
            break;
        }
View Full Code Here


   * @param node : the node to update the icons
   * @param sFile : the name of the added file.
   */
  public static void updateExtendedProgressIcons(final NodeModel node, final String sFile) {
    if (sFile.matches(EXTENDED_PROGRESS_ICON_IDENTIFIER)) {
      final MIconController iconController = (MIconController) IconController.getController();
      ProgressIcons.removeProgressIcons(node);
      //add the right progress icon
      if (sFile.matches(".*_quarter_.*")) {
        final int fileNum = Integer.parseInt(sFile.substring(sFile.lastIndexOf("_") + 1,
            sFile.lastIndexOf("_") + 3));
        switch (fileNum) {
          case 0:
            iconController.addIcon(node, progressIcons[0], 0);
            break;
          case 1:
            iconController.addIcon(node, progressIcons[1], 0);
            break;
          case 2:
            iconController.addIcon(node, progressIcons[2], 0);
            break;
          case 3:
            iconController.addIcon(node, progressIcons[3], 0);
            break;
          case 4:
            iconController.addIcon(node, progressIcons[4], 0);
            iconController.addIcon(node, OKIcon, 0);
            break;
          default:
            iconController.addIcon(node, progressIcons[0], 0);
            break;
        }
      }
      else if (sFile.matches(".*_tenth_.*")) {
        final int fileNum = Integer.parseInt(sFile.substring(sFile.lastIndexOf("_") + 1,
            sFile.lastIndexOf("_") + 3));
        switch (fileNum) {
          case 0:
          case 1:
            iconController.addIcon(node, progressIcons[0], 0);
            break;
          case 2:
          case 3:
            iconController.addIcon(node, progressIcons[1], 0);
            break;
          case 4:
          case 5:
          case 6:
            iconController.addIcon(node, progressIcons[2], 0);
            break;
          case 7:
          case 8:
          case 9:
            iconController.addIcon(node, progressIcons[3], 0);
            break;
          case 10:
            iconController.addIcon(node, progressIcons[4], 0);
            iconController.addIcon(node, OKIcon, 0);
            break;
          default:
            iconController.addIcon(node, progressIcons[0], 0);
            break;
        }
      }
    }
  }
View Full Code Here

   * @param node : the node from which the progress icons are removed
   */
  public static void removeProgressIcons(final NodeModel node) {
    final ProgressUtilities progUtil = new ProgressUtilities();
    if (progUtil.hasProgressIcons(node) || progUtil.hasOKIcon(node)) {
      final MIconController iconController = (MIconController) IconController.getController();
      final String[] progressIconNames = new String[] { "0%", "25%", "50%", "75%", "100%", "button_ok" };
      final List<MindIcon> icons = node.getIcons();
      //  remove progress icons
      for (int i = 0; i < icons.size(); i++) {
        String iconName = icons.get(i).getName();
        for (int j = 0; j < progressIconNames.length; j++) {
          if (iconName.equals(progressIconNames[j])) {
            iconController.removeIcon(node, i);
            i--;
            break;
          }
        }
      }
View Full Code Here

    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());
View Full Code Here

    new MMapController(modeController);
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    IconController.install(new MIconController(modeController));
    new ProgressFactory().installActions(modeController);
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    final MTextController textController = new MTextController(modeController);
View Full Code Here

    }
    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));
View Full Code Here

      }
      isHtml = isHtml || isHtmlNode;
    }
    controller.getSelection().selectAsTheOnlyOneSelected(selectedNode);
    setNodeText(selectedNode, joinedContent);
    final MIconController iconController = (MIconController) IconController.getController();
    iconController.removeAllIcons(selectedNode);
    for (final MindIcon icon : icons) {
      iconController.addIcon(selectedNode, icon);
    }
  }
View Full Code Here

  /** lists all icons that are available in the icon selection dialog. This may include user icons
   * if there are some installed. */
  public static List<String> listStandardIconKeys() {
    // the source of this list is the property "icons.list" in freeplane.properties
    ArrayList<String> result = new ArrayList<String>();
    final MIconController mIconController = (MIconController) IconController.getController();
    for (MindIcon mindIcon : mIconController.getMindIcons())
      result.add(mindIcon.getName());
    return result;
  }
View Full Code Here

TOP

Related Classes of org.freeplane.features.icon.mindmapmode.MIconController

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.