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


001:        package org.enhydra.kelp.ant.xmlc;
002:
003:        //Kelp
004:        import org.enhydra.kelp.common.node.OtterProject;
005:        import org.enhydra.kelp.common.Constants;
006:
007:        import org.enhydra.kelp.ant.node.AntProject;
008:        import org.enhydra.kelp.ant.xmlc.AntXMLCParamViewer;
009:
010:        //ToolBox
011:        import org.enhydra.tool.common.DialogPanel;
012:        import org.enhydra.tool.common.ExtensionFilter;
013:        import org.enhydra.tool.common.PathHandle;
014:
015:        import org.enhydra.tool.swing.layout.*;
016:
017:        //JDK
018:        import java.awt.*;
019:        import java.awt.event.*;
020:        import javax.swing.*;
021:        import javax.swing.border.*;
022:        import java.util.ResourceBundle;
023:        import java.io.File;
024:
025:        //import com.borland.jbcl.layout.*;
026:        /**
027:         * <p>Title: </p>
028:         * <p>Description: </p>
029:         * <p>Copyright: Copyright (c) 2003</p>
030:         * <p>Company: </p>
031:         * @author Damir Milovic
032:         * @version 1.0
033:         */
034:
035:        public class AntXMLCOptionsPanel extends JPanel {
036:
037:            static ResourceBundle res = ResourceBundle
038:                    .getBundle("org.enhydra.kelp.common.Res");
039:
040:            XYLayout xYLayout1 = new XYLayout();
041:            JPanel jPanel1 = new JPanel();
042:            JPanel jPanel2 = new JPanel();
043:            XYLayout xYLayout2 = new XYLayout();
044:            XYLayout xYLayout3 = new XYLayout();
045:            TitledBorder titledBorder1;
046:            TitledBorder titledBorder2;
047:            JLabel jLabel1 = new JLabel();
048:            JTextField jTextPackage = new JTextField();
049:            JButton jButtonDefault = new JButton();
050:            JLabel jLabel2 = new JLabel();
051:            JTextField jTextOptionFile = new JTextField();
052:            JButton jButtonEdit = new JButton();
053:            JButton jButtonBrowse = new JButton();
054:
055:            //    LocalButtonListener buttonListener = null;
056:            AntProject project = null;
057:            JPanel jPanel3 = new JPanel();
058:            JCheckBox jCheckBoxInvoke = new JCheckBox();
059:            XYLayout xYLayout4 = new XYLayout();
060:            JCheckBox jCheckBoxVerbose = new JCheckBox();
061:
062:            public AntXMLCOptionsPanel() {
063:                try {
064:                    jbInit();
065:                    pmInit();
066:                } catch (Exception ex) {
067:                    ex.printStackTrace();
068:                }
069:            }
070:
071:            void jbInit() throws Exception {
072:                titledBorder1 = new TitledBorder(BorderFactory
073:                        .createEtchedBorder(Color.white, new Color(148, 145,
074:                                140)), "Mappings");
075:                titledBorder2 = new TitledBorder(BorderFactory
076:                        .createEtchedBorder(Color.white, new Color(148, 145,
077:                                140)), "XMLC Options");
078:                this .setLayout(xYLayout1);
079:                jPanel1.setLayout(xYLayout2);
080:                jPanel2.setLayout(xYLayout3);
081:                jPanel1.setBorder(titledBorder1);
082:                jPanel2.setBorder(titledBorder2);
083:                jLabel1.setText(res.getString("Package"));
084:                jButtonDefault.setText(res.getString("Default"));
085:                jButtonDefault
086:                        .addActionListener(new java.awt.event.ActionListener() {
087:                            public void actionPerformed(ActionEvent e) {
088:                                jButtonDefault_actionPerformed(e);
089:                            }
090:                        });
091:                jLabel2.setText(res.getString("Option_file"));
092:                jButtonEdit.setText(res.getString("Edit"));
093:                jButtonEdit
094:                        .addActionListener(new java.awt.event.ActionListener() {
095:                            public void actionPerformed(ActionEvent e) {
096:                                jButtonEdit_actionPerformed(e);
097:                            }
098:                        });
099:                jButtonBrowse.setText(res.getString("Browse"));
100:                jButtonBrowse
101:                        .addActionListener(new java.awt.event.ActionListener() {
102:                            public void actionPerformed(ActionEvent e) {
103:                                jButtonBrowse_actionPerformed(e);
104:                            }
105:                        });
106:                xYLayout1.setWidth(520);
107:                xYLayout1.setHeight(302);
108:                jTextOptionFile.setBackground(SystemColor.inactiveCaptionText);
109:                jTextOptionFile.setEditable(false);
110:                jPanel3.setLayout(xYLayout4);
111:                jCheckBoxInvoke.setText(res.getString("XMLC_Invoke_make"));
112:                jCheckBoxInvoke
113:                        .addActionListener(new java.awt.event.ActionListener() {
114:                            public void actionPerformed(ActionEvent e) {
115:                                jCheckBoxInvoke_actionPerformed(e);
116:                            }
117:                        });
118:                jCheckBoxVerbose.setText(res.getString("Verbose_output"));
119:                jCheckBoxVerbose
120:                        .addActionListener(new java.awt.event.ActionListener() {
121:                            public void actionPerformed(ActionEvent e) {
122:                                jCheckBoxVerbose_actionPerformed(e);
123:                            }
124:                        });
125:                jTextPackage
126:                        .addFocusListener(new java.awt.event.FocusAdapter() {
127:                            public void focusLost(FocusEvent e) {
128:                                jTextPackage_focusLost(e);
129:                            }
130:                        });
131:
132:                jPanel1.add(jTextPackage, new XYConstraints(63, 13, 357, 23));
133:                jPanel1.add(jLabel1, new XYConstraints(4, 13, 59, 20));
134:                jPanel1.add(jButtonDefault, new XYConstraints(424, 11, -1, -1));
135:                this .add(jPanel3, new XYConstraints(6, 16, 509, 106));
136:                jPanel2.add(jLabel2, new XYConstraints(3, 15, -1, -1));
137:                jPanel2
138:                        .add(jTextOptionFile,
139:                                new XYConstraints(63, 13, 278, 25));
140:                jPanel2.add(jButtonBrowse, new XYConstraints(410, 13, 88, -1));
141:                jPanel2.add(jButtonEdit, new XYConstraints(343, 13, -1, -1));
142:                this .add(jPanel1, new XYConstraints(6, 127, 509, 76));
143:                jPanel3
144:                        .add(jCheckBoxVerbose,
145:                                new XYConstraints(6, 52, 151, 21));
146:                jPanel3.add(jCheckBoxInvoke, new XYConstraints(6, 14, -1, -1));
147:                this .add(jPanel2, new XYConstraints(6, 208, 509, 86));
148:            }
149:
150:            private void pmInit() {
151:                //textCommandLine.setText(new String());
152:                //buttonListener = new LocalButtonListener();
153:                //jButtonBrowse.addActionListener(buttonListener);
154:                //jButtonDefault.addActionListener(buttonListener);
155:                //jButtonEdit.addActionListener(buttonListener);
156:            }
157:
158:            public void setProject(OtterProject otterProject) {
159:                if (otterProject instanceof  AntProject) {
160:                    project = (AntProject) otterProject;
161:                    initOptions();
162:                } else
163:                    System.err.println("DEBUG project must be AntProject");//FIXME throw Exception
164:            }
165:
166:            private void initOptions() {
167:                String invoke = project.getProperty(AntProject.XMLC_INVOKE);
168:                if (invoke != null)
169:                    jCheckBoxInvoke
170:                            .setSelected(invoke.equalsIgnoreCase("true"));
171:                String verbose = project.getProperty(AntProject.XMLC_VERBOSE);
172:                if (verbose != null)
173:                    jCheckBoxVerbose.setSelected(verbose
174:                            .equalsIgnoreCase("true"));
175:                jTextPackage.setText(project
176:                        .getProperty(AntProject.XMLC_PACKAGE_NAME));
177:                jTextOptionFile.setText(project
178:                        .getProperty(AntProject.XMLC_OPTIONS_FILE));
179:            }
180:
181:            public OtterProject getProject() {
182:                return (OtterProject) project;
183:            }
184:
185:            private void editParameters() {
186:                String[] params = new String[0];
187:                AntXMLCParamViewer viewer = null;
188:
189:                viewer = new AntXMLCParamViewer();
190:                params = project.getXMLCOptionsFileParams();
191:                viewer.setParameters(params);
192:                viewer.setOwner((Dialog) getTopLevelAncestor());
193:                if (viewer.showDialog() == DialogPanel.OK_OPTION) {
194:                    params = viewer.getParameters();
195:                    project.setXMLCOptionsFileParams(params);
196:                }
197:            }
198:
199:            private void browseForFile() {
200:                JFileChooser chooser;
201:                ExtensionFilter filter;
202:                String fileDir = new String();
203:                String fileName = new String();
204:                String filePath = new String();
205:
206:                filter = new ExtensionFilter();
207:                filter.addExtension(Constants.TYPE_XMLC);
208:                filter.setDescriptionTitle(res
209:                        .getString("filter_DescriptionTitle"));
210:                chooser = new JFileChooser();
211:                if (jTextOptionFile.getText().trim().length() > 0) {
212:                    chooser.setCurrentDirectory(new File(project
213:                            .getProperty(AntProject.RESOURCES_DIR)));
214:                } else {
215:                    /*
216:                    PathHandle ph = null;
217:
218:                    if (node instanceof OtterFileNode) {
219:                       OtterFileNode fileNode = (OtterFileNode) node;
220:                        ph = PathHandle.createPathHandle(fileNode.getFilePath());
221:                        if (ph.isEmpty()) {
222:                          ph = null;
223:                        } else {
224:                          ph = ph.getParent();
225:                        }
226:                    }
227:
228:                    if (ph == null) {
229:                        ph = PathHandle.createPathHandle(node.getProject().getRootPath());
230:                    }
231:                     */
232:                    PathHandle ph = PathHandle.createPathHandle(getProject()
233:                            .getWorkingPath());
234:                    chooser.setCurrentDirectory(ph.getFile());
235:                }
236:                chooser.setFileFilter(filter);
237:                chooser.setDialogTitle(res.getString("chooser_DialogTitle"));
238:                chooser.setApproveButtonText(res.getString("OK"));
239:                int v = chooser.showOpenDialog(this );
240:
241:                this .requestFocus();
242:                jButtonBrowse.requestFocus();
243:                if (v == JFileChooser.APPROVE_OPTION) {
244:                    if (chooser.getSelectedFile() == null
245:                            || (!chooser.getSelectedFile().isFile())) {
246:                        jTextOptionFile.setText(new String());
247:                    } else {
248:                        fileDir = chooser.getCurrentDirectory().toString();
249:                        fileDir = stripSlash(fileDir);
250:                        fileName = chooser.getSelectedFile().getName();
251:                        filePath = fileDir + File.separator + fileName;
252:                        jTextOptionFile.setText(filePath);
253:                        project.setProperty(AntProject.XMLC_OPTIONS_FILE,
254:                                filePath);
255:                    }
256:                }
257:                chooser.removeAll();
258:                chooser = null;
259:            }
260:
261:            private String stripSlash(String dir) {
262:                String stripped = new String(dir);
263:
264:                if (dir != null) {
265:                    if (dir.length() > 0) {
266:                        if (dir.endsWith(File.separator)) {
267:                            stripped = dir.substring(0, dir.length() - 1);
268:                        }
269:                    }
270:                }
271:                return stripped;
272:            }
273:
274:            /*
275:             private class LocalButtonListener implements ActionListener {
276:             public void actionPerformed(ActionEvent e) {
277:             Object source = e.getSource();
278:
279:             if (source == jButtonBrowse) {
280:             browseForFile();
281:             } else if (source == jButtonDefault) {
282:             // setDefaultPackage();
283:             } else if (source == jButtonEdit) {
284:             editParameters();
285:             }
286:             }
287:
288:             }
289:             */
290:            void jCheckBoxInvoke_actionPerformed(ActionEvent e) {
291:                String invoke = "false";
292:                if (jCheckBoxInvoke.isSelected())
293:                    invoke = "true";
294:                project.setProperty(AntProject.XMLC_INVOKE, invoke);
295:            }
296:
297:            void jCheckBoxVerbose_actionPerformed(ActionEvent e) {
298:                String verbose = "false";
299:                if (jCheckBoxVerbose.isSelected())
300:                    verbose = "true";
301:                project.setProperty(AntProject.XMLC_VERBOSE, verbose);
302:            }
303:
304:            void jButtonDefault_actionPerformed(ActionEvent e) {
305:                //get default package name
306:                jTextPackage.setText(project
307:                        .getProperty(AntProject.XMLC_DEFAULT_PACKAGE));
308:                project.setProperty(AntProject.XMLC_PACKAGE_NAME, jTextPackage
309:                        .getText());
310:            }
311:
312:            void jButtonEdit_actionPerformed(ActionEvent e) {
313:                editParameters();
314:            }
315:
316:            void jButtonBrowse_actionPerformed(ActionEvent e) {
317:                browseForFile();
318:            }
319:
320:            void jTextPackage_focusLost(FocusEvent e) {
321:                project.setProperty(AntProject.XMLC_PACKAGE_NAME, jTextPackage
322:                        .getText());
323:            }
324:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.