Source Code Cross Referenced for AntDeployReplaceEditorDialog.java in  » J2EE » enhydra-IDE-plugin » org » enhydra » kelp » ant » deployer » 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 » J2EE » enhydra IDE plugin » org.enhydra.kelp.ant.deployer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.kelp.ant.deployer;
002:
003:        /*
004:         * Enhydra Java Application Server Project
005:         *
006:         * The contents of this file are subject to the Enhydra Public License
007:         * Version 1.1 (the "License"); you may not use this file except in
008:         * compliance with the License. You may obtain a copy of the License on
009:         * the Enhydra web site ( http://www.enhydra.org/ ).
010:         *
011:         * Software distributed under the License is distributed on an "AS IS"
012:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
013:         * the License for the specific terms governing rights and limitations
014:         * under the License.
015:         *
016:         * The Initial Developer of the Enhydra Application Server is Lutris
017:         * Technologies, Inc. The Enhydra Application Server and portions created
018:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
019:         * All Rights Reserved.
020:         *
021:         * Contributor(s):
022:         * Paul Mahar
023:         *
024:         */
025:
026:        // ToolBox imports
027:        import org.enhydra.tool.common.SwingUtil;
028:
029:        // Standard imports
030:        import java.awt.Dimension;
031:        import java.awt.Dialog;
032:        import java.awt.Frame;
033:        import java.awt.GridBagLayout;
034:        import java.awt.GridBagConstraints;
035:        import java.awt.Insets;
036:        import java.awt.Point;
037:        import java.awt.event.ActionEvent;
038:        import java.awt.event.ActionListener;
039:        import java.io.File;
040:        import java.beans.Beans;
041:        import javax.swing.JButton;
042:        import javax.swing.JDialog;
043:        import javax.swing.JPanel;
044:        import javax.swing.JTextField;
045:        import javax.swing.JLabel;
046:        import java.util.ResourceBundle;
047:
048:        /**
049:         * Class declaration
050:         *
051:         *
052:         * @author
053:         * @version %I%, %G%
054:         */
055:        public class AntDeployReplaceEditorDialog extends JDialog {
056:            static ResourceBundle res = ResourceBundle
057:                    .getBundle("org.enhydra.kelp.common.Res"); // nores
058:            public static final int ACTION_OK = 0;
059:            public static final int ACTION_CANCEL = 1;
060:            private static File startFolder = null;
061:            private int option = ACTION_CANCEL;
062:            private LocalButtonListener buttonListener = null;
063:            private JPanel panelMain = new JPanel();
064:            private GridBagLayout layoutMain;
065:            private JPanel panelEntry;
066:            private GridBagLayout layoutEntry;
067:            private JPanel panelButtons;
068:            private GridBagLayout layoutButton;
069:            private JLabel labelFind;
070:            private JTextField textFind;
071:            private JButton buttonBrowse;
072:            private JLabel labelReplaceWith;
073:            private JTextField textReplaceWith;
074:            private JButton buttonCancel;
075:            private JButton buttonOK;
076:
077:            /**
078:             * Constructor declaration
079:             *
080:             *
081:             * @param owner
082:             * @param title
083:             * @param modal
084:             */
085:            public AntDeployReplaceEditorDialog(Dialog owner, String title,
086:                    boolean modal) {
087:                super (owner, title, modal);
088:                construct();
089:            }
090:
091:            public AntDeployReplaceEditorDialog(Frame owner, String title,
092:                    boolean modal) {
093:                super (owner, title, modal);
094:                construct();
095:            }
096:
097:            private void construct() {
098:                try {
099:                    jbInit();
100:                    pmInit();
101:                    pack();
102:                } catch (Exception ex) {
103:                    ex.printStackTrace();
104:                }
105:            }
106:
107:            /**
108:             * Constructor declaration
109:             *
110:             */
111:            public AntDeployReplaceEditorDialog() {
112:                this (new Frame(), new String(), false);
113:            }
114:
115:            /**
116:             * Method declaration
117:             *
118:             */
119:            public void show() {
120:                setResizable(false);
121:                Point cPoint;
122:
123:                invalidate();
124:                doLayout();
125:                pack();
126:                cPoint = SwingUtil.getCenteringPoint(getSize());
127:                setLocation(cPoint);
128:                super .show();
129:            }
130:
131:            /**
132:             * Method declaration
133:             *
134:             */
135:            private void pmInit() {
136:                buttonListener = new LocalButtonListener();
137:                buttonBrowse.addActionListener(buttonListener);
138:                buttonOK.addActionListener(buttonListener);
139:                buttonCancel.addActionListener(buttonListener);
140:                textFind.setText(new String());
141:                textReplaceWith.setText(new String());
142:            }
143:
144:            /**
145:             * Method declaration
146:             *
147:             *
148:             * @throws Exception
149:             */
150:            private void jbInit() throws Exception {
151:                layoutMain = (GridBagLayout) Beans.instantiate(getClass()
152:                        .getClassLoader(), GridBagLayout.class.getName());
153:                panelEntry = (JPanel) Beans.instantiate(getClass()
154:                        .getClassLoader(), JPanel.class.getName());
155:                layoutEntry = (GridBagLayout) Beans.instantiate(getClass()
156:                        .getClassLoader(), GridBagLayout.class.getName());
157:                panelButtons = (JPanel) Beans.instantiate(getClass()
158:                        .getClassLoader(), JPanel.class.getName());
159:                layoutButton = (GridBagLayout) Beans.instantiate(getClass()
160:                        .getClassLoader(), GridBagLayout.class.getName());
161:                labelFind = (JLabel) Beans.instantiate(getClass()
162:                        .getClassLoader(), JLabel.class.getName());
163:                textFind = (JTextField) Beans.instantiate(getClass()
164:                        .getClassLoader(), JTextField.class.getName());
165:                buttonBrowse = (JButton) Beans.instantiate(getClass()
166:                        .getClassLoader(), JButton.class.getName());
167:                labelReplaceWith = (JLabel) Beans.instantiate(getClass()
168:                        .getClassLoader(), JLabel.class.getName());
169:                textReplaceWith = (JTextField) Beans.instantiate(getClass()
170:                        .getClassLoader(), JTextField.class.getName());
171:                buttonCancel = (JButton) Beans.instantiate(getClass()
172:                        .getClassLoader(), JButton.class.getName());
173:                buttonOK = (JButton) Beans.instantiate(getClass()
174:                        .getClassLoader(), JButton.class.getName());
175:                panelMain.setLayout(layoutMain);
176:                panelEntry.setLayout(layoutEntry);
177:                panelButtons.setLayout(layoutButton);
178:                labelFind.setText(res.getString("labelFind_Text"));
179:                textFind.setPreferredSize(new Dimension(250, 21));
180:                labelReplaceWith
181:                        .setText(res.getString("labelReplaceWith_Text"));
182:                textReplaceWith.setPreferredSize(new Dimension(250, 21));
183:                buttonBrowse.setText(res.getString("Browse"));
184:                buttonCancel.setText(res.getString("Cancel"));
185:                buttonOK.setText(res.getString("OK"));
186:                getContentPane().add(panelMain);
187:                panelMain.add(panelEntry, new GridBagConstraints(0, 0, 1, 1,
188:                        0.2, 0.2, GridBagConstraints.CENTER,
189:                        GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
190:                panelEntry.add(labelFind, new GridBagConstraints(0, 0, 1, 1,
191:                        0.2, 0.2, GridBagConstraints.WEST,
192:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
193:                        0, 0));
194:                panelEntry.add(textFind, new GridBagConstraints(0, 1, 1, 1,
195:                        0.4, 0.4, GridBagConstraints.WEST,
196:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
197:                        200, 0));
198:                panelEntry.add(labelReplaceWith, new GridBagConstraints(0, 2,
199:                        1, 1, 0.2, 0.2, GridBagConstraints.WEST,
200:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
201:                        0, 0));
202:                panelEntry.add(textReplaceWith, new GridBagConstraints(0, 3, 1,
203:                        1, 0.4, 0.4, GridBagConstraints.WEST,
204:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
205:                        200, 0));
206:                panelEntry.add(buttonBrowse, new GridBagConstraints(1, 3, 1, 1,
207:                        0.2, 0.2, GridBagConstraints.CENTER,
208:                        GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
209:                panelMain.add(panelButtons, new GridBagConstraints(0, 1, 1, 1,
210:                        0.2, 0.2, GridBagConstraints.CENTER,
211:                        GridBagConstraints.BOTH, new Insets(5, 5, 5, 0), 0, 0));
212:                panelButtons.add(buttonOK, new GridBagConstraints(0, 0, 1, 1,
213:                        0.0, 0.0, GridBagConstraints.CENTER,
214:                        GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
215:                panelButtons.add(buttonCancel, new GridBagConstraints(1, 0, 1,
216:                        1, 0.0, 0.0, GridBagConstraints.CENTER,
217:                        GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
218:            }
219:
220:            /**
221:             * Method declaration
222:             *
223:             */
224:            protected void closeDialog() {
225:                setVisible(false);
226:                removeAll();
227:                dispose();
228:            }
229:
230:            /**
231:             * Method declaration
232:             *
233:             *
234:             * @return
235:             */
236:            protected int getOption() {
237:                return option;
238:            }
239:
240:            /**
241:             * Method declaration
242:             *
243:             *
244:             * @return
245:             */
246:            protected String getFind() {
247:                return textFind.getText();
248:            }
249:
250:            protected void setFind(String find) {
251:                textFind.setText(find);
252:            }
253:
254:            /**
255:             * Method declaration
256:             *
257:             *
258:             * @return
259:             */
260:            protected String getReplaceWith() {
261:                return textReplaceWith.getText();
262:            }
263:
264:            protected void setReplaceWith(String replace) {
265:                textReplaceWith.setText(replace);
266:            }
267:
268:            /**
269:             * Method declaration
270:             *
271:             *
272:             * @param o
273:             */
274:            private void setOption(int o) {
275:                option = o;
276:            }
277:
278:            /**
279:             * Method declaration
280:             *
281:             */
282:            private void browseAction() {
283:                File choice;
284:
285:                if (startFolder == null || !startFolder.exists()) {
286:                    startFolder = new File(textReplaceWith.getText());
287:                }
288:                choice = SwingUtil.getDirectoryChoice(this , startFolder, res
289:                        .getString("Select_folder_to_use"));
290:                buttonBrowse.requestFocus();
291:                if (choice != null) {
292:                    textReplaceWith.setText(choice.toString());
293:                    startFolder = choice; // persist this choice for next call
294:                }
295:            }
296:
297:            class LocalButtonListener implements  ActionListener {
298:
299:                /**
300:                 * Method declaration
301:                 *
302:                 *
303:                 * @param event
304:                 */
305:                public void actionPerformed(ActionEvent event) {
306:                    Object source = event.getSource();
307:
308:                    if (source == buttonBrowse) {
309:                        browseAction();
310:                    } else if (source == buttonOK) {
311:                        setOption(ACTION_OK);
312:                        closeDialog();
313:                    } else if (source == buttonCancel) {
314:                        setOption(ACTION_CANCEL);
315:                        closeDialog();
316:                    }
317:                }
318:
319:            }
320:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.