Search in sources :

Example 91 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class EdgeController method getStyleWidth.

private Integer getStyleWidth(final MapModel map, final Collection<IStyle> collection) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : collection) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final EdgeModel styleModel = EdgeModel.getModel(styleNode);
        if (styleModel == null) {
            continue;
        }
        final int width = styleModel.getWidth();
        if (width == EdgeModel.DEFAULT_WIDTH) {
            continue;
        }
        return width;
    }
    return null;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 92 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class EdgeColorAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    final ModeController modeController = Controller.getCurrentModeController();
    final NodeModel model = modeController.getMapController().getSelectedNode();
    final Controller controller = modeController.getController();
    final Color edgeColor = EdgeController.getController().getColor(model);
    actionColor = ColorTracker.showCommonJColorChooserDialog(controller.getSelection().getSelected(), TextUtils.getText("choose_edge_color"), edgeColor, EdgeController.STANDARD_EDGE_COLOR);
    super.actionPerformed(e);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) Color(java.awt.Color) ModeController(org.freeplane.features.mode.ModeController) EdgeController(org.freeplane.features.edge.EdgeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 93 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class MEdgeController method setWidth.

public void setWidth(final NodeModel node, final int width) {
    final ModeController modeController = Controller.getCurrentModeController();
    final int oldWidth = EdgeModel.createEdgeModel(node).getWidth();
    if (width == oldWidth) {
        return;
    }
    final IActor actor = new IActor() {

        public void act() {
            EdgeModel.createEdgeModel(node).setWidth(width);
            modeController.getMapController().nodeChanged(node);
            edgeWidthRefresh(node);
        }

        private void edgeWidthRefresh(final NodeModel node) {
            for (final NodeModel child : modeController.getMapController().childrenFolded(node)) {
                final EdgeModel edge = EdgeModel.getModel(child);
                if (edge == null || edge.getWidth() == EdgeModel.WIDTH_PARENT) {
                    modeController.getMapController().nodeRefresh(child);
                    edgeWidthRefresh(child);
                }
            }
        }

        public String getDescription() {
            return "setWidth";
        }

        public void undo() {
            EdgeModel.createEdgeModel(node).setWidth(oldWidth);
            modeController.getMapController().nodeChanged(node);
            edgeWidthRefresh(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 94 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class MoveAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final MClipboardController clipboardController = (MClipboardController) ClipboardController.getController();
    final NodeModel parent = Controller.getCurrentController().getSelection().getSelected();
    clipboardController.move(clipboardController.getClipboardContents(), parent);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel)

Example 95 with NodeModel

use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.

the class SelectedPasteAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final MClipboardController clipboardController = (MClipboardController) ClipboardController.getController();
    final Collection<IDataFlavorHandler> flavorHandlers = clipboardController.getFlavorHandlers();
    if (flavorHandlers.isEmpty()) {
        return;
    }
    final JPanel options = createPane(flavorHandlers);
    if (JOptionPane.CANCEL_OPTION == JOptionPane.showConfirmDialog((Component) e.getSource(), options, e.getActionCommand(), JOptionPane.OK_CANCEL_OPTION)) {
        return;
    }
    final NodeModel parent = Controller.getCurrentController().getSelection().getSelected();
    final Transferable clipboardContents = clipboardController.getClipboardContents();
    clipboardController.paste(clipboardContents, selectedHandler, parent, false, parent.isNewChildLeft());
    selectedHandler = null;
}
Also used : JPanel(javax.swing.JPanel) NodeModel(org.freeplane.features.map.NodeModel) Transferable(java.awt.datatransfer.Transferable) IDataFlavorHandler(org.freeplane.features.clipboard.mindmapmode.MClipboardController.IDataFlavorHandler) Component(java.awt.Component)

Aggregations

NodeModel (org.freeplane.features.map.NodeModel)450 ModeController (org.freeplane.features.mode.ModeController)100 MapModel (org.freeplane.features.map.MapModel)53 Controller (org.freeplane.features.mode.Controller)46 MapStyleModel (org.freeplane.features.styles.MapStyleModel)46 MMapController (org.freeplane.features.map.mindmapmode.MMapController)39 MapController (org.freeplane.features.map.MapController)38 Point (java.awt.Point)37 IStyle (org.freeplane.features.styles.IStyle)36 IActor (org.freeplane.core.undo.IActor)34 IMapSelection (org.freeplane.features.map.IMapSelection)33 ArrayList (java.util.ArrayList)22 NodeView (org.freeplane.view.swing.map.NodeView)20 URI (java.net.URI)19 Color (java.awt.Color)18 Component (java.awt.Component)17 ResourceController (org.freeplane.core.resources.ResourceController)17 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)16 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)15 MTextController (org.freeplane.features.text.mindmapmode.MTextController)15