Search in sources :

Example 6 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class RemoveExternalImageAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent arg0, final NodeModel node) {
    final ProgressUtilities progUtil = new ProgressUtilities();
    final ViewerController vc = ((ViewerController) Controller.getCurrentController().getModeController().getExtension(ViewerController.class));
    if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
        vc.undoableDeactivateHook(node);
    }
}
Also used : ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)

Example 7 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class AddExternalImageAction method actionPerformed.

public void actionPerformed(final ActionEvent event) {
    final ProgressUtilities progUtil = new ProgressUtilities();
    final MapController mapController = Controller.getCurrentModeController().getMapController();
    final Collection<NodeModel> nodes = mapController.getSelectedNodes();
    final ViewerController vc = Controller.getCurrentController().getModeController().getExtension(ViewerController.class);
    final NodeModel selectedNode = mapController.getSelectedNode();
    if (selectedNode == null)
        return;
    final ExternalResource extRes = (ExternalResource) vc.createExtension(selectedNode);
    if (extRes == null)
        return;
    URI absoluteUri = extRes.getAbsoluteUri(selectedNode.getMap());
    if (absoluteUri == null)
        return;
    for (final NodeModel node : nodes) {
        if (!progUtil.hasExternalResource(node)) {
            vc.paste(absoluteUri, node, node.isLeft());
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities) URI(java.net.URI) MapController(org.freeplane.features.map.MapController)

Example 8 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class ExternalImagePopupMenu method getRemove.

/**
 * @return Returns the delete menu item.
 */
private JMenuItem getRemove() {
    final ProgressUtilities progUtil = new ProgressUtilities();
    if (remove == null) {
        remove = new JMenuItem(TextUtils.getText("ExternalImage_popupMenu_Remove"));
        remove.addActionListener(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                final ExternalResource extRes = node.getExtension(ExternalResource.class);
                if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
                    viewer.remove(node, extRes);
                    NodeView nv = null;
                    final Collection<INodeView> invs = Controller.getCurrentController().getModeController().getMapController().getSelectedNode().getViewers();
                    for (final INodeView inv : invs) {
                        if (inv instanceof NodeView) {
                            nv = (NodeView) inv;
                            break;
                        }
                    }
                    viewer.deleteViewer(extRes, nv);
                    viewer.undoableDeactivateHook(node);
                    Controller.getCurrentModeController().getMapController().nodeChanged(node, NodeModel.UNKNOWN_PROPERTY, null, null);
                }
            }
        });
    }
    return remove;
}
Also used : ActionListener(java.awt.event.ActionListener) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities) ActionEvent(java.awt.event.ActionEvent) Collection(java.util.Collection) JMenuItem(javax.swing.JMenuItem) INodeView(org.freeplane.features.map.INodeView) NodeView(org.freeplane.view.swing.map.NodeView) INodeView(org.freeplane.features.map.INodeView)

Example 9 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class ExternalImagePopupMenu method make.

/**
 * Builds the menu.
 */
private void make() {
    final ProgressUtilities progUtil = new ProgressUtilities();
    if (progUtil.hasExtendedProgressIcon(node)) {
        removeAll();
        add(getOpen());
        add(getResetZoom());
    } else {
        removeAll();
        add(getRemove());
        add(getChange());
        add(getOpen());
        add(getResetZoom());
    }
}
Also used : ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)

Aggregations

ProgressUtilities (org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)9 NodeModel (org.freeplane.features.map.NodeModel)5 URI (java.net.URI)3 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 JMenuItem (javax.swing.JMenuItem)2 MapController (org.freeplane.features.map.MapController)2 Collection (java.util.Collection)1 INodeView (org.freeplane.features.map.INodeView)1 NodeView (org.freeplane.view.swing.map.NodeView)1