Source Code Cross Referenced for DBTableSequencesPanel.java in  » Database-Client » DBBrowser » org » dbbrowser » ui » panel » dbbrowserwindow » 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 » Database Client » DBBrowser » org.dbbrowser.ui.panel.dbbrowserwindow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser.ui.panel.dbbrowserwindow;
002:
003:        import infrastructure.internationalization.InternationalizationManager;
004:        import infrastructure.logging.Log;
005:        import infrastructure.propertymanager.PropertyManager;
006:        import java.awt.*;
007:        import java.awt.event.ActionEvent;
008:        import java.awt.event.ActionListener;
009:        import java.util.ArrayList;
010:        import java.util.List;
011:        import javax.swing.*;
012:        import javax.swing.event.ChangeListener;
013:        import javax.swing.event.ChangeEvent;
014:        import org.dbbrowser.db.engine.model.DBTable;
015:        import org.dbbrowser.db.engine.exception.DBEngineException;
016:        import org.dbbrowser.ui.helper.DBTableDataTableModel;
017:        import org.dbbrowser.ui.UIControllerForQueries;
018:        import org.dbbrowser.ui.UIControllerForUpdates;
019:        import org.dbbrowser.ui.panel.ButtonsPanel;
020:        import org.dbbrowser.ui.widget.Button;
021:        import org.dbbrowser.ui.widget.Table;
022:        import org.dbbrowser.drivermanager.ConnectionInfo;
023:
024:        public class DBTableSequencesPanel extends JPanel implements 
025:                ActionListener, ChangeListener {
026:            private static final long serialVersionUID = UIControllerForQueries.version;
027:
028:            private String addNewRecordIconFileName = PropertyManager
029:                    .getInstance()
030:                    .getProperty(
031:                            "dbbrowser-ui-dbbrowser-window-add-new-record-icon");
032:            private String deleteRecordIconFileName = PropertyManager
033:                    .getInstance().getProperty(
034:                            "dbbrowser-ui-dbbrowser-window-delete-record-icon");
035:
036:            private Icon iconForAddNewRecordButton = new ImageIcon(
037:                    addNewRecordIconFileName);
038:            private Icon iconForDeleteRecordButton = new ImageIcon(
039:                    deleteRecordIconFileName);
040:
041:            private static final String TITLE = InternationalizationManager
042:                    .getInstance().getMessage("dbbrowser-ui",
043:                            "dbbrowser-ui-dbbrowser-window-title-label", null);;
044:            private static final String ADD_NEW_SEQUENCE_BUTTON_LABEL = InternationalizationManager
045:                    .getInstance()
046:                    .getMessage(
047:                            "dbbrowser-ui",
048:                            "dbbrowser-ui-dbbrowser-browser-tab-table-sequences-panel-add-new-sequence-button-label",
049:                            null);;
050:            private static final String REMOVE_SEQUENCE_BUTTON_LABEL = InternationalizationManager
051:                    .getInstance()
052:                    .getMessage(
053:                            "dbbrowser-ui",
054:                            "dbbrowser-ui-dbbrowser-browser-tab-table-sequences-panel-remove-sequence-button-label",
055:                            null);;
056:
057:            private UIControllerForQueries uiControllerForQueries = null;
058:            private UIControllerForUpdates uiControllerForUpdates = null;
059:            private Table tableForSequences = null;
060:            private ButtonsPanel buttonsPanel = null;
061:
062:            private boolean sequencesSetupCompleted = false;
063:
064:            public DBTableSequencesPanel(
065:                    UIControllerForQueries uiControllerForQueries,
066:                    UIControllerForUpdates uiControllerForUpdates) {
067:                this .uiControllerForQueries = uiControllerForQueries;
068:                this .uiControllerForUpdates = uiControllerForUpdates;
069:                initialize();
070:            }
071:
072:            public void refresh() {
073:                showSequences();
074:            }
075:
076:            public void stateChanged(ChangeEvent e) {
077:                //Setup sequences only if this panel has been selected
078:                Object source = e.getSource();
079:                if ((source != null) && (source instanceof  JTabbedPane)) {
080:                    //Get the selected tab
081:                    JTabbedPane pane = (JTabbedPane) source;
082:                    Component selectedComponent = pane.getSelectedComponent();
083:                    if ((selectedComponent != null)
084:                            && (selectedComponent instanceof  DBTableSequencesPanel)) {
085:                        //If sequences have not been retrieved, retrieve them and cache them
086:                        if (!sequencesSetupCompleted) {
087:                            showSequences();
088:                        }
089:                    }
090:                }
091:            }
092:
093:            private void showSequences() {
094:                try {
095:                    //Remove existing panels
096:                    if (this .tableForSequences != null) {
097:                        this .remove(this .tableForSequences);
098:                        this .remove(this .buttonsPanel);
099:                    }
100:
101:                    //Show all sequences in the database if it is a oracle database
102:                    ConnectionInfo ci = this .uiControllerForQueries
103:                            .getConnectionInfo();
104:                    String dbmsType = ci.getDBMSType();
105:                    DBTable dbTableOfSequences = this .uiControllerForQueries
106:                            .listSequences();
107:
108:                    //Add the table
109:                    this .tableForSequences = new Table(
110:                            this .uiControllerForQueries,
111:                            this .uiControllerForUpdates);
112:                    this .add(tableForSequences);
113:
114:                    //Set the buttons panel
115:                    Button addNewSequenceButton = new Button(
116:                            ADD_NEW_SEQUENCE_BUTTON_LABEL, this ,
117:                            ADD_NEW_SEQUENCE_BUTTON_LABEL,
118:                            iconForAddNewRecordButton, Boolean.TRUE);
119:                    Button removeSequenceButton = new Button(
120:                            REMOVE_SEQUENCE_BUTTON_LABEL, this ,
121:                            REMOVE_SEQUENCE_BUTTON_LABEL,
122:                            iconForDeleteRecordButton, Boolean.FALSE);
123:                    List listOfButtons = new ArrayList();
124:                    listOfButtons.add(addNewSequenceButton);
125:                    listOfButtons.add(removeSequenceButton);
126:                    buttonsPanel = new ButtonsPanel(listOfButtons);
127:
128:                    this .add(buttonsPanel);
129:
130:                    //Initialize table
131:                    this .initializeTable(dbTableOfSequences);
132:
133:                    sequencesSetupCompleted = true;
134:                } catch (DBEngineException exc) {
135:                    Log.getInstance()
136:                            .fatalMessage(
137:                                    exc.getClass().getName() + " - "
138:                                            + exc.getMessage(),
139:                                    BrowserPanel.class.getName());
140:                    String sqlFailedLabel = InternationalizationManager
141:                            .getInstance().getMessage("dbbrowser-ui",
142:                                    "dbbrowser-ui-dbbrowser-window-sql-failed",
143:                                    null);
144:                    JOptionPane.showMessageDialog(null, sqlFailedLabel + " - "
145:                            + exc.getMessage(), TITLE,
146:                            JOptionPane.ERROR_MESSAGE);
147:                } catch (UnsupportedOperationException exc) {
148:                    ConnectionInfo ci = this .uiControllerForQueries
149:                            .getConnectionInfo();
150:                    String[] dbmsTypes = new String[] { ci.getDBMSType() };
151:                    String featureSupportedByDBMSLabel = InternationalizationManager
152:                            .getInstance()
153:                            .getMessage(
154:                                    "dbbrowser-ui",
155:                                    "dbbrowser-ui-dbbrowser-feature-not-supported-error-message",
156:                                    dbmsTypes);
157:                    JLabel label = new JLabel(featureSupportedByDBMSLabel);
158:                    label.setHorizontalAlignment(SwingConstants.CENTER);
159:                    this .setLayout(new BorderLayout());
160:                    this .add(label);
161:                }
162:            }
163:
164:            private void initialize() {
165:                //Set the table for data
166:                this .setLayout(new BoxLayout(this , BoxLayout.PAGE_AXIS));
167:            }
168:
169:            public void initializeTable(DBTable dbTableOfSequences) {
170:                this .tableForSequences
171:                        .initializeTable(new DBTableDataTableModel(
172:                                dbTableOfSequences));
173:            }
174:
175:            public void actionPerformed(ActionEvent e) {
176:                //Add a new column
177:                if (ADD_NEW_SEQUENCE_BUTTON_LABEL.equals(e.getActionCommand())) {
178:                    String UNIMPLEMENTED_FEATURE_MESSAGE = InternationalizationManager
179:                            .getInstance()
180:                            .getMessage(
181:                                    "dbbrowser-ui",
182:                                    "dbbrowser-ui-dbbrowser-unimplemented-feature",
183:                                    null);
184:                    JOptionPane.showMessageDialog(null,
185:                            UNIMPLEMENTED_FEATURE_MESSAGE, TITLE,
186:                            JOptionPane.INFORMATION_MESSAGE);
187:                }
188:
189:                //Remove the selected column
190:                if (REMOVE_SEQUENCE_BUTTON_LABEL.equals(e.getActionCommand())) {
191:                    String UNIMPLEMENTED_FEATURE_MESSAGE = InternationalizationManager
192:                            .getInstance()
193:                            .getMessage(
194:                                    "dbbrowser-ui",
195:                                    "dbbrowser-ui-dbbrowser-unimplemented-feature",
196:                                    null);
197:                    JOptionPane.showMessageDialog(null,
198:                            UNIMPLEMENTED_FEATURE_MESSAGE, TITLE,
199:                            JOptionPane.INFORMATION_MESSAGE);
200:                }
201:            }
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.