Search in sources :

Example 1 with ZoomableLabel

use of org.freeplane.view.swing.map.ZoomableLabel in project freeplane by freeplane.

the class MMapViewController method createEditor.

private EditNodeBase createEditor(final NodeModel node, final EditedComponent parent, final String text, final IEditControl editControl) {
    final ZoomableLabel parentComponent;
    final MainView mainView = (MainView) getComponent(node);
    final NodeView nodeView = mainView.getNodeView();
    if (EditedComponent.TEXT.equals(parent))
        parentComponent = mainView;
    else if (EditedComponent.DETAIL.equals(parent)) {
        final JComponent component = nodeView.getContent(NodeView.DETAIL_VIEWER_POSITION);
        if (component instanceof ZoomableLabel)
            parentComponent = (ZoomableLabel) component;
        else
            parentComponent = null;
    } else
        parentComponent = null;
    if (parentComponent == null || !parentComponent.isVisible()) {
        return null;
    }
    final EditNodeTextField textField = new EditNodeTextField(node, (ZoomableLabel) parentComponent, text, editControl);
    if (EditedComponent.TEXT.equals(parent))
        textField.setBackground(nodeView.getTextBackground());
    else if (EditedComponent.DETAIL.equals(parent))
        textField.setBackground(nodeView.getDetailBackground());
    return textField;
}
Also used : MainView(org.freeplane.view.swing.map.MainView) JComponent(javax.swing.JComponent) ZoomableLabel(org.freeplane.view.swing.map.ZoomableLabel) NodeView(org.freeplane.view.swing.map.NodeView)

Example 2 with ZoomableLabel

use of org.freeplane.view.swing.map.ZoomableLabel in project freeplane by freeplane.

the class LinkNavigatorMouseListener method mouseMoved.

public void mouseMoved(final MouseEvent e) {
    final ZoomableLabel node = ((ZoomableLabel) e.getComponent());
    String link = node.getLink(e.getPoint());
    boolean followLink = link != null;
    Controller currentController = Controller.getCurrentController();
    final int requiredCursor;
    if (followLink) {
        currentController.getViewController().out(link);
        requiredCursor = Cursor.HAND_CURSOR;
    } else {
        requiredCursor = Cursor.DEFAULT_CURSOR;
    }
    if (node.getCursor().getType() != requiredCursor) {
        node.setCursor(requiredCursor != Cursor.DEFAULT_CURSOR ? new Cursor(requiredCursor) : null);
    }
}
Also used : ZoomableLabel(org.freeplane.view.swing.map.ZoomableLabel) Controller(org.freeplane.features.mode.Controller) Cursor(java.awt.Cursor)

Aggregations

ZoomableLabel (org.freeplane.view.swing.map.ZoomableLabel)2 Cursor (java.awt.Cursor)1 JComponent (javax.swing.JComponent)1 Controller (org.freeplane.features.mode.Controller)1 MainView (org.freeplane.view.swing.map.MainView)1 NodeView (org.freeplane.view.swing.map.NodeView)1