Source Code Cross Referenced for DBIndexesPanel.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.Component;
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.BoxLayout;
012:        import javax.swing.Icon;
013:        import javax.swing.ImageIcon;
014:        import javax.swing.JOptionPane;
015:        import javax.swing.JPanel;
016:        import javax.swing.JTabbedPane;
017:        import javax.swing.event.ChangeEvent;
018:        import javax.swing.event.ChangeListener;
019:        import org.dbbrowser.db.engine.exception.DBEngineException;
020:        import org.dbbrowser.db.engine.model.DBTable;
021:        import org.dbbrowser.ui.UIControllerForQueries;
022:        import org.dbbrowser.ui.UIControllerForUpdates;
023:        import org.dbbrowser.ui.helper.DBTableDataTableModel;
024:        import org.dbbrowser.ui.panel.ButtonsPanel;
025:        import org.dbbrowser.ui.widget.Button;
026:        import org.dbbrowser.ui.widget.Table;
027:
028:        public class DBIndexesPanel extends JPanel implements  ActionListener,
029:                ChangeListener {
030:            private static final long serialVersionUID = UIControllerForQueries.version;
031:
032:            private String addNewRecordIconFileName = PropertyManager
033:                    .getInstance()
034:                    .getProperty(
035:                            "dbbrowser-ui-dbbrowser-window-add-new-record-icon");
036:            private String deleteRecordIconFileName = PropertyManager
037:                    .getInstance().getProperty(
038:                            "dbbrowser-ui-dbbrowser-window-delete-record-icon");
039:
040:            private Icon iconForAddNewRecordButton = new ImageIcon(
041:                    addNewRecordIconFileName);
042:            private Icon iconForDeleteRecordButton = new ImageIcon(
043:                    deleteRecordIconFileName);
044:
045:            private static final String TITLE = InternationalizationManager
046:                    .getInstance().getMessage("dbbrowser-ui",
047:                            "dbbrowser-ui-dbbrowser-window-title-label", null);;
048:            private static final String ADD_NEW_INDEX_BUTTON_LABEL = InternationalizationManager
049:                    .getInstance()
050:                    .getMessage(
051:                            "dbbrowser-ui",
052:                            "dbbrowser-ui-dbbrowser-indexes-tab-add-new-index-button-label",
053:                            null);;
054:            private static final String REMOVE_INDEX_BUTTON_LABEL = InternationalizationManager
055:                    .getInstance()
056:                    .getMessage(
057:                            "dbbrowser-ui",
058:                            "dbbrowser-ui-dbbrowser-indexes-tab-remove-index-button-label",
059:                            null);;
060:
061:            private UIControllerForQueries uiControllerForQueries = null;
062:            private UIControllerForUpdates uiControllerForUpdates = null;
063:
064:            private Table tableForIndexes = null;
065:            private ButtonsPanel buttonsPanel = null;
066:
067:            private boolean indexesSetupCompleted = false;
068:
069:            public DBIndexesPanel(
070:                    UIControllerForQueries uiControllerForQueries,
071:                    UIControllerForUpdates uiControllerForUpdates) {
072:                this .uiControllerForQueries = uiControllerForQueries;
073:                this .uiControllerForUpdates = uiControllerForUpdates;
074:                initialize();
075:            }
076:
077:            public void refresh() {
078:                showIndexes();
079:            }
080:
081:            public void stateChanged(ChangeEvent e) {
082:                //Setup indexes only if this panel has been selected
083:                Object source = e.getSource();
084:                if ((source != null) && (source instanceof  JTabbedPane)) {
085:                    //Get the selected tab
086:                    JTabbedPane pane = (JTabbedPane) source;
087:                    Component selectedComponent = pane.getSelectedComponent();
088:                    if ((selectedComponent != null)
089:                            && (selectedComponent instanceof  DBIndexesPanel)) {
090:                        //If indexes have not been retrieved, retrieve them and cache them
091:                        if (!indexesSetupCompleted) {
092:                            showIndexes();
093:                        }
094:                    }
095:                }
096:            }
097:
098:            private void showIndexes() {
099:                try {
100:                    //Remove existing panels
101:                    if (this .tableForIndexes != null) {
102:                        this .remove(this .tableForIndexes);
103:                        this .remove(this .buttonsPanel);
104:                    }
105:
106:                    DBTable dbTableOfIndexes = this .uiControllerForQueries
107:                            .listIndexes();
108:
109:                    //Add the table
110:                    this .tableForIndexes = new Table(
111:                            this .uiControllerForQueries,
112:                            this .uiControllerForUpdates);
113:                    this .add(tableForIndexes);
114:
115:                    //Set the buttons panel
116:                    Button addNewIndexButton = new Button(
117:                            ADD_NEW_INDEX_BUTTON_LABEL, this ,
118:                            ADD_NEW_INDEX_BUTTON_LABEL,
119:                            iconForAddNewRecordButton, Boolean.TRUE);
120:                    Button removeIndexButton = new Button(
121:                            REMOVE_INDEX_BUTTON_LABEL, this ,
122:                            REMOVE_INDEX_BUTTON_LABEL,
123:                            iconForDeleteRecordButton, Boolean.FALSE);
124:                    List listOfButtons = new ArrayList();
125:                    listOfButtons.add(addNewIndexButton);
126:                    listOfButtons.add(removeIndexButton);
127:                    buttonsPanel = new ButtonsPanel(listOfButtons);
128:
129:                    this .add(buttonsPanel);
130:
131:                    //Initialize table
132:                    this .initializeTable(dbTableOfIndexes);
133:                    indexesSetupCompleted = 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:                }
148:            }
149:
150:            private void initialize() {
151:                //Set the table for data
152:                this .setLayout(new BoxLayout(this , BoxLayout.PAGE_AXIS));
153:            }
154:
155:            public void initializeTable(DBTable dbTableOfSequences) {
156:                this .tableForIndexes.initializeTable(new DBTableDataTableModel(
157:                        dbTableOfSequences));
158:            }
159:
160:            public void actionPerformed(ActionEvent e) {
161:                //Add a new column
162:                if (ADD_NEW_INDEX_BUTTON_LABEL.equals(e.getActionCommand())) {
163:                    String UNIMPLEMENTED_FEATURE_MESSAGE = InternationalizationManager
164:                            .getInstance()
165:                            .getMessage(
166:                                    "dbbrowser-ui",
167:                                    "dbbrowser-ui-dbbrowser-unimplemented-feature",
168:                                    null);
169:                    JOptionPane.showMessageDialog(null,
170:                            UNIMPLEMENTED_FEATURE_MESSAGE, TITLE,
171:                            JOptionPane.INFORMATION_MESSAGE);
172:                }
173:
174:                //Remove the selected column
175:                if (REMOVE_INDEX_BUTTON_LABEL.equals(e.getActionCommand())) {
176:                    String UNIMPLEMENTED_FEATURE_MESSAGE = InternationalizationManager
177:                            .getInstance()
178:                            .getMessage(
179:                                    "dbbrowser-ui",
180:                                    "dbbrowser-ui-dbbrowser-unimplemented-feature",
181:                                    null);
182:                    JOptionPane.showMessageDialog(null,
183:                            UNIMPLEMENTED_FEATURE_MESSAGE, TITLE,
184:                            JOptionPane.INFORMATION_MESSAGE);
185:                }
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.