Search in sources :

Example 11 with MindIcon

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

the class MIconController method listStandardIconKeys.

/**
 * 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;
}
Also used : ArrayList(java.util.ArrayList) MindIcon(org.freeplane.features.icon.MindIcon)

Example 12 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, final String separator) {
    if (selectedNodes.isEmpty())
        return;
    final NodeModel selectedNode = selectedNodes.get(0);
    for (final NodeModel node : selectedNodes) {
        if (node != selectedNode && node.subtreeContainsCloneOf(selectedNode)) {
            UITools.errorMessage(TextUtils.getText("cannot_move_into_child_node"));
            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, separator);
        if (node != selectedNode) {
            final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
            mapController.moveNodes(node.getChildren(), 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) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) 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 13 with MindIcon

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

the class IconsRenderer method setValue.

@Override
public void setValue(final Object value) {
    if (value instanceof IconsHolder) {
        final IconsHolder iconsHolder = (IconsHolder) value;
        final MultipleImage iconImages = new MultipleImage();
        for (final MindIcon icon : iconsHolder.getIcons()) {
            iconImages.addImage(icon.getIcon());
        }
        if (iconImages.getImageCount() > 0) {
            setIcon(iconImages);
        } else {
            setIcon(null);
        }
    }
}
Also used : MultipleImage(org.freeplane.core.ui.components.MultipleImage) MindIcon(org.freeplane.features.icon.MindIcon)

Example 14 with MindIcon

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

the class IconProperty method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final List<MindIcon> icons = new ArrayList<MindIcon>();
    final List<String> descriptions = new ArrayList<String>();
    for (final MindIcon icon : mIcons) {
        icons.add(icon);
        descriptions.add(icon.getTranslationValueLabel());
    }
    final IconSelectionPopupDialog dialog = new IconSelectionPopupDialog(JOptionPane.getFrameForComponent((Component) e.getSource()), icons);
    dialog.setLocationRelativeTo(JOptionPane.getFrameForComponent((Component) e.getSource()));
    dialog.setModal(true);
    dialog.setVisible(true);
    final int result = dialog.getResult();
    if (result >= 0) {
        final MindIcon icon = mIcons.get(result);
        setValue(icon.getName());
        firePropertyChangeEvent();
    }
}
Also used : ArrayList(java.util.ArrayList) MindIcon(org.freeplane.features.icon.MindIcon) IconSelectionPopupDialog(org.freeplane.core.ui.components.IconSelectionPopupDialog) Component(java.awt.Component)

Example 15 with MindIcon

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

the class IconProperty method setValue.

@Override
public void setValue(final String value) {
    for (final MindIcon icon : mIcons) {
        if (icon.getName().equals(value)) {
            mActualIcon = icon;
            setIcon(mActualIcon);
            return;
        }
    }
    throw new NoSuchElementException();
}
Also used : MindIcon(org.freeplane.features.icon.MindIcon) NoSuchElementException(java.util.NoSuchElementException)

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