~ubuntu-branches/ubuntu/utopic/freemind/utopic

« back to all changes in this revision

Viewing changes to freemind/freemind/modes/common/GotoLinkNodeAction.java

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-01-03 14:19:19 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100103141919-m5az7dkicy21hqop
Tags: 0.9.0~rc6+dfsg-1ubuntu1
* Merge from Debian unstable (LP: #182927), remaining changes:
  - debian/copyright: add license/copyright for
    freemind/freemind/main/ExampleFileFilter.java

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*FreeMind - A Program for creating and viewing Mindmaps
 
2
 *Copyright (C) 2000-2004  Joerg Mueller, Daniel Polansky, Christian Foltin and others.
 
3
 *
 
4
 *See COPYING for Details
 
5
 *
 
6
 *This program is free software; you can redistribute it and/or
 
7
 *modify it under the terms of the GNU General Public License
 
8
 *as published by the Free Software Foundation; either version 2
 
9
 *of the License, or (at your option) any later version.
 
10
 *
 
11
 *This program is distributed in the hope that it will be useful,
 
12
 *but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *GNU General Public License for more details.
 
15
 *
 
16
 *You should have received a copy of the GNU General Public License
 
17
 *along with this program; if not, write to the Free Software
 
18
 *Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
 *
 
20
 * Created on 16.10.2004
 
21
 */
 
22
/* $Id: GotoLinkNodeAction.java,v 1.1.2.1.2.2 2008/01/09 21:31:15 christianfoltin Exp $ */
 
23
 
 
24
package freemind.modes.common;
 
25
 
 
26
import java.awt.event.ActionEvent;
 
27
 
 
28
import javax.swing.AbstractAction;
 
29
import javax.swing.Action;
 
30
import javax.swing.ImageIcon;
 
31
 
 
32
import freemind.modes.MindMapNode;
 
33
import freemind.modes.ModeController;
 
34
 
 
35
/** Follow a graphical link (AKA connector) action.*/
 
36
public class GotoLinkNodeAction extends AbstractAction {
 
37
        MindMapNode source;
 
38
 
 
39
        private final ModeController controller;
 
40
 
 
41
        public GotoLinkNodeAction(ModeController controller, MindMapNode source) {
 
42
                super(controller.getText("goto_link_node_action"), new ImageIcon(
 
43
                                controller.getResource("images/Link.png")));
 
44
                this.controller = controller;
 
45
                // only display a reasonable part of the string. the rest is available
 
46
                // via the short description (tooltip).
 
47
                this.source = source;
 
48
                // source is for the controllerAdapter == null,
 
49
                if (source != null) {
 
50
                        String adaptedText = source.getShortText(controller);
 
51
                        putValue(Action.NAME, controller.getText("follow_graphical_link")
 
52
                                        + adaptedText);
 
53
                        putValue(Action.SHORT_DESCRIPTION, source.toString());
 
54
                }
 
55
        }
 
56
 
 
57
        public void actionPerformed(ActionEvent e) {
 
58
                controller.centerNode(source);
 
59
        }
 
60
 
 
61
}
 
 
b'\\ No newline at end of file'