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


001:        /*
002:         *
003:         *          Copyright (c) 2003-2005, SeeBeyond Technology Corporation,
004:         *          All Rights Reserved
005:         *
006:         *          This program, and all the routines referenced herein,
007:         *          are the proprietary properties and trade secrets of
008:         *          SEEBEYOND TECHNOLOGY CORPORATION.
009:         *
010:         *          Except as provided for by license agreement, this
011:         *          program shall not be duplicated, used, or disclosed
012:         *          without  written consent signed by an officer of
013:         *          SEEBEYOND TECHNOLOGY CORPORATION.
014:         *
015:         */
016:
017:        package org.netbeans.modules.etl.ui.view.graph.actions;
018:
019:        import com.sun.sql.framework.exception.DBSQLException;
020:        import org.netbeans.modules.sql.framework.model.SQLDBTable;
021:        import org.netbeans.modules.sql.framework.model.SourceTable;
022:        import org.netbeans.modules.sql.framework.model.TargetTable;
023:        import org.netbeans.modules.sql.framework.model.visitors.SQLDBSynchronizationVisitor;
024:        import java.awt.event.ActionEvent;
025:        import java.awt.event.InputEvent;
026:        import java.net.URL;
027:        import java.util.ArrayList;
028:        import javax.swing.Action;
029:        import java.util.Iterator;
030:        import java.util.List;
031:        import javax.swing.ImageIcon;
032:        import javax.swing.JOptionPane;
033:        import javax.swing.KeyStroke;
034:        import net.java.hulp.i18n.Logger;
035:        import org.netbeans.modules.etl.logger.Localizer;
036:        import org.netbeans.modules.etl.logger.LogUtil;
037:        import org.netbeans.modules.etl.ui.DataObjectProvider;
038:        import org.netbeans.modules.sql.framework.model.SQLJoinView;
039:        import org.openide.util.Exceptions;
040:        import org.netbeans.modules.sql.framework.ui.view.graph.MetaTableModel;
041:        import org.netbeans.modules.sql.framework.ui.view.graph.SQLTableArea;
042:        import org.netbeans.modules.sql.framework.model.visitors.SQLDBSynchronizationVisitor;
043:        import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
044:        import org.netbeans.modules.sql.framework.ui.model.CollabSQLUIModel;
045:        import org.netbeans.modules.sql.framework.ui.view.graph.SQLSourceTableArea;
046:        import org.netbeans.modules.sql.framework.ui.view.graph.SQLTargetTableArea;
047:        import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
048:        import org.netbeans.modules.sql.framework.ui.view.BasicTopView;
049:        import org.netbeans.modules.sql.framework.ui.view.join.JoinViewGraphNode;
050:        import org.openide.windows.WindowManager;
051:
052:        /**
053:         * @author Nithya Radhakrishnan
054:         * @version $Revision$
055:         */
056:        public class RefreshMetadataAction extends GraphAction {
057:
058:            private static final URL synchroniseImgUrl = RefreshMetadataAction.class
059:                    .getResource("/org/netbeans/modules/sql/framework/ui/resources/images/refresh.png");
060:            private static transient final Logger mLogger = LogUtil
061:                    .getLogger(RefreshMetadataAction.class.getName());
062:            private static transient final Localizer mLoc = Localizer.get();
063:
064:            public RefreshMetadataAction() {
065:                //action name
066:                String nbBundle1 = mLoc.t("PRSR001: Refresh Metadata");
067:                this .putValue(Action.NAME, Localizer.parse(nbBundle1));
068:
069:                //action icon
070:                this .putValue(Action.SMALL_ICON, new ImageIcon(
071:                        synchroniseImgUrl));
072:
073:                //action tooltip
074:                String nbBundle2 = mLoc.t("PRSR001: Refresh Metadata (Cntl-R)");
075:                this .putValue(Action.SHORT_DESCRIPTION, Localizer
076:                        .parse(nbBundle2));
077:                // Acceleratot Cntl-R
078:                this .putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
079:                        'R', InputEvent.CTRL_MASK));
080:            }
081:
082:            /**
083:             * called when this action is performed in the ui
084:             *
085:             * @param ev event
086:             */
087:            public void actionPerformed(ActionEvent ev) {
088:                IGraphView graphView = (IGraphView) ev.getSource();
089:                CollabSQLUIModel model = (CollabSQLUIModel) graphView
090:                        .getGraphModel();
091:                List infoList = new ArrayList();
092:                String nbBundle3 = mLoc
093:                        .t("PRSR001: If columns are deleted or renamed you may lose existing mappings.");
094:                String dlgMsg = Localizer.parse(nbBundle3);
095:
096:                String nbBundle4 = mLoc.t("PRSR001: Refresh Metadata");
097:                String dlgTitle = Localizer.parse(nbBundle4);
098:                int response = JOptionPane.showConfirmDialog(WindowManager
099:                        .getDefault().getMainWindow(), dlgMsg, dlgTitle,
100:                        JOptionPane.OK_CANCEL_OPTION,
101:                        JOptionPane.WARNING_MESSAGE);
102:                if (JOptionPane.OK_OPTION == response) {
103:                    Iterator targetTables = model.getSQLDefinition()
104:                            .getTargetTables().iterator();
105:                    while (targetTables.hasNext()) {
106:                        try {
107:                            TargetTable tt = (TargetTable) targetTables.next();
108:                            SQLDBSynchronizationVisitor visitView = new SQLDBSynchronizationVisitor();
109:                            SQLTargetTableArea ttArea = (SQLTargetTableArea) graphView
110:                                    .findGraphNode(tt);
111:                            SQLTableArea tarea = (SQLTableArea) ttArea
112:                                    .getTableArea();
113:                            MetaTableModel metaModel = (MetaTableModel) tarea
114:                                    .getModel();
115:                            visitView.mergeCollabTableWithDatabaseTable(
116:                                    (SQLDBTable) tt, metaModel);
117:                            if (!visitView.infoList.isEmpty()) {
118:                                ttArea.layoutChildren();
119:                                // Mark collab as needing to be persisted.
120:                                DataObjectProvider.getProvider()
121:                                        .getActiveDataObject()
122:                                        .setModified(true);
123:                                model.setDirty(true);
124:                                infoList.addAll(visitView.infoList);
125:                            }
126:                        } catch (DBSQLException ex) {
127:                            Exceptions.printStackTrace(ex);
128:                        } catch (Exception ex) {
129:                            Exceptions.printStackTrace(ex);
130:                        }
131:                    }
132:
133:                    Iterator sourceTables = model.getSQLDefinition()
134:                            .getSourceTables().iterator();
135:                    while (sourceTables.hasNext()) {
136:                        try {
137:                            SourceTable st = (SourceTable) sourceTables.next();
138:                            SQLDBSynchronizationVisitor visitView = new SQLDBSynchronizationVisitor();
139:                            SQLSourceTableArea stArea = (SQLSourceTableArea) graphView
140:                                    .findGraphNode(st);
141:                            SQLTableArea tarea = (SQLTableArea) stArea
142:                                    .getTableArea();
143:                            MetaTableModel metaModel = (MetaTableModel) tarea
144:                                    .getModel();
145:                            visitView.mergeCollabTableWithDatabaseTable(
146:                                    (SQLDBTable) st, metaModel);
147:                            if (!visitView.infoList.isEmpty()) {
148:                                stArea.layoutChildren();
149:                                SQLJoinView jView = model.getJoinView(st);
150:                                if (jView != null) {
151:                                    JoinViewGraphNode jViewGraph = (JoinViewGraphNode) graphView
152:                                            .findGraphNode(jView);
153:                                    jViewGraph.layoutChildren();
154:                                    jViewGraph.setHeight(jViewGraph
155:                                            .getMaximumHeight());
156:                                }
157:                                // Mark collab as needing to be persisted.
158:                                DataObjectProvider.getProvider()
159:                                        .getActiveDataObject()
160:                                        .setModified(true);
161:                                model.setDirty(true);
162:                                infoList.addAll(visitView.infoList);
163:                            }
164:                        } catch (DBSQLException ex) {
165:                            Exceptions.printStackTrace(ex);
166:                        } catch (Exception ex) {
167:                            Exceptions.printStackTrace(ex);
168:                        }
169:                    }
170:                    BasicTopView gvMgr = (BasicTopView) graphView
171:                            .getGraphViewContainer();
172:                    gvMgr.showRefreshMetadataInfo(infoList);
173:                } // end of jOptionPane
174:            }
175:        }
w___w_w___.j___a___v_a__2s__._co___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.