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

« back to all changes in this revision

Viewing changes to freemind/accessories/plugins/time/TimeManagementOrganizer.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-2005  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 02.05.2005
 
21
 */
 
22
/* $Id: TimeManagementOrganizer.java,v 1.1.2.2 2008/01/13 20:55:33 christianfoltin Exp $ */
 
23
package accessories.plugins.time;
 
24
 
 
25
import java.util.Iterator;
 
26
 
 
27
import javax.swing.Action;
 
28
import javax.swing.JMenuItem;
 
29
 
 
30
import freemind.controller.MenuItemEnabledListener;
 
31
import freemind.extensions.HookRegistration;
 
32
import freemind.extensions.PermanentNodeHook;
 
33
import freemind.modes.MindMap;
 
34
import freemind.modes.MindMapNode;
 
35
import freemind.modes.ModeController;
 
36
import freemind.modes.common.plugins.ReminderHookBase;
 
37
import freemind.modes.mindmapmode.actions.NodeHookAction;
 
38
 
 
39
/** Enables the encrypt/decrypt menu item only if the map/node is encrypted.
 
40
 * @author foltin
 
41
 *
 
42
 */
 
43
public class TimeManagementOrganizer implements HookRegistration, MenuItemEnabledListener {
 
44
 
 
45
    private final ModeController controller;
 
46
    private final MindMap mMap;
 
47
    private final java.util.logging.Logger logger;
 
48
 
 
49
    public TimeManagementOrganizer(ModeController controller, MindMap map) {
 
50
        this.controller = controller;
 
51
        mMap = map;
 
52
        logger = controller.getFrame().getLogger(this.getClass().getName());
 
53
    }
 
54
 
 
55
        public void register() {
 
56
        }
 
57
 
 
58
        public void deRegister() {
 
59
        }
 
60
 
 
61
        /* (non-Javadoc)
 
62
         * @see freemind.controller.MenuItemEnabledListener#isEnabled(javax.swing.JMenuItem, javax.swing.Action)
 
63
         */
 
64
        public boolean isEnabled(JMenuItem item, Action action) {
 
65
                if (action instanceof NodeHookAction) {
 
66
                        String hookName = ((NodeHookAction) action).getHookName();
 
67
                        if (hookName.equals("plugins/time/RemoveReminderHook.java")) {
 
68
                                boolean visible = false;
 
69
                                for (Iterator i = controller.getSelecteds().iterator(); i.hasNext();) {
 
70
                                        MindMapNode node = (MindMapNode) i.next();
 
71
                                        if(TimeManagementOrganizer.getHook(node)!= null) {
 
72
                                                visible = true;
 
73
                                        }
 
74
                                }
 
75
                                item.setVisible(visible);
 
76
                        }
 
77
                }
 
78
                return true;
 
79
        }
 
80
        
 
81
 
 
82
        /**
 
83
         */
 
84
        public static ReminderHookBase getHook(MindMapNode node) {
 
85
                for (Iterator j = node.getActivatedHooks().iterator(); j.hasNext();) {
 
86
                        PermanentNodeHook element = (PermanentNodeHook) j.next();
 
87
                        if (element instanceof ReminderHookBase) {
 
88
                                return (ReminderHookBase) element;
 
89
                        }
 
90
                }
 
91
                return null;
 
92
        }
 
93
}
 
 
b'\\ No newline at end of file'