Search in sources :

Example 1 with MultipleImage

use of org.freeplane.core.ui.components.MultipleImage in project freeplane by freeplane.

the class MainView method updateIcons.

void updateIcons(final NodeView node) {
    if (!node.getMap().showsIcons()) {
        setIcon(null);
        return;
    }
    // setHorizontalTextPosition(node.isLeft() ? SwingConstants.LEADING : SwingConstants.TRAILING);
    final MultipleImage iconImages = new MultipleImage();
    /* fc, 06.10.2003: images? */
    final NodeModel model = node.getModel();
    for (final UIIcon icon : IconController.getController().getStateIcons(model)) {
        iconImages.addIcon(icon, model);
    }
    final ModeController modeController = getNodeView().getMap().getModeController();
    final Collection<MindIcon> icons = IconController.getController(modeController).getIcons(model);
    for (final MindIcon myIcon : icons) {
        iconImages.addIcon(myIcon, model);
    }
    addOwnIcons(iconImages, model);
    setIcon((iconImages.getImageCount() > 0 ? iconImages : null));
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MultipleImage(org.freeplane.core.ui.components.MultipleImage) MindIcon(org.freeplane.features.icon.MindIcon) ModeController(org.freeplane.features.mode.ModeController) UIIcon(org.freeplane.features.icon.UIIcon)

Example 2 with MultipleImage

use of org.freeplane.core.ui.components.MultipleImage 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.addIcon(icon);
        }
        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 3 with MultipleImage

use of org.freeplane.core.ui.components.MultipleImage in project freeplane by freeplane.

the class MainView method getUIIconAt.

public UIIcon getUIIconAt(Point coordinate) {
    Icon icon = getIcon();
    if (icon instanceof MultipleImage) {
        Rectangle iconRectangle = getIconRectangle();
        Point transformedToIconCoordinate = new Point(coordinate);
        transformedToIconCoordinate.translate(-iconRectangle.x, -iconRectangle.y);
        return ((MultipleImage) icon).getUIIconAt(transformedToIconCoordinate);
    } else
        return null;
}
Also used : MultipleImage(org.freeplane.core.ui.components.MultipleImage) Rectangle(java.awt.Rectangle) Icon(javax.swing.Icon) UIIcon(org.freeplane.features.icon.UIIcon) MindIcon(org.freeplane.features.icon.MindIcon) Point(java.awt.Point)

Aggregations

MultipleImage (org.freeplane.core.ui.components.MultipleImage)3 MindIcon (org.freeplane.features.icon.MindIcon)3 UIIcon (org.freeplane.features.icon.UIIcon)2 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 Icon (javax.swing.Icon)1 NodeModel (org.freeplane.features.map.NodeModel)1 ModeController (org.freeplane.features.mode.ModeController)1