Source Code Cross Referenced for SelectAddressbookFolderDialog.java in  » Mail-Clients » columba-1.4 » org » columba » addressbook » gui » tree » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Mail Clients » columba 1.4 » org.columba.addressbook.gui.tree.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:        package org.columba.addressbook.gui.tree.util;
019:
020:        import java.awt.BorderLayout;
021:        import java.awt.GridLayout;
022:        import java.awt.event.ActionEvent;
023:        import java.awt.event.ActionListener;
024:
025:        import javax.swing.BorderFactory;
026:        import javax.swing.JButton;
027:        import javax.swing.JDialog;
028:        import javax.swing.JFrame;
029:        import javax.swing.JPanel;
030:        import javax.swing.JScrollPane;
031:        import javax.swing.JTree;
032:        import javax.swing.SwingConstants;
033:        import javax.swing.event.TreeSelectionEvent;
034:        import javax.swing.event.TreeSelectionListener;
035:        import javax.swing.tree.TreeModel;
036:        import javax.swing.tree.TreePath;
037:
038:        import org.columba.addressbook.config.FolderItem;
039:        import org.columba.addressbook.folder.AddressbookFolder;
040:        import org.columba.addressbook.folder.AddressbookTreeNode;
041:        import org.columba.addressbook.folder.IFolder;
042:        import org.columba.addressbook.gui.tree.AddressbookTreeModel;
043:        import org.columba.addressbook.util.AddressbookResourceLoader;
044:        import org.columba.core.gui.base.ButtonWithMnemonic;
045:        import org.columba.core.gui.base.SingleSideEtchedBorder;
046:
047:        public class SelectAddressbookFolderDialog extends JDialog implements 
048:                ActionListener, TreeSelectionListener, ISelectFolderDialog {
049:
050:            // private MainInterface mainInterface;
051:            private boolean bool = false;
052:
053:            // public SelectFolderTree tree;
054:            private JTree tree;
055:
056:            private JButton[] buttons;
057:
058:            // private TreeView treeViewer;
059:            private IFolder selectedFolder;
060:
061:            private TreeModel model;
062:
063:            public SelectAddressbookFolderDialog(TreeModel model) {
064:                super (new JFrame(), true);
065:
066:                setTitle(AddressbookResourceLoader.getString("tree",
067:                        "folderdialog", "select_folder"));
068:
069:                this .model = model;
070:
071:                initComponents();
072:
073:                layoutComponents();
074:
075:                pack();
076:                setLocationRelativeTo(null);
077:                setVisible(true);
078:            }
079:
080:            private void layoutComponents() {
081:                getContentPane().setLayout(new BorderLayout());
082:
083:                JPanel mainPanel = new JPanel(new BorderLayout());
084:                mainPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12,
085:                        12));
086:                mainPanel.add(new JScrollPane(tree), BorderLayout.CENTER);
087:
088:                getContentPane().add(mainPanel, BorderLayout.CENTER);
089:
090:                JPanel bottomPanel = new JPanel(new BorderLayout());
091:                bottomPanel.setBorder(new SingleSideEtchedBorder(
092:                        SwingConstants.TOP));
093:
094:                JPanel buttonPanel = new JPanel(new GridLayout(1, 2, 6, 0));
095:                buttonPanel.setBorder(BorderFactory.createEmptyBorder(12, 12,
096:                        12, 12));
097:
098:                buttonPanel.add(buttons[0]);
099:                buttonPanel.add(buttons[1]);
100:                bottomPanel.add(buttonPanel, BorderLayout.EAST);
101:
102:                getContentPane().add(bottomPanel, BorderLayout.SOUTH);
103:            }
104:
105:            private void initComponents() {
106:                buttons = new JButton[3];
107:
108:                buttons[0] = new ButtonWithMnemonic(AddressbookResourceLoader
109:                        .getString("global", "cancel"));
110:                buttons[0].setActionCommand("CANCEL");
111:                buttons[0].setDefaultCapable(true);
112:                buttons[1] = new ButtonWithMnemonic(AddressbookResourceLoader
113:                        .getString("global", "ok"));
114:                buttons[1].setEnabled(true);
115:                buttons[1].setActionCommand("OK");
116:                buttons[2] = new JButton(AddressbookResourceLoader.getString(
117:                        "tree", "folderdialog", "new_subFolder"));
118:                buttons[2].setActionCommand("NEW");
119:                buttons[2].setEnabled(false);
120:
121:                getRootPane().setDefaultButton(buttons[1]);
122:
123:                tree = new JTree(model);
124:                tree.expandRow(0);
125:                tree.expandRow(1);
126:                tree.putClientProperty("JTree.lineStyle", "Angled");
127:                tree.setShowsRootHandles(true);
128:                tree.setRootVisible(false);
129:
130:                tree.addTreeSelectionListener(this );
131:                tree.setCellRenderer(new AddressbookTreeCellRenderer(true));
132:
133:                for (int i = 0; i < 3; i++) {
134:                    buttons[i].addActionListener(this );
135:                }
136:
137:                tree.setSelectionPath(new TreePath(AddressbookTreeModel
138:                        .getInstance().getFolder("101").getPath()));
139:            }
140:
141:            public boolean success() {
142:                return bool;
143:            }
144:
145:            public IFolder getSelectedFolder() {
146:                return selectedFolder;
147:            }
148:
149:            public int getUid() {
150:                /*
151:                 * FolderTreeNode node = tree.getSelectedNode(); FolderItem item =
152:                 * node.getFolderItem();
153:                 */
154:                return 101;
155:
156:                // return item.getUid();
157:            }
158:
159:            public void actionPerformed(ActionEvent e) {
160:                String action = e.getActionCommand();
161:
162:                if (action.equals("OK")) {
163:                    bool = true;
164:                    setVisible(false);
165:                } else if (action.equals("CANCEL")) {
166:                    bool = false;
167:                    setVisible(false);
168:                } else if (action.equals("NEW")) {
169:                    /*
170:                     * EditFolderDialog dialog = treeViewer.getEditFolderDialog( "New
171:                     * Folder" ); dialog.showDialog(); String name; if (
172:                     * dialog.success() == true ) { // ok pressed name =
173:                     * dialog.getName(); } else { // cancel pressed return; }
174:                     * treeViewer.getFolderTree().addUserFolder( getSelectedFolder(),
175:                     * name ); //TreeNodeEvent updateEvent2 = new TreeNodeEvent(
176:                     * getSelectedFolder(), TreeNodeEvent.STRUCTURE_CHANGED );
177:                     * //treeViewer.mainInterface.crossbar.fireTreeNodeChanged(updateEvent2);
178:                     */
179:                }
180:            }
181:
182:            /**
183:             * ***************************** tree selection listener
184:             * *******************************
185:             */
186:            public void valueChanged(TreeSelectionEvent e) {
187:                AddressbookTreeNode node = (AddressbookTreeNode) tree
188:                        .getLastSelectedPathComponent();
189:
190:                if (node == null) {
191:                    return;
192:                }
193:
194:                FolderItem item = node.getFolderItem();
195:
196:                if (item.get("type").equals("AddressbookFolder")) {
197:                    buttons[1].setEnabled(true);
198:                    selectedFolder = (AddressbookFolder) node;
199:                } else {
200:                    buttons[1].setEnabled(false);
201:                }
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.