Source Code Cross Referenced for AntXMLCTool.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:        //AddInCore
004:        //import org.enhydra.kelp.common.xmlc.CoreXMLCTool;
005:        //import org.enhydra.kelp.common.xmlc.XMLCInnerPanel;
006:        import org.enhydra.kelp.common.AbstractTool;
007:        import org.enhydra.kelp.common.event.SelectionPanelEvent;
008:        import org.enhydra.kelp.common.event.SelectionPanelListener;
009:        import org.enhydra.kelp.common.node.OtterProject;
010:        import org.enhydra.kelp.common.node.OtterFileNode;
011:        import org.enhydra.kelp.common.swing.AddinInnerPanel;
012:
013:        //AddInAnt
014:        import org.enhydra.kelp.ant.node.AntProject;
015:        import org.enhydra.kelp.ant.swing.HTMLViewer;
016:
017:        //ToolBox
018:        import org.enhydra.tool.common.InnerPanel;
019:        import org.enhydra.tool.common.SwingUtil;
020:        import org.enhydra.tool.common.ButtonPanel;
021:        import org.enhydra.tool.common.event.FirstFocusEvent;
022:        import org.enhydra.tool.common.event.FirstFocusListener;
023:
024:        // Standard imports
025:        import java.io.File;
026:        import java.awt.Component;
027:        import java.awt.Dialog;
028:        import java.awt.Frame;
029:        import java.awt.event.ActionListener;
030:        import java.lang.ref.WeakReference;
031:        import java.net.URL;
032:        import java.util.ResourceBundle;
033:
034:        import org.enhydra.kelp.common.node.OtterDocumentNode;
035:
036:        /**
037:         * <p>Title: </p>
038:         * <p>Description: XMLC tool use AntProject for read,write properties and
039:         * AntXMLCBuilder for running XML Compiler. </p>
040:         * <p>Copyright: Copyright (c) 2003</p>
041:         * <p>Company: </p>
042:         * @author Damir Milovic
043:         * @version 1.0
044:         */
045:
046:        public class AntXMLCTool extends AbstractTool implements 
047:                SelectionPanelListener, FirstFocusListener {
048:
049:            static ResourceBundle addinRes = ResourceBundle
050:                    .getBundle("org.enhydra.kelp.common.Res");
051:            private AntXMLCInnerPanel innerPanel = null;
052:            private AntXMLCButtonPanel buttonPanel = null;
053:            private WeakReference compileRef = null;
054:            private static AntProject project = null;
055:
056:            public AntXMLCTool() {
057:                super ();
058:                innerPanel = new AntXMLCInnerPanel();
059:                buttonPanel = new AntXMLCButtonPanel();
060:                innerPanel.addFirstFocusListener(this );
061:                innerPanel.getSelectionPanel().addSelectionPanelListener(this );
062:            }
063:
064:            public static void main(String[] args) {
065:                SwingUtil.setLookAndFeelToSystem();
066:                AntXMLCTool tool = null;
067:
068:                if (args.length > 0) {
069:                    // check path
070:                    File root = new File(args[0]);
071:                    if (!root.exists()) {
072:                        System.err.println("ERROR: directory'" + args[0]
073:                                + "' don't exist!");
074:                        return;
075:                    }
076:                    try {
077:                        project = new AntProject(args[0]);
078:                    } catch (Exception ex) {
079:                        ex.printStackTrace();
080:                        return;
081:                    }
082:
083:                } else {
084:                    return;
085:                    //FIXME TODO get current directory
086:                }
087:                tool = new AntXMLCTool();
088:                tool.setProject(project); //DACHA
089:                tool.showDialog(new Frame());
090:                //tool.showDialog(null);
091:            }
092:
093:            /**
094:             * Override
095:             */
096:            public void build() {
097:                ((AntXMLCInnerPanel) getInnerPanel()).selectOutputTab();
098:                ((AntXMLCInnerPanel) getInnerPanel()).save();
099:                ((AntXMLCInnerPanel) getInnerPanel()).clearOutput();
100:                buildImpl();
101:            }
102:
103:            private void buildImpl() {
104:                try {
105:                    AntXMLCBuilder builder = new AntXMLCBuilder(
106:                            ((AntXMLCInnerPanel) getInnerPanel())
107:                                    .getWriteListeners());
108:                    builder.setProject(getProject());
109:                    builder.build();
110:                } catch (Exception ex) {
111:                    ex.printStackTrace();
112:                }
113:            }
114:
115:            public static final String getDefaultTitle() {
116:                return "XML Compiler";
117:            }
118:
119:            // implements AbstractTool
120:            public String getTitle() {
121:                return AntXMLCTool.getDefaultTitle();
122:            }
123:
124:            // implements AbstractTool
125:            public InnerPanel getInnerPanel() {
126:                return innerPanel;
127:            }
128:
129:            // implements AbstractTool
130:            public ButtonPanel getButtonPanel() {
131:                return buttonPanel;
132:            }
133:
134:            public ActionListener createButtonListener() {
135:                return (new AntXMLCButtonListener(this ));
136:            }
137:
138:            // overrides AbstractTool
139:            public void setProject(OtterProject project) {
140:                super .setProject(project);
141:                setNodes(project.getAllDocuments());
142:            }
143:
144:            // overrides AbstractTool
145:            public void clearAll() {
146:                super .clearAll();
147:                innerPanel.removeFirstFocusListener(this );
148:                if (compileRef != null) {
149:                    compileRef.clear();
150:                }
151:                innerPanel = null;
152:                buttonPanel = null;
153:                compileRef = null;
154:            }
155:
156:            // implements FirstFocusListener
157:            public void onFirstFocus(FirstFocusEvent event) {
158:                refreshCompile();
159:            }
160:
161:            // implements SelectionPanelListener
162:            public void onSelection(SelectionPanelEvent event) {
163:                boolean enable = event.getSelected().size() > 0;
164:                //First set to project changed documents
165:                OtterFileNode[] fileNodes = new OtterFileNode[0];
166:                fileNodes = innerPanel.getNodes();
167:                OtterDocumentNode[] docNodes = new OtterDocumentNode[fileNodes.length];
168:                for (int i = 0; i < fileNodes.length; i++) {
169:                    docNodes[i] = (OtterDocumentNode) fileNodes[i];
170:                }
171:                project.setAllDocuments(docNodes);
172:                //refrsh Compile button
173:                refreshCompile(enable);
174:            }
175:
176:            public void showHelp(Dialog parent) {
177:                URL helpURL = this .getClass().getClassLoader().getResource(
178:                        "using_ant_kelp.html");
179:                HTMLViewer.createAndShow(parent, "Kelp Help", helpURL);
180:
181:            }
182:
183:            //
184:            // PROTECTED
185:            //
186:            // implements org.enhydra.kelp.common.tool.AbstractTool
187:
188:            /**
189:             * Get source files that can be selected for compilation.
190:             */
191:            protected OtterFileNode[] getNodes() {
192:                return innerPanel.getNodes();
193:            }
194:
195:            /**
196:             * Set the source files that can be selected for compilation
197:             */
198:            protected void setNodes(OtterFileNode[] n) {
199:                innerPanel.setNodes(n);
200:                //refreshCompile();
201:            }
202:
203:            protected String[] getSelectText() {
204:                String[] s = { "Documents Available", "Documents Selected" };
205:                return s;
206:            }
207:
208:            // implements org.enhydra.kelp.common.tool.AbstractTool
209:            protected String getBuildText() {
210:                return addinRes.getString("buttonMake_Text");
211:            }
212:
213:            // implements org.enhydra.kelp.common.tool.AbstractTool
214:            protected String getProgressTitle() {
215:                return addinRes.getString("XMLC_Progress");
216:            }
217:
218:            // implements org.enhydra.kelp.common.tool.AbstractTool
219:            protected AddinInnerPanel getPropertyPanel() {
220:                return innerPanel;
221:            }
222:
223:            private Component getCompile() {
224:                Component comp = null;
225:
226:                if (compileRef == null) {
227:                    comp = ButtonPanel.findButton(getInnerPanel()
228:                            .getTopLevelAncestor(),
229:                            AntXMLCButtonPanel.COMMAND_COMPILE);
230:                    if (comp != null) {
231:                        compileRef = new WeakReference(comp);
232:                    }
233:                } else {
234:                    comp = (Component) compileRef.get();
235:                }
236:                return comp;
237:            }
238:
239:            //Called when user change selection
240:            private void refreshCompile() {
241:
242:                boolean enable = false;
243:                OtterFileNode[] nodes = new OtterFileNode[0];
244:                nodes = innerPanel.getNodes();
245:                if (nodes != null) {
246:
247:                    for (int i = 0; i < nodes.length; i++) {
248:                        if (nodes[i].isSelected()) {
249:                            enable = true;
250:                            break;
251:                        }
252:                    }
253:                }
254:                refreshCompile(enable);
255:            }
256:
257:            private void refreshCompile(boolean enable) {
258:                Component compileButton = getCompile();
259:
260:                if (compileButton != null) {
261:                    compileButton.setEnabled(enable);
262:                }
263:            }
264:
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.