Source Code Cross Referenced for EditWin.java in  » Report » datavision-1.1.0 » jimm » datavision » gui » 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 » Report » datavision 1.1.0 » jimm.datavision.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package jimm.datavision.gui;
002:
003:        import jimm.datavision.gui.cmd.CompoundCommand;
004:        import jimm.util.I18N;
005:        import java.awt.event.*;
006:        import javax.swing.*;
007:
008:        /**
009:         * The abstract parent of all edit windows except the main design window.
010:         * Handles common behavior.
011:         *
012:         * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
013:         */
014:        public abstract class EditWin extends JDialog implements  ActionListener {
015:
016:            protected Designer designer;
017:            protected JButton revertButton;
018:            protected CompoundCommand commands;
019:
020:            /**
021:             * Constructor for a non-modal dialog.
022:             *
023:             * @param designer the design window to which this dialog belongs
024:             * @param title window title
025:             * @param commandNameKey the {@link jimm.util.I18N} lookup key for the command
026:             * name
027:             */
028:            public EditWin(Designer designer, String title,
029:                    String commandNameKey) {
030:                this (designer, title, commandNameKey, false);
031:            }
032:
033:            /**
034:             * Constructor.
035:             *
036:             * @param designer the window to which this dialog belongs
037:             * @param title window title
038:             * @param commandNameKey the {@link jimm.util.I18N} lookup key for the command
039:             * name
040:             * @param modal passed on to superclass
041:             */
042:            public EditWin(Designer designer, String title,
043:                    String commandNameKey, boolean modal) {
044:                super (designer.getFrame(), title, modal);
045:                this .designer = designer;
046:                commands = new CompoundCommand(I18N.get(commandNameKey));
047:            }
048:
049:            /**
050:             * Builds and returns a panel containing the bottom four buttons.
051:             *
052:             * @return the four buttons OK, Apply, Revert, and Cancel
053:             */
054:            protected JPanel closeButtonPanel() {
055:                JPanel buttonPanel = new JPanel();
056:                JButton button;
057:
058:                buttonPanel.add(button = new JButton(I18N.get("GUI.ok")));
059:                button.addActionListener(this );
060:                button.setDefaultCapable(true);
061:
062:                buttonPanel.add(button = new JButton(I18N.get("GUI.apply")));
063:                button.addActionListener(this );
064:
065:                buttonPanel.add(revertButton = new JButton(I18N
066:                        .get("GUI.revert")));
067:                revertButton.addActionListener(this );
068:                revertButton.setEnabled(false);
069:
070:                buttonPanel.add(button = new JButton(I18N.get("GUI.cancel")));
071:                button.addActionListener(this );
072:
073:                return buttonPanel;
074:            }
075:
076:            /**
077:             * Handles the four buttons.
078:             *
079:             * @param e action event
080:             */
081:            public void actionPerformed(ActionEvent e) {
082:                String cmd = e.getActionCommand();
083:                if (I18N.get("GUI.ok").equals(cmd)) {
084:                    save(true); // Should add commands
085:                    dispose();
086:                } else if (I18N.get("GUI.apply").equals(cmd)) {
087:                    save(false); // Should add commands
088:                } else if (I18N.get("GUI.revert").equals(cmd)) {
089:                    revert();
090:                } else if (I18N.get("GUI.cancel").equals(cmd)) {
091:                    revert();
092:                    dispose();
093:                }
094:            }
095:
096:            /**
097:             * Saves all data by creating and performing a command. If not, that means we
098:             * are done and we should give the compound command to the design window.
099:             * <p>
100:             * Subclasses that implement {@link #doSave} should probably create a command,
101:             * call its <code>perform</code> method, and add it to the <var>commands</var>
102:             * compound command.
103:             *
104:             * @param closing passed through to <code>doSave</code>
105:             */
106:            protected void save(boolean closing) {
107:                doSave();
108:                revertButton.setEnabled(true);
109:
110:                if (closing && commands.numCommands() > 0)
111:                    designer.addCommand(commands);
112:            }
113:
114:            /**
115:             * Saves all data by creating a new command, performing it, and adding it
116:             * to <var>commands</var>.
117:             */
118:            protected abstract void doSave();
119:
120:            /**
121:             * Reverts all state information by undoing any commands previously performed
122:             * and emptying the compound command.
123:             *
124:             * @see #doRevert
125:             */
126:            protected void revert() {
127:                commands.undo();
128:                commands = new CompoundCommand(commands.getName());
129:                doRevert();
130:            }
131:
132:            /**
133:             * Gives subclasses a chance to clean up their GUI.
134:             */
135:            protected abstract void doRevert();
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.