Search in sources :

Example 21 with MindIcon

use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.

the class MindMapHTMLWriter method writeIcons.

private void writeIcons(final NodeModel model) throws IOException {
    final Collection<MindIcon> icons = IconController.getController().getIcons(model);
    for (MindIcon icon : icons) {
        final String iconFileName = icon.getFileName();
        fileout.write("<img src=\"" + iconFileName + "\" alt=\"" + icon.getTranslationValueLabel() + "\">");
    }
}
Also used : MindIcon(org.freeplane.features.icon.MindIcon)

Example 22 with MindIcon

use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.

the class MTextController method joinNodes.

public void joinNodes(final List<NodeModel> selectedNodes) {
    if (selectedNodes.isEmpty())
        return;
    final NodeModel selectedNode = selectedNodes.get(0);
    final NodeModel parentNode = selectedNode.getParentNode();
    for (final NodeModel node : selectedNodes) {
        if (node.getParentNode() != parentNode) {
            UITools.errorMessage(TextUtils.getText("cannot_add_parent_diff_parents"));
            return;
        }
    }
    String joinedContent = "";
    final Controller controller = Controller.getCurrentController();
    boolean isHtml = false;
    final LinkedHashSet<MindIcon> icons = new LinkedHashSet<MindIcon>();
    for (final NodeModel node : selectedNodes) {
        final String nodeContent = node.getText();
        icons.addAll(node.getIcons());
        final boolean isHtmlNode = HtmlUtils.isHtmlNode(nodeContent);
        joinedContent = addContent(joinedContent, isHtml, nodeContent, isHtmlNode);
        if (node != selectedNode) {
            final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
            for (final NodeModel child : node.getChildren().toArray(new NodeModel[] {})) {
                mapController.moveNode(child, selectedNode, selectedNode.getChildCount());
            }
            mapController.deleteNode(node);
        }
        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);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) NodeModel(org.freeplane.features.map.NodeModel) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MindIcon(org.freeplane.features.icon.MindIcon) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FormatController(org.freeplane.features.format.FormatController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) LinkController(org.freeplane.features.link.LinkController) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ScannerController(org.freeplane.features.format.ScannerController)

Example 23 with MindIcon

use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.

the class IconStoreFactory method setIconGroups.

private static void setIconGroups(final IconStore iconStore) {
    final String[] groupNames = RESOURCE_CONTROLLER.getProperty(GROUP_NAMES_KEY).split(SEPARATOR);
    for (final String groupName : groupNames) {
        final String description = TextUtils.getText(String.format(GROUP_DESC_KEY, groupName));
        List<MindIcon> icons;
        UIIcon groupIcon = null;
        if ("user".equals(groupName)) {
            icons = IconStoreFactory.getUserIcons();
            groupIcon = MindIconFactory.create("user_icon");
        } else {
            final String groupIconName = RESOURCE_CONTROLLER.getProperty(String.format(GROUP_ICON_KEY, groupName));
            final Map<String, MindIcon> iconMap = IconStoreFactory.getIcons(groupName);
            groupIcon = iconMap.get(groupIconName);
            icons = new ArrayList<MindIcon>(iconMap.values());
        }
        if (groupIcon == null) {
            groupIcon = icons.size() > 0 ? icons.get(0) : IconNotFound.instance();
        }
        iconStore.addGroup(new IconGroup(groupName, groupIcon, description, icons));
    }
}
Also used : IconGroup(org.freeplane.features.icon.IconGroup) MindIcon(org.freeplane.features.icon.MindIcon) UIIcon(org.freeplane.features.icon.UIIcon)

Example 24 with MindIcon

use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.

the class IconsProxy method getIcons.

public List<String> getIcons() {
    final List<MindIcon> icons = getDelegate().getIcons();
    final int size = icons.size();
    if (size == 0) {
        return Collections.emptyList();
    }
    final ArrayList<String> list = new ArrayList<String>(size);
    for (final MindIcon icon : icons) {
        list.add(icon.getName());
    }
    return Collections.unmodifiableList(list);
}
Also used : ArrayList(java.util.ArrayList) MindIcon(org.freeplane.features.icon.MindIcon)

Aggregations

MindIcon (org.freeplane.features.icon.MindIcon)24 ArrayList (java.util.ArrayList)8 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)5 NodeModel (org.freeplane.features.map.NodeModel)5 ModeController (org.freeplane.features.mode.ModeController)4 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)3 IconController (org.freeplane.features.icon.IconController)3 Controller (org.freeplane.features.mode.Controller)3 ViewController (org.freeplane.features.ui.ViewController)3 Point (java.awt.Point)2 LinkedHashSet (java.util.LinkedHashSet)2 Action (javax.swing.Action)2 JMenu (javax.swing.JMenu)2 ResourceController (org.freeplane.core.resources.ResourceController)2 IconSelectionPopupDialog (org.freeplane.core.ui.components.IconSelectionPopupDialog)2 MultipleImage (org.freeplane.core.ui.components.MultipleImage)2 FormatController (org.freeplane.features.format.FormatController)2 ScannerController (org.freeplane.features.format.ScannerController)2 UIIcon (org.freeplane.features.icon.UIIcon)2 LinkController (org.freeplane.features.link.LinkController)2