Source Code Cross Referenced for IThemeRegistry.java in  » IDE-Eclipse » ui-workbench » org » eclipse » ui » internal » themes » 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 Eclipse » ui workbench » org.eclipse.ui.internal.themes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2004, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.ui.internal.themes;
011:
012:        import java.util.Arrays;
013:        import java.util.Comparator;
014:        import java.util.Map;
015:        import java.util.Set;
016:
017:        /**
018:         * Registry of color, font, gradient, category and theme descriptors.
019:         *
020:         * @since 3.0
021:         */
022:        public interface IThemeRegistry {
023:
024:            /**
025:             * A comparator that will sort IHierarchalThemeElementDefinition elements
026:             * by defaultsTo depth.
027:             * 
028:             * @since 3.0
029:             */
030:            public static class HierarchyComparator implements  Comparator {
031:
032:                private IHierarchalThemeElementDefinition[] definitions;
033:
034:                /**
035:                 * Create a new comparator.
036:                 * 
037:                 * @param definitions the elements to be sorted by depth, in ID order.
038:                 */
039:                public HierarchyComparator(
040:                        IHierarchalThemeElementDefinition[] definitions) {
041:                    this .definitions = definitions;
042:                }
043:
044:                /* (non-Javadoc)
045:                 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
046:                 */
047:                public int compare(Object arg0, Object arg1) {
048:                    String def0 = arg0 == null ? null
049:                            : ((IHierarchalThemeElementDefinition) arg0)
050:                                    .getDefaultsTo();
051:                    String def1 = arg1 == null ? null
052:                            : ((IHierarchalThemeElementDefinition) arg1)
053:                                    .getDefaultsTo();
054:
055:                    if (def0 == null && def1 == null) {
056:                        return 0;
057:                    }
058:
059:                    if (def0 == null) {
060:                        return -1;
061:                    }
062:
063:                    if (def1 == null) {
064:                        return 1;
065:                    }
066:
067:                    return compare(getDefaultsTo(def0), getDefaultsTo(def1));
068:                }
069:
070:                /** 
071:                 * @param id the identifier to search for.
072:                 * @return the <code>IHierarchalThemeElementDefinition</code> that 
073:                 * matches the id.
074:                 */
075:                private IHierarchalThemeElementDefinition getDefaultsTo(
076:                        String id) {
077:                    int idx = Arrays.binarySearch(definitions, id,
078:                            ID_COMPARATOR);
079:                    if (idx >= 0) {
080:                        return definitions[idx];
081:                    }
082:                    return null;
083:                }
084:            }
085:
086:            /**
087:             * A comparator that will sort <code>IThemeElementDefinition</code> elements
088:             * by id depth.  You may use this on both <code>String</code> and 
089:             * <code>IThemeElementDefinition</code> objects in order to perform 
090:             * searching.
091:             * 
092:             * @since 3.0
093:             */
094:            public static final Comparator ID_COMPARATOR = new Comparator() {
095:
096:                /* (non-Javadoc)
097:                 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
098:                 */
099:                public int compare(Object arg0, Object arg1) {
100:                    String str0 = getCompareString(arg0);
101:                    String str1 = getCompareString(arg1);
102:                    return str0.compareTo(str1);
103:                }
104:
105:                /**
106:                 * @param object
107:                 * @return <code>String</code> representation of the object.
108:                 */
109:                private String getCompareString(Object object) {
110:                    if (object instanceof  String) {
111:                        return (String) object;
112:                    } else if (object instanceof  IThemeElementDefinition) {
113:                        return ((IThemeElementDefinition) object).getId();
114:                    }
115:                    return ""; //$NON-NLS-1$
116:                }
117:            };
118:
119:            /**
120:             * Returns the category matching the provided id.
121:             * 
122:             * @param id the id to search for
123:             * @return the element matching the provided id, or <code>null</code> if 
124:             * not found
125:             */
126:            public ThemeElementCategory findCategory(String id);
127:
128:            /**
129:             * Returns the color matching the provided id.
130:             * 
131:             * @param id the id to search for
132:             * @return the element matching the provided id, or <code>null</code> if 
133:             * not found
134:             */
135:            public ColorDefinition findColor(String id);
136:
137:            /**
138:             * Returns the font matching the provided id.
139:             * 
140:             * @param id the id to search for
141:             * @return the element matching the provided id, or <code>null</code> if 
142:             * not found
143:             */
144:            public FontDefinition findFont(String id);
145:
146:            /**
147:             *  Returns the theme matching the provided id.
148:             * 
149:             * @param id the id to search for
150:             * @return the element matching the provided id, or <code>null</code> if 
151:             * not found
152:             */
153:            public IThemeDescriptor findTheme(String id);
154:
155:            /**
156:             * Returns a list of categories defined in the registry.
157:             * 
158:             * @return the categories in this registry
159:             */
160:            public ThemeElementCategory[] getCategories();
161:
162:            /**
163:             * Returns a list of colors defined in the registry.
164:             * 
165:             * @return the colors in this registry
166:             */
167:            public ColorDefinition[] getColors();
168:
169:            /**
170:             * Returns a list of colors defined for the given theme.  This is the
171:             * set of base colours overlayed with any theme specific overrides.
172:             * 
173:             * @param themeId the theme id
174:             * @return the colors in this theme
175:             */
176:            public ColorDefinition[] getColorsFor(String themeId);
177:
178:            /**
179:             * Returns a list of fonts defined for the given theme.  This is the
180:             * set of base fonts overlayed with any theme specific overrides.
181:             * 
182:             * @param themeId the theme id
183:             * @return the fonts in this theme
184:             */
185:            public FontDefinition[] getFontsFor(String themeId);
186:
187:            /**
188:             * Returns a list of fonts defined in the registry.
189:             * 
190:             * @return the fonts in this registry
191:             */
192:            public FontDefinition[] getFonts();
193:
194:            /**
195:             * Returns a list of themes defined in the registry.
196:             * 
197:             * @return the themes in this registry
198:             */
199:            public IThemeDescriptor[] getThemes();
200:
201:            /**
202:             * Return the data map.
203:             * 
204:             * @return the data map
205:             */
206:            public Map getData();
207:
208:            /**
209:             * Return the set of category presentation bindings.
210:             * 
211:             * @param category the category to test
212:             * @return the set of bindings or <code>null</code> if this category has no bindings
213:             */
214:            public Set getPresentationsBindingsFor(ThemeElementCategory category);
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.