All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bibliothek.gui.dock.extension.css.transition.CssTransition Maven / Gradle / Ivy

The newest version!
/*
 * Bibliothek - DockingFrames
 * Library built on Java/Swing, allows the user to "drag and drop"
 * panels containing any Swing-Component the developer likes to add.
 * 
 * Copyright (C) 2012 Benjamin Sigg
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Benjamin Sigg
 * [email protected]
 * CH - Switzerland
 */
package bibliothek.gui.dock.extension.css.transition;

import bibliothek.gui.dock.extension.css.CssProperty;
import bibliothek.gui.dock.extension.css.CssPropertyContainer;
import bibliothek.gui.dock.extension.css.CssPropertyKey;
import bibliothek.gui.dock.extension.css.CssRule;
import bibliothek.gui.dock.extension.css.CssRuleContent;
import bibliothek.gui.dock.extension.css.CssType;
import bibliothek.util.Filter;

/**
 * A {@link CssTransition} describes the transition between one {@link CssRule} to another {@link CssRule}. The transition
 * may include features like colors softly blending over to a new style, or shapes slowly changing their outline.
* The lifecycle of any {@link CssTransition} looks always like this: *
    *
  1. Upon applying a new {@link CssRule} the {@link CssTransition} is created from a factory.
  2. *
  3. Immediately afterwards {@link #init(CssRule, CssTransitionCallback) init} is called, the transition is now * allowed to change properties whenever it wants.
  4. *
  5. If another {@link CssRule} is applied, {@link #transition(CssRule) transition} is called. The transition should * now slowly apply the new rule. As there may already be an transition active on the new rule, this transition * may actually gain access to a wrapper which behaves like an animated {@link CssRule}.
  6. *
  7. At the end of its lifetime the transition should call {@link CssTransitionCallback#destroyed()} to inform * the framework that this transition will never be used again.
  8. *
* The transition can and should make use of the {@link CssTransitionCallback} to learn: *
    *
  • Which properties can be animated
  • *
  • Override properties with new values
  • *
  • Ask for delayed execution of {@link #step()}
  • *
  • Inform the framework that it is no longer active
  • *
* * If transitions are handled by the {@link DefaultAnimatedCssRuleChain}, some limitations are applied: transitions of * one {@link CssRule} run in parallel, they do not know of each other nor can they influence each other. It is not * possible to use the output of one transition as input for another transition. If two transitions modify the same * property, then one of the transitions is silently ignored. If a customized {@link TransitionalCssRuleChain} is in use, * these limitations may no longer apply. * * @author Benjamin Sigg */ public interface CssTransition extends CssPropertyContainer{ /** * Sets a filter telling this transition which properties should actually be animated, and which not. * @param propertyFilter the filter, only properties passing the filter should be animated, can be null */ public void setPropertyFilter( Filter propertyFilter ); /** * Informs this transition about the type of the properties is should handle. * @param type the type of the properties */ public void setType( CssType type ); /** * Tells whether property is declaring input values for the transition. The * property may be a child of this {@link CssPropertyContainer}, or a child of one * of the {@link CssProperty}s returned by this container. * @param property the name of the property to check * @return whether this transition depends on property */ public boolean isInput( CssPropertyKey property ); /** * Initializes this transition. * @param source a rule representing the properties before the transition started * @param callback information about the properties and utility methods */ public void init( CssRuleContent source, CssTransitionCallback callback ); /** * Called asynchronously if {@link CssTransitionCallback#step()} is called, or if one of the underlying {@link CssRuleContent}s * changed a property. This method is always executed in the EDT.
* This method should recalculate all the properties affected by this transition and transfer the new values * to the {@link CssTransitionCallback}. * @param delay the amount of milliseconds that passed since the last call of this method, or -1 * if the call to this method is out of order. This argument will always be -1 if * this transition does not call {@link CssTransitionCallback#step()} during execution of this method. */ public void step( int delay ); /** * Called if this transition is about to become obsolete. The transition should gracefully transform the properties * to the properties of destination, and then shutdown by calling {@link CssTransitionCallback#destroyed()}. * @param destination the target rule which should be adapted by this transition */ public void transition( CssRuleContent destination ); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy