KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > mailchecking > FetchMessageSubMenu


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16

17 package org.columba.mail.mailchecking;
18
19 import java.util.Observable JavaDoc;
20 import java.util.Observer JavaDoc;
21
22 import org.columba.api.gui.frame.IFrameMediator;
23 import org.columba.core.gui.action.AbstractColumbaAction;
24 import org.columba.core.gui.menu.IMenu;
25 import org.columba.mail.util.MailResourceLoader;
26
27 /**
28  * Provides a menu item for each mail account enabling users to fetch new
29  * messages.
30  */

31
32 public class FetchMessageSubMenu extends IMenu implements Observer JavaDoc {
33     //private POP3ServerCollection popServer;
34

35     public FetchMessageSubMenu(IFrameMediator controller) {
36         super(controller,
37             MailResourceLoader.getString("menu", "mainframe",
38                 "menu_file_checkmessage"),"menu_file_checkmessage");
39
40         createMenu();
41
42         // register interest on account changes
43
MailCheckingManager.getInstance().addObserver(this);
44     }
45
46     protected void createMenu() {
47         // remove all items
48
removeAll();
49
50         MailCheckingManager mailCheckingManager = MailCheckingManager.getInstance();
51         AbstractColumbaAction[] actions = mailCheckingManager.getActions();
52
53         for (int i = 0; i < actions.length; i++) {
54             add(actions[i]);
55         }
56     }
57
58     /**
59  * Listening for account changes here.
60  *
61  * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
62  */

63     public void update(Observable JavaDoc observable, Object JavaDoc arg1) {
64         // recreate menu
65
createMenu();
66     }
67 }
68
Popular Tags