2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6
* The contents of this file are subject to the terms of either the GNU
7
* General Public License Version 2 only ("GPL") or the Common
8
* Development and Distribution License("CDDL") (collectively, the
9
* "License"). You may not use this file except in compliance with the
10
* License. You can obtain a copy of the License at
11
* http://www.netbeans.org/cddl-gplv2.html
12
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
* specific language governing permissions and limitations under the
14
* License. When distributing the software, include this License Header
15
* Notice in each file and include the License file at
16
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17
* particular file as subject to the "Classpath" exception as provided
18
* by Sun in the GPL Version 2 section of the License file that
19
* accompanied this code. If applicable, add the following below the
20
* License Header, with the fields enclosed by brackets [] replaced by
21
* your own identifying information:
22
* "Portions Copyrighted [year] [name of copyright owner]"
26
* The Original Software is NetBeans. The Initial Developer of the Original
27
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28
* Microsystems, Inc. All Rights Reserved.
30
* If you wish your version of this file to be governed by only the CDDL
31
* or only the GPL Version 2, indicate your decision by adding
32
* "[Contributor] elects to include this software in this distribution
33
* under the [CDDL or GPL Version 2] license." If you do not indicate a
34
* single choice of license, a recipient has the option to distribute
35
* your version of this file under either the CDDL, the GPL Version 2 or
36
* to extend the choice of license to its licensees as provided above.
37
* However, if you add GPL Version 2 code and therefore, elected the GPL
38
* Version 2 license, then the option applies only if the new code is
39
* made subject to such option by the copyright holder.
44
* Created on March 27, 2004, 9:04 PM
47
package org.netbeans.swing.tabcontrol.plaf;
51
/** Class which can provide sliding or other eye-candy effects as a component
52
* is displayed. To use, subclass TabbedContainerUI and create an instance
53
* in createFxProvider. The abstract doFinish() method is expected to call
54
* TabbedContainerUI.showComponent(), so this is best implemented as an inner
55
* class of a TabbbedContainerUI implementation.
57
* @author Tim Boudreau
59
public abstract class FxProvider {
60
protected JComponent comp;
61
protected JRootPane root;
62
private boolean running = false;
63
protected Object orientation = null;
64
/** Creates a new instance of FxProvider */
68
/** Start the effect running. This method will set up the fields with
69
* the passed values, set the running flag, and then call <code>doStart()</code>.
70
* If <code>isRunning()</code> is true, calls <code>abort()</code> before
73
public final void start(JComponent comp, JRootPane root, Object orientation) {
75
if (comp == this.comp && root == this.root) {
83
this.orientation = orientation;
89
* Perform any cleanup necessary and complete the effect.
90
* Sets the running flag to false, calls <code>doFinish()</code> (in which
91
* the implementation should call showComponent() on the TabbedContainerUI
92
* to actually show the component for which an effect has been being
93
* presented. <strong>After</strong> calling <code>finish()</code>, it
94
* calls <code>cleanup()</code>. The common use case is for the effect
95
* to be painted on the window's glass pane, so the idea is to leave that
96
* onscreen while doing the work that will display the actual component,
97
* and then hide the glass pane containing the effect's product once the
98
* window is in its new state, with the component displayed.
100
public final void finish() {
106
/** Abort a running effect, so that finish will never be called. Sets
107
* the running flag to false and calls <code>cleanup()</code>. */
108
public final void abort() {
115
/** Determine if an effect is currently running */
116
public final boolean isRunning() {
120
/** Clean up any artifacts of the effect, shut down timers, etc. */
121
public abstract void cleanup();
123
/** Implement whatever is needed to begin running the effect - starting a
124
* timer, playing with the glass pane, creating offscreen images, etc.,
126
protected abstract void doStart();
128
/** Finish the operation - this method should be implemented to actually
129
* install the component and leave the displayer in its final state */
130
protected abstract void doFinish();