Source Code Cross Referenced for SubstanceConstants.java in  » Swing-Library » substance-look-feel » org » jvnet » substance » utils » 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 » substance look feel » org.jvnet.substance.utils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without 
005:         * modification, are permitted provided that the following conditions are met:
006:         * 
007:         *  o Redistributions of source code must retain the above copyright notice, 
008:         *    this list of conditions and the following disclaimer. 
009:         *     
010:         *  o Redistributions in binary form must reproduce the above copyright notice, 
011:         *    this list of conditions and the following disclaimer in the documentation 
012:         *    and/or other materials provided with the distribution. 
013:         *     
014:         *  o Neither the name of Substance Kirill Grouchnikov nor the names of 
015:         *    its contributors may be used to endorse or promote products derived 
016:         *    from this software without specific prior written permission. 
017:         *     
018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
019:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
020:         * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
021:         * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
022:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
023:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
024:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
025:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
027:         * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
028:         * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
029:         */
030:        package org.jvnet.substance.utils;
031:
032:        import java.awt.*;
033:        import java.awt.geom.GeneralPath;
034:
035:        import javax.swing.*;
036:
037:        import org.jvnet.lafwidget.animation.FadeKind;
038:        import org.jvnet.lafwidget.animation.FadeTracker;
039:        import org.jvnet.substance.SubstanceLookAndFeel;
040:        import org.jvnet.substance.border.InnerDelegateBorderPainter;
041:        import org.jvnet.substance.button.BaseButtonShaper;
042:        import org.jvnet.substance.button.SubstanceButtonShaper;
043:        import org.jvnet.substance.color.*;
044:        import org.jvnet.substance.theme.SubstanceTheme;
045:
046:        /**
047:         * <b>Substance</b> constants.
048:         * 
049:         * @author Kirill Grouchnikov
050:         */
051:        public class SubstanceConstants {
052:            /**
053:             * Enumerates available sides.
054:             * 
055:             * @author Kirill Grouchnikov
056:             * @see SubstanceLookAndFeel#BUTTON_OPEN_SIDE_PROPERTY
057:             * @see SubstanceLookAndFeel#BUTTON_SIDE_PROPERTY
058:             */
059:            public static enum Side {
060:                /**
061:                 * Left side.
062:                 */
063:                LEFT,
064:
065:                /**
066:                 * Right side.
067:                 */
068:                RIGHT,
069:
070:                /**
071:                 * Top side.
072:                 */
073:                TOP,
074:
075:                /**
076:                 * Bottom side.
077:                 */
078:                BOTTOM;
079:            }
080:
081:            /**
082:             * Enumerates focus indication kinds.
083:             * 
084:             * @author Kirill Grouchnikov
085:             * @see SubstanceLookAndFeel#FOCUS_KIND
086:             */
087:            public enum FocusKind {
088:                /**
089:                 * No focus indication.
090:                 */
091:                NONE {
092:                    /*
093:                     * (non-Javadoc)
094:                     * 
095:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
096:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
097:                     *      java.awt.Rectangle, int)
098:                     */
099:                    @Override
100:                    public void paintFocus(Component mainComp,
101:                            Component focusedComp, Graphics2D graphics,
102:                            Shape focusShape, Rectangle textRect,
103:                            int extraPadding) {
104:                    }
105:                },
106:
107:                /**
108:                 * Focus indication around the text.
109:                 */
110:                TEXT {
111:                    /*
112:                     * (non-Javadoc)
113:                     * 
114:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
115:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
116:                     *      java.awt.Rectangle, int)
117:                     */
118:                    @Override
119:                    public void paintFocus(Component mainComp,
120:                            Component focusedComp, Graphics2D graphics,
121:                            Shape focusShape, Rectangle textRect,
122:                            int extraPadding) {
123:                        if (textRect == null)
124:                            return;
125:                        if ((textRect.width == 0) || (textRect.height == 0))
126:                            return;
127:
128:                        float dashPhase = 0.0f;
129:                        int fontSize = SubstanceSizeUtils
130:                                .getComponentFontSize(mainComp);
131:                        float dashLength = getDashLength(fontSize);
132:                        float dashGap = getDashGap(fontSize);
133:                        FadeTracker fadeTracker = FadeTracker.getInstance();
134:                        if (fadeTracker.isTracked(focusedComp,
135:                                FadeKind.FOCUS_LOOP_ANIMATION)) {
136:                            dashPhase = (dashLength + dashGap)
137:                                    * (1.0f - fadeTracker.getFade10(
138:                                            focusedComp,
139:                                            FadeKind.FOCUS_LOOP_ANIMATION) / 10.0f);
140:                        }
141:                        graphics.setStroke(new BasicStroke(SubstanceSizeUtils
142:                                .getFocusStrokeWidth(fontSize),
143:                                BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND,
144:                                0.0f, new float[] { dashLength, dashGap },
145:                                dashPhase));
146:
147:                        int delta = ((mainComp instanceof  JComboBox) || (mainComp instanceof  JSpinner)) ? 0
148:                                : 1;
149:                        GeneralPath contour = BaseButtonShaper.getBaseOutline(
150:                                textRect.width + 2 * delta, textRect.height, 2,
151:                                null);
152:
153:                        graphics.translate(textRect.x - delta, textRect.y);
154:                        graphics.draw(contour);
155:                    }
156:
157:                    /*
158:                     * (non-Javadoc)
159:                     * 
160:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#isAnimated()
161:                     */
162:                    @Override
163:                    public boolean isAnimated() {
164:                        return true;
165:                    }
166:                },
167:
168:                /**
169:                 * Focus indication around the whole component.
170:                 */
171:                ALL {
172:                    /*
173:                     * (non-Javadoc)
174:                     * 
175:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
176:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
177:                     *      java.awt.Rectangle, int)
178:                     */
179:                    @Override
180:                    public void paintFocus(Component mainComp,
181:                            Component focusedComp, Graphics2D graphics,
182:                            Shape focusShape, Rectangle textRect,
183:                            int extraPadding) {
184:                        if ((focusShape == null)
185:                                && ((mainComp instanceof  AbstractButton)
186:                                        && !(mainComp instanceof  JCheckBox) && !(mainComp instanceof  JRadioButton))) {
187:                            SubstanceButtonShaper shaper = SubstanceCoreUtilities
188:                                    .getButtonShaper(mainComp);
189:                            if (shaper == null)
190:                                return;
191:
192:                            // Shape currClip = graphics.getClip();
193:                            // if (!shaper.isProportionate()) {
194:                            float dashPhase = 0.0f;
195:                            int fontSize = SubstanceSizeUtils
196:                                    .getComponentFontSize(mainComp);
197:                            float dashLength = getDashLength(fontSize);
198:                            float dashGap = getDashGap(fontSize);
199:                            FadeTracker fadeTracker = FadeTracker.getInstance();
200:                            if (fadeTracker.isTracked(focusedComp,
201:                                    FadeKind.FOCUS_LOOP_ANIMATION)) {
202:                                dashPhase = (dashLength + dashGap)
203:                                        * (1.0f - fadeTracker.getFade10(
204:                                                focusedComp,
205:                                                FadeKind.FOCUS_LOOP_ANIMATION) / 10.0f);
206:                            }
207:                            graphics.setStroke(new BasicStroke(
208:                                    SubstanceSizeUtils
209:                                            .getFocusStrokeWidth(fontSize),
210:                                    BasicStroke.CAP_BUTT,
211:                                    BasicStroke.JOIN_ROUND, 0.0f, new float[] {
212:                                            dashLength, dashGap }, dashPhase));
213:
214:                            GeneralPath contour = shaper.getButtonOutline(
215:                                    (AbstractButton) mainComp, null);
216:                            graphics.draw(contour);
217:                            // }
218:                        } else {
219:                            // graphics.translate(textRect.x - 1, textRect.y - 1);
220:                            graphics.translate(1, 1);
221:                            Shape contour = (focusShape != null) ? focusShape
222:                                    : BaseButtonShaper.getBaseOutline(mainComp
223:                                            .getWidth() - 2, mainComp
224:                                            .getHeight() - 2, 3, null);
225:
226:                            float dashPhase = 0.0f;
227:                            int fontSize = SubstanceSizeUtils
228:                                    .getComponentFontSize(mainComp);
229:                            float dashLength = getDashLength(fontSize);
230:                            float dashGap = getDashGap(fontSize);
231:                            FadeTracker fadeTracker = FadeTracker.getInstance();
232:                            if (fadeTracker.isTracked(focusedComp,
233:                                    FadeKind.FOCUS_LOOP_ANIMATION)) {
234:                                dashPhase = (dashLength + dashGap)
235:                                        * (1.0f - fadeTracker.getFade10(
236:                                                focusedComp,
237:                                                FadeKind.FOCUS_LOOP_ANIMATION) / 10.0f);
238:                            }
239:                            graphics.setStroke(new BasicStroke(
240:                                    SubstanceSizeUtils
241:                                            .getFocusStrokeWidth(fontSize),
242:                                    BasicStroke.CAP_BUTT,
243:                                    BasicStroke.JOIN_ROUND, 0.0f, new float[] {
244:                                            dashLength, dashGap }, dashPhase));
245:                            graphics.draw(contour);
246:                        }
247:                    }
248:
249:                    /*
250:                     * (non-Javadoc)
251:                     * 
252:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#isAnimated()
253:                     */
254:                    @Override
255:                    public boolean isAnimated() {
256:                        return true;
257:                    }
258:                },
259:
260:                /**
261:                 * Focus indication around the whole component, but moved 1 pixel inside
262:                 * the component.
263:                 */
264:                ALL_INNER {
265:                    /*
266:                     * (non-Javadoc)
267:                     * 
268:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
269:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
270:                     *      java.awt.Rectangle, int)
271:                     */
272:                    @Override
273:                    public void paintFocus(Component mainComp,
274:                            Component focusedComp, Graphics2D graphics,
275:                            Shape focusShape, Rectangle textRect,
276:                            int extraPadding) {
277:
278:                        if ((focusShape == null)
279:                                && ((mainComp instanceof  AbstractButton)
280:                                        && !(mainComp instanceof  JCheckBox) && !(mainComp instanceof  JRadioButton))) {
281:                            SubstanceButtonShaper shaper = SubstanceCoreUtilities
282:                                    .getButtonShaper(mainComp);
283:                            if (shaper == null)
284:                                return;
285:
286:                            if (shaper.isProportionate()) {
287:                                float dashPhase = 0.0f;
288:                                int fontSize = SubstanceSizeUtils
289:                                        .getComponentFontSize(mainComp);
290:                                float dashLength = getDashLength(fontSize);
291:                                float dashGap = getDashGap(fontSize);
292:                                FadeTracker fadeTracker = FadeTracker
293:                                        .getInstance();
294:                                if (fadeTracker.isTracked(focusedComp,
295:                                        FadeKind.FOCUS_LOOP_ANIMATION)) {
296:                                    dashPhase = (dashLength + dashGap)
297:                                            * (1.0f - fadeTracker
298:                                                    .getFade10(
299:                                                            focusedComp,
300:                                                            FadeKind.FOCUS_LOOP_ANIMATION) / 10.0f);
301:                                }
302:                                graphics.setStroke(new BasicStroke(
303:                                        SubstanceSizeUtils
304:                                                .getFocusStrokeWidth(fontSize),
305:                                        BasicStroke.CAP_BUTT,
306:                                        BasicStroke.JOIN_ROUND, 0.0f,
307:                                        new float[] { dashLength, dashGap },
308:                                        dashPhase));
309:                                Insets insets = new Insets(extraPadding,
310:                                        extraPadding, extraPadding,
311:                                        extraPadding);
312:
313:                                GeneralPath contour = shaper.getButtonOutline(
314:                                        (AbstractButton) mainComp, insets);
315:                                graphics.draw(contour);
316:                            }
317:                        } else {
318:                            graphics.translate(extraPadding, extraPadding);
319:                            Shape contour = (focusShape != null) ? focusShape
320:                                    : BaseButtonShaper.getBaseOutline(mainComp
321:                                            .getWidth()
322:                                            - 2 * extraPadding, mainComp
323:                                            .getHeight()
324:                                            - 2 * extraPadding, 2, null);
325:
326:                            float dashPhase = 0.0f;
327:                            int fontSize = SubstanceSizeUtils
328:                                    .getComponentFontSize(mainComp);
329:                            float dashLength = getDashLength(fontSize);
330:                            float dashGap = getDashGap(fontSize);
331:                            FadeTracker fadeTracker = FadeTracker.getInstance();
332:                            if (fadeTracker.isTracked(focusedComp,
333:                                    FadeKind.FOCUS_LOOP_ANIMATION)) {
334:                                dashPhase = (dashLength + dashGap)
335:                                        * (1.0f - fadeTracker.getFade10(
336:                                                focusedComp,
337:                                                FadeKind.FOCUS_LOOP_ANIMATION) / 10.0f);
338:                            }
339:                            graphics.setStroke(new BasicStroke(
340:                                    SubstanceSizeUtils
341:                                            .getFocusStrokeWidth(fontSize),
342:                                    BasicStroke.CAP_BUTT,
343:                                    BasicStroke.JOIN_ROUND, 0.0f, new float[] {
344:                                            dashLength, dashGap }, dashPhase));
345:                            graphics.draw(contour);
346:                        }
347:                    }
348:
349:                    /*
350:                     * (non-Javadoc)
351:                     * 
352:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#isAnimated()
353:                     */
354:                    @Override
355:                    public boolean isAnimated() {
356:                        return true;
357:                    }
358:                },
359:
360:                /**
361:                 * Focus indication around the whole component, but moved 1 pixel inside
362:                 * the component.
363:                 */
364:                ALL_STRONG_INNER {
365:                    /*
366:                     * (non-Javadoc)
367:                     * 
368:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
369:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
370:                     *      java.awt.Rectangle, int)
371:                     */
372:                    @Override
373:                    public void paintFocus(Component mainComp,
374:                            Component focusedComp, Graphics2D graphics,
375:                            Shape focusShape, Rectangle textRect,
376:                            int extraPadding) {
377:                        if ((focusShape == null)
378:                                && ((mainComp instanceof  AbstractButton)
379:                                        && !(mainComp instanceof  JCheckBox) && !(mainComp instanceof  JRadioButton))) {
380:                            SubstanceButtonShaper shaper = SubstanceCoreUtilities
381:                                    .getButtonShaper(mainComp);
382:                            if (shaper == null)
383:                                return;
384:
385:                            if (shaper.isProportionate()) {
386:                                Insets insets = new Insets(extraPadding,
387:                                        extraPadding, extraPadding,
388:                                        extraPadding);
389:
390:                                GeneralPath contour = shaper.getButtonOutline(
391:                                        (AbstractButton) mainComp, insets);
392:                                graphics.draw(contour);
393:                            }
394:                        } else {
395:                            graphics.translate(extraPadding, extraPadding);
396:                            Shape contour = (focusShape != null) ? focusShape
397:                                    : BaseButtonShaper.getBaseOutline(mainComp
398:                                            .getWidth()
399:                                            - 2 * extraPadding, mainComp
400:                                            .getHeight()
401:                                            - 2 * extraPadding, 2, null);
402:
403:                            graphics.draw(contour);
404:                        }
405:                    }
406:                },
407:
408:                /**
409:                 * Focus indication under the component text.
410:                 */
411:                UNDERLINE {
412:                    /*
413:                     * (non-Javadoc)
414:                     * 
415:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
416:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
417:                     *      java.awt.Rectangle, int)
418:                     */
419:                    @Override
420:                    public void paintFocus(Component mainComp,
421:                            Component focusedComp, Graphics2D graphics,
422:                            Shape focusShape, Rectangle textRect,
423:                            int extraPadding) {
424:                        if (textRect == null)
425:                            return;
426:
427:                        float dashPhase = 0.0f;
428:                        int fontSize = SubstanceSizeUtils
429:                                .getComponentFontSize(mainComp);
430:                        float dashLength = getDashLength(fontSize);
431:                        float dashGap = getDashGap(fontSize);
432:                        FadeTracker fadeTracker = FadeTracker.getInstance();
433:                        if (fadeTracker.isTracked(focusedComp,
434:                                FadeKind.FOCUS_LOOP_ANIMATION)) {
435:                            dashPhase = (dashLength + dashGap)
436:                                    * (1.0f - fadeTracker.getFade10(mainComp,
437:                                            FadeKind.FOCUS_LOOP_ANIMATION) / 10.0f);
438:                        }
439:                        graphics.setStroke(new BasicStroke(SubstanceSizeUtils
440:                                .getFocusStrokeWidth(fontSize),
441:                                BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND,
442:                                0.0f, new float[] { dashLength, dashGap },
443:                                dashPhase));
444:
445:                        graphics.translate(textRect.x - 1, textRect.y);
446:                        graphics.drawLine(0, textRect.height - 1,
447:                                textRect.width, textRect.height - 1);
448:                        graphics.dispose();
449:                    }
450:
451:                    /*
452:                     * (non-Javadoc)
453:                     * 
454:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#isAnimated()
455:                     */
456:                    @Override
457:                    public boolean isAnimated() {
458:                        return true;
459:                    }
460:                },
461:
462:                /**
463:                 * Strong focus indication under the component text.
464:                 */
465:                STRONG_UNDERLINE {
466:                    /*
467:                     * (non-Javadoc)
468:                     * 
469:                     * @see org.jvnet.substance.utils.SubstanceConstants.FocusKind#paintFocus(java.awt.Component,
470:                     *      java.awt.Component, java.awt.Graphics2D, java.awt.Shape,
471:                     *      java.awt.Rectangle, int)
472:                     */
473:                    @Override
474:                    public void paintFocus(Component mainComp,
475:                            Component focusedComp, Graphics2D graphics,
476:                            Shape focusShape, Rectangle textRect,
477:                            int extraPadding) {
478:                        if (textRect == null)
479:                            return;
480:
481:                        graphics.translate(textRect.x - 1, textRect.y);
482:                        graphics.drawLine(0, textRect.height - 1,
483:                                textRect.width, textRect.height - 1);
484:                    }
485:                };
486:
487:                /**
488:                 * Paints the focus ring on the specified component.
489:                 * 
490:                 * @param mainComp
491:                 *            The main component for the focus painting.
492:                 * @param focusedComp
493:                 *            The actual component that has the focus. For example, the
494:                 *            main component can be a {@link JSpinner}, while the
495:                 *            focused component is a text field inside the the spinner
496:                 *            editor.
497:                 * @param graphics
498:                 *            Graphics context.
499:                 * @param focusShape
500:                 *            Focus shape. May be <code>null</code> - in this case,
501:                 *            the bounds of <code>mainComp</code> will be used.
502:                 * @param textRect
503:                 *            Text rectangle (if relevant).
504:                 * @param extraPadding
505:                 *            Extra padding between the component bounds and the focus
506:                 *            ring painting.
507:                 */
508:                public abstract void paintFocus(Component mainComp,
509:                        Component focusedComp, Graphics2D graphics,
510:                        Shape focusShape, Rectangle textRect, int extraPadding);
511:
512:                /**
513:                 * Paints the focus ring on the specified component.
514:                 * 
515:                 * @param comp
516:                 *            Component.
517:                 * @param graphics
518:                 *            Graphics context.
519:                 * @param textRect
520:                 *            Text rectangle (if relevant).
521:                 */
522:                public void paintFocus(Component comp, Graphics2D graphics,
523:                        Rectangle textRect) {
524:                    this .paintFocus(comp, comp, graphics, null, textRect, 0);
525:                }
526:
527:                /**
528:                 * Returns DPI-aware dash length for dash-based focus painting.
529:                 * 
530:                 * @param fontSize
531:                 *            The font size of the component for focus painting.
532:                 * @return DPI-aware dash length for dash-based focus painting.
533:                 */
534:                protected static float getDashLength(int fontSize) {
535:                    return 2.0f + SubstanceSizeUtils.getExtraPadding(fontSize);
536:                }
537:
538:                /**
539:                 * Returns DPI-aware dash gap for dash-based focus painting.
540:                 * 
541:                 * @param fontSize
542:                 *            The font size of the component for focus painting.
543:                 * @return DPI-aware dash gap for dash-based focus painting.
544:                 */
545:                protected static float getDashGap(int fontSize) {
546:                    return getDashLength(fontSize) / 2.0f;
547:                }
548:
549:                /**
550:                 * Returns indication whether <code>this</code> focus kind can be
551:                 * animated. For example, focus rings painted with solid lines are
552:                 * generally static.
553:                 * 
554:                 * @return <code>true</code> if <code>this</code> focus kind can be
555:                 *         animated, <code>false</code> otherwise.
556:                 */
557:                public boolean isAnimated() {
558:                    return false;
559:                }
560:            }
561:
562:            /**
563:             * Enumerates of image-based watermarks kinds.
564:             * 
565:             * @author Kirill Grouchnikov
566:             * @see SubstanceLookAndFeel#setImageWatermarkKind(org.jvnet.substance.utils.SubstanceConstants.ImageWatermarkKind)
567:             * @see SubstanceLookAndFeel#getImageWatermarkKind()
568:             */
569:            public enum ImageWatermarkKind {
570:                /**
571:                 * The default behaviour. The image is centered in the screen and scaled
572:                 * down if necessary.
573:                 */
574:                SCREEN_CENTER_SCALE,
575:
576:                /**
577:                 * The image is tiled starting from the screen top-left corner and not
578:                 * scaled.
579:                 */
580:                SCREEN_TILE,
581:
582:                /**
583:                 * The image is anchored to the top-left corner of the application frame
584:                 * and not scaled.
585:                 */
586:                APP_ANCHOR,
587:
588:                /**
589:                 * The image is anchored to the center of the application frame and not
590:                 * scaled.
591:                 */
592:                APP_CENTER,
593:
594:                /**
595:                 * The image is tiled starting from the top-left corner of the
596:                 * application frame and not scaled.
597:                 */
598:                APP_TILE
599:            }
600:
601:            /**
602:             * Enumerates possible modes of closing tabs.
603:             * 
604:             * @author Kirill Grouchnikov
605:             * @see SubstanceLookAndFeel#TABBED_PANE_CLOSE_CALLBACK
606:             */
607:            public enum TabCloseKind {
608:                /**
609:                 * Indicates that no tabs should be closed.
610:                 */
611:                NONE,
612:
613:                /**
614:                 * Indicates that the specified tab should be closed.
615:                 */
616:                THIS,
617:
618:                /**
619:                 * Indicates that all tabs should be closed.
620:                 */
621:                ALL,
622:
623:                /**
624:                 * Indicates that all tabs except the specified should be closed.
625:                 */
626:                ALL_BUT_THIS
627:            }
628:
629:            /**
630:             * Enumerates alignments of tab texts on left and right tab placement.
631:             * 
632:             * @author Kirill Grouchnikov
633:             * @see SubstanceLookAndFeel#TABBED_PANE_TEXT_ALIGNMENT_KIND
634:             */
635:            public enum TabTextAlignmentKind {
636:                /**
637:                 * The default alignment.
638:                 */
639:                DEFAULT,
640:
641:                /**
642:                 * Tab texts are always aligned to the left.
643:                 */
644:                ALWAYS_LEFT,
645:
646:                /**
647:                 * Tab texts are always aligned to the right.
648:                 */
649:                ALWAYS_RIGHT,
650:
651:                /**
652:                 * On left placement, tab texts are aligned to the left. On right
653:                 * placement, tab texts are aligned to the right.
654:                 */
655:                FOLLOW_PLACEMENT,
656:
657:                /**
658:                 * On LTR orientation, tab texts are aligned to the left. On RTL
659:                 * orientation, tab texts are aligned to the right.
660:                 */
661:                FOLLOW_ORIENTATION
662:            }
663:
664:            /**
665:             * Enumerates possible button policies for scroll panes.
666:             * 
667:             * @author Kirill Grouchnikov
668:             * @see SubstanceLookAndFeel#SCROLL_PANE_BUTTONS_POLICY
669:             */
670:            public enum ScrollPaneButtonPolicyKind {
671:                /**
672:                 * The <code>empty</code> button policy - no buttons.
673:                 */
674:                NONE,
675:
676:                /**
677:                 * The <code>opposite</code> (default) button policy - the decrease
678:                 * button is on one side of the scroll bar, and the increase button is
679:                 * on the other side of the scroll bar.
680:                 */
681:                OPPOSITE,
682:
683:                /**
684:                 * The <code>adjacent</code> button policy - both the decrease button
685:                 * and the increase button are on the same side of the scroll bar
686:                 * adjacent to each other (like on Mac).
687:                 */
688:                ADJACENT,
689:
690:                /**
691:                 * The <code>multiple</code> button policy - there are two decrease
692:                 * buttons on the opposite side of the scroll bar and the increase
693:                 * button is adjacent to the second decrease button. This combines the
694:                 * {@link #OPPOSITE} and the {@link #ADJACENT} policies together.
695:                 */
696:                MULTIPLE,
697:
698:                /**
699:                 * The <code>multiple both</code> button policy - there are two pairs
700:                 * of decrease-increase buttons on the opposite sides of the scroll bar.
701:                 * This extends the {@link #MULTIPLE} policy.
702:                 */
703:                MULTIPLE_BOTH
704:            }
705:
706:            /**
707:             * Enumerates possible values for menu gutter fill kind.
708:             * 
709:             * @author Kirill Grouchnikov
710:             * @see SubstanceLookAndFeel#MENU_GUTTER_FILL_KIND
711:             */
712:            public enum MenuGutterFillKind {
713:                /**
714:                 * The <code>none</code> fill kind - draws no background in the menu
715:                 * gutter.
716:                 */
717:                NONE,
718:
719:                /**
720:                 * The <code>soft fill</code> fill kind - draws light fill background
721:                 * in the menu gutter.
722:                 */
723:                SOFT_FILL,
724:
725:                /**
726:                 * The <code>hard fill</code> fill kind - draws darker fill background
727:                 * in the menu gutter.
728:                 */
729:                HARD_FILL,
730:
731:                /**
732:                 * The <code>soft</code> fill kind - draws gradient ranging from
733:                 * darker to light in the menu gutter.
734:                 */
735:                SOFT,
736:
737:                /**
738:                 * The <code>hard</code> (default) fill kind - draws gradient ranging
739:                 * from darker to light in the menu gutter.
740:                 */
741:                HARD
742:            }
743:
744:            /**
745:             * Color shift kind for shifting themes in inner border painters. See
746:             * {@link InnerDelegateBorderPainter} for usage details.
747:             * 
748:             * @author Kirill Grouchnikov
749:             */
750:            public enum ColorShiftKind {
751:                /**
752:                 * Instructs the inner border painter to shade the border theme for the
753:                 * inner part of the border.
754:                 * 
755:                 * @see ShadeColorScheme
756:                 * @see SubstanceTheme#shade(double)
757:                 */
758:                SHADE,
759:
760:                /**
761:                 * Instructs the inner border painter to tint the border theme for the
762:                 * inner part of the border.
763:                 * 
764:                 * @see TintColorScheme
765:                 * @see SubstanceTheme#tint(double)
766:                 */
767:                TINT,
768:
769:                /**
770:                 * Instructs the inner border painter to tone the border theme for the
771:                 * inner part of the border.
772:                 * 
773:                 * @see ToneColorScheme
774:                 * @see SubstanceTheme#tone(double)
775:                 */
776:                TONE,
777:
778:                /**
779:                 * Instructs the inner border painter to shift the border theme for the
780:                 * inner part of the border towards its light colors.
781:                 */
782:                THEME_LIGHT
783:            }
784:
785:            /**
786:             * Tab content pane border kind.
787:             * 
788:             * @author Kirill Grouchnikov
789:             * @since version 4.1
790:             */
791:            public enum TabContentPaneBorderKind {
792:                /**
793:                 * The content pane has full border on all sides plus an additional line
794:                 * along the tab placement side (as in Firefox 2.0, Internet Explorer
795:                 * 7.0 and Nimbus). This is the default kind starting from version 4.1.
796:                 */
797:                DOUBLE_FULL,
798:
799:                /**
800:                 * The content pane has full single border on all sides. This has been
801:                 * the default kind prior to version 4.1.
802:                 */
803:                SINGLE_FULL,
804:
805:                /**
806:                 * The content pane has double border along the tab placement side.
807:                 */
808:                DOUBLE_PLACEMENT,
809:
810:                /**
811:                 * The content pane has single border along the tab placement side.
812:                 */
813:                SINGLE_PLACEMENT
814:            }
815:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.