Source Code Cross Referenced for ExternalToolsDialog.java in  » Mail-Clients » columba-1.4 » org » columba » core » gui » externaltools » 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.core.gui.externaltools 
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.core.gui.externaltools;
019:
020:        import java.awt.BorderLayout;
021:        import java.awt.Dimension;
022:        import java.awt.GridLayout;
023:        import java.awt.HeadlessException;
024:        import java.awt.event.ActionEvent;
025:        import java.awt.event.ActionListener;
026:        import java.awt.event.KeyEvent;
027:        import java.awt.event.MouseEvent;
028:
029:        import javax.swing.BorderFactory;
030:        import javax.swing.JButton;
031:        import javax.swing.JComponent;
032:        import javax.swing.JDialog;
033:        import javax.swing.JFrame;
034:        import javax.swing.JLabel;
035:        import javax.swing.JList;
036:        import javax.swing.JPanel;
037:        import javax.swing.JScrollPane;
038:        import javax.swing.KeyStroke;
039:        import javax.swing.SwingConstants;
040:        import javax.swing.event.ListSelectionEvent;
041:        import javax.swing.event.ListSelectionListener;
042:
043:        import org.columba.api.plugin.IExtension;
044:        import org.columba.api.plugin.IExtensionHandler;
045:        import org.columba.api.plugin.IExtensionHandlerKeys;
046:        import org.columba.api.plugin.PluginHandlerNotFoundException;
047:        import org.columba.core.gui.base.ButtonWithMnemonic;
048:        import org.columba.core.gui.base.DoubleClickListener;
049:        import org.columba.core.gui.base.InfoViewerDialog;
050:        import org.columba.core.gui.base.SingleSideEtchedBorder;
051:        import org.columba.core.gui.util.DialogHeaderPanel;
052:        import org.columba.core.help.HelpManager;
053:        import org.columba.core.plugin.PluginManager;
054:        import org.columba.core.resourceloader.GlobalResourceLoader;
055:        import org.columba.core.resourceloader.IconKeys;
056:        import org.columba.core.resourceloader.ImageLoader;
057:
058:        import com.jgoodies.forms.layout.CellConstraints;
059:        import com.jgoodies.forms.layout.FormLayout;
060:
061:        /**
062:         * Shows a list of external tools used in Columba.
063:         * <p>
064:         * Should be the central location to configure these tools
065:         * 
066:         * @author fdietz
067:         */
068:        @SuppressWarnings({"serial","serial"})
069:        public class ExternalToolsDialog extends JDialog implements 
070:                ActionListener, ListSelectionListener {
071:
072:            private static final String RESOURCE_PATH = "org.columba.core.i18n.dialog";
073:
074:            IExtensionHandler handler;
075:
076:            protected JButton helpButton;
077:
078:            protected JButton closeButton;
079:
080:            protected JButton configButton;
081:
082:            protected JButton infoButton;
083:
084:            protected JList list;
085:
086:            protected String selection;
087:
088:            /**
089:             * @throws java.awt.HeadlessException
090:             */
091:            public ExternalToolsDialog() throws HeadlessException {
092:                super (new JFrame(), true);
093:
094:                // TODO (@author fdietz): i18n
095:                setTitle("External Tools");
096:
097:                try {
098:                    handler = PluginManager
099:                            .getInstance()
100:                            .getExtensionHandler(
101:                                    IExtensionHandlerKeys.ORG_COLUMBA_CORE_EXTERNALTOOLS);
102:                } catch (PluginHandlerNotFoundException e) {
103:                    e.printStackTrace();
104:                }
105:
106:                initComponents();
107:
108:                pack();
109:                setLocationRelativeTo(null);
110:                setVisible(true);
111:            }
112:
113:            protected void initComponents() {
114:                JPanel mainPanel = new JPanel(new BorderLayout());
115:                mainPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12,
116:                        12));
117:
118:                // TODO (@author fdietz): i18n
119:                configButton = new ButtonWithMnemonic("Con&figure...");
120:                configButton.setActionCommand("CONFIG");
121:                configButton.addActionListener(this );
122:                configButton.setEnabled(false);
123:
124:                // TODO (@author fdietz): i18n
125:                infoButton = new ButtonWithMnemonic("&Details...");
126:                infoButton.setActionCommand("INFO");
127:                infoButton.addActionListener(this );
128:                infoButton.setEnabled(false);
129:
130:                String[] ids = handler.getPluginIdList();
131:                list = new JList(ids);
132:                list.addListSelectionListener(this );
133:                list.addMouseListener(new DoubleClickListener() {
134:                    public void doubleClick(MouseEvent ev) {
135:                        actionPerformed(new ActionEvent(list, 0, "CONFIG"));
136:                    }
137:                });
138:
139:                getContentPane().add(
140:                        new DialogHeaderPanel(
141:                                GlobalResourceLoader.getString(RESOURCE_PATH,
142:                                        "externaltools", "header_title"),
143:                                GlobalResourceLoader.getString(RESOURCE_PATH,
144:                                        "externaltools", "header_description"),
145:                                ImageLoader.getIcon(IconKeys.PREFERENCES)),
146:                        BorderLayout.NORTH);
147:
148:                getContentPane().add(createPanel(), BorderLayout.CENTER);
149:                getContentPane().add(createBottomPanel(), BorderLayout.SOUTH);
150:
151:                getRootPane().setDefaultButton(closeButton);
152:                getRootPane().registerKeyboardAction(this , "CLOSE",
153:                        KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
154:                        JComponent.WHEN_IN_FOCUSED_WINDOW);
155:
156:                // associate with JavaHelp
157:                HelpManager.getInstance().enableHelpOnButton(helpButton,
158:                        "extending_columba_2");
159:                HelpManager.getInstance().enableHelpKey(getRootPane(),
160:                        "extending_columba_2");
161:            }
162:
163:            private JPanel createPanel() {
164:                JPanel jpanel1 = new JPanel();
165:                FormLayout formlayout1 = new FormLayout(
166:                        "FILL:DEFAULT:GROW(1.0),3DLU,FILL:DEFAULT:NONE",
167:                        "CENTER:DEFAULT:NONE,1DLU,FILL:DEFAULT:GROW(1.0),3DLU,CENTER:DEFAULT:NONE");
168:                CellConstraints cc = new CellConstraints();
169:                jpanel1.setBorder(BorderFactory.createEmptyBorder(12, 12, 12,
170:                        12));
171:                jpanel1.setLayout(formlayout1);
172:
173:                JLabel jlabel1 = new JLabel();
174:                jlabel1.setText("External Tools:");
175:                jpanel1.add(jlabel1, cc.xy(1, 1));
176:
177:                JScrollPane scrollPane = new JScrollPane(list);
178:                scrollPane.setPreferredSize(new Dimension(250, 150));
179:                jpanel1.add(scrollPane, cc.xy(1, 3));
180:
181:                jpanel1.add(createPanel1(), new CellConstraints(3, 3, 1, 1,
182:                        CellConstraints.DEFAULT, CellConstraints.TOP));
183:
184:                return jpanel1;
185:            }
186:
187:            private JPanel createPanel1() {
188:                JPanel jpanel1 = new JPanel();
189:                FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE",
190:                        "CENTER:DEFAULT:NONE,3DLU,CENTER:DEFAULT:NONE,3DLU,CENTER:DEFAULT:NONE");
191:                CellConstraints cc = new CellConstraints();
192:                jpanel1.setLayout(formlayout1);
193:
194:                jpanel1.add(configButton, cc.xy(1, 1));
195:
196:                jpanel1.add(infoButton, cc.xy(1, 3));
197:
198:                return jpanel1;
199:            }
200:
201:            private JPanel createBottomPanel() {
202:                JPanel bottomPanel = new JPanel(new BorderLayout());
203:                bottomPanel.setBorder(new SingleSideEtchedBorder(
204:                        SwingConstants.TOP));
205:
206:                JPanel buttonPanel = new JPanel(new GridLayout(1, 3, 6, 0));
207:                buttonPanel.setBorder(BorderFactory.createEmptyBorder(12, 12,
208:                        12, 12));
209:
210:                closeButton = new ButtonWithMnemonic(GlobalResourceLoader
211:                        .getString("global", "global", "close"));
212:                closeButton.setActionCommand("CLOSE"); //$NON-NLS-1$
213:                closeButton.addActionListener(this );
214:                buttonPanel.add(closeButton);
215:
216:                helpButton = new ButtonWithMnemonic(GlobalResourceLoader
217:                        .getString("global", "global", "help"));
218:
219:                buttonPanel.add(helpButton);
220:                bottomPanel.add(buttonPanel, BorderLayout.EAST);
221:
222:                return bottomPanel;
223:            }
224:
225:            public void actionPerformed(ActionEvent e) {
226:                String action = e.getActionCommand();
227:
228:                if (action.equals("CLOSE")) {
229:                    setVisible(false);
230:                } else if (action.equals("CONFIG")) {
231:                    new ExternalToolsWizardLauncher().launchWizard(selection,
232:                            false);
233:                } else if (action.equals("INFO")) {
234:                    AbstractExternalToolsPlugin plugin = null;
235:
236:                    try {
237:                        IExtension extension = handler.getExtension(selection);
238:
239:                        plugin = (AbstractExternalToolsPlugin) extension
240:                                .instanciateExtension(null);
241:                    } catch (Exception e1) {
242:                        e1.printStackTrace();
243:                    }
244:
245:                    String info = plugin.getDescription();
246:                    new InfoViewerDialog(info);
247:                }
248:            }
249:
250:            /*
251:             * (non-Javadoc)
252:             * 
253:             * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
254:             */
255:            public void valueChanged(ListSelectionEvent e) {
256:                boolean enabled = !list.isSelectionEmpty();
257:                configButton.setEnabled(enabled);
258:                infoButton.setEnabled(enabled);
259:                selection = (String) list.getSelectedValue();
260:            }
261:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.