Source Code Cross Referenced for LFCustoms.java in  » IDE-Netbeans » library » org » netbeans » swing » plaf » 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 » library » org.netbeans.swing.plaf 
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-2006 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:
042:        package org.netbeans.swing.plaf;
043:
044:        /** Look and feel customizations interface.
045:         * For various look and feels, there is a need to customize colors,
046:         * borders etc. to provide 'native-like' UI.
047:         * Implementers of this interface should install and uninstall custom
048:         * UI elements into UIManager on request.
049:         *
050:         * There are three types of customization possible:
051:         * <ol>
052:         * <li>Guaranteeing values code expects to be non-null but the look and feel (i.e. GTK) may not provide.</li>
053:         * <li>Customizing values that are already present (such as changing the default font for labels)</li>
054:         * <li>Adding values used by custom components which are not part of Swing, but use UIDefaults to fetch their colors,
055:         *     fonts, uis, borders, etc.</li>
056:         * </ol>
057:         * Each type of customization is a separate method on this interface.  On startup, first the customizations for
058:         * all look and feels are run, then the customizations for the specific look and feel that is currently set.
059:         * <p>
060:         * A non-standard look and feel that wishes to provide some custom colors for NetBeans window system, etc., can
061:         * do so by placing an instance of its implementation of LFCustoms into UIDefaults under the key
062:         * &quot;Nb.[return value of the custom look and feel's getID() method]LFCustoms&quot;.
063:         * <p>
064:         * Given that all this class does is return some keys and values, in the future it may be replaced by an
065:         * XML file similar to <a href="ui.netbeans.org/project/ui/docs/ui/themes/themes.html">theme files</a>.
066:         * <p>
067:         * This class defines a number of relatively self-explanatory UIManager keys for things used in various parts
068:         * of NetBeans.
069:         *
070:         * @author  Dafe Simonek, Tim Boudreau
071:         */
072:        public abstract class LFCustoms {
073:            private Object[] lfKeysAndValues = null;
074:            private Object[] appKeysAndValues = null;
075:            private Object[] guaranteedKeysAndValues = null;
076:            protected static final String WORKPLACE_FILL = "nb_workplace_fill"; //NOI18N
077:
078:            //TODO: A nice idea would be to replace these classes with XML files - minor rewrite of NbTheme to do it
079:
080:            /** Fetch and cache keys and values */
081:            Object[] getLookAndFeelCustomizationKeysAndValues() {
082:                if (lfKeysAndValues == null) {
083:                    //System.err.println (getClass() + " getLfKeysAndValues");
084:                    lfKeysAndValues = createLookAndFeelCustomizationKeysAndValues();
085:                }
086:                return lfKeysAndValues;
087:            }
088:
089:            /** Fetch and cache keys and values */
090:            Object[] getApplicationSpecificKeysAndValues() {
091:                if (appKeysAndValues == null) {
092:                    //System.err.println (getClass() + " getAppSpecificKeysAndValues");
093:                    appKeysAndValues = createApplicationSpecificKeysAndValues();
094:                }
095:                return appKeysAndValues;
096:            }
097:
098:            /** Fetch and cache keys and values */
099:            Object[] getGuaranteedKeysAndValues() {
100:                if (guaranteedKeysAndValues == null) {
101:                    //System.err.println (getClass() + " getGuaranteedKeysAndValues");
102:                    guaranteedKeysAndValues = createGuaranteedKeysAndValues();
103:                }
104:                return guaranteedKeysAndValues;
105:            }
106:
107:            /**
108:             * Get all keys this LFCustoms installs in UIManager.  This is used to 
109:             * delete unneeded elements from UIManager if the look and feel is changed
110:             * on the fly (for example, the user switches Windows from Classic to XP
111:             * look).
112:             */
113:            Object[] allKeys() {
114:                Object[] additional = additionalKeys();
115:                int size = additional == null ? 0 : additional.length;
116:                if (appKeysAndValues != null) {
117:                    size += appKeysAndValues.length / 2;
118:                }
119:                if (guaranteedKeysAndValues != null) {
120:                    size += guaranteedKeysAndValues.length / 2;
121:                }
122:                if (lfKeysAndValues != null) {
123:                    size += (lfKeysAndValues.length / 2);
124:                }
125:                Object[] result = new Object[size];
126:
127:                int ct = 0;
128:                if (lfKeysAndValues != null) {
129:                    //may be null, if the flag to not customize was set
130:                    for (int i = 0; i < lfKeysAndValues.length; i += 2) {
131:                        result[ct++] = lfKeysAndValues[i];
132:                    }
133:                }
134:                if (guaranteedKeysAndValues != null) {
135:                    for (int i = 0; i < guaranteedKeysAndValues.length; i += 2) {
136:                        result[ct++] = guaranteedKeysAndValues[i];
137:                    }
138:                }
139:                if (appKeysAndValues != null) {
140:                    for (int i = 0; i < appKeysAndValues.length; i += 2) {
141:                        result[ct++] = appKeysAndValues[i];
142:                    }
143:                }
144:                if (additional != null) {
145:                    for (int i = 0; i < additional.length; i++) {
146:                        result[ct++] = additional[i];
147:                    }
148:                }
149:                return result;
150:            }
151:
152:            /**
153:             * LFCustoms implementations which use UIBootstrapValue.Lazy should return
154:             * any keys that it will install here, so they can be merged into the list
155:             * of things to clear on L&F change.
156:             *
157:             * @return an array of objects or null.
158:             */
159:            protected Object[] additionalKeys() {
160:                return null;
161:            }
162:
163:            /** Dispose the value part of all arrays - no need to hold onto lazy value instances
164:             * or GuaranteedValue instances - they should disappear once dereferenced.  We only
165:             * need the keys to uninstall the customizations later.
166:             */
167:            void disposeValues() {
168:                if (lfKeysAndValues != null) {
169:                    //may be null, if the flag to not customize was set
170:                    disposeValues(lfKeysAndValues);
171:                }
172:                disposeValues(appKeysAndValues);
173:                disposeValues(guaranteedKeysAndValues);
174:            }
175:
176:            /** Null every other element of an array */
177:            private void disposeValues(Object[] arr) {
178:                for (int i = 1; i < arr.length; i += 2) {
179:                    arr[i] = null;
180:                }
181:            }
182:
183:            /**
184:             * Create any objects to put into UIDefaults to <strong>replace</strong> values normally supplied by the look
185:             * and feel, to customize application appearance.
186:             *
187:             * @return An array of key-value pairs to put into UIDefaults
188:             */
189:            public Object[] createLookAndFeelCustomizationKeysAndValues() {
190:                return new Object[0];
191:            }
192:
193:            /**
194:             * Create any objects to put into UIDefaults for custom components which use UIManager to find values, UIs, etc.
195:             *
196:             * @return An array of key-value pairs to put into UIDefaults
197:             */
198:            public Object[] createApplicationSpecificKeysAndValues() {
199:                return new Object[0];
200:            }
201:
202:            /**
203:             * Provide UIDefaults entries for things which components rely on being non-null, but which may be null on some
204:             * look and feels or some versions of the look and feel in question.  For example, if you have a component that
205:             * sets its background by calling <code>UIManager.get(&quot;controlShadow&quot;)</code>, you need to guarantee
206:             * that this will be non-null when fetched from UIManager - but look and feels do not guarantee this.  The typical
207:             * pattern here is to put into UIManager an instance of <code>GuaranteedValue</code>, i.e.
208:             * <code>new GuaranteedValue ("controlShadow", Color.GRAY)</code> which will take on the value already present
209:             * if it's there, and provide a fallback if it's not.
210:             *
211:             * @see org.netbeans.swing.plaf.util.GuaranteedValue
212:             * @return An array of key-value pairs to put into UIDefaults
213:             *
214:             **/
215:            public Object[] createGuaranteedKeysAndValues() {
216:                return new Object[0];
217:            }
218:
219:            /** Integer value which LFCustoms will <i>read</i>.  On startup, if a
220:             * custom font size is specified, the core will put this into UIDefaults.
221:             * We then read it out if present and use it to set up a custom font size. */
222:            protected static final String CUSTOM_FONT_SIZE = "customFontSize"; //NOI18N
223:
224:            //Default font size - some classes use this to handle creating appropriate
225:            //custom fonts based on this value
226:            protected static final String DEFAULT_FONT_SIZE = "nbDefaultFontSize"; //NOI18N
227:
228:            //Editor
229:            protected static final String EDITOR_STATUS_LEFT_BORDER = "Nb.Editor.Status.leftBorder"; //NOI18N
230:            protected static final String EDITOR_STATUS_INNER_BORDER = "Nb.Editor.Status.innerBorder"; //NOI18N
231:            protected static final String EDITOR_STATUS_RIGHT_BORDER = "Nb.Editor.Status.rightBorder"; //NOI18N
232:            protected static final String EDITOR_STATUS_ONLYONEBORDER = "Nb.Editor.Status.onlyOneBorder"; //NOI18N
233:            protected static final String EDITOR_TOOLBAR_BORDER = "Nb.Editor.Toolbar.border"; //NOI18N
234:            protected static final String EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS = "Nb.Editor.ErrorStripe.ScrollBar.Insets"; //NOI18N
235:
236:            //Explorer
237:            protected static final String EXPLORER_STATUS_BORDER = "Nb.Explorer.Status.border"; //NOI18N
238:            protected static final String EXPLORER_FOLDER_ICON = "Nb.Explorer.Folder.icon"; //NOI18N
239:            protected static final String EXPLORER_FOLDER_OPENED_ICON = "Nb.Explorer.Folder.openedIcon"; //NOI18N
240:
241:            //Winsys
242:            protected static final String DESKTOP_BORDER = "Nb.Desktop.border"; //NOI18N
243:            public static final String SCROLLPANE_BORDER = "Nb.ScrollPane.border"; //NOI18N
244:            protected static final String TOOLBAR_UI = "Nb.Toolbar.ui"; //NOI18N
245:            protected static final String DESKTOP_BACKGROUND = "Nb.Desktop.background"; //NOI18N
246:            public static final String SCROLLPANE_BORDER_COLOR = "Nb.ScrollPane.Border.color"; //NOI18N
247:
248:            //Output window
249:            protected static final String OUTPUT_SELECTION_BACKGROUND = "nb.output.selectionBackground"; //NOI18N
250:            protected static final String OUTPUT_HYPERLINK_FOREGROUND = "nb.hyperlink.foreground"; //NOI18N
251:            protected static final String OUTPUT_BACKGROUND = "nb.output.background"; //NOI18N
252:            protected static final String OUTPUT_FOREGROUND = "nb.output.foreground"; //NOI18N
253:
254:            //Property sheet
255:            protected static final String PROPSHEET_ALTERNATE_ROW_COLOR = "Tree.altbackground"; //NOI18N
256:            protected static final String PROPSHEET_SET_BACKGROUND = "PropSheet.setBackground"; //NOI18N
257:            protected static final String PROPSHEET_SELECTED_SET_BACKGROUND = "PropSheet.selectedSetBackground"; //NOI18N
258:            protected static final String PROPSHEET_SET_FOREGROUND = "PropSheet.setForeground"; //NOI18N
259:            protected static final String PROPSHEET_SELECTED_SET_FOREGROUND = "PropSheet.selectedSetForeground"; //NOI18N
260:            protected static final String PROPSHEET_DISABLED_FOREGROUND = "PropSheet.disabledForeground"; //NOI18N
261:            protected static final String PROPSHEET_SELECTION_BACKGROUND = "PropSheet.selectionBackground"; //NOI18N
262:            protected static final String PROPSHEET_SELECTION_FOREGROUND = "PropSheet.selectionForeground"; //NOI18N
263:            protected static final String PROPSHEET_BUTTON_FOREGROUND = "PropSheet.customButtonForeground"; //NOI18N
264:            protected static final String PROPSHEET_BUTTON_COLOR = "netbeans.ps.buttonColor"; //NOI18N
265:            protected static final String PROPSHEET_BACKGROUND = "netbeans.ps.background"; //NOI18N
266:
267:            protected static final String PROPSHEET_ICON_MARGIN = "netbeans.ps.iconmargin"; //NOI18N //Integer
268:            protected static final String PROPSHEET_ROWHEIGHT = "netbeans.ps.rowheight"; //NOI18N
269:
270:            //General
271:            protected static final String ERROR_FOREGROUND = "nb.errorForeground"; //NOI18N
272:            protected static final String WARNING_FOREGROUND = "nb.warningForeground"; //NOI18N
273:
274:            //Tab control
275:            protected static final String EDITOR_TABBED_CONTAINER_UI = "TabbedContainerUI"; //NOI18N
276:            protected static final String EDITOR_TAB_DISPLAYER_UI = "EditorTabDisplayerUI"; //NOI18N
277:            protected static final String VIEW_TAB_DISPLAYER_UI = "ViewTabDisplayerUI"; //NOI18N
278:            protected static final String SLIDING_TAB_DISPLAYER_UI = "SlidingTabDisplayerUI"; //NOI18N
279:            protected static final String SLIDING_TAB_BUTTON_UI = "IndexButtonUI";
280:            protected static final String SLIDING_BUTTON_UI = "SlidingButtonUI"; //NOI18N
281:
282:            //Tab control colors - see org.netbeans.swing.plaf.DefaultTabbedContainerUI
283:            protected static final String EDITOR_TAB_CONTENT_BORDER = "TabbedContainer.editor.contentBorder"; //NOI18N
284:            protected static final String EDITOR_TAB_TABS_BORDER = "TabbedContainer.editor.tabsBorder"; //NOI18N
285:            protected static final String EDITOR_TAB_OUTER_BORDER = "TabbedContainer.editor.outerBorder"; //NOI18N
286:
287:            //Tab control colors - see org.netbeans.swing.plaf.DefaultTabbedContainerUI
288:            protected static final String VIEW_TAB_CONTENT_BORDER = "TabbedContainer.view.contentBorder"; //NOI18N
289:            protected static final String VIEW_TAB_TABS_BORDER = "TabbedContainer.view.tabsBorder"; //NOI18N
290:            protected static final String VIEW_TAB_OUTER_BORDER = "TabbedContainer.view.outerBorder"; //NOI18N
291:
292:            //Tab control colors - see org.netbeans.swing.plaf.DefaultTabbedContainerUI
293:            protected static final String SLIDING_TAB_CONTENT_BORDER = "TabbedContainer.sliding.contentBorder"; //NOI18N
294:            protected static final String SLIDING_TAB_TABS_BORDER = "TabbedContainer.sliding.tabsBorder"; //NOI18N
295:            protected static final String SLIDING_TAB_OUTER_BORDER = "TabbedContainer.sliding.outerBorder"; //NOI18N
296:
297:            //Tab control borders
298:            protected static final String TAB_ACTIVE_SELECTION_BACKGROUND = "TabRenderer.selectedActivatedBackground"; //NOI18N
299:            protected static final String TAB_ACTIVE_SELECTION_FOREGROUND = "TabRenderer.selectedActivatedForeground"; //NOI18N
300:            protected static final String TAB_SELECTION_FOREGROUND = "TabRenderer.selectedForeground"; //NOI18N
301:            protected static final String TAB_SELECTION_BACKGROUND = "TabRenderer.selectedBackground"; //NOI18N
302:
303:            protected static final String EXPLORER_MINISTATUSBAR_BORDER = "nb.explorer.ministatusbar.border"; //NOI18N
304:
305:            protected static final String DESKTOP_SPLITPANE_BORDER = "nb.desktop.splitpane.border"; //NOI18N
306:
307:            //Enables lazy loading of defaults for the property sheet - since it's not actually shown on startup
308:            //anymore, no need to install its keys and values on startup
309:            protected static final String PROPERTYSHEET_BOOTSTRAP = "nb.propertysheet";
310:
311:            // keys used to store theme values in UIDefaults
312:            public static final String CONTROLFONT = "controlFont"; // NOI18N
313:            public static final String SYSTEMFONT = "systemFont"; //NOI18N
314:            public static final String USERFONT = "userFont"; //NOI18N
315:            public static final String MENUFONT = "menuFont"; //NOI18N
316:            public static final String WINDOWTITLEFONT = "windowTitleFont"; //NOI18N
317:            public static final String SUBFONT = "subFont"; //NOI18N
318:            public static final String LISTFONT = "List.font"; //NOI18N
319:            public static final String TREEFONT = "Tree.font"; //NOI18N
320:            public static final String PANELFONT = "Panel.font"; //NOI18N  
321:            public static final String SPINNERFONT = "Spinner.font"; //NOI18N  
322:
323:            // keys used by the progressbar api module.
324:            public static final String PROGRESS_CANCEL_BUTTON_ICON = "nb.progress.cancel.icon";
325:            public static final String PROGRESS_CANCEL_BUTTON_ROLLOVER_ICON = "nb.progress.cancel.icon.mouseover";
326:            public static final String PROGRESS_CANCEL_BUTTON_PRESSED_ICON = "nb.progress.cancel.icon.pressed";
327:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.