KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > folderoptions > ThreadedViewOptionsPlugin


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
package org.columba.mail.folderoptions;
17
18 import org.columa.core.config.IDefaultItem;
19 import org.columba.core.config.DefaultItem;
20 import org.columba.core.xml.XmlElement;
21 import org.columba.mail.folder.IMailbox;
22 import org.columba.mail.gui.frame.MailFrameMediator;
23 import org.columba.mail.gui.frame.TableViewOwner;
24 import org.columba.mail.gui.table.ITableController;
25
26 /**
27  * Handles enabled/disabled state of threaded-view.
28  *
29  * @author fdietz
30  */

31 public class ThreadedViewOptionsPlugin extends AbstractFolderOptionsPlugin {
32     /**
33      * Constructor
34      *
35      * @param mediator
36      * mail framemediator
37      */

38     public ThreadedViewOptionsPlugin(MailFrameMediator mediator) {
39         super("threadedview", "ThreadedViewOptions", mediator);
40     }
41
42     /**
43      * @see org.columba.mail.folderoptions.AbstractFolderOptionsPlugin#saveOptionsToXml(IMailbox)
44      */

45     public void saveOptionsToXml(IMailbox folder) {
46         XmlElement parent = getConfigNode(folder);
47         IDefaultItem item = new DefaultItem(parent);
48
49         ITableController tableController = ((ITableController) ((TableViewOwner) getMediator())
50                 .getTableController());
51
52         item.setBoolean("enabled", tableController.isThreadedViewEnabled());
53     }
54
55     /**
56      * @see org.columba.mail.folderoptions.AbstractFolderOptionsPlugin#loadOptionsFromXml(IMailbox)
57      */

58     public void loadOptionsFromXml(IMailbox folder) {
59         XmlElement parent = getConfigNode(folder);
60         IDefaultItem item = new DefaultItem(parent);
61
62         boolean enableThreadedView = item.getBooleanWithDefault("enabled",
63                 false);
64
65         ITableController tableController = ((ITableController) ((TableViewOwner) getMediator())
66                 .getTableController());
67
68         tableController.enableThreadedView(enableThreadedView, false);
69     }
70
71     /**
72      * @see org.columba.mail.folderoptions.AbstractFolderOptionsPlugin#createDefaultElement()
73      */

74     public XmlElement createDefaultElement(boolean global) {
75         XmlElement parent = super.createDefaultElement(global);
76         parent.addAttribute("enabled", "false");
77
78         return parent;
79     }
80 }
81
Popular Tags