Source Code Cross Referenced for EnhydraBasePanel.java in  » J2EE » enhydra » org » enhydra » base » tool » 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 » org.enhydra.base.tool 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Jul 20, 2005
003:         *
004:         * TODO To change the template for this generated file go to
005:         * Window - Preferences - Java - Code Style - Code Templates
006:         */
007:        package org.enhydra.base.tool;
008:
009:        import java.awt.event.ActionEvent;
010:        import java.awt.event.ActionListener;
011:
012:        import javax.swing.JPanel;
013:
014:        import javax.swing.AbstractAction;
015:        import javax.swing.JCheckBox;
016:        import javax.swing.JFileChooser;
017:        import javax.swing.JLabel;
018:        import javax.swing.JOptionPane;
019:        import javax.swing.JTextField;
020:        import javax.swing.JButton;
021:
022:        /**
023:         * @author slobodan
024:         * 
025:         * TODO To change the template for this generated type comment go to Window -
026:         * Preferences - Java - Code Style - Code Templates
027:         */
028:        public class EnhydraBasePanel extends JPanel {
029:
030:            private JCheckBox createNew = null;
031:
032:            private JLabel jLabel = null;
033:
034:            private JLabel serviceLabel = null;
035:
036:            private JTextField serviceText = null;
037:
038:            private JLabel pathLabel = null;
039:
040:            private JTextField pathText = null;
041:
042:            private JButton browseButton = null;
043:
044:            private JLabel jLabel2 = null;
045:
046:            private JLabel jLabel1 = null;
047:
048:            /**
049:             * This is the default constructor
050:             */
051:            public EnhydraBasePanel() {
052:                super ();
053:                initialize();
054:            }
055:
056:            /**
057:             * This method initializes this
058:             * 
059:             * @return void
060:             */
061:            private void initialize() {
062:                jLabel1 = new JLabel();
063:                serviceLabel = new JLabel();
064:                jLabel2 = new JLabel();
065:                pathLabel = new JLabel();
066:                jLabel = new JLabel();
067:                this .setPreferredSize(new java.awt.Dimension(300, 150));
068:                this .setSize(300, 150);
069:                jLabel.setText("");
070:                jLabel.setPreferredSize(new java.awt.Dimension(300, 16));
071:                serviceLabel.setText("Service Name:");
072:                serviceLabel.setName("serviceLabel");
073:                serviceLabel.setEnabled(false);
074:                pathLabel.setText("Path to Enhydra Base Directory:");
075:                pathLabel.setEnabled(false);
076:                pathLabel.setName("pathLabel");
077:                pathLabel.setPreferredSize(new java.awt.Dimension(281, 16));
078:                jLabel2.setText("");
079:                jLabel2.setPreferredSize(new java.awt.Dimension(80, 10));
080:                jLabel1.setText("");
081:                jLabel1.setPreferredSize(new java.awt.Dimension(300, 5));
082:                this .add(getCreateNew(), null);
083:                this .add(jLabel, null);
084:                this .add(serviceLabel, null);
085:                this .add(getServiceText(), null);
086:                this .add(jLabel2, null);
087:                this .add(jLabel1, null);
088:                this .add(pathLabel, null);
089:                this .add(getPathText(), null);
090:                this .add(getBrowseButton(), null);
091:            }
092:
093:            /**
094:             * This method initializes jCheckBox
095:             * 
096:             * @return javax.swing.JCheckBox
097:             */
098:            private JCheckBox getCreateNew() {
099:                if (createNew == null) {
100:                    createNew = new JCheckBox();
101:                    createNew.setSelected(false);
102:                    createNew.setName("createNew");
103:                    createNew.setText("Create New Enhydra Base Directory");
104:                    createNew.setPreferredSize(new java.awt.Dimension(300, 24));
105:                    createNew.addActionListener(new CustomActionListener());
106:                }
107:                return createNew;
108:            }
109:
110:            /**
111:             * This method initializes jTextField
112:             * 
113:             * @return javax.swing.JTextField
114:             */
115:            private JTextField getServiceText() {
116:                if (serviceText == null) {
117:                    serviceText = new JTextField();
118:                    serviceText.setName("serviceText");
119:                    serviceText
120:                            .setPreferredSize(new java.awt.Dimension(110, 20));
121:                    serviceText.setEnabled(false);
122:                }
123:                return serviceText;
124:            }
125:
126:            /**
127:             * This method initializes jTextField
128:             * 
129:             * @return javax.swing.JTextField
130:             */
131:            private JTextField getPathText() {
132:                if (pathText == null) {
133:                    pathText = new JTextField();
134:                    pathText.setPreferredSize(new java.awt.Dimension(196, 20));
135:                    pathText.setEnabled(false);
136:                    pathText.setName("pathText");
137:                }
138:                return pathText;
139:            }
140:
141:            /**
142:             * This method initializes jButton
143:             * 
144:             * @return javax.swing.JButton
145:             */
146:            private JButton getBrowseButton() {
147:                if (browseButton == null) {
148:                    browseButton = new JButton();
149:                    browseButton.setText("Browse");
150:                    browseButton.setEnabled(false);
151:                    browseButton.setName("browseButton");
152:                    browseButton
153:                            .setPreferredSize(new java.awt.Dimension(80, 26));
154:                    browseButton.addActionListener(new CustomActionListener());
155:                }
156:                return browseButton;
157:            }
158:
159:            public void setServiceName(String name) {
160:                getServiceText().setText(name);
161:            }
162:
163:            public String getServiceName() {
164:                return getServiceText().getText();
165:            }
166:
167:            public void setBasePath(String path) {
168:                getPathText().setText(path);
169:            }
170:
171:            public String getBasePath() {
172:                return getPathText().getText();
173:            }
174:
175:            public void setBaseChecked(boolean selected) {
176:                getCreateNew().setSelected(selected);
177:
178:                serviceLabel.setEnabled(getCreateNew().isSelected());
179:                serviceText.setEnabled(getCreateNew().isSelected());
180:                pathLabel.setEnabled(getCreateNew().isSelected());
181:                pathText.setEnabled(getCreateNew().isSelected());
182:                browseButton.setEnabled(getCreateNew().isSelected());
183:            }
184:
185:            public boolean getBaseChecked() {
186:                return getCreateNew().isSelected();
187:            }
188:
189:            private class CustomAction extends AbstractAction {
190:                public void actionPerformed(ActionEvent ae) {
191:                    String command = ae.getActionCommand();
192:                    if ("Create New Enhydra Base Directory".equals(command)) {
193:                        serviceLabel.setEnabled(getCreateNew().isSelected());
194:                        serviceText.setEnabled(getCreateNew().isSelected());
195:                        pathLabel.setEnabled(getCreateNew().isSelected());
196:                        pathText.setEnabled(getCreateNew().isSelected());
197:                        browseButton.setEnabled(getCreateNew().isSelected());
198:                    } else if ("Browse".equals(command)) {
199:                        JFileChooser chooser = new JFileChooser();
200:                        chooser.setDialogTitle("Choose Enhydra Base Path!!!");
201:                        chooser.setFileSelectionMode(chooser.DIRECTORIES_ONLY);
202:                        int returnVal = chooser.showOpenDialog(null);
203:                        if (returnVal == JFileChooser.APPROVE_OPTION) {
204:                            pathText.setText(chooser.getSelectedFile()
205:                                    .getAbsolutePath());
206:                        }
207:                    }
208:                }
209:            }
210:
211:            private class CustomActionListener implements  ActionListener {
212:
213:                protected AbstractAction action;
214:
215:                public CustomActionListener() {
216:                    action = new CustomAction();
217:                }
218:
219:                public void actionPerformed(ActionEvent e) {
220:                    action.actionPerformed(e);
221:                }
222:            }
223:
224:            public boolean checkEntries() {
225:                boolean valid = true;
226:                if (createNew.isSelected()) {
227:                    if ("".equals(serviceText.getText())
228:                            || serviceText.getText() == null) {
229:                        displayErrorMessage("Service Name");
230:                        valid = false;
231:                    } else {
232:                        serviceText.setText(serviceText.getText().replace(' ',
233:                                '_'));
234:                    }
235:
236:                    if ("".equals(pathText.getText())
237:                            || pathText.getText() == null) {
238:                        displayErrorMessage("Path to Enhydra Base Directory");
239:                        valid = false;
240:                    }
241:                }
242:                return valid;
243:            }
244:
245:            private void displayErrorMessage(String field) {
246:                JOptionPane
247:                        .showMessageDialog(
248:                                null,
249:                                "Check '" + field + "' Field Setting!",
250:                                "Enhydra Configuration Tool - Houston, we have a problem!",
251:                                JOptionPane.ERROR_MESSAGE);
252:            }
253:
254:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.