Source Code Cross Referenced for ButtonEvent.java in  » Swing-Library » jide-common » com » jidesoft » dialog » 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 » Swing Library » jide common » com.jidesoft.dialog 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)ButtonEvent.java
003:         *
004:         * Copyright 2002 - 2003 JIDE Software Inc. All rights reserved.
005:         */
006:        package com.jidesoft.dialog;
007:
008:        import java.awt.*;
009:        import java.util.EventObject;
010:
011:        /**
012:         * An EventObject used to change the state of any button.
013:         */
014:        public class ButtonEvent extends EventObject {
015:
016:            /**
017:             * The first number in the range of IDs used for <code>ButtonEvent</code>.
018:             */
019:            public static final int BUTTON_EVENT_FIRST = AWTEvent.RESERVED_ID_MAX + 5000;
020:
021:            /**
022:             * The last number in the range of IDs used for <code>DockableFrame</code> events.
023:             */
024:            public static final int BUTTON_EVENT_LAST = BUTTON_EVENT_FIRST + 8;
025:
026:            /**
027:             * This event is fired when you want to show the button.
028:             */
029:            public static final int SHOW_BUTTON = BUTTON_EVENT_FIRST;
030:
031:            /**
032:             * This event is fired when you want to hide the button.
033:             */
034:            public static final int HIDE_BUTTON = 1 + BUTTON_EVENT_FIRST;
035:
036:            /**
037:             * This event is fired when you want to enable the button.
038:             */
039:            public static final int ENABLE_BUTTON = 2 + BUTTON_EVENT_FIRST;
040:
041:            /**
042:             * This event is fired when you want to disable the button.
043:             */
044:            public static final int DISABLE_BUTTON = 3 + BUTTON_EVENT_FIRST;
045:
046:            /**
047:             * This event is fired when you want to change the text of the button.
048:             */
049:            public static final int CHANGE_BUTTON_TEXT = 4 + BUTTON_EVENT_FIRST;
050:
051:            /**
052:             * This event is fired when you want to change the mnemonic of the button.
053:             */
054:            public static final int CHANGE_BUTTON_MNEMONIC = 5 + BUTTON_EVENT_FIRST;
055:
056:            /**
057:             * This event is fired when you want to change the tooltip of the button.
058:             */
059:            public static final int CHANGE_BUTTON_TOOLTIP = 6 + BUTTON_EVENT_FIRST;
060:
061:            /**
062:             * This event is fired when you want to set focus to the button.
063:             */
064:            public static final int CHANGE_BUTTON_FOCUS = 7 + BUTTON_EVENT_FIRST;
065:
066:            /**
067:             * This event is fired when you want to set focus to the button.
068:             */
069:            public static final int SET_DEFAULT_BUTTON = 8 + BUTTON_EVENT_FIRST;
070:
071:            private int _id;
072:
073:            private String _buttonName;
074:
075:            private String _userObject;
076:
077:            /**
078:             * Creates a ButtonEvent with source, id and the button name.
079:             *
080:             * @param source
081:             * @param id
082:             * @param buttonName
083:             */
084:            public ButtonEvent(Object source, int id, String buttonName) {
085:                super (source);
086:                _id = id;
087:                _buttonName = buttonName;
088:                checkParam();
089:            }
090:
091:            /**
092:             * Creates a ButtonEvent with source, id, the button name and a user
093:             * object. User object is required for CHANGE_BUTTON_TEXT and
094:             * CHANGE_BUTTON_TOOLTIP event.
095:             *
096:             * @param source
097:             * @param id
098:             * @param buttonName
099:             * @param userObject
100:             */
101:            public ButtonEvent(Object source, int id, String buttonName,
102:                    String userObject) {
103:                super (source);
104:                _id = id;
105:                _buttonName = buttonName;
106:                _userObject = userObject;
107:                checkParam();
108:            }
109:
110:            private void checkParam() {
111:                if (getID() < BUTTON_EVENT_FIRST && getID() > BUTTON_EVENT_LAST) {
112:                    throw new IllegalArgumentException(getID()
113:                            + " is an invalid event id for ButtonEvent");
114:                }
115:                if (_buttonName == null || _buttonName.trim().length() == 0) {
116:                    throw new IllegalArgumentException(
117:                            "buttonName cannot be null or empty");
118:                }
119:                if ((_userObject == null || _userObject.trim().length() == 0)
120:                        && (getID() == CHANGE_BUTTON_TEXT
121:                                || getID() == CHANGE_BUTTON_MNEMONIC || getID() == CHANGE_BUTTON_TOOLTIP)) {
122:                    throw new IllegalArgumentException(
123:                            "userObject cannot be null or empty for "
124:                                    + paramString());
125:                }
126:            }
127:
128:            /**
129:             * Returns the event id.
130:             *
131:             * @return event id.
132:             */
133:            public int getID() {
134:                return _id;
135:            }
136:
137:            /**
138:             * Sets the event id.
139:             *
140:             * @param id
141:             */
142:            public void setID(int id) {
143:                _id = id;
144:            }
145:
146:            /**
147:             * Gets the button name of this event object.
148:             *
149:             * @return the button name.
150:             */
151:            public String getButtonName() {
152:                return _buttonName;
153:            }
154:
155:            /**
156:             * Sets the button name.
157:             *
158:             * @param buttonName
159:             */
160:            public void setButtonName(String buttonName) {
161:                _buttonName = buttonName;
162:            }
163:
164:            /**
165:             * Gets the user object of this event object.
166:             *
167:             * @return the user object.
168:             */
169:            public String getUserObject() {
170:                return _userObject;
171:            }
172:
173:            /**
174:             * Sets the user object.
175:             *
176:             * @param userObject
177:             */
178:            public void setUserObject(String userObject) {
179:                _userObject = userObject;
180:            }
181:
182:            /**
183:             * Returns a parameter string identifying this event.
184:             * This method is useful for event logging and for debugging.
185:             *
186:             * @return a string identifying the event and its attributes
187:             */
188:            public String paramString() {
189:                String typeStr;
190:                switch (getID()) {
191:                case SHOW_BUTTON:
192:                    typeStr = "SHOW_BUTTON";
193:                    break;
194:                case HIDE_BUTTON:
195:                    typeStr = "HIDE_BUTTON";
196:                    break;
197:                case ENABLE_BUTTON:
198:                    typeStr = "ENABLE_BUTTON";
199:                    break;
200:                case DISABLE_BUTTON:
201:                    typeStr = "DISABLE_BUTTON";
202:                    break;
203:                case CHANGE_BUTTON_TEXT:
204:                    typeStr = "CHANGE_BUTTON_TEXT";
205:                    break;
206:                case CHANGE_BUTTON_MNEMONIC:
207:                    typeStr = "CHANGE_BUTTON_MNEMONIC";
208:                    break;
209:                case CHANGE_BUTTON_TOOLTIP:
210:                    typeStr = "CHANGE_BUTTON_TOOLTIP";
211:                    break;
212:                case CHANGE_BUTTON_FOCUS:
213:                    typeStr = "CHANGE_BUTTON_FOCUS";
214:                    break;
215:                case SET_DEFAULT_BUTTON:
216:                    typeStr = "SET_DEFAULT_BUTTON";
217:                    break;
218:                default:
219:                    typeStr = "BUTTON_EVENT_UNKNOWN";
220:                }
221:                return typeStr;
222:            }
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.