Source Code Cross Referenced for ETLEditorTopView.java in  » IDE-Netbeans » etl.project » org » netbeans » modules » etl » ui » view » 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 » IDE Netbeans » etl.project » org.netbeans.modules.etl.ui.view 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.modules.etl.ui.view;
042:
043:        import com.sun.sql.framework.exception.BaseException;
044:        import net.java.hulp.i18n.Logger;
045:        import com.sun.sql.framework.utils.StringUtil;
046:        import java.util.ArrayList;
047:        import java.util.List;
048:        import org.netbeans.modules.etl.codegen.ETLProcessFlowGeneratorFactory;
049:        import org.netbeans.modules.etl.codegen.ETLStrategyBuilder;
050:        import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
051:        import org.netbeans.modules.etl.logger.Localizer;
052:        import org.netbeans.modules.etl.logger.LogUtil;
053:        import org.netbeans.modules.etl.ui.view.graph.actions.CollabPropertiesAction;
054:        import org.netbeans.modules.etl.ui.view.graph.actions.EditDbModelAction;
055:        import org.netbeans.modules.etl.ui.view.graph.actions.JoinAction;
056:        import org.netbeans.modules.etl.ui.view.graph.actions.RuntimeInputAction;
057:        import org.netbeans.modules.etl.ui.view.graph.actions.RuntimeOutputAction;
058:        import org.netbeans.modules.etl.ui.view.graph.actions.SelectTableAction;
059:        import org.netbeans.modules.etl.ui.view.graph.actions.TestRunAction;
060:        import org.netbeans.modules.etl.ui.view.graph.actions.ToggleOutputAction;
061:        import org.netbeans.modules.etl.ui.view.graph.actions.ValidationAction;
062:        import org.netbeans.modules.sql.framework.model.SQLConstants;
063:        import org.netbeans.modules.sql.framework.model.SQLObject;
064:        import org.netbeans.modules.sql.framework.ui.graph.ICommand;
065:        import org.netbeans.modules.sql.framework.ui.graph.actions.AutoLayoutAction;
066:        import org.netbeans.modules.sql.framework.ui.graph.actions.CollapseAllAction;
067:        import org.netbeans.modules.sql.framework.ui.graph.actions.ExpandAllAction;
068:        import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
069:        import org.netbeans.modules.sql.framework.ui.graph.actions.ZoomAction;
070:        import org.netbeans.modules.sql.framework.ui.model.CollabSQLUIModel;
071:        import org.netbeans.modules.sql.framework.ui.view.BasicTopView;
072:        import org.netbeans.modules.etl.ui.view.graph.actions.RefreshMetadataAction;
073:        import org.netbeans.modules.etl.ui.view.graph.actions.RemountCollaborationAction;
074:        import org.netbeans.modules.sql.framework.model.SQLDefinition;
075:        import org.netbeans.modules.sql.framework.model.TargetTable;
076:        import org.netbeans.modules.sql.framework.ui.graph.actions.ZoomInAction;
077:        import org.netbeans.modules.sql.framework.ui.graph.actions.ZoomOutAction;
078:        import org.netbeans.modules.sql.framework.ui.output.SQLStatementPanel;
079:        import org.openide.util.NbBundle;
080:
081:        /**
082:         * ETL Editor top view. This class just provides ETL specfic actions in toolbar and graph
083:         * right click.
084:         *
085:         * @author Ritesh Adval
086:         */
087:        public class ETLEditorTopView extends BasicTopView {
088:
089:            public static final String OPERATOR_FOLDER = "ETLOperators";
090:            private static transient final Logger mLogger = LogUtil
091:                    .getLogger(ETLEditorTopView.class.getName());
092:            private static transient final Localizer mLoc = Localizer.get();
093:            private ETLCollaborationTopPanel topPanel;
094:
095:            //private UndoAction undoAction;
096:            //private RedoAction redoAction;
097:            /**
098:             * Creates a new instance of ETLEditorTopView.
099:             *
100:             * @param model CollabSQLUIModelImpl containing collab model info
101:             * @param etlTopComp ETLCollaborationTopPanel which will host this view
102:             */
103:            public ETLEditorTopView(CollabSQLUIModel model,
104:                    ETLCollaborationTopPanel etlTopComp) {
105:                super (model);
106:                this .topPanel = etlTopComp;
107:            }
108:
109:            /**
110:             * Creates a new instance of ETLEditorTopView.
111:             *
112:             * @param model CollabSQLUIModelImpl containing collab model info
113:             */
114:            public ETLEditorTopView(CollabSQLUIModel model) {
115:                super (model);
116:            }
117:
118:            /**
119:             * Indicates whether this view is editable.
120:             *
121:             * @return boolean - true/false
122:             */
123:            @Override
124:            public boolean canEdit() {
125:                return topPanel.canEdit();
126:            }
127:
128:            /**
129:             * Execute a command
130:             *
131:             * @param command - command
132:             * @param args - arguments
133:             */
134:            @Override
135:            public Object[] execute(String command, Object[] args) {
136:                if (command.equals(ICommand.ADD_RUNTIME_CMD)) {
137:                    Integer tableType = (Integer) args[0];
138:                    TablePanel tPanel = new TablePanel(tableType.intValue());
139:                    tPanel.showTablePanel();
140:                } else {
141:                    return super .execute(command, args);
142:                }
143:                return null;
144:            }
145:
146:            /**
147:             * Gets List of Actions associated with the graph canvas.
148:             *
149:             * @return List of graph canvas actions
150:             */
151:            public List getGraphActions() {
152:                ArrayList actions = new ArrayList();
153:                //        // undo action are not static (because they are used in condition builder also) so
154:                //        // we create it using constructor 
155:                //          if ((undoAction == null) || (redoAction == null) ) {
156:                //            synchronized (this) {
157:                //                if ((undoAction == null) || (redoAction == null) ) {
158:                //                    undoAction = new UndoAction();
159:                //                    redoAction = new RedoAction();
160:                //                }
161:                //            }
162:                //        }
163:                //
164:                //        //FOR RIGHT CLICK......
165:                //        if ((undoAction == null) || (redoAction == null)) {
166:                //            synchronized (this) {
167:                //                if ((undoAction == null) || (redoAction == null) ) {
168:                //                    undoAction.setEnabled(true);
169:                //                    redoAction.setEnabled(true);
170:                //                }
171:                //            }
172:                //        }
173:                //        actions.add(undoAction);
174:                //        actions.add(redoAction);
175:                //        //null is used for seperator
176:                //        actions.add(null);
177:
178:                actions.add(GraphAction.getAction(ExpandAllAction.class));
179:                actions.add(GraphAction.getAction(CollapseAllAction.class));
180:                actions.add(GraphAction.getAction(ToggleOutputAction.class));
181:                actions.add(GraphAction.getAction(RefreshMetadataAction.class));
182:                actions.add(GraphAction
183:                        .getAction(RemountCollaborationAction.class));
184:                actions.add(GraphAction.getAction(SelectTableAction.class));
185:
186:                //null is used for seperator
187:                actions.add(null);
188:
189:                actions.add(GraphAction.getAction(JoinAction.class));
190:                actions.add(GraphAction.getAction(EditDbModelAction.class));
191:                actions.add(GraphAction.getAction(RuntimeInputAction.class));
192:                actions.add(GraphAction.getAction(RuntimeOutputAction.class));
193:
194:                //null is used for seperator
195:                actions.add(null);
196:
197:                actions.add(GraphAction.getAction(ZoomInAction.class));
198:                actions.add(GraphAction.getAction(ZoomOutAction.class));
199:                //actions.add(GraphAction.getAction(ZoomAction.class));
200:                // null is used for seperator
201:                actions.add(null);
202:
203:                actions.add(GraphAction.getAction(AutoLayoutAction.class));
204:                actions.add(GraphAction.getAction(ValidationAction.class));
205:                actions.add(GraphAction.getAction(TestRunAction.class));
206:                // actions.add(GraphAction.getAction(PrintAction.class));
207:                //null is used for seperator
208:                actions.add(null);
209:
210:                actions
211:                        .add(GraphAction
212:                                .getAction(CollabPropertiesAction.class));
213:
214:                return actions;
215:            }
216:
217:            /**
218:             * Gets name of operator folder.
219:             *
220:             * @return name of operator folder
221:             */
222:            public String getOperatorFolder() {
223:                return OPERATOR_FOLDER;
224:            }
225:
226:            /**
227:             * Gets List of Actions associated with the editor toolbar.
228:             *
229:             * @return List of toolbar Actions
230:             */
231:            public List getToolBarActions() {
232:                ArrayList actions = new ArrayList();
233:                //        // undo action are not static (because they are used in condition builder also) so
234:                //        // we create it using constructor 
235:                //        if ((undoAction == null) || (redoAction == null) ) {
236:                //            synchronized (this) {
237:                //                if ((undoAction == null) || (redoAction == null) ) {
238:                //                    undoAction = new UndoAction();
239:                //                    redoAction = new RedoAction();
240:                //                }
241:                //            }
242:                //        }
243:                //         
244:                //        actions.add(undoAction);
245:                //        actions.add(redoAction);
246:                //        actions.add(null);
247:
248:                actions.add(GraphAction.getAction(ExpandAllAction.class));
249:                actions.add(GraphAction.getAction(CollapseAllAction.class));
250:                actions.add(GraphAction.getAction(ToggleOutputAction.class));
251:                actions.add(GraphAction.getAction(RefreshMetadataAction.class));
252:                actions.add(GraphAction
253:                        .getAction(RemountCollaborationAction.class));
254:                actions.add(GraphAction.getAction(SelectTableAction.class));
255:
256:                // null is used for seperator
257:                actions.add(null);
258:                actions.add(GraphAction.getAction(JoinAction.class));
259:                actions.add(GraphAction.getAction(EditDbModelAction.class));
260:                actions.add(GraphAction.getAction(RuntimeInputAction.class));
261:                actions.add(GraphAction.getAction(RuntimeOutputAction.class));
262:                // null is used for seperator
263:                actions.add(null);
264:
265:                actions.add(GraphAction.getAction(ZoomInAction.class));
266:                actions.add(GraphAction.getAction(ZoomOutAction.class));
267:                actions.add(GraphAction.getAction(ZoomAction.class));
268:                // null is used for seperator
269:                actions.add(null);
270:                actions.add(GraphAction.getAction(AutoLayoutAction.class));
271:                // actions.add(GraphAction.getAction(PrintAction.class));
272:                actions.add(GraphAction.getAction(ValidationAction.class));
273:                actions.add(GraphAction.getAction(TestRunAction.class));
274:                return actions;
275:            }
276:
277:            /**
278:             * Generates and displays associated SQL statement for the given SQLObject.
279:             *
280:             * @param obj SQLObject whose SQL statement is to be displayed
281:             */
282:            @Override
283:            protected void showSql(SQLObject obj) {
284:                if (obj.getObjectType() == SQLConstants.TARGET_TABLE) {
285:                    SQLStatementPanel statementPanel = super 
286:                            .getOrCreateSQLStatementPanel(obj);
287:                    SQLStatementPanel.ShowSQLWorkerThread showSqlThread = statementPanel
288:
289:                    .new ShowSQLWorkerThread() {
290:                        @Override
291:                        public Object construct() {
292:                            TargetTable targetTable = null;
293:                            try {
294:                                startProgressBar();
295:                                if (sqlObjectLocalRef.getObjectType() == SQLConstants.TARGET_TABLE) {
296:                                    targetTable = (TargetTable) sqlObjectLocalRef;
297:                                    // Show SQL which will be executed during run time
298:                                    SQLDefinition sqlDefn = sqlModel
299:                                            .getSQLDefinition();
300:
301:                                    ETLStrategyBuilderContext context = new ETLStrategyBuilderContext(
302:                                            sqlDefn, targetTable);
303:                                    ETLStrategyBuilder tableScriptBuilder = ETLProcessFlowGeneratorFactory
304:                                            .getTargetTableScriptBuilder(context);
305:
306:                                    if (!hasValidationErrors()) {
307:                                        this .sqlText = tableScriptBuilder
308:                                                .getScriptToDisplay(context);
309:                                    }
310:                                }
311:                            } catch (BaseException be) {
312:                                mLogger
313:                                        .errorNoloc(
314:                                                mLoc
315:                                                        .t(
316:                                                                "PRSR048: Failed to generate Core SQL{0}",
317:                                                                ETLEditorTopView.class
318:                                                                        .getName()),
319:                                                be);
320:                                StringBuilder msg = new StringBuilder();
321:                                if (targetTable != null) {
322:                                    msg.append(targetTable.getQualifiedName())
323:                                            .append(": ");
324:                                }
325:
326:                                if (StringUtil.isNullString(be.getMessage())) {
327:                                    msg
328:                                            .append("Unknown error occurred while generating SQL.");
329:                                } else {
330:                                    msg.append(be.getMessage());
331:                                }
332:                                String nbBundle1 = mLoc
333:                                        .t("PRSR001: Cannot evaluate SQL:{0}",
334:                                                msg);
335:                                this .sqlText = Localizer.parse(nbBundle1);
336:                            } catch (Exception exp) {
337:                                String nbBundle2 = mLoc.t(
338:                                        "PRSR001: Cannot evaluate SQL:{0}", exp
339:                                                .getMessage());
340:                                mLogger
341:                                        .errorNoloc(
342:                                                mLoc
343:                                                        .t(
344:                                                                "PRSR049: Failed to generate Core SQL{0}",
345:                                                                ETLEditorTopView.class
346:                                                                        .getName()),
347:                                                ex);
348:                                this .sqlText = Localizer.parse(nbBundle2);
349:                            }
350:                            return "";
351:                        }
352:                    };
353:                    showSqlThread.start();
354:                    showSplitPaneView(statementPanel);
355:
356:                } else {
357:                    super.showSql(obj);
358:                }
359:            }
360:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.