1
/*FreeMind - A Program for creating and viewing Mindmaps
2
*Copyright (C) 2000-2005 Joerg Mueller, Daniel Polansky, Christian Foltin and others.
4
*See COPYING for Details
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.
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.
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.
20
* Created on 02.05.2005
22
/* $Id: TimeManagementOrganizer.java,v 1.1.2.2 2008/01/13 20:55:33 christianfoltin Exp $ */
23
package accessories.plugins.time;
25
import java.util.Iterator;
27
import javax.swing.Action;
28
import javax.swing.JMenuItem;
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;
39
/** Enables the encrypt/decrypt menu item only if the map/node is encrypted.
43
public class TimeManagementOrganizer implements HookRegistration, MenuItemEnabledListener {
45
private final ModeController controller;
46
private final MindMap mMap;
47
private final java.util.logging.Logger logger;
49
public TimeManagementOrganizer(ModeController controller, MindMap map) {
50
this.controller = controller;
52
logger = controller.getFrame().getLogger(this.getClass().getName());
55
public void register() {
58
public void deRegister() {
62
* @see freemind.controller.MenuItemEnabledListener#isEnabled(javax.swing.JMenuItem, javax.swing.Action)
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) {
75
item.setVisible(visible);
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;
b'\\ No newline at end of file'