Search in sources :

Example 1 with LinkController

use of org.freeplane.features.link.LinkController in project freeplane by freeplane.

the class MapView method paintConnectors.

private void paintConnectors(final NodeView source, final Graphics2D graphics, final HashSet<ConnectorModel> alreadyPaintedConnectors) {
    final LinkController linkController = LinkController.getController(getModeController());
    final NodeModel node = source.getModel();
    final Collection<NodeLinkModel> outLinks = linkController.getLinksFrom(node);
    paintConnectors(outLinks, graphics, alreadyPaintedConnectors);
    final Collection<NodeLinkModel> inLinks = linkController.getLinksTo(node);
    paintConnectors(inLinks, graphics, alreadyPaintedConnectors);
    final int nodeViewCount = source.getComponentCount();
    for (int i = 0; i < nodeViewCount; i++) {
        final Component component = source.getComponent(i);
        if (!(component instanceof NodeView)) {
            continue;
        }
        final NodeView child = (NodeView) component;
        if (!isPrinting) {
            if (!child.isHierarchyVisible())
                continue;
            final Rectangle bounds = SwingUtilities.convertRectangle(source, child.getBounds(), this);
            final JViewport vp = (JViewport) getParent();
            final Rectangle viewRect = vp.getViewRect();
            viewRect.x -= viewRect.width;
            viewRect.y -= viewRect.height;
            viewRect.width *= 3;
            viewRect.height *= 3;
            if (!viewRect.intersects(bounds)) {
                continue;
            }
        }
        paintConnectors(child, graphics, alreadyPaintedConnectors);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) JViewport(javax.swing.JViewport) LinkController(org.freeplane.features.link.LinkController) Rectangle(java.awt.Rectangle) Component(java.awt.Component) ScalableComponent(org.freeplane.view.swing.features.filepreview.ScalableComponent) JComponent(javax.swing.JComponent) INodeView(org.freeplane.features.map.INodeView) NodeLinkModel(org.freeplane.features.link.NodeLinkModel) Point(java.awt.Point)

Example 2 with LinkController

use of org.freeplane.features.link.LinkController in project freeplane by freeplane.

the class SetLinkAnchorAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    /**
     * @TODO
     *
     * -# implement GUID as reliable nodeID
     * -# correct tickmark handling in menu (BUG)
     * -# set tooltip for mouse-over SetLinkAnchorAction in menu
     */
    // get reference to selected node
    final Controller controller = Controller.getCurrentController();
    final NodeModel node = controller.getSelection().getSelected();
    // get file path of selected node
    File mindmapFile = node.getMap().getFile();
    if (mindmapFile == null) {
        UITools.errorMessage(TextUtils.getRawText("map_not_saved"));
        return;
    }
    // set idString variable according to file and node info
    final String idString = mindmapFile.toURI().toString() + '#' + node.createID();
    // save idString in LinkController
    ((MLinkController) (LinkController.getController())).setAnchorID(idString);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) Controller(org.freeplane.features.mode.Controller) LinkController(org.freeplane.features.link.LinkController) File(java.io.File)

Example 3 with LinkController

use of org.freeplane.features.link.LinkController in project freeplane by freeplane.

the class FModeControllerFactory method createModeController.

public static FModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new FModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new FMapController(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    new IconController(modeController).install(modeController);
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    CloudController.install(new CloudController(modeController));
    ClipboardController.install(new ClipboardController());
    LocationController.install(new LocationController());
    LogicalStyleController.install(new LogicalStyleController(modeController));
    MapStyle.install(true);
    NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<ShapeConfigurationModel, NodeModel>() {

        public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
            return ShapeConfigurationModel.FORK;
        }
    });
    modeController.addAction(new CenterAction());
    modeController.addAction(new OpenPathAction());
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    NodeHistory.install(modeController);
    return modeController;
}
Also used : OpenPathAction(org.freeplane.features.map.filemode.OpenPathAction) ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) EdgeController(org.freeplane.features.edge.EdgeController) TextController(org.freeplane.features.text.TextController) LinkController(org.freeplane.features.link.LinkController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) LocationController(org.freeplane.features.nodelocation.LocationController) FMapController(org.freeplane.features.map.filemode.FMapController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) FModeController(org.freeplane.features.mode.filemode.FModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) LocationController(org.freeplane.features.nodelocation.LocationController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FMapController(org.freeplane.features.map.filemode.FMapController) JPopupMenu(javax.swing.JPopupMenu) IconController(org.freeplane.features.icon.IconController) CenterAction(org.freeplane.features.map.filemode.CenterAction) NodeModel(org.freeplane.features.map.NodeModel) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FModeController(org.freeplane.features.mode.filemode.FModeController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) FrameController(org.freeplane.features.ui.FrameController)

Example 4 with LinkController

use of org.freeplane.features.link.LinkController in project freeplane by freeplane.

the class AttributePopupMenu method make.

/**
 */
private void make() {
    final String attributeViewType = table.getAttributeView().getViewType();
    final IAttributeTableModel model = table.getAttributeTableModel();
    final int rowCount = model.getRowCount();
    add(getOptimalWidth());
    if (col == 1) {
        add(getInsertLink());
        add(getInsertFileLink());
        add(getInsertNodeLink());
        final LinkController linkController = LinkController.getController();
        if (linkController instanceof MLinkController && ((MLinkController) linkController).isAnchored())
            add(getInsertAnchoredLink());
    }
    if (attributeViewType.equals(AttributeTableLayoutModel.SHOW_ALL)) {
        add(getInsert());
        if (row != -1) {
            add(getDelete());
            if (row != 0) {
                add(getUp());
            }
            if (row != rowCount - 1) {
                add(getDown());
            }
        }
    }
}
Also used : MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) LinkController(org.freeplane.features.link.LinkController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) IAttributeTableModel(org.freeplane.features.attribute.IAttributeTableModel) Point(java.awt.Point)

Example 5 with LinkController

use of org.freeplane.features.link.LinkController in project freeplane by freeplane.

the class ConnectorColorAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MLinkController linkController = (MLinkController) LinkController.getController();
    final Color selectedColor = linkController.getColor(arrowLink);
    final Color color = ColorTracker.showCommonJColorChooserDialog(controller.getSelection().getSelected(), (String) this.getValue(Action.NAME), selectedColor, linkController.getStandardConnectorColor());
    if (color != null) {
        linkController.setConnectorColor(arrowLink, color);
    }
}
Also used : Color(java.awt.Color) Controller(org.freeplane.features.mode.Controller) LinkController(org.freeplane.features.link.LinkController)

Aggregations

LinkController (org.freeplane.features.link.LinkController)8 Controller (org.freeplane.features.mode.Controller)4 NodeModel (org.freeplane.features.map.NodeModel)3 Point (java.awt.Point)2 JPopupMenu (javax.swing.JPopupMenu)2 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)2 IAttributeTableModel (org.freeplane.features.attribute.IAttributeTableModel)2 ClipboardController (org.freeplane.features.clipboard.ClipboardController)2 CloudController (org.freeplane.features.cloud.CloudController)2 EdgeController (org.freeplane.features.edge.EdgeController)2 FilterController (org.freeplane.features.filter.FilterController)2 IconController (org.freeplane.features.icon.IconController)2 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)2 LocationController (org.freeplane.features.nodelocation.LocationController)2 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 TextController (org.freeplane.features.text.TextController)2 FrameController (org.freeplane.features.ui.FrameController)2 ViewController (org.freeplane.features.ui.ViewController)2 UrlManager (org.freeplane.features.url.UrlManager)2