Source Code Cross Referenced for SchemaListView.java in  » Database-Client » ViennaSQL » uk » co » whisperingwind » vienna » 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 » ViennaSQL » uk.co.whisperingwind.vienna 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         ** $Id: SchemaListView.java,v 1.10 2000/10/26 08:34:16 mrw Exp $
003:         **
004:         ** Dialog to list all available schema names and allow the user to
005:         ** make a selection.
006:         **
007:         ** Mike Wilson, July 2000, mrw@whisperingwind.co.uk
008:         **
009:         ** (C) Copyright 2000, Mike Wilson, Reading, Berkshire, UK
010:         **
011:         ** This program is free software; you can redistribute it and/or modify
012:         ** it under the terms of the GNU General Public License as published by
013:         ** the Free Software Foundation; either version 2 of the License, or
014:         ** (at your option) any later version.
015:         ** 
016:         ** This program is distributed in the hope that it will be useful,
017:         ** but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019:         ** GNU General Public License for more details.
020:         ** 
021:         ** You should have received a copy of the GNU Library General
022:         ** Public License along with this library; if not, write to the
023:         ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
024:         ** Boston, MA  02111-1307  USA.
025:         */
026:
027:        package uk.co.whisperingwind.vienna;
028:
029:        import java.awt.Cursor;
030:        import java.awt.event.MouseEvent;
031:        import java.awt.event.MouseListener;
032:        import java.awt.GridBagConstraints;
033:        import java.awt.Insets;
034:        import javax.swing.JButton;
035:        import javax.swing.JFrame;
036:        import javax.swing.JList;
037:        import javax.swing.JScrollPane;
038:        import javax.swing.ListModel;
039:        import uk.co.whisperingwind.framework.ActionFactory;
040:        import uk.co.whisperingwind.framework.ButtonView;
041:        import uk.co.whisperingwind.framework.ModelEvent;
042:
043:        class SchemaListView extends ButtonView {
044:            private SchemaListModel schemaListModel = null;
045:            private JButton okButton = null;
046:            private ActionFactory.DefaultAction okAction = null;
047:            private ActionFactory.DefaultAction cancelAction = null;
048:            private ListModel listModel = null;
049:            private JList schemaList = null;
050:            private Cursor originalCursor = null;
051:
052:            public SchemaListView(JFrame parent, SchemaListModel model,
053:                    boolean modal) {
054:                super (parent, modal);
055:
056:                schemaListModel = model;
057:                content.setTitle("Select schema");
058:                schemaListModel.addObserver(this );
059:                listModel = schemaListModel.getListModel();
060:                createActions();
061:                createComponents();
062:            }
063:
064:            /*
065:             ** When I become visible, make the "Ok" button the default and set
066:             ** the focus to the user name entry.
067:             */
068:
069:            public void setVisible(boolean visible) {
070:                content.setVisible(visible);
071:                content.getRootPane().setDefaultButton(okButton);
072:            }
073:
074:            private void createActions() {
075:                ConfigActionFactory factory = new ConfigActionFactory(
076:                        "/uk/co/whisperingwind/images");
077:
078:                okAction = factory.createAction("ok");
079:                cancelAction = factory.createAction("cancel");
080:
081:                okAction.addActionListener(actionListener);
082:                cancelAction.addActionListener(actionListener);
083:            }
084:
085:            private void createComponents() {
086:                schemaList = new JList(listModel);
087:                schemaList.addMouseListener(new DoubleMouseListener());
088:                JScrollPane listScroller = new JScrollPane(schemaList);
089:
090:                GridBagConstraints constraints = new GridBagConstraints();
091:
092:                constraints.fill = GridBagConstraints.BOTH;
093:                constraints.gridx = 0;
094:                constraints.gridy = 0;
095:                constraints.insets = new Insets(4, 4, 4, 4);
096:                constraints.fill = GridBagConstraints.BOTH;
097:                constraints.weightx = 1.0;
098:                constraints.weighty = 1.0;
099:                content.getContentPane().add(listScroller, constraints);
100:
101:                okButton = okAction.toolButtonFactory(buttonPanel);
102:                cancelAction.toolButtonFactory(buttonPanel);
103:
104:                content.pack();
105:            }
106:
107:            public String getSelection() {
108:                String selected = null;
109:                int i = schemaList.getSelectedIndex();
110:
111:                if (i >= 0) {
112:                    return (String) listModel.getElementAt(i);
113:                }
114:
115:                return selected;
116:            }
117:
118:            public void busyCursor(boolean busy) {
119:                if (busy) {
120:                    originalCursor = content.getCursor();
121:                    content.setCursor(new Cursor(Cursor.WAIT_CURSOR));
122:                } else {
123:                    content.setCursor(originalCursor);
124:                }
125:            }
126:
127:            protected void modelEvent(ModelEvent event) {
128:                if (event.getField().equals("schema")) {
129:                    if (event.getValue().equals("end")) {
130:                        schemaList.setSelectedIndex(0);
131:                    }
132:                }
133:            }
134:
135:            protected void cleanUp() {
136:                schemaListModel.deleteObserver(this );
137:            }
138:
139:            private class DoubleMouseListener implements  MouseListener {
140:                public void mouseClicked(MouseEvent event) {
141:                    if (event.getClickCount() == 2) {
142:                        fireEvent("ok");
143:                    }
144:                }
145:
146:                public void mouseEntered(MouseEvent event) {
147:                }
148:
149:                public void mouseExited(MouseEvent event) {
150:                }
151:
152:                public void mousePressed(MouseEvent event) {
153:                }
154:
155:                public void mouseReleased(MouseEvent event) {
156:                }
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.