KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > core > windows > view > ui > slides > SlideOperationFactory


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.core.windows.view.ui.slides;
21
22 import java.awt.Component JavaDoc;
23 import java.awt.Rectangle JavaDoc;
24
25 /**
26  * Factory for possible types of sliding operations with asociated effect.
27  *
28  * Operations are designed to be sent to winsys to be runned.
29  *
30  * @author Dafe Simonek
31  */

32 public final class SlideOperationFactory {
33
34     private static final SlidingFx slideInFx = new ScaleFx(0.1f, 0.9f, true);
35     private static final SlidingFx slideOutFx = new ScaleFx(0.9f, 0.1f, false);
36     private static final SlidingFx slideIntoEdgeFx = new ScaleFx(0.9f, 0.1f, false);
37     private static final SlidingFx slideIntoDesktopFx = new ScaleFx(1.0f, 1.0f, true);
38
39     /** true when slide effects should be applied, false otherwise */
40     static final boolean EFFECTS_ENABLED = Boolean.getBoolean("nb.winsys.sliding.effects"); //NOI18N
41

42     private SlideOperationFactory() {
43         // no need to instantiate
44
}
45     
46     public static SlideOperation createSlideIn(Component JavaDoc component,
47         int orientation, boolean useEffect, boolean requestActivation) {
48             
49         SlideOperation result = new SlideOperationImpl(SlideOperation.SLIDE_IN,
50                 component, orientation, useEffect && EFFECTS_ENABLED ? slideInFx : null,
51                 requestActivation);
52                 
53         return result;
54     }
55
56     public static SlideOperation createSlideOut(Component JavaDoc component,
57         int orientation, boolean useEffect, boolean requestActivation) {
58             
59         SlideOperation result = new SlideOperationImpl(SlideOperation.SLIDE_OUT,
60                 component, orientation, useEffect && EFFECTS_ENABLED ? slideOutFx : null,
61                 requestActivation);
62                 
63         return result;
64     }
65     
66     public static SlideOperation createSlideIntoEdge(Component JavaDoc component,
67         String JavaDoc side, boolean useEffect) {
68             
69         SlideOperation result = new SlideOperationImpl(SlideOperation.SLIDE_INTO_EDGE,
70                 component, side, useEffect && EFFECTS_ENABLED ? slideIntoEdgeFx : null, false);
71                 
72         return result;
73     }
74     
75     public static SlideOperation createSlideIntoDesktop(Component JavaDoc component,
76         int orientation, boolean useEffect) {
77             
78         SlideOperation result = new SlideOperationImpl(SlideOperation.SLIDE_INTO_DESKTOP,
79                 component, orientation, useEffect && EFFECTS_ENABLED ? slideIntoDesktopFx : null, false);
80                 
81         return result;
82     }
83     
84     public static SlideOperation createSlideResize(Component JavaDoc component, int orientation) {
85         SlideOperation result = new SlideOperationImpl(SlideOperation.SLIDE_RESIZE,
86                 component, orientation, null, false);
87                 
88         return result;
89     }
90     
91     public static SlideOperation createSlideResize(Component JavaDoc component, String JavaDoc side) {
92         return createSlideResize( component, SlideOperationImpl.side2Orientation( side ) );
93     }
94 }
Popular Tags