Source Code Cross Referenced for Pseudoclasses.java in  » XML-UI » JAXX » jaxx » runtime » css » 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 » XML UI » JAXX » jaxx.runtime.css 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package jaxx.runtime.css;
002:
003:        import java.util.*;
004:
005:        import jaxx.runtime.*;
006:
007:        public class Pseudoclasses {
008:            public static final String NO_PSEUDOCLASS = "no pseudoclass";
009:
010:            private static Map/*<Object, Map<String, List<PropertyValue>>>*/properties = new WeakHashMap/*<Object, Map<String, List<PropertyValue>>>*/();
011:
012:            private static class PropertyValue implements  Comparable {
013:                private Object value;
014:                private int id;
015:
016:                public PropertyValue(Object value, int id) {
017:                    this .value = value;
018:                    this .id = id;
019:                }
020:
021:                public Object getValue() {
022:                    return value;
023:                }
024:
025:                public int getId() {
026:                    return id;
027:                }
028:
029:                public int compareTo(Object o) {
030:                    return getId() - ((PropertyValue) o).getId();
031:                }
032:
033:                public boolean equals(Object o) {
034:                    if (!(o instanceof  PropertyValue))
035:                        return false;
036:                    PropertyValue value = (PropertyValue) o;
037:                    if (value.getId() != getId())
038:                        return false;
039:                    if (value.getValue() == null)
040:                        return getValue() == null;
041:                    else
042:                        return value.getValue().equals(getValue());
043:                }
044:
045:                public int hashCode() {
046:                    return (value != null ? value.hashCode() : 0) ^ id;
047:                }
048:
049:                public String toString() {
050:                    return "PropertyValue[" + value + ", " + id + "]";
051:                }
052:            }
053:
054:            private static List/*<PropertyValue>*/getPropertyList(
055:                    Object object, String property) {
056:                Map/*<String, List<PropertyValue>>*/propertyMap = (Map) properties
057:                        .get(object);
058:                if (propertyMap == null) {
059:                    propertyMap = new HashMap/*<String, List<PropertyValue>>*/();
060:                    properties.put(object, propertyMap);
061:                }
062:
063:                List/*<PropertyValue>*/propertyList = (List) propertyMap
064:                        .get(property);
065:                if (propertyList == null) {
066:                    propertyList = new ArrayList/*<PropertyValue>*/();
067:                    propertyMap.put(property, propertyList);
068:                }
069:
070:                return propertyList;
071:            }
072:
073:            public static boolean isPropertyApplied(Object object,
074:                    String property, int id) {
075:                List/*<PropertyValue>*/propertyList = getPropertyList(object,
076:                        property);
077:                for (int i = 0; i < propertyList.size(); i++)
078:                    if (((PropertyValue) propertyList.get(i)).getId() == id)
079:                        return true;
080:                return false;
081:            }
082:
083:            public static void propertyApplied(Object object, String property,
084:                    Object value, int id) {
085:                List/*<PropertyValue>*/propertyList = getPropertyList(object,
086:                        property);
087:                propertyList.add(new PropertyValue(value, id));
088:                Collections.sort(propertyList);
089:            }
090:
091:            public static void propertyRemoved(Object object, String property,
092:                    Object value, int id) {
093:                List/*<PropertyValue>*/propertyList = getPropertyList(object,
094:                        property);
095:                propertyList.remove(new PropertyValue(value, id));
096:            }
097:
098:            public static Object getCurrentValue(Object object, String property) {
099:                List/*<PropertyValue>*/propertyList = getPropertyList(object,
100:                        property);
101:                if (propertyList.size() > 0)
102:                    return ((PropertyValue) propertyList.get(propertyList
103:                            .size() - 1)).getValue();
104:                return NO_PSEUDOCLASS;
105:            }
106:
107:            public static Object applyProperty(JAXXObject parent,
108:                    Object object, String property, Object newValue,
109:                    Object currentValue, int id) {
110:                if (!isPropertyApplied(object, property, id)) {
111:                    Object value = getCurrentValue(object, property);
112:                    if (value == NO_PSEUDOCLASS)
113:                        propertyApplied(object, property, wrap(currentValue),
114:                                -1);
115:                    propertyApplied(object, property, wrap(newValue), id);
116:                    value = getCurrentValue(object, property);
117:                    if (value instanceof  DataBinding)
118:                        parent.applyDataBinding(((DataBinding) value).getId());
119:                    return value;
120:                } else
121:                    return currentValue;
122:            }
123:
124:            public static Object removeProperty(JAXXObject parent,
125:                    Object object, String property, Object oldValue,
126:                    Object currentValue, int id) {
127:                if (isPropertyApplied(object, property, id)) {
128:                    Object value = getCurrentValue(object, property);
129:                    if (value == NO_PSEUDOCLASS)
130:                        throw new java.lang.IllegalStateException(
131:                                "found NO_PSEUDOCLASS value for a property which does not have a default value");
132:                    if (value instanceof  DataBinding)
133:                        parent.removeDataBinding(((DataBinding) value).getId());
134:                    propertyRemoved(object, property, wrap(oldValue), id);
135:                    value = getCurrentValue(object, property);
136:                    return value;
137:                } else
138:                    return currentValue;
139:            }
140:
141:            public static Object wrap(boolean value) {
142:                return new Boolean(value);
143:            }
144:
145:            public static Object wrap(byte value) {
146:                return new Byte(value);
147:            }
148:
149:            public static Object wrap(short value) {
150:                return new Short(value);
151:            }
152:
153:            public static Object wrap(int value) {
154:                return new Integer(value);
155:            }
156:
157:            public static Object wrap(long value) {
158:                return new Long(value);
159:            }
160:
161:            public static Object wrap(float value) {
162:                return new Float(value);
163:            }
164:
165:            public static Object wrap(double value) {
166:                return new Double(value);
167:            }
168:
169:            public static Object wrap(char value) {
170:                return new Character(value);
171:            }
172:
173:            public static Object wrap(Object value) {
174:                return value;
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.