Source Code Cross Referenced for ObjectState.java in  » IDE-Netbeans » api » org » netbeans » api » visual » model » 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 » IDE Netbeans » api » org.netbeans.api.visual.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.api.visual.model;
042:
043:        /**
044:         * This class holds a state of a object or a widget. The object state is a set of those following flags:
045:         * selected, highlighted (also called secondary selection), object-hovered, widget-hovered, widget-aimed.
046:         * <p>
047:         * Initial (normal) value of object state is used for Widget.state and in ObjectScene class.
048:         *
049:         * @author David Kaspar
050:         */
051:        // TODO - rename to VisualState?
052:        public class ObjectState {
053:
054:            private static final ObjectState NORMAL = new ObjectState(false,
055:                    false, false, false, false, false, false);
056:
057:            private boolean objectSelected;
058:            private boolean objectHighlighted;
059:            private boolean objectHovered;
060:            private boolean objectFocused;
061:
062:            private boolean widgetHovered;
063:            private boolean widgetFocused;
064:            private boolean widgetAimed;
065:
066:            private ObjectState(boolean objectSelected,
067:                    boolean objectHighlighted, boolean objectHovered,
068:                    boolean objectFocused, boolean widgetHovered,
069:                    boolean widgetFocused, boolean widgetAimed) {
070:                this .objectSelected = objectSelected;
071:                this .objectHighlighted = objectHighlighted;
072:                this .objectHovered = objectHovered;
073:                this .objectFocused = objectFocused;
074:                this .widgetHovered = widgetHovered;
075:                this .widgetFocused = widgetFocused;
076:                this .widgetAimed = widgetAimed;
077:            }
078:
079:            /**
080:             * Returns a value of selected-flag.
081:             * @return true, if selected
082:             */
083:            public boolean isSelected() {
084:                return objectSelected;
085:            }
086:
087:            /**
088:             * Creates a state derived from this one where the selected flag will be set according to the parameter.
089:             * @param selected the new selected-flag of the new state.
090:             * @return the new state
091:             */
092:            public ObjectState deriveSelected(boolean selected) {
093:                return new ObjectState(selected, objectHighlighted,
094:                        objectHovered, objectFocused, widgetHovered,
095:                        widgetFocused, widgetAimed);
096:            }
097:
098:            /**
099:             * Returns a value of highlighted-flag.
100:             * @return true, if highlighted
101:             */
102:            public boolean isHighlighted() {
103:                return objectHighlighted;
104:            }
105:
106:            /**
107:             * Creates a state derived from this one where the highlighted flag will be set according to the parameter.
108:             * @param highlighted the new highlighted-flag of the new state.
109:             * @return the new state
110:             */
111:            public ObjectState deriveHighlighted(boolean highlighted) {
112:                return new ObjectState(objectSelected, highlighted,
113:                        objectHovered, objectFocused, widgetHovered,
114:                        widgetFocused, widgetAimed);
115:            }
116:
117:            /**
118:             * Returns a value of hovered-flag.
119:             * @return true, if object-hovered or widget-hovered flag is set
120:             */
121:            public boolean isHovered() {
122:                return objectHovered || widgetHovered;
123:            }
124:
125:            /**
126:             * Returns a value of object-hovered-flag.
127:             * @return true, if object-hovered
128:             */
129:            public boolean isObjectHovered() {
130:                return objectHovered;
131:            }
132:
133:            /**
134:             * Creates a state derived from this one where the object-hovered flag will be set according to the parameter.
135:             * @param hovered the new object-hovered-flag of the new state.
136:             * @return the new state
137:             */
138:            public ObjectState deriveObjectHovered(boolean hovered) {
139:                return new ObjectState(objectSelected, objectHighlighted,
140:                        hovered, objectFocused, widgetHovered, widgetFocused,
141:                        widgetAimed);
142:            }
143:
144:            /**
145:             * Returns a value of widget-hovered-flag.
146:             * @return true, if widget-hovered
147:             */
148:            public boolean isWidgetHovered() {
149:                return widgetHovered;
150:            }
151:
152:            /**
153:             * Creates a state derived from this one where the widget-hovered flag will be set according to the parameter.
154:             * @param hovered the new widget-hovered-flag of the new state.
155:             * @return the new state
156:             */
157:            public ObjectState deriveWidgetHovered(boolean hovered) {
158:                return new ObjectState(objectSelected, objectHighlighted,
159:                        objectHovered, objectFocused, hovered, widgetFocused,
160:                        widgetAimed);
161:            }
162:
163:            /**
164:             * Returns a value of focused-flag.
165:             * @return true, if object-focused or widget-focused flag is set
166:             */
167:            public boolean isFocused() {
168:                return objectFocused || widgetFocused;
169:            }
170:
171:            /**
172:             * Returns a value of object-focused flag.
173:             * @return true, if object-focused
174:             */
175:            public boolean isObjectFocused() {
176:                return objectFocused;
177:            }
178:
179:            /**
180:             * Creates a state derived from this one where the object-focused flag will be set according to the parameter.
181:             * @param focused the new object-focused-flag of the new state.
182:             * @return the new state
183:             */
184:            public ObjectState deriveObjectFocused(boolean focused) {
185:                return new ObjectState(objectSelected, objectHighlighted,
186:                        objectHovered, focused, widgetHovered, widgetFocused,
187:                        widgetAimed);
188:            }
189:
190:            /**
191:             * Returns a value of widget-focused-flag.
192:             * @return true, if widget-focused
193:             */
194:            public boolean isWidgetFocused() {
195:                return widgetFocused;
196:            }
197:
198:            /**
199:             * Creates a state derived from this one where the widget-focused flag will be set according to the parameter.
200:             * @param focused the new widget-focused-flag of the new state.
201:             * @return the new state
202:             */
203:            public ObjectState deriveWidgetFocused(boolean focused) {
204:                return new ObjectState(objectSelected, objectHighlighted,
205:                        objectHovered, objectFocused, widgetHovered, focused,
206:                        widgetAimed);
207:            }
208:
209:            /**
210:             * Returns a value of widget-aimed-flag.
211:             * @return true, if widget-aimed
212:             */
213:            public boolean isWidgetAimed() {
214:                return widgetAimed;
215:            }
216:
217:            /**
218:             * Creates a state derived from this one where the aimed flag will be set according to the parameter.
219:             * @param aimed the new aimed-flag of the new state.
220:             * @return the new state
221:             */
222:            public ObjectState deriveWidgetAimed(boolean aimed) {
223:                return new ObjectState(objectSelected, objectHighlighted,
224:                        objectHovered, objectFocused, widgetHovered,
225:                        widgetFocused, aimed);
226:            }
227:
228:            /**
229:             * Creates a normal (initial/default) state. No flags is set in the state.
230:             * @return the normal state
231:             */
232:            public static ObjectState createNormal() {
233:                return NORMAL;
234:            }
235:
236:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.