Source Code Cross Referenced for BaseActionCommand.java in  » Database-Client » executequery » org » underworldlabs » swing » 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 » Database Client » executequery » org.underworldlabs.swing.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BaseActionCommand.java
003:         *
004:         * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         *
020:         */
021:
022:        package org.underworldlabs.swing.actions;
023:
024:        import java.awt.event.ActionEvent;
025:
026:        import javax.swing.AbstractAction;
027:        import javax.swing.Icon;
028:        import javax.swing.SwingUtilities;
029:
030:        /* ----------------------------------------------------------
031:         * CVS NOTE: Changes to the CVS repository prior to the 
032:         *           release of version 3.0.0beta1 has meant a 
033:         *           resetting of CVS revision numbers.
034:         * ----------------------------------------------------------
035:         */
036:
037:        /** <p>This is the base class for the action library. All
038:         *  actions will inherit from this class. The CommandAction
039:         *  defines a generic implementation of actionPerformed.
040:         *  Here actionPerformed simply calls the execute method
041:         *  on its command object.<br>
042:         *
043:         *  A developer can use this type directly by passing in
044:         *  the command, string, and action. However, convenience
045:         *  implementations are available that already provide the
046:         *  string and icon. The developer simply needs to provide
047:         *  the proper command.<br>
048:         *
049:         *  @author   Takis Diakoumis
050:         * @version  $Revision: 1.5 $
051:         * @date     $Date: 2006/06/03 01:23:02 $
052:         */
053:        public class BaseActionCommand extends AbstractAction {
054:
055:            /** The action ID */
056:            private String actionId;
057:
058:            /** The associated command for execution */
059:            protected BaseCommand command;
060:
061:            /** Whether the accelerator is editable */
062:            private boolean acceleratorEditable;
063:
064:            /** <p>Constructs a new command */
065:            public BaseActionCommand() {
066:                super ();
067:            }
068:
069:            /** <p>This constructor creates an action without an icon.
070:             *
071:             *  @param command the command for this action to act upon
072:             *  @param name the action's name
073:             */
074:            public BaseActionCommand(BaseCommand command, String name) {
075:                super (name);
076:                setCommand(command);
077:            }
078:
079:            /** <p>This constructor creates an action with an icon but no name.
080:             *  (for buttons that require only an icon)
081:             *
082:             *  @param command the command for this action to act upon
083:             *  @param icon the action's icon
084:             */
085:            public BaseActionCommand(BaseCommand command, Icon icon) {
086:                super (null, icon);
087:                setCommand(command);
088:            }
089:
090:            /** <p>This constructor creates an action with an icon.
091:             *
092:             *  @param command the command for this action to act upon
093:             *  @param name the action's name
094:             *  @param icon the action's icon
095:             */
096:            public BaseActionCommand(BaseCommand command, String name, Icon icon) {
097:                super (name, icon);
098:                setCommand(command);
099:            }
100:
101:            /** <p>ActionPerformed is what executed the command.<br>
102:             *  ActionPerformed is called whenever the action is acted upon.
103:             *
104:             *  @param e the action event
105:             */
106:            public void actionPerformed(final ActionEvent e) {
107:                SwingUtilities.invokeLater(new Runnable() {
108:                    public void run() {
109:                        getCommand().execute(e);
110:                    }
111:                });
112:            }
113:
114:            /** <p>This method retrieves the encapsulated command.
115:             *
116:             * @return the command
117:             */
118:            public final BaseCommand getCommand() {
119:                return command;
120:            }
121:
122:            /** <p>Sets the action's command object to the specified value.
123:             *
124:             * @param newValue the command for this action to act upon
125:             */
126:            protected final void setCommand(BaseCommand newValue) {
127:                this .command = newValue;
128:            }
129:
130:            /** <p>Sets the action's command object using the
131:             *  class name specified which is loaded using
132:             *  <code>Class.forName(...)</code>.
133:             *
134:             *  @param the command's fully qualified class name
135:             */
136:            public void setCommand(String className) {
137:
138:                try {
139:                    Class _class = Class.forName(className, true, ClassLoader
140:                            .getSystemClassLoader());
141:                    Object object = _class.newInstance();
142:                    command = (BaseCommand) object;
143:                } catch (ClassNotFoundException e) {
144:                    e.printStackTrace();
145:                    throw new InternalError();
146:                } catch (Exception e) {
147:                    e.printStackTrace();
148:                }
149:
150:            }
151:
152:            /** <p>Returns whether this action has an associated
153:             *  accelerator key combination.
154:             *
155:             *  @return true | false
156:             */
157:            public boolean hasAccelerator() {
158:                return getValue(ACCELERATOR_KEY) != null;
159:            }
160:
161:            /** <p>Returns this command's action ID.
162:             *
163:             *  @return the action id
164:             */
165:            public String getActionId() {
166:                return actionId;
167:            }
168:
169:            /** <p>Sets this command's action ID to the
170:             *  specified value.
171:             *
172:             *  @param the action ID
173:             */
174:            public void setActionId(String actionId) {
175:                this .actionId = actionId;
176:            }
177:
178:            public boolean isAcceleratorEditable() {
179:                return acceleratorEditable;
180:            }
181:
182:            public void setAcceleratorEditable(boolean acceleratorEditable) {
183:                this.acceleratorEditable = acceleratorEditable;
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.