KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > config > ViewItem


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.core.config;
17
18 import org.columba.core.xml.XmlElement;
19
20 /**
21  * View configuration item includes window properties, like position and
22  * dimensions, toolbar properties, splitpane position.
23  *
24  * @author fdietz
25  */

26
27 //
28
// views.xml
29
//
30
// <view header="100" header_enabled="true" id="ThreePaneMail"
31
// infopanel="true" main="100">
32
// <window maximized="true" height="721" width="1034" y="26" x="0"></window>
33
// <toolbars infopanel="true" main="true"></toolbars>
34
// <splitpanes header="200" header_enabled="true" main="283"
35
// attachment="100"></splitpanes>
36
// </view>
37
public class ViewItem extends DefaultItem {
38
39     public static final String JavaDoc ID = "id"; //$NON-NLS-1$
40

41     public static final String JavaDoc VIEW = "view"; //$NON-NLS-1$
42

43     public final static String JavaDoc WINDOW = "window"; //$NON-NLS-1$
44

45     public final static String JavaDoc MAXIMIZED_BOOL = "maximized"; //$NON-NLS-1$
46

47     public final static String JavaDoc HEIGHT_INT = "height"; //$NON-NLS-1$
48

49     public final static String JavaDoc WIDTH_INT = "width"; //$NON-NLS-1$
50

51     public final static String JavaDoc POSITION_X_INT = "x"; //$NON-NLS-1$
52

53     public final static String JavaDoc POSITION_Y_INT = "y"; //$NON-NLS-1$
54

55     public final static String JavaDoc TOOLBARS = "toolbars"; //$NON-NLS-1$
56

57     public final static String JavaDoc MAIN_BOOL = "main"; //$NON-NLS-1$
58

59     public final static String JavaDoc INFOPANEL_BOOL = "infopanel"; //$NON-NLS-1$
60

61     public final static String JavaDoc SPLITPANES = "splitpanes"; //$NON-NLS-1$
62

63     public final static String JavaDoc HEADER_INT = "header"; //$NON-NLS-1$
64

65     public ViewItem(final XmlElement theRoot) {
66         super(theRoot);
67     }
68
69     public static ViewItem createDefault(final String JavaDoc id) {
70
71         // initialize default view options
72
final XmlElement defaultView = new XmlElement(ViewItem.VIEW);
73         final XmlElement window = new XmlElement(WINDOW);
74         // tstich: Default values are set in the loadPostions() method
75
defaultView.addElement(window);
76
77         final XmlElement toolbars = new XmlElement(TOOLBARS);
78         toolbars.addAttribute(MAIN_BOOL, Boolean.TRUE.toString());
79         defaultView.addElement(toolbars);
80
81         defaultView.addAttribute(ViewItem.ID, id);
82
83         return new ViewItem(defaultView);
84     }
85 }
Popular Tags