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


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