/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A class to help mimic Vista theme animations. The only kind of
* animation it handles for now is 'transition' animation (this seems
* to be the only animation which Vista theme can do). This is when
* one picture fadein over another one in some period of time.
* According to
* The animations are all linear.
*
* This class has a number of responsibilities.
* <ul>
* <li> It trigger rapaint for the UI components involved in the animation
* <li> It tracks the animation state for every UI component involved in the
* animation and paints {@code Skin} in new {@code State} over the
* {@code Skin} in last {@code State} using
* {@code AlphaComposite.SrcOver.derive(alpha)} where {code alpha}
* depends on the state of animation
* </ul>
*
* @author Igor Kushnirskiy
*/
private final static boolean VISTA_ANIMATION_DISABLED =
new StringBuilder("ANIMATION_CONTROLLER_KEY");
//this timer is used to cause repaint on animated components
//30 repaints per second should give smooth animation affect
obj = new AnimationController();
}
return (AnimationController) obj;
}
private AnimationController() {
timer.setRepeats(true);
timer.setCoalesce(true);
//we need to dispose the controller on l&f change
}
//idk: we can not handle tabs animation because
//the same (component,part) is used to handle all the tabs
//and we can not track the states
//Vista theme might have transition duration for toolbar buttons
//but native application does not seem to animate them
return;
}
// it seems for DEFAULTED button state Vista does animation from
// HOT
}
long duration;
//Only button might have DEFAULTED state
//idk: do not know how to get the value from Vista
//one second seems plausible value
duration = 1000;
} else {
c, part,
}
}
}
}
// for scrollbar up, down, left and right button pictures are
// defined by states. It seems that theme has duration defined
// only for up button states thus we doing this translation here.
switch (state) {
case DOWNPRESSED:
/* falls through */
case LEFTPRESSED:
/* falls through */
case RIGHTPRESSED:
break;
case DOWNDISABLED:
/* falls through */
case LEFTDISABLED:
/* falls through */
case RIGHTDISABLED:
rv = UPDISABLED;
break;
case DOWNHOT:
/* falls through */
case LEFTHOT:
/* falls through */
case RIGHTHOT:
break;
case DOWNNORMAL:
/* falls through */
case LEFTNORMAL:
/* falls through */
case RIGHTNORMAL:
break;
default :
break;
}
return rv;
}
}
return rv;
}
state);
}
long millis) {
boolean isForwardAndReverse = false;
isForwardAndReverse = true;
}
if (millis <= 0) {
}
}
return;
}
}
}
}
if (VISTA_ANIMATION_DISABLED) {
return;
}
synchronized (controller) {
}
if (animationState != null) {
} else {
}
}
}
if ("lookAndFeel" == e.getPropertyName()
&& ! (e.getNewValue() instanceof WindowsLookAndFeel) ) {
dispose();
}
}
if (partsToRemove != null) {
}
if (componentsToRemove == null) {
}
continue;
}
if (partsToRemove == null) {
}
}
}
if (partsToRemove != null) {
//animation is done for the component
if (componentsToRemove == null) {
}
} else {
}
}
}
}
if (componentsToRemove != null) {
}
}
}
}
private synchronized void dispose() {
synchronized (AnimationController.class) {
}
}
private static class AnimationState {
//animation duration in nanoseconds
private final long duration;
//animatin start time in nanoseconds
private long startTime;
//direction the alpha value is changing
//forward - from 0 to 1
//!forward - from 1 to 0
private boolean isForward = true;
//if isForwardAndReverse the animation continually goes
//forward and reverse. alpha value is changing from 0 to 1 then
//from 1 to 0 and so forth
private boolean isForwardAndReverse;
private float progress;
final long milliseconds,
boolean isForwardAndReverse) {
assert SwingUtilities.isEventDispatchThread();
this.startState = startState;
progress = 0f;
}
private void updateProgress() {
assert SwingUtilities.isEventDispatchThread();
if (isDone()) {
return;
}
/ duration;
if (progress >= 1) {
progress = 1;
if (isForwardAndReverse) {
progress = 0;
}
}
}
assert SwingUtilities.isEventDispatchThread();
if (! isDone()) {
float alpha;
if (isForward) {
} else {
}
g.dispose();
} else {
}
}
boolean isDone() {
assert SwingUtilities.isEventDispatchThread();
return progress >= 1;
}
}
private static class PartUIClientPropertyKey
implements UIClientPropertyKey {
}
return rv;
}
}
}
}
}