Source Code Cross Referenced for XMLCOutputPanel.java in  » J2EE » enhydra-IDE-plugin » org » enhydra » kelp » common » 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.common.xmlc 
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.xmlc;
024:
025:        // AddinCore
026:        import org.enhydra.kelp.common.Constants;
027:        import org.enhydra.kelp.common.event.WriteEvent;
028:        import org.enhydra.kelp.common.event.WriteListener;
029:        import org.enhydra.kelp.common.node.OtterProject;
030:        import org.enhydra.kelp.common.swing.OutputPanel;
031:
032:        // ToolBox
033:        import org.enhydra.tool.common.ExtensionFilter;
034:        import org.enhydra.tool.common.PathHandle;
035:
036:        // JDK
037:        import javax.swing.*;
038:        import javax.swing.text.BadLocationException;
039:        import java.awt.*;
040:        import java.awt.event.*;
041:        import java.beans.Beans;
042:        import java.io.File;
043:        import java.io.FileWriter;
044:        import java.util.ResourceBundle;
045:
046:        //
047:        public class XMLCOutputPanel extends JPanel implements  WriteListener {
048:
049:            //
050:            public static ResourceBundle res = ResourceBundle
051:                    .getBundle("org.enhydra.kelp.common.Res"); // nores
052:            private LocalButtonListener buttonListener = null;
053:            private LocalCheckListener checkListener = null;
054:            private OtterProject project = null;
055:            private JPanel panelFile;
056:            private JCheckBox checkSave;
057:            private OutputPanel outputPanel;
058:            private JTextField textFile;
059:            private JButton buttonBrowse;
060:            private GridBagLayout layoutFile;
061:            private GridBagLayout layoutMain;
062:            private int waitCount = 0;
063:
064:            /**
065:             * Constructor declaration
066:             *
067:             */
068:            public XMLCOutputPanel() {
069:                try {
070:                    jbInit();
071:                    pmInit();
072:                } catch (Exception e) {
073:                    e.printStackTrace();
074:                }
075:            }
076:
077:            /**
078:             * Method declaration
079:             *
080:             *
081:             * @param event
082:             */
083:            public void onWrite(WriteEvent event) {
084:                outputPanel.onWrite(event);
085:            }
086:
087:            /**
088:             * Method declaration
089:             *
090:             *
091:             * @return
092:             */
093:            public OtterProject getProject() {
094:                return project;
095:            }
096:
097:            /**
098:             * Method declaration
099:             *
100:             *
101:             * @param p
102:             */
103:            public void setProject(OtterProject p) {
104:                project = p;
105:                String outPath = project.getOutputFilename();
106:
107:                if ((outPath == null) || (outPath.trim().length() == 0)) {
108:                    checkSave.setSelected(false);
109:                    textFile.setText(new String());
110:                } else {
111:                    textFile.setText(PathHandle.createPathString(outPath));
112:                    checkSave.setSelected(true);
113:                }
114:                outputPanel.setProject(project);
115:            }
116:
117:            public void clearOutput() {
118:                outputPanel.clearOutput();
119:            }
120:
121:            //
122:            // PROTECTED
123:            //
124:
125:            /**
126:             * Method declaration
127:             *
128:             */
129:            protected void scrollToBottom() {
130:                outputPanel.scrollToBottom();
131:            }
132:
133:            //
134:            // PRIVATE
135:            //
136:            private void buttonFileAction() {
137:                JFileChooser chooser = null;
138:                ExtensionFilter filter = null;
139:                PathHandle path = null;
140:                File file = null;
141:                String fileDir = new String();
142:                int choice = -1;
143:
144:                //
145:                filter = new ExtensionFilter();
146:                filter.addExtension(Constants.TYPE_TXT);
147:                filter.setDescriptionTitle(res.getString("Kelp_log"));
148:
149:                //
150:                chooser = new JFileChooser();
151:                if (textFile.getText().trim().length() == 0) {
152:                    file = new File(project.getRootPath() + File.separator
153:                            + Constants.FILE_KELP_TXT);
154:                } else {
155:                    file = new File(textFile.getText());
156:                }
157:                chooser.setSelectedFile(file);
158:                chooser.setFileFilter(filter);
159:                chooser.setDialogTitle(res.getString("Select_log"));
160:                chooser.setApproveButtonText(res.getString("OK"));
161:                choice = chooser.showOpenDialog(this );
162:
163:                //
164:                this .requestFocus();
165:                buttonBrowse.requestFocus();
166:
167:                //
168:                if (choice == JFileChooser.APPROVE_OPTION
169:                        && chooser.getSelectedFile() != null) {
170:                    path = PathHandle.createPathHandle(chooser
171:                            .getSelectedFile());
172:                    textFile.setText(path.getPath());
173:                    project.setOutputFilename(path.getPath());
174:                }
175:
176:                //
177:                chooser.removeAll();
178:                chooser = null;
179:            }
180:
181:            /**
182:             * Method declaration
183:             *
184:             */
185:            private void pmInit() {
186:                buttonListener = new LocalButtonListener();
187:                buttonBrowse.addActionListener(buttonListener);
188:                buttonBrowse.setEnabled(false);
189:                checkListener = new LocalCheckListener();
190:                checkSave.addItemListener(checkListener);
191:                checkSave.setSelected(false);
192:            }
193:
194:            /**
195:             * Method declaration
196:             *
197:             *
198:             * @throws Exception
199:             */
200:            private void jbInit() throws Exception {
201:                panelFile = (JPanel) Beans.instantiate(getClass()
202:                        .getClassLoader(), JPanel.class.getName());
203:                outputPanel = (OutputPanel) Beans.instantiate(getClass()
204:                        .getClassLoader(), OutputPanel.class.getName());
205:                checkSave = (JCheckBox) Beans.instantiate(getClass()
206:                        .getClassLoader(), JCheckBox.class.getName());
207:                textFile = (JTextField) Beans.instantiate(getClass()
208:                        .getClassLoader(), JTextField.class.getName());
209:                buttonBrowse = (JButton) Beans.instantiate(getClass()
210:                        .getClassLoader(), JButton.class.getName());
211:                layoutFile = (GridBagLayout) Beans.instantiate(getClass()
212:                        .getClassLoader(), GridBagLayout.class.getName());
213:                layoutMain = (GridBagLayout) Beans.instantiate(getClass()
214:                        .getClassLoader(), GridBagLayout.class.getName());
215:                buttonBrowse.setText(res.getString("Browse"));
216:                panelFile.setLayout(layoutFile);
217:                checkSave.setText(res.getString("Output_to_log"));
218:                textFile.setBackground(SystemColor.controlLtHighlight);
219:                textFile.setEnabled(false);
220:                textFile.setPreferredSize(new Dimension(150, 21));
221:                panelFile
222:                        .add(checkSave, new GridBagConstraints(0, 0, 1, 1, 0.0,
223:                                0.0, GridBagConstraints.WEST,
224:                                GridBagConstraints.BOTH,
225:                                new Insets(5, 5, 5, 5), 14, 0));
226:                panelFile.add(textFile, new GridBagConstraints(1, 0, 1, 1, 0.5,
227:                        0.5, GridBagConstraints.CENTER,
228:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
229:                        14, 0));
230:                panelFile.add(buttonBrowse, new GridBagConstraints(2, 0, 1, 1,
231:                        0.5, 0.5, GridBagConstraints.WEST,
232:                        GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 6, 0));
233:                this .setLayout(layoutMain);
234:                this .add(outputPanel, new GridBagConstraints(0, 0, 1, 1, 0.75,
235:                        0.75, GridBagConstraints.WEST, GridBagConstraints.BOTH,
236:                        new Insets(8, 12, 0, 0), 0, 0));
237:                this 
238:                        .add(panelFile, new GridBagConstraints(0, 1, 1, 1,
239:                                0.25, 0.25, GridBagConstraints.CENTER,
240:                                GridBagConstraints.BOTH,
241:                                new Insets(0, 12, 0, 0), 0, 0));
242:            }
243:
244:            /**
245:             */
246:            private class LocalCheckListener implements  ItemListener {
247:                public void itemStateChanged(ItemEvent event) {
248:                    Object source = event.getSource();
249:
250:                    if (source == checkSave) {
251:                        if (checkSave.isSelected()) {
252:                            buttonBrowse.setEnabled(true);
253:                        } else {
254:                            buttonBrowse.setEnabled(false);
255:                            textFile.setText(new String());
256:                            if (project == null) {
257:
258:                                // done
259:                            } else {
260:                                project.setOutputFilename(new String());
261:                            }
262:                        }
263:                    }
264:                }
265:
266:            }
267:
268:            /**
269:             */
270:            private class LocalButtonListener implements  ActionListener {
271:                public void actionPerformed(ActionEvent event) {
272:                    Object source = event.getSource();
273:
274:                    if (source == buttonBrowse) {
275:                        buttonFileAction();
276:                    }
277:                }
278:
279:            }
280:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.